In perl.git, the branch blead has been updated <http://perl5.git.perl.org/perl.git/commitdiff/3f3ffb6144f605cbf5773fd80fc9f5c2949f7d87?hp=23d483e2ac9eec5dd3415b4d8aad7ec7b0551ead>
- Log ----------------------------------------------------------------- commit 3f3ffb6144f605cbf5773fd80fc9f5c2949f7d87 Author: Nicholas Clark <n...@ccl4.org> Date: Wed Jan 28 15:10:42 2009 +0000 Move ext/util/make_ext.pl to the top level. M Cross/Makefile-cross-SH M MANIFEST M Makefile.SH D ext/util/make_ext.pl A make_ext.pl commit 97a26ad97b57719769c0df73f21ab399fc6ae981 Author: Nicholas Clark <n...@ccl4.org> Date: Wed Jan 28 14:33:34 2009 +0000 Fold ext/util/make_ext_cross into ext/util/make_ext.pl, and delete it. Add --option argument parsing to make_ext.pl (swiped from buildext.pl). Add a --cross option to add -MCross to the Makefile.PL line. Change Cross/Makefile-cross-SH to call "ext/util/make_ext.pl --cross ..." M Cross/Makefile-cross-SH M MANIFEST M ext/util/make_ext.pl D ext/util/make_ext_cross ----------------------------------------------------------------------- Summary of changes: Cross/Makefile-cross-SH | 8 +- MANIFEST | 3 +- Makefile.SH | 14 ++-- ext/util/make_ext_cross | 147 ----------------------------------- ext/util/make_ext.pl => make_ext.pl | 25 +++++- 5 files changed, 32 insertions(+), 165 deletions(-) delete mode 100644 ext/util/make_ext_cross rename ext/util/make_ext.pl => make_ext.pl (91%) diff --git a/Cross/Makefile-cross-SH b/Cross/Makefile-cross-SH index 8ab4d72..1c7d42b 100755 --- a/Cross/Makefile-cross-SH +++ b/Cross/Makefile-cross-SH @@ -937,16 +937,16 @@ manicheck: FORCE $(DYNALOADER): preplibrary FORCE - @$(LDLIBPTH) sh ext/util/make_ext_cross $(STATIC) $@ MAKE=$(MAKE) LIBPERL_A=$(LIBPERL) + @$(LDLIBPTH) $(RUN) ./miniperl$(EXE_EXT) -Ilib make_ext.pl --cross $(STATIC) $@ MAKE=$(MAKE) LIBPERL_A=$(LIBPERL) d_dummy $(dynamic_ext): miniperl$(EXE_EXT) preplibrary makeppport $(DYNALOADER) FORCE - @$(LDLIBPTH) sh ext/util/make_ext_cross dynamic $@ MAKE=$(MAKE) LIBPERL_A=$(LIBPERL) + @$(LDLIBPTH) $(RUN) ./miniperl$(EXE_EXT) -Ilib make_ext.pl --cross dynamic $@ MAKE=$(MAKE) LIBPERL_A=$(LIBPERL) s_dummy $(static_ext): miniperl$(EXE_EXT) preplibrary makeppport $(DYNALOADER) FORCE - @$(LDLIBPTH) sh ext/util/make_ext_cross $(STATIC) $@ MAKE=$(MAKE) LIBPERL_A=$(LIBPERL) + @$(LDLIBPTH) $(RUN) ./miniperl$(EXE_EXT) -Ilib make_ext.pl --cross $(STATIC) $@ MAKE=$(MAKE) LIBPERL_A=$(LIBPERL) n_dummy $(nonxs_ext): miniperl$(EXE_EXT) preplibrary $(DYNALOADER) FORCE - @$(LDLIBPTH) sh ext/util/make_ext_cross nonxs $@ MAKE=$(MAKE) LIBPERL_A=$(LIBPERL) + @$(LDLIBPTH) $(RUN) ./miniperl$(EXE_EXT) -Ilib make_ext.pl --cross nonxs $@ MAKE=$(MAKE) LIBPERL_A=$(LIBPERL) !NO!SUBS! $spitshell >>$Makefile <<EOF diff --git a/MANIFEST b/MANIFEST index 7776e9c..7d86fc1 100644 --- a/MANIFEST +++ b/MANIFEST @@ -1400,8 +1400,6 @@ ext/Unicode/Normalize/t/proto.t Unicode::Normalize ext/Unicode/Normalize/t/split.t Unicode::Normalize ext/Unicode/Normalize/t/test.t Unicode::Normalize ext/Unicode/Normalize/t/tie.t Unicode::Normalize -ext/util/make_ext.pl Used by Makefile to execute extension Makefiles -ext/util/make_ext_cross Cross-compilation ext/Win32API/File/buffers.h Win32API::File extension ext/Win32API/File/cFile.h Win32API::File extension ext/Win32API/File/cFile.pc Win32API::File extension @@ -3176,6 +3174,7 @@ Makefile.SH A script that generates Makefile make_patchnum.pl Script to generate git_version.h and lib/Config_git.pl files for all OS'es malloc.c A version of malloc you might not want malloc_ctl.h A version of malloc you might not want +make_ext.pl Used by Makefile to execute extension Makefiles MANIFEST This list of files mathoms.c A home for binary-compatible code artifacts META.yml Distribution meta-data in YAML diff --git a/Makefile.SH b/Makefile.SH index d601254..33e5893 100644 --- a/Makefile.SH +++ b/Makefile.SH @@ -272,7 +272,7 @@ SHRPENV = $shrpenv # if building a shared libperl.so that might later be linked into # another application, then it might be appropriate to also build static # extensions (usually just DynaLoader) with relocatable code (e.g. -fPIC -# for GNU cc). This is handled by ext/util/make_ext.pl. +# for GNU cc). This is handled by make_ext.pl. STATIC = $static_target # The following is used to include the current directory in @@ -1127,16 +1127,16 @@ manicheck: FORCE # DynaLoader may be needed for extensions that use Makefile.PL. $(DYNALOADER): miniperl$(EXE_EXT) preplibrary FORCE - $(LDLIBPTH) $(RUN) ./miniperl$(EXE_EXT) -Ilib ext/util/make_ext.pl $(STATIC) $@ MAKE=$(MAKE) LIBPERL_A=$(LIBPERL) + $(LDLIBPTH) $(RUN) ./miniperl$(EXE_EXT) -Ilib make_ext.pl $(STATIC) $@ MAKE=$(MAKE) LIBPERL_A=$(LIBPERL) d_dummy $(dynamic_ext): miniperl$(EXE_EXT) preplibrary makeppport $(DYNALOADER) FORCE - $(LDLIBPTH) $(RUN) ./miniperl$(EXE_EXT) -Ilib ext/util/make_ext.pl dynamic $@ MAKE=$(MAKE) LIBPERL_A=$(LIBPERL) + $(LDLIBPTH) $(RUN) ./miniperl$(EXE_EXT) -Ilib make_ext.pl dynamic $@ MAKE=$(MAKE) LIBPERL_A=$(LIBPERL) s_dummy $(static_ext): miniperl$(EXE_EXT) preplibrary makeppport $(DYNALOADER) FORCE - $(LDLIBPTH) $(RUN) ./miniperl$(EXE_EXT) -Ilib ext/util/make_ext.pl $(STATIC) $@ MAKE=$(MAKE) LIBPERL_A=$(LIBPERL) + $(LDLIBPTH) $(RUN) ./miniperl$(EXE_EXT) -Ilib make_ext.pl $(STATIC) $@ MAKE=$(MAKE) LIBPERL_A=$(LIBPERL) n_dummy $(nonxs_ext): miniperl$(EXE_EXT) preplibrary FORCE - $(LDLIBPTH) $(RUN) ./miniperl$(EXE_EXT) -Ilib ext/util/make_ext.pl nonxs $@ MAKE=$(MAKE) LIBPERL_A=$(LIBPERL) + $(LDLIBPTH) $(RUN) ./miniperl$(EXE_EXT) -Ilib make_ext.pl nonxs $@ MAKE=$(MAKE) LIBPERL_A=$(LIBPERL) !NO!SUBS! $spitshell >>$Makefile <<EOF @@ -1196,7 +1196,7 @@ _tidy: -cd x2p; $(LDLIBPTH) $(MAKE) clean -rm -f lib/Config_git.pl git_version.h -...@for x in $(DYNALOADER) $(dynamic_ext) $(static_ext) $(nonxs_ext) ; do \ - $(LDLIBPTH) $(RUN) ./miniperl$(EXE_EXT) -Ilib ext/util/make_ext.pl clean $$x MAKE=$(MAKE) ; \ + $(LDLIBPTH) $(RUN) ./miniperl$(EXE_EXT) -Ilib make_ext.pl clean $$x MAKE=$(MAKE) ; \ done _cleaner1: @@ -1206,7 +1206,7 @@ _cleaner1: -cd x2p; $(LDLIBPTH) $(MAKE) $(CLEAN) -...@if test -f miniperl$(EXE_EXT) ; then \ for x in $(DYNALOADER) $(dynamic_ext) $(static_ext) $(nonxs_ext) ; do \ - $(LDLIBPTH) $(RUN) ./miniperl$(EXE_EXT) -Ilib ext/util/make_ext.pl $(CLEAN) $$x MAKE=$(MAKE) ; \ + $(LDLIBPTH) $(RUN) ./miniperl$(EXE_EXT) -Ilib make_ext.pl $(CLEAN) $$x MAKE=$(MAKE) ; \ done ; \ else \ sh $(CLEAN).sh ; \ diff --git a/ext/util/make_ext_cross b/ext/util/make_ext_cross deleted file mode 100644 index b89c8e7..0000000 --- a/ext/util/make_ext_cross +++ /dev/null @@ -1,147 +0,0 @@ -#!/bin/sh - -# This script acts as a simple interface for building extensions. -# (borrowed from make_ext; but it will be deleted in future versions) -# It primarily used by the perl Makefile: -# -# d_dummy $(dynamic_ext): miniperl preplibrary FORCE -# @sh ext/util/make_ext dynamic $@ MAKE=$(MAKE) LIBPERL_A=$(LIBPERL) -# -# It may be deleted in a later release of perl so try to -# avoid using it for other purposes. - -target=$1; shift -extspec=$1; shift -makecmd=$1; shift # Should be something like MAKE=make -passthru="$*" # allow extra macro=value to be passed through -echo "" - -# Previously, $make was taken from config.sh. However, the user might -# instead be running a possibly incompatible make. This might happen if -# the user types "gmake" instead of a plain "make", for example. The -# correct current value of MAKE will come through from the main perl -# makefile as MAKE=/whatever/make in $makecmd. We'll be cautious in -# case third party users of this script (are there any?) don't have the -# MAKE=$(MAKE) argument, which was added after 5.004_03. -case "$makecmd" in -MAKE=*) - eval $makecmd - ;; -*) echo 'ext/util/make_ext: WARNING: Please include MAKE=$(MAKE)' - echo ' in your call to make_ext. See ext/util/make_ext for details.' - exit 1 - ;; -esac - - -case $CONFIG in -'') - if test -f config.sh; then TOP=.; - elif test -f ../config.sh; then TOP=..; - elif test -f ../../config.sh; then TOP=../..; - elif test -f ../../../config.sh; then TOP=../../..; - elif test -f ../../../../config.sh; then TOP=../../../..; - else - echo "Can't find config.sh generated by Configure"; exit 1 - fi - . $TOP/config.sh - ;; -esac - -if test "X$extspec" = X; then - echo "make_ext: no extension specified" - exit 1; -fi - -# The Perl Makefile.SH will expand all extensions to -# lib/auto/X/X.a (or lib/auto/X/Y/Y.a if nested) -# A user wishing to run make_ext might use -# X (or X/Y or X::Y if nested) - -# canonise into X/Y form (pname) -case "$extspec" in -lib*) # Remove lib/auto prefix and /*.* suffix - pname=`echo "$extspec" | sed -e 's:^lib/auto/::' -e 's:/[^/]*\.[^/]*$::' ` ;; -ext*) # Remove ext/ prefix and /pm_to_blib suffix - pname=`echo "$extspec" | sed -e 's:^ext/::' -e 's:/pm_to_blib$::' ` ;; -*::*) # Convert :: to / - pname=`echo "$extspec" | sed -e 's/::/\//g' ` ;; -*.*o) pname=`echo "$extspec" | sed -e 's/\..*o//'` ;; -*) pname="$extspec" ;; -esac -# echo "Converted $extspec to $pname" - -mname=`echo "$pname" | sed -e 's!/!::!g'` -depth=`echo "$pname" | sed -e 's![^/][^/]*!..!g'` -makefile=Makefile -makeargs='' -makeopts='' - -if test ! -d "ext/$pname"; then - echo " Skipping $extspec (directory does not exist)" - exit 0 # not an error ? -fi - -case "$osname" in -catamount) # Snowball's chance of building extensions. - echo "This is $osname, not building $mname, sorry." - exit 0 - ;; -esac - -echo " Making $mname ($target)" - -cd ext/$pname - -# check link type and do any preliminaries. Valid link types are -# 'dynamic', 'static', and 'static_pic' (the last one respects -# CCCDLFLAGS such as -fPIC -- see static_target in the main Makefile.SH) -case "$target" in -dynamic) makeargs="LINKTYPE=dynamic"; - target=all - ;; -static) makeargs="LINKTYPE=static CCCDLFLAGS=" - target=all - ;; -static_pic) makeargs="LINKTYPE=static" - target=all - ;; -nonxs) makeargs=""; - target=all - ;; - -*clean) # If Makefile has been moved to Makefile.old by a make clean - # then use Makefile.old for realclean rather than rebuild it - if test ! -f $makefile -a -f Makefile.old; then - makefile=Makefile.old - makeopts="-f $makefile" - echo "Note: Using Makefile.old" - fi - ;; - -*) # for the time being we are strict about what make_ext is used for - echo "make_ext: unknown make target '$target'"; exit 1 - ;; -'') echo "make_ext: no make target specified (eg static or dynamic)"; exit 1 - ;; -esac - -if test ! -f $makefile ; then - test -f Makefile.PL && $run ../$depth/miniperl -I../$depth/lib -MCross Makefile.PL INSTALLDIRS=perl INSTALLMAN3DIR=none PERL_CORE=1 $passthru -fi -if test ! -f $makefile ; then - echo "Warning: No Makefile!" -fi - -case "$target" in -clean) ;; -realclean) ;; -*) # Give makefile an opportunity to rewrite itself. - # reassure users that life goes on... - $MAKE config MAKE=$MAKE $passthru || echo "$MAKE config failed, continuing anyway..." - ;; -esac - -$MAKE $makeopts $target MAKE=$MAKE $makeargs $passthru || exit - -exit $? diff --git a/ext/util/make_ext.pl b/make_ext.pl similarity index 91% rename from ext/util/make_ext.pl rename to make_ext.pl index 0f35ab4..b0dc3ee 100644 --- a/ext/util/make_ext.pl +++ b/make_ext.pl @@ -11,10 +11,24 @@ use warnings; # It may be deleted in a later release of perl so try to # avoid using it for other purposes. -my $target = shift(@ARGV); -my $extspec = shift(@ARGV); -my $makecmd = shift(@ARGV); # Should be something like MAKE=make -my $passthru = join(' ', @ARGV); # allow extra macro=value to be passed through +my (%excl, %incl, %opts, @argv); + +foreach (@ARGV) { + if (/^!(.*)$/) { + $excl{$1} = 1; + } elsif (/^\+(.*)$/) { + $incl{$1} = 1; + } elsif (/^--([\w\-]+)$/) { + $opts{$1} = 1; + } else { + push @argv, $_; + } +} + +my $target = shift @argv; +my $extspec = shift @argv; +my $makecmd = shift @argv; # Should be something like MAKE=make +my $passthru = join ' ', @argv; # allow extra macro=value to be passed through print "\n"; # Previously, $make was taken from config.sh. However, the user might @@ -149,7 +163,8 @@ else { if (not -f $makefile) { if (-f "Makefile.PL") { - system("${run}../$depth/miniperl -I../$depth/lib Makefile.PL INSTALLDIRS=perl INSTALLMAN3DIR=none PERL_CORE=1 $passthru"); + my $cross = $opts{cross} ? ' -MCross' : ''; + system("${run}../$depth/miniperl -I../$depth/lib$cross Makefile.PL INSTALLDIRS=perl INSTALLMAN3DIR=none PERL_CORE=1 $passthru"); } # Right. The reason for this little hack is that we're sitting inside # a program run by ./miniperl, but there are tasks we need to perform -- Perl5 Master Repository