From: Nicholas Clark Date: Sat, 26 Sep 2009 20:15:34 +0000 (+0100) Subject: Support building extensions in dist/ as well as cpan/ and ext/ X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=a193a2dbe32848820392de0a7fd340ca82c2efd9;p=p5sagit%2Fp5-mst-13.2.git Support building extensions in dist/ as well as cpan/ and ext/ --- diff --git a/Configure b/Configure index b2b92af..9b9d2c7 100755 --- a/Configure +++ b/Configure @@ -21691,6 +21691,10 @@ cd "$rsrc/cpan" set X shift eval $find_extensions +cd "$rsrc/dist" +set X +shift +eval $find_extensions cd "$rsrc/ext" set X shift diff --git a/Makefile.SH b/Makefile.SH index 2b28787..623064a 100644 --- a/Makefile.SH +++ b/Makefile.SH @@ -218,7 +218,7 @@ done nonxs_list=' ' for f in $nonxs_ext; do p=`echo "$f" | tr / -` - for d in ext cpan; do + for d in ext dist cpan; do if test -d $d/$p; then nonxs_list="$nonxs_list $d/$p/pm_to_blib" fi diff --git a/Porting/core-cpan-diff b/Porting/core-cpan-diff index 8e3feeb..7dc907b 100755 --- a/Porting/core-cpan-diff +++ b/Porting/core-cpan-diff @@ -432,7 +432,7 @@ sub get_map { my $ext; for (@$perl_files) { - if (m{^((?:ext|cpan)/[^/]+/)}) { + if (m{^((?:ext|dist|cpan)/[^/]+/)}) { if (defined $ext and $ext ne $1) { # more than one ext/$ext/ undef $ext; diff --git a/TestInit.pm b/TestInit.pm index 7eec5b4..8513955 100644 --- a/TestInit.pm +++ b/TestInit.pm @@ -59,7 +59,7 @@ if (-f 't/TEST' && -f 'MANIFEST' && -d 'lib' && -d 'ext') { # We're being run from the top level. Try to change directory, and set # things up correctly. This is a 90% solution, but for hand-running tests, # that's good enough - if ($0 =~ s!^((?:ext|cpan)[\\/][^\\/]+)[\//](.*\.t)$!$2!) { + if ($0 =~ s!^((?:ext|dist|cpan)[\\/][^\\/]+)[\//](.*\.t)$!$2!) { # Looks like a test in ext. chdir $1 or die "Can't chdir '$1': $!"; new_inc(@up_2_t); diff --git a/configure.com b/configure.com index d79d6f4..d5ea932 100644 --- a/configure.com +++ b/configure.com @@ -2727,6 +2727,7 @@ $ OPEN/READ CONFIG 'manifestfound' $ext_loop: $ READ/END_OF_FILE=end_ext/ERROR=end_ext CONFIG line $ IF F$EXTRACT(0,4,line) .NES. "ext/" .AND. - + F$EXTRACT(0,5,line) .NES. "dist/".AND. - F$EXTRACT(0,5,line) .NES. "cpan/" THEN goto ext_loop $ line = F$EDIT(line,"COMPRESS") $ line = F$ELEMENT(0," ",line) @@ -2735,6 +2736,11 @@ $ THEN $ xxx = F$ELEMENT(1,"/",line) $ IF F$SEARCH("[-.ext]''xxx'.DIR;1") .EQS. "" THEN GOTO ext_loop $ ENDIF +$ IF F$EXTRACT(0,5,line) .EQS. "dist/" +$ THEN +$ xxx = F$ELEMENT(1,"/",line) +$ IF F$SEARCH("[-.dist]''xxx'.DIR;1") .EQS. "" THEN GOTO ext_loop +$ ENDIF $ IF F$EXTRACT(0,5,line) .EQS. "cpan/" $ THEN $ xxx = F$ELEMENT(1,"/",line) @@ -2790,7 +2796,7 @@ $ xxx = F$EXTRACT(F$LENGTH(extspec) + 1, extlen, xxx) $ ENDIF $! $ found_new_extension: -$ IF F$SEARCH("[-.ext.''extension_dir_name']*.xs") .EQS. "" .AND. F$SEARCH("[-.cpan.''extension_dir_name']*.xs") .EQS. "" +$ IF F$SEARCH("[-.ext.''extension_dir_name']*.xs") .EQS. "" .AND. F$SEARCH("[-.dist.''extension_dir_name']*.xs") .EQS. "" .AND. F$SEARCH("[-.cpan.''extension_dir_name']*.xs") .EQS. "" $ THEN $ nonxs_ext = nonxs_ext + " ''extspec'" $ ELSE diff --git a/dist/.gitignore b/dist/.gitignore new file mode 100644 index 0000000..48ab117 --- /dev/null +++ b/dist/.gitignore @@ -0,0 +1,8 @@ +# ignore generated .c files, and other module build traces +*.c +*.bs +blib +pm_to_blib +Makefile +Makefile.PL +ppport.h diff --git a/make_ext.pl b/make_ext.pl index 5aa861d..04c2add 100644 --- a/make_ext.pl +++ b/make_ext.pl @@ -19,7 +19,7 @@ my @toolchain = qw(ext/constant/lib ext/Cwd ext/Cwd/lib ext/ExtUtils-Command/lib ext/ExtUtils-Manifest/lib ext/Text-ParseWords/lib cpan/File-Path/lib cpan/AutoLoader/lib); -my @ext_dirs = qw(cpan ext); +my @ext_dirs = qw(cpan dist ext); my $ext_dirs_re = '(?:' . join('|', @ext_dirs) . ')'; # This script acts as a simple interface for building extensions. diff --git a/t/TEST b/t/TEST index 8883b3a..0ee0dd2 100755 --- a/t/TEST +++ b/t/TEST @@ -194,7 +194,7 @@ sub _scan_test { my $dir = $1; my $testswitch = $dir_to_switch{$dir}; if (!defined $testswitch) { - if ($test =~ s!^(\.\./(?:cpan|ext)/[^/]+)/t!t!) { + if ($test =~ s!^(\.\./(?:cpan|dist|ext)/[^/]+)/t!t!) { $run_dir = $1; $return_dir = '../../t'; $lib = '../../lib'; @@ -345,7 +345,7 @@ sub _tests_from_manifest { my $mani = '../MANIFEST'; if (open(MANI, $mani)) { while () { - if (m!^((?:cpan|ext)/(\S+)/+(?:[^/\s]+\.t|test\.pl)|lib/\S+?(?:\.t|test\.pl))\s!) { + if (m!^((?:cpan|dist|ext)/(\S+)/+(?:[^/\s]+\.t|test\.pl)|lib/\S+?(?:\.t|test\.pl))\s!) { my $t = $1; my $extension = $2; if (!$::core || $t =~ m!^lib/[a-z]!) { diff --git a/t/pod/diag.t b/t/pod/diag.t index eb6f10e..573450d 100644 --- a/t/pod/diag.t +++ b/t/pod/diag.t @@ -31,7 +31,7 @@ while (<$diagfh>) { my @todo = ('..'); while (@todo) { my $todo = shift @todo; - next if $todo ~~ ['../t', '../lib', '../ext', '../cpan']; + next if $todo ~~ ['../t', '../lib', '../ext', '../dist', '../cpan']; # opmini.c is just a copy of op.c, so there's no need to check again. next if $todo eq '../opmini.c'; if (-d $todo) { diff --git a/win32/Makefile b/win32/Makefile index 732b3cd..55a2ba9 100644 --- a/win32/Makefile +++ b/win32/Makefile @@ -396,6 +396,7 @@ COREDIR = ..\lib\CORE AUTODIR = ..\lib\auto LIBDIR = ..\lib EXTDIR = ..\ext +DISTDIR = ..\dist CPANDIR = ..\cpan PODDIR = ..\pod EXTUTILSDIR = $(LIBDIR)\ExtUtils @@ -1037,30 +1038,30 @@ MakePPPort_clean: # DynaLoader.pm, so this will have to do Extensions: ..\make_ext.pl $(PERLDEP) $(CONFIGPM) $(DYNALOADER) $(XCOPY) ..\*.h $(COREDIR)\*.* - $(MINIPERL) -I..\lib ..\make_ext.pl "MAKE=$(MAKE)" --dir=$(CPANDIR) --dir=$(EXTDIR) --dynamic + $(MINIPERL) -I..\lib ..\make_ext.pl "MAKE=$(MAKE)" --dir=$(CPANDIR) --dir=$(DISTDIR) --dir=$(EXTDIR) --dynamic Extensions_reonly: ..\make_ext.pl $(PERLDEP) $(CONFIGPM) $(DYNALOADER) $(XCOPY) ..\*.h $(COREDIR)\*.* - $(MINIPERL) -I..\lib ..\make_ext.pl "MAKE=$(MAKE)" --dir=$(CPANDIR) --dir=$(EXTDIR) --dynamic +re + $(MINIPERL) -I..\lib ..\make_ext.pl "MAKE=$(MAKE)" --dir=$(CPANDIR) --dir=$(DISTDIR) --dir=$(EXTDIR) --dynamic +re Extensions_static : ..\make_ext.pl list_static_libs.pl $(PERLDEP) $(CONFIGPM) $(XCOPY) ..\*.h $(COREDIR)\*.* - $(MINIPERL) -I..\lib ..\make_ext.pl "MAKE=$(MAKE)" --dir=$(CPANDIR) --dir=$(EXTDIR) --static + $(MINIPERL) -I..\lib ..\make_ext.pl "MAKE=$(MAKE)" --dir=$(CPANDIR) --dir=$(DISTDIR) --dir=$(EXTDIR) --static $(MINIPERL) -I..\lib list_static_libs.pl > Extensions_static Extensions_nonxs: ..\make_ext.pl $(PERLDEP) $(CONFIGPM) $(XCOPY) ..\*.h $(COREDIR)\*.* - $(MINIPERL) -I..\lib ..\make_ext.pl "MAKE=$(MAKE)" --dir=$(CPANDIR) --dir=$(EXTDIR) --nonxs + $(MINIPERL) -I..\lib ..\make_ext.pl "MAKE=$(MAKE)" --dir=$(CPANDIR) --dir=$(DISTDIR) --dir=$(EXTDIR) --nonxs $(DYNALOADER) : ..\make_ext.pl $(PERLDEP) $(CONFIGPM) Extensions_nonxs $(XCOPY) ..\*.h $(COREDIR)\*.* $(MINIPERL) -I..\lib ..\make_ext.pl "MAKE=$(MAKE)" --dir=$(EXTDIR) --dynaloader Extensions_clean: - -if exist $(MINIPERL) $(MINIPERL) -I..\lib ..\make_ext.pl "MAKE=$(MAKE)" --dir=$(CPANDIR) --dir=$(EXTDIR) --all --target=clean + -if exist $(MINIPERL) $(MINIPERL) -I..\lib ..\make_ext.pl "MAKE=$(MAKE)" --dir=$(CPANDIR) --dir=$(DISTDIR) --dir=$(EXTDIR) --all --target=clean Extensions_realclean: - -if exist $(MINIPERL) $(MINIPERL) -I..\lib ..\make_ext.pl "MAKE=$(MAKE)" --dir=$(CPANDIR) --dir=$(EXTDIR) --all --target=realclean + -if exist $(MINIPERL) $(MINIPERL) -I..\lib ..\make_ext.pl "MAKE=$(MAKE)" --dir=$(CPANDIR) --dir=$(DISTDIR) --dir=$(EXTDIR) --all --target=realclean #------------------------------------------------------------------------------- @@ -1205,6 +1206,7 @@ distclean: realclean -del /f perl.base -cd .. && del /s *.lib *.map *.pdb *.ilk *.bs *$(o) .exists pm_to_blib -cd $(EXTDIR) && del /s *.def Makefile Makefile.old + -cd $(DISTDIR) && del /s *.def Makefile Makefile.old -cd $(CPANDIR) && del /s *.def Makefile Makefile.old -if exist $(AUTODIR) rmdir /s /q $(AUTODIR) -if exist $(COREDIR) rmdir /s /q $(COREDIR) diff --git a/win32/makefile.mk b/win32/makefile.mk index 78f7c87..b6bfdf4 100644 --- a/win32/makefile.mk +++ b/win32/makefile.mk @@ -395,6 +395,7 @@ COREDIR = ..\lib\CORE AUTODIR = ..\lib\auto LIBDIR = ..\lib EXTDIR = ..\ext +DISTDIR = ..\dist CPANDIR = ..\cpan PODDIR = ..\pod EXTUTILSDIR = $(LIBDIR)\ExtUtils @@ -1373,30 +1374,30 @@ MakePPPort_clean: # DynaLoader.pm, so this will have to do Extensions : ..\make_ext.pl $(PERLDEP) $(CONFIGPM) $(DYNALOADER) $(XCOPY) ..\*.h $(COREDIR)\*.* - $(MINIPERL) -I..\lib ..\make_ext.pl "MAKE=$(MAKE)" --dir=$(CPANDIR) --dir=$(EXTDIR) --dynamic + $(MINIPERL) -I..\lib ..\make_ext.pl "MAKE=$(MAKE)" --dir=$(CPANDIR) --dir=$(DISTDIR) --dir=$(EXTDIR) --dynamic Extensions_reonly : ..\make_ext.pl $(PERLDEP) $(CONFIGPM) $(DYNALOADER) $(XCOPY) ..\*.h $(COREDIR)\*.* - $(MINIPERL) -I..\lib ..\make_ext.pl "MAKE=$(MAKE)" --dir=$(CPANDIR) --dir=$(EXTDIR) --dynamic +re + $(MINIPERL) -I..\lib ..\make_ext.pl "MAKE=$(MAKE)" --dir=$(CPANDIR) --dir=$(DISTDIR) --dir=$(EXTDIR) --dynamic +re Extensions_static : ..\make_ext.pl list_static_libs.pl $(PERLDEP) $(CONFIGPM) $(XCOPY) ..\*.h $(COREDIR)\*.* - $(MINIPERL) -I..\lib ..\make_ext.pl "MAKE=$(MAKE)" --dir=$(CPANDIR) --dir=$(EXTDIR) --static + $(MINIPERL) -I..\lib ..\make_ext.pl "MAKE=$(MAKE)" --dir=$(CPANDIR) --dir=$(DISTDIR) --dir=$(EXTDIR) --static $(MINIPERL) -I..\lib list_static_libs.pl > Extensions_static Extensions_nonxs : ..\make_ext.pl $(PERLDEP) $(CONFIGPM) $(XCOPY) ..\*.h $(COREDIR)\*.* - $(MINIPERL) -I..\lib ..\make_ext.pl "MAKE=$(MAKE)" --dir=$(CPANDIR) --dir=$(EXTDIR) --nonxs + $(MINIPERL) -I..\lib ..\make_ext.pl "MAKE=$(MAKE)" --dir=$(CPANDIR) --dir=$(DISTDIR) --dir=$(EXTDIR) --nonxs $(DYNALOADER) : ..\make_ext.pl $(PERLDEP) $(CONFIGPM) Extensions_nonxs $(XCOPY) ..\*.h $(COREDIR)\*.* $(MINIPERL) -I..\lib ..\make_ext.pl "MAKE=$(MAKE)" --dir=$(EXTDIR) --dynaloader Extensions_clean : - -if exist $(MINIPERL) $(MINIPERL) -I..\lib ..\make_ext.pl "MAKE=$(MAKE)" --dir=$(CPANDIR) --dir=$(EXTDIR) --all --target=clean + -if exist $(MINIPERL) $(MINIPERL) -I..\lib ..\make_ext.pl "MAKE=$(MAKE)" --dir=$(CPANDIR) --dir=$(DISTDIR) --dir=$(EXTDIR) --all --target=clean Extensions_realclean : - -if exist $(MINIPERL) $(MINIPERL) -I..\lib ..\make_ext.pl "MAKE=$(MAKE)" --dir=$(CPANDIR) --dir=$(EXTDIR) --all --target=realclean + -if exist $(MINIPERL) $(MINIPERL) -I..\lib ..\make_ext.pl "MAKE=$(MAKE)" --dir=$(CPANDIR) --dir=$(DISTDIR) --dir=$(EXTDIR) --all --target=realclean #------------------------------------------------------------------------------- @@ -1538,6 +1539,7 @@ distclean: realclean -del /f perl.base -cd .. && del /s *$(a) *.map *.pdb *.ilk *.tds *.bs *$(o) .exists pm_to_blib -cd $(EXTDIR) && del /s *.def Makefile Makefile.old + -cd $(DISTDIR) && del /s *.def Makefile Makefile.old -cd $(CPANDIR) && del /s *.def Makefile Makefile.old -if exist $(AUTODIR) rmdir /s /q $(AUTODIR) -if exist $(COREDIR) rmdir /s /q $(COREDIR)