* Static cygwin perl + Win32CORE
@ 2008-04-16 18:40 Reini Urban
0 siblings, 0 replies; only message in thread
From: Reini Urban @ 2008-04-16 18:40 UTC (permalink / raw)
To: cygwin; +Cc: pp
[-- Attachment #1: Type: text/plain, Size: 337 bytes --]
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/
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: pl-static-Win32CORE.patch --]
[-- Type: text/x-diff; name=pl-static-Win32CORE.patch, Size: 1925 bytes --]
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
[-- Attachment #3: Type: text/plain, Size: 218 bytes --]
--
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/
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2008-04-16 14:28 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-04-16 18:40 Static cygwin perl + Win32CORE Reini Urban
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).