summaryrefslogtreecommitdiff
path: root/win32
diff options
context:
space:
mode:
authorYitzchak Scott-Thoennes <sthoenna@efn.org>2005-01-05 02:01:41 -0800
committerSteve Hay <SteveHay@planit.com>2005-01-06 16:50:10 +0000
commit3fd041e4c6b6a291992aea064f6ddbb6882443a0 (patch)
treec4ebd7e19ce6147c0c3eb016b8421c99141bfeb9 /win32
parenta80036c632e9a590837ce173395af69d6c7c2ed5 (diff)
downloadperl-3fd041e4c6b6a291992aea064f6ddbb6882443a0.tar.gz
Allow static linking core extensions on Win32 with MinGW
Subject: [PATCH] Re: lib/Config/Extensions.t fails on Win32 Message-ID: <20050105180141.GA676@efn.org> p4raw-id: //depot/perl@23762
Diffstat (limited to 'win32')
-rw-r--r--win32/buildext.pl20
-rw-r--r--win32/makefile.mk13
2 files changed, 16 insertions, 17 deletions
diff --git a/win32/buildext.pl b/win32/buildext.pl
index 0ae9f74173..90518d1e4f 100644
--- a/win32/buildext.pl
+++ b/win32/buildext.pl
@@ -29,7 +29,6 @@ If '--dynamic' specified, only dynamic extensions will be built.
=cut
-use File::Basename;
use Cwd;
use FindExt;
use Config;
@@ -46,11 +45,8 @@ if ("$static,$dynamic" eq "0,0") {
($static,$dynamic) = (1,1);
}
if ($opts{'list-static-libs'} || $opts{'create-perllibst-h'}) {
- my @statics = grep{!/^DynaLoader$/} split /\s+/, $Config{static_ext};
+ my @statics = split /\s+/, $Config{static_ext};
if ($opts{'create-perllibst-h'}) {
- # at moment of creation of perllibst.h no luck consulting Config.pm,
- # so list of static extensions passed with @ARGV
- @statics = grep{!/^DynaLoader$/} @ARGV;
open my $fh, ">perllibst.h";
my @statics1 = map {local $_=$_;s/\//__/g;$_} @statics;
my @statics2 = map {local $_=$_;s/\//::/g;$_} @statics;
@@ -65,7 +61,7 @@ if ($opts{'list-static-libs'} || $opts{'create-perllibst-h'}) {
open my $fh, "<..\\lib\\auto\\$_\\extralibs.ld" or die "can't open <..\\lib\\auto\\$_\\extralibs.ld: $!";
$extralibs{$_}++ for grep {/\S/} split /\s+/, join '', <$fh>;
}
- print map {/([^\/]+)$/;"..\\lib\\auto\\$_/$1.lib "} @statics;
+ print map {/([^\/]+)$/;"..\\lib\\auto\\$_/$1$Config{_a} "} @statics;
print map {"$_ "} sort keys %extralibs;
}
exit;
@@ -98,12 +94,11 @@ my $targ = shift;
(my $ext = getcwd()) =~ s,/,\\,g;
my $code;
FindExt::scan_ext($ext);
+FindExt::set_static_extensions(split ' ', $Config{static_ext}) if $ext ne "ext";
-my @ext = FindExt::extensions();
-my %static_exts = map {$_=>1} split /\s+/, $Config{static_ext};
-
-if ("$static$dynamic" eq "01") {@ext = grep {!exists $static_exts{$_}} @ext}
-elsif ("$static$dynamic" eq "10") {@ext = grep {exists $static_exts{$_}} @ext}
+my @ext;
+push @ext, FindExt::static_ext() if $static;
+push @ext, FindExt::dynamic_ext(), FindExt::nonxs_ext() if $dynamic;
foreach $dir (sort @ext)
{
@@ -119,7 +114,8 @@ foreach $dir (sort @ext)
print "\nRunning Makefile.PL in $dir\n";
my @perl = ($perl, "-I$here\\..\\lib", 'Makefile.PL',
'INSTALLDIRS=perl', 'PERL_CORE=1',
- ($static_exts{$dir}?('LINKTYPE=static'):()), # if ext is static
+ (FindExt::is_static($dir)
+ ? ('LINKTYPE=static') : ()), # if ext is static
);
if (defined $::Cross::platform) {
@perl = (@perl[0,1],"-MCross=$::Cross::platform",@perl[2..$#perl]);
diff --git a/win32/makefile.mk b/win32/makefile.mk
index 095be64b55..1a2625a5e4 100644
--- a/win32/makefile.mk
+++ b/win32/makefile.mk
@@ -819,7 +819,7 @@ DYNAMIC_EXT = Socket IO Fcntl Opcode SDBM_File POSIX attrs Thread B re \
Sys/Hostname Storable Filter/Util/Call Encode \
Digest/MD5 PerlIO/scalar MIME/Base64 Time/HiRes \
Unicode/Normalize Win32
-STATIC_EXT = DynaLoader
+STATIC_EXT =
NONXS_EXT = Errno
DYNALOADER = $(EXTDIR)\DynaLoader\DynaLoader
@@ -1030,7 +1030,7 @@ $(DLL_OBJ) : $(CORE_H)
$(X2P_OBJ) : $(CORE_H)
perldll.def : $(MINIPERL) $(CONFIGPM) ..\global.sym ..\pp.sym ..\makedef.pl
- $(MINIPERL) -I..\lib buildext.pl --create-perllibst-h $(STATIC_EXT)
+ $(MINIPERL) -I..\lib buildext.pl --create-perllibst-h
$(MINIPERL) -w ..\makedef.pl PLATFORM=win32 $(OPTIMIZE) $(DEFINES) \
$(BUILDOPT) CCTYPE=$(CCTYPE) > perldll.def
@@ -1044,15 +1044,18 @@ $(PERLDLL): perldll.def $(PERLDLL_OBJ) $(PERLDLL_RES) Extensions_static
$(IMPLIB) $*.lib $@
.ELIF "$(CCTYPE)" == "GCC"
$(LINK32) -mdll -o $@ -Wl,--base-file -Wl,perl.base $(BLINK_FLAGS) \
- $(mktmp $(LKPRE) $(PERLDLL_OBJ:s,\,\\) $(LIBFILES) $(LKPOST))
+ $(mktmp $(LKPRE) $(PERLDLL_OBJ:s,\,\\) \
+ $(shell $(MINIPERL) -I..\lib buildext.pl --list-static-libs|tr \\\\ /) \
+ $(LIBFILES) $(LKPOST))
dlltool --output-lib $(PERLIMPLIB) \
--dllname $(PERLDLL:b).dll \
--def perldll.def \
--base-file perl.base \
--output-exp perl.exp
$(LINK32) -mdll -o $@ $(BLINK_FLAGS) \
- $(mktmp $(LKPRE) $(PERLDLL_OBJ:s,\,\\) $(LIBFILES) \
- perl.exp $(LKPOST))
+ $(mktmp $(LKPRE) $(PERLDLL_OBJ:s,\,\\) \
+ $(shell $(MINIPERL) -I..\lib buildext.pl --list-static-libs|tr \\\\ /) \
+ $(LIBFILES) perl.exp $(LKPOST))
.ELSE
$(LINK32) -dll -def:perldll.def -out:$@ \
$(shell $(MINIPERL) -I..\lib buildext.pl --list-static-libs) \