From a24cc0c03d2211980be311ac40a0e038f157d31f Mon Sep 17 00:00:00 2001 From: Yves Orton Date: Sun, 21 May 2006 14:20:12 +0200 Subject: [PATCH] Re: [patch] win32/buildext.pl to handle inclusions and not just exclusions Message-ID: <9b18b3110605210320h5adc9df4hbee2302722b3dd6e@mail.gmail.com> p4raw-id: //depot/perl@28293 --- win32/Makefile | 8 ++++++++ win32/buildext.pl | 20 +++++++++++++++++--- 2 files changed, 25 insertions(+), 3 deletions(-) diff --git a/win32/Makefile b/win32/Makefile index 2a14e97..77b233c 100644 --- a/win32/Makefile +++ b/win32/Makefile @@ -917,6 +917,10 @@ all : .\config.h $(GLOBEXE) $(MINIMOD) $(CONFIGPM) $(UNIDATAFILES) $(PERLEXE) \ $(X2P) Extensions @echo Everything is up to date. '$(MAKE_BARE) test' to run test suite. +reonly : .\config.h $(GLOBEXE) $(MINIMOD) $(CONFIGPM) $(UNIDATAFILES) $(PERLEXE) \ + $(X2P) Extensions_reonly + @echo Perl and 're' are up to date. + $(DYNALOADER)$(o) : $(DYNALOADER).c $(CORE_H) $(EXTDIR)\DynaLoader\dlutils.c #------------------------------------------------------------ @@ -1074,6 +1078,10 @@ Extensions: buildext.pl $(PERLDEP) $(CONFIGPM) $(MINIPERL) -I..\lib buildext.pl $(MAKE) $(PERLDEP) $(EXTDIR) --dynamic $(MINIPERL) -I..\lib buildext.pl $(MAKE) $(PERLDEP) ext --dynamic +Extensions_reonly: buildext.pl $(PERLDEP) $(CONFIGPM) + $(MINIPERL) -I..\lib buildext.pl $(MAKE) $(PERLDEP) $(EXTDIR) --dynamic +re + $(MINIPERL) -I..\lib buildext.pl $(MAKE) $(PERLDEP) ext --dynamic +re + Extensions_static : buildext.pl $(MINIPERL) -I..\lib buildext.pl $(MAKE) $(PERLDEP) $(EXTDIR) --static $(MINIPERL) -I..\lib buildext.pl $(MAKE) $(PERLDEP) ext --static diff --git a/win32/buildext.pl b/win32/buildext.pl index 2f18b90..7578669 100644 --- a/win32/buildext.pl +++ b/win32/buildext.pl @@ -4,7 +4,7 @@ buildext.pl - build extensions =head1 SYNOPSIS - buildext.pl make [-make_opts] dep directory [target] [--static|--dynamic] !ext1 !ext2 + buildext.pl make [-make_opts] dep directory [target] [--static|--dynamic] +ext2 !ext1 E.g. @@ -19,6 +19,10 @@ E.g. Will skip building extensions which are marked with an '!' char. Mostly because they still not ported to specified platform. +If any extensions are listed with a '+' char then only those +extensions will be built, but only if they arent countermanded +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. @@ -36,6 +40,9 @@ use Config; # @ARGV with '!' at first position are exclusions my %excl = map {$_=>1} map {/^!(.*)$/} @ARGV; @ARGV = grep {!/^!/} @ARGV; +# @ARGV with '+' at first position are inclusions +my %incl = map {$_=>1} map {/^\+(.*)$/} @ARGV; +@ARGV = grep {!/^\+/} @ARGV; # --static/--dynamic my %opts = map {$_=>1} map {/^--([\w\-]+)$/} @ARGV; @@ -47,13 +54,15 @@ if ("$static,$dynamic" eq "0,0") { 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"; + 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; @@ -64,7 +73,7 @@ if ($opts{'list-static-libs'} || $opts{'create-perllibst-h'}) { print map {s|/|\\|g;m|([^\\]+)$|;"..\\lib\\auto\\$_\\$1$Config{_a} "} @statics; print map {"$_ "} sort keys %extralibs; } - exit; + exit(0); } my $here = getcwd(); @@ -100,8 +109,13 @@ my @ext; push @ext, FindExt::static_ext() if $static; push @ext, FindExt::dynamic_ext(), FindExt::nonxs_ext() if $dynamic; + foreach $dir (sort @ext) { + if (%incl and !exists $incl{$dir}) { + #warn "Skipping extension $ext\\$dir, not in inclusion list\n"; + next; + } if (exists $excl{$dir}) { warn "Skipping extension $ext\\$dir, not ported to current platform"; next; -- 2.7.4