This is the mail archive of the
cygwin
mailing list for the Cygwin project.
Static cygwin perl + Win32CORE
- From: "Reini Urban" <rurban at x-ray dot at>
- To: cygwin at cygwin dot com
- Cc: pp <perl5-porters at perl dot org>
- Date: Wed, 16 Apr 2008 16:27:52 +0200
- Subject: Static cygwin perl + Win32CORE
I've had a bit of a hack-day enabling static cygwin perl compilation (-Uusedl),
esp. needed for bleadperl so that I can have more easily multiple versions
around for testing.
This is the Win32CORE hack for blead, perl-5.10 later.
Don't apply yet, needs more testing.
--
Reini Urban
http://phpwiki.org/ http://murbreak.at/
difforig perl-current/ext/Win32CORE
2008-04-16 16:15:50 <rurban@x-ray.at>
Enable static Win32CORE compilation for -Uusedl (non-shared perl),
esp. for cygwin. This enables static cygwin perl compilation.
The EXTCONST hack is needed, because Win32CORE requires extern __declspec(dllimport)
for the windows symbols, but no dllimport attribute for non-shared libperl symbols.
diff -ub perl-current/ext/Win32CORE/Makefile.PL.orig
--- perl-current/ext/Win32CORE/Makefile.PL.orig 2007-05-16 10:29:12.000000000 +0200
+++ perl-current/ext/Win32CORE/Makefile.PL 2008-04-16 15:46:29.468750000 +0200
@@ -4,3 +4,17 @@
'NAME' => 'Win32CORE',
'VERSION_FROM' => 'Win32CORE.pm',
);
+
+# undef USEIMPORTLIB for static compilation
+sub MY::cflags {
+ package MY; # so that "SUPER" works right
+ my ($self, $libperl)=@_;
+ return '' unless $self->needs_linking();
+ my $base = $self->SUPER::cflags($libperl);
+ #print STDERR "cflags:\n$base";
+ if ($self->{LINKTYPE} eq 'static') {
+ #print STDERR "LINKTYPE=static\n";
+ $base =~ s/CCFLAGS =(.*)$/CCFLAGS =\1 -UUSEIMPORTLIB -DLINKSTATIC/m;
+ }
+ return $base;
+}
diff -ub perl-current/ext/Win32CORE/Win32CORE.c.orig
--- perl-current/ext/Win32CORE/Win32CORE.c.orig 2007-06-28 12:13:36.000000000 +0200
+++ perl-current/ext/Win32CORE/Win32CORE.c 2008-04-16 16:14:43.390625000 +0200
@@ -10,7 +10,13 @@
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
+#if defined(__CYGWIN__) && !defined(USEIMPORTLIB)
+ #undef WIN32
+#endif
#include "EXTERN.h"
+#if defined(__CYGWIN__) && !defined(USEIMPORTLIB)
+ #define EXTCONST extern const
+#endif
#include "perl.h"
#include "XSUB.h"
@@ -62,7 +68,7 @@
* should never be called though, as Win32CORE.pm doesn't use DynaLoader.
*/
}
-#ifdef __CYGWIN__
+#if defined(__CYGWIN__) && defined(USEIMPORTLIB)
__declspec(dllexport)
#endif
void
diff -ub perl-current/ext/Win32CORE/t/win32core.t.orig
--
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Problem reports: http://cygwin.com/problems.html
Documentation: http://cygwin.com/docs.html
FAQ: http://cygwin.com/faq/