From: Nicholas Clark Date: Mon, 26 Jan 2009 22:49:19 +0000 (+0000) Subject: Break the --create-perllibst-h and --list-static-libs options out of buildext.pl X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=c6d234b82f2f6387f4a8ddb73277519b5bca93fc;p=p5sagit%2Fp5-mst-13.2.git Break the --create-perllibst-h and --list-static-libs options out of buildext.pl into separate scripts. --- diff --git a/MANIFEST b/MANIFEST index 671b61a..7776e9c 100644 --- a/MANIFEST +++ b/MANIFEST @@ -4350,6 +4350,7 @@ win32/config_H.vc64 Win64 config header (Visual C++ build) win32/config_sh.PL Perl code to update Win32 config.sh from Makefile win32/config.vc Win32 base line config.sh (Visual C++ build) win32/config.vc64 Win64 base line config.sh (Visual C++ build) +win32/create_perllibst_h.pl creates perllibst.h file for inclusion from perllib.c win32/distclean.bat Remove _ALL_ files not listed here in MANIFEST win32/dl_win32.xs Win32 port win32/fcrypt.c crypt() implementation @@ -4359,6 +4360,7 @@ win32/include/arpa/inet.h Win32 port win32/include/dirent.h Win32 port win32/include/netdb.h Win32 port win32/include/sys/socket.h Win32 port +win32/list_static_libs.pl prints libraries for static linking win32/Makefile Win32 makefile for NMAKE (Visual C++ build) win32/Makefile.ce WinCE port win32/makefile.mk Win32 makefile for DMAKE (BC++, VC++ builds) diff --git a/win32/Makefile b/win32/Makefile index 50f4167..e3104eb 100644 --- a/win32/Makefile +++ b/win32/Makefile @@ -950,8 +950,8 @@ $(CORE_OBJ) : $(CORE_H) $(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 +perldll.def : $(MINIPERL) $(CONFIGPM) ..\global.sym ..\pp.sym ..\makedef.pl create_perllibst_h.pl + $(MINIPERL) -I..\lib create_perllibst_h.pl $(MINIPERL) -w ..\makedef.pl PLATFORM=win32 $(OPTIMIZE) $(DEFINES) $(BUILDOPT) \ CCTYPE=$(CCTYPE) > perldll.def @@ -1071,11 +1071,11 @@ Extensions_reonly: buildext.pl $(PERLDEP) $(CONFIGPM) $(MINIPERL) -I..\lib buildext.pl $(MAKE) $(PERLDEP) $(EXTDIR) --dynamic +re -if exist ext $(MINIPERL) -I..\lib buildext.pl $(MAKE) $(PERLDEP) ext --dynamic +re -Extensions_static : buildext.pl $(PERLDEP) $(CONFIGPM) +Extensions_static : buildext.pl list_static_libs.pl $(PERLDEP) $(CONFIGPM) $(XCOPY) ..\*.h $(COREDIR)\*.* $(MINIPERL) -I..\lib buildext.pl $(MAKE) $(PERLDEP) $(EXTDIR) --static -if exist ext $(MINIPERL) -I..\lib buildext.pl $(MAKE) $(PERLDEP) ext --static - $(MINIPERL) -I..\lib buildext.pl --list-static-libs > Extensions_static + $(MINIPERL) -I..\lib list_static_libs.pl > Extensions_static Extensions_clean: -if exist $(MINIPERL) $(MINIPERL) -I..\lib buildext.pl $(MAKE) $(PERLDEP) $(EXTDIR) clean diff --git a/win32/buildext.pl b/win32/buildext.pl index ea5f57f..f8cc432 100644 --- a/win32/buildext.pl +++ b/win32/buildext.pl @@ -26,11 +26,6 @@ by an '!ext' and are appropriate to the type of building being done. If '--static' specified, only static extensions will be built. If '--dynamic' specified, only dynamic extensions will be built. ---create-perllibst-h - creates perllibst.h file for inclusion from perllib.c ---list-static-libs: - prints libraries for static linking and exits - =cut use Cwd; @@ -51,29 +46,6 @@ my ($static,$dynamic) = ((exists $opts{static}?1:0),(exists $opts{dynamic}?1:0)) if ("$static,$dynamic" eq "0,0") { ($static,$dynamic) = (1,1); } -if ($opts{'list-static-libs'} || $opts{'create-perllibst-h'}) { - my @statics = split /\s+/, $Config{static_ext}; - if ($opts{'create-perllibst-h'}) { - open my $fh, ">perllibst.h" - or die "Failed to write to perllibst.h:$!"; - my @statics1 = map {local $_=$_;s/\//__/g;$_} @statics; - my @statics2 = map {local $_=$_;s/\//::/g;$_} @statics; - print $fh "/*DO NOT EDIT\n this file is included from perllib.c to init static extensions */\n"; - print $fh "#ifdef STATIC1\n",(map {" \"$_\",\n"} @statics),"#undef STATIC1\n#endif\n"; - print $fh "#ifdef STATIC2\n",(map {" EXTERN_C void boot_$_ (pTHX_ CV* cv);\n"} @statics1),"#undef STATIC2\n#endif\n"; - print $fh "#ifdef STATIC3\n",(map {" newXS(\"$statics2[$_]::bootstrap\", boot_$statics1[$_], file);\n"} 0 .. $#statics),"#undef STATIC3\n#endif\n"; - close $fh; - } else { - my %extralibs; - for (@statics) { - 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 {s|/|\\|g;m|([^\\]+)$|;"..\\lib\\auto\\$_\\$1$Config{_a} "} @statics; - print map {"$_ "} sort keys %extralibs; - } - exit(0); -} (my $here = getcwd()) =~ s{/}{\\}g; my $perl = $^X; diff --git a/win32/create_perllibst_h.pl b/win32/create_perllibst_h.pl new file mode 100644 index 0000000..37fd3a4 --- /dev/null +++ b/win32/create_perllibst_h.pl @@ -0,0 +1,17 @@ +#!perl -w +use strict; + +# creates perllibst.h file for inclusion from perllib.c + +use Config; + +my @statics = split /\s+/, $Config{static_ext}; +open my $fh, '>', 'perllibst.h' or die "Failed to write to perllibst.h:$!"; + +my @statics1 = map {local $_=$_;s/\//__/g;$_} @statics; +my @statics2 = map {local $_=$_;s/\//::/g;$_} @statics; +print $fh "/*DO NOT EDIT\n this file is included from perllib.c to init static extensions */\n"; +print $fh "#ifdef STATIC1\n",(map {" \"$_\",\n"} @statics),"#undef STATIC1\n#endif\n"; +print $fh "#ifdef STATIC2\n",(map {" EXTERN_C void boot_$_ (pTHX_ CV* cv);\n"} @statics1),"#undef STATIC2\n#endif\n"; +print $fh "#ifdef STATIC3\n",(map {" newXS(\"$statics2[$_]::bootstrap\", boot_$statics1[$_], file);\n"} 0 .. $#statics),"#undef STATIC3\n#endif\n"; +close $fh; diff --git a/win32/list_static_libs.pl b/win32/list_static_libs.pl new file mode 100644 index 0000000..4b63d90 --- /dev/null +++ b/win32/list_static_libs.pl @@ -0,0 +1,17 @@ +#!perl -w +use strict; + +# prints libraries for static linking and exits + +use Config; + +my @statics = split /\s+/, $Config{static_ext}; + +my %extralibs; +for (@statics) { + my $file = "..\\lib\\auto\\$_\\extralibs.ld"; + open my $fh, '<', $file or die "can't open $file for reading: $!"; + $extralibs{$_}++ for grep {/\S/} split /\s+/, join '', <$fh>; +} +print map {s|/|\\|g;m|([^\\]+)$|;"..\\lib\\auto\\$_\\$1$Config{_a} "} @statics; +print map {"$_ "} sort keys %extralibs; diff --git a/win32/makefile.mk b/win32/makefile.mk index 05c8744..db8ba38 100644 --- a/win32/makefile.mk +++ b/win32/makefile.mk @@ -1210,8 +1210,8 @@ $(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 +perldll.def : $(MINIPERL) $(CONFIGPM) ..\global.sym ..\pp.sym ..\makedef.pl create_perllibst_h.pl + $(MINIPERL) -I..\lib create_perllibst_h.pl $(MINIPERL) -w ..\makedef.pl PLATFORM=win32 $(OPTIMIZE) $(DEFINES) \ $(BUILDOPT) CCTYPE=$(CCTYPE) > perldll.def @@ -1397,11 +1397,11 @@ Extensions_reonly : buildext.pl $(PERLDEP) $(CONFIGPM) $(MINIPERL) -I..\lib buildext.pl $(MAKE) $(PERLDEP) $(EXTDIR) --dynamic +re -if exist ext $(MINIPERL) -I..\lib buildext.pl $(MAKE) $(PERLDEP) ext --dynamic +re -Extensions_static : buildext.pl $(PERLDEP) $(CONFIGPM) +Extensions_static : buildext.pl list_static_libs.pl $(PERLDEP) $(CONFIGPM) $(XCOPY) ..\*.h $(COREDIR)\*.* $(MINIPERL) -I..\lib buildext.pl $(MAKE) $(PERLDEP) $(EXTDIR) --static -if exist ext $(MINIPERL) -I..\lib buildext.pl $(MAKE) $(PERLDEP) ext --static - $(MINIPERL) -I..\lib buildext.pl --list-static-libs > Extensions_static + $(MINIPERL) -I..\lib list_static_libs.pl > Extensions_static Extensions_clean : -if exist $(MINIPERL) $(MINIPERL) -I..\lib buildext.pl $(MAKE) $(PERLDEP) $(EXTDIR) clean