diff options
author | Nicholas Clark <nick@ccl4.org> | 2010-11-28 17:15:58 +0000 |
---|---|---|
committer | Nicholas Clark <nick@ccl4.org> | 2010-11-28 17:18:45 +0000 |
commit | fbcaf61123069fe46010699dd41ca5f60f448361 (patch) | |
tree | bed07724daa52b9f6741f74cb245a2a1507a519c | |
parent | 603928ea21886dfb891e73164afc6b81c2793547 (diff) | |
download | perl-fbcaf61123069fe46010699dd41ca5f60f448361.tar.gz |
Generate perlmain.c using ExtUtils::Miniperl, instead of writemain.SH.
This allows writemain.SH to be removed. This also has the side effect of testing
that ExtUtils::Miniperl actually works. :-)
-rw-r--r-- | MANIFEST | 1 | ||||
-rwxr-xr-x | Makefile.SH | 8 | ||||
-rw-r--r-- | Porting/exec-bit.txt | 1 | ||||
-rw-r--r-- | pod/perlhack.pod | 2 | ||||
-rwxr-xr-x | writemain.SH | 108 |
5 files changed, 5 insertions, 115 deletions
@@ -5032,7 +5032,6 @@ win32/win32thread.h Win32 port mapping to threads win32/wince.c WinCE port win32/wince.h WinCE port win32/wincesck.c WinCE port -writemain.SH Generate perlmain.c from miniperlmain.c+extensions x2p/a2p.c Output of a2p.y run through byacc x2p/a2p.h Global declarations x2p/a2p.pod Pod for awk to perl translator diff --git a/Makefile.SH b/Makefile.SH index 557f4f864a..531579368a 100755 --- a/Makefile.SH +++ b/Makefile.SH @@ -435,10 +435,10 @@ private = preplibrary $(CONFIGPM) $(CONFIGPOD) lib/ExtUtils/Miniperl.pm git_vers # Files to be built with variable substitution before miniperl # is available. sh = Makefile.SH cflags.SH config_h.SH makeaperl.SH makedepend.SH \ - myconfig.SH writemain.SH pod/Makefile.SH + myconfig.SH pod/Makefile.SH shextract = Makefile cflags config.h makeaperl makedepend \ - makedir myconfig writemain pod/Makefile + makedir myconfig pod/Makefile addedbyconf = UU $(shextract) pstruct @@ -644,8 +644,8 @@ generate_uudmap$(HOST_EXE_EXT): generate_uudmap$(OBJ_EXT) miniperlmain$(OBJ_EXT): miniperlmain.c patchlevel.h $(CCCMD) $(PLDLFLAGS) $*.c -perlmain.c: miniperlmain.c config.sh $(FIRSTMAKEFILE) - sh writemain $(DYNALOADER) $(static_ext) > perlmain.c +perlmain.c: $(MINIPERL_EXE) lib/ExtUtils/Miniperl.pm + $(MINIPERL) -Ilib -MExtUtils::Miniperl -e 'writemain(@ARGV)' DynaLoader $(static_ext) > perlmain.c perlmain$(OBJ_EXT): perlmain.c $(CCCMD) $(PLDLFLAGS) $*.c diff --git a/Porting/exec-bit.txt b/Porting/exec-bit.txt index 047b4bcb22..5e0f1e0645 100644 --- a/Porting/exec-bit.txt +++ b/Porting/exec-bit.txt @@ -21,7 +21,6 @@ regen/embed.pl regen/keywords.pl regen/opcode.pl runtests.SH -writemain.SH t/TEST vms/ext/filespec.t x2p/Makefile.SH diff --git a/pod/perlhack.pod b/pod/perlhack.pod index 831f407ad0..cf692e8412 100644 --- a/pod/perlhack.pod +++ b/pod/perlhack.pod @@ -458,7 +458,7 @@ This is very high-level code, enough to fit on a single screen, and it resembles the code found in L<perlembed>; most of the real action takes place in F<perl.c> -F<perlmain.c> is generated by L<writemain> from F<miniperlmain.c> at +F<perlmain.c> is generated by C<ExtUtils::Miniperl> from F<miniperlmain.c> at make time, so you should make perl to follow this along. First, F<perlmain.c> allocates some memory and constructs a Perl diff --git a/writemain.SH b/writemain.SH deleted file mode 100755 index ac1c5aaf45..0000000000 --- a/writemain.SH +++ /dev/null @@ -1,108 +0,0 @@ -case $PERL_CONFIG_SH 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."; exit 1 - fi - . $TOP/config.sh - ;; -esac -: This forces SH files to create target in same directory as SH file. -: This is so that make depend always knows where to find SH derivatives. -case "$0" in -*/*) cd `expr X$0 : 'X\(.*\)/'` ;; -esac -echo "Extracting writemain (with variable substitutions)" -: This section of the file will have variable substitutions done on it. -: Move anything that needs config subs from !NO!SUBS! section to !GROK!THIS!. -: Protect any dollar signs and backticks that you do not want interpreted -: by putting a backslash in front. You may delete these comments. -rm -f writemain -$spitshell >writemain <<!GROK!THIS! -$startsh -!GROK!THIS! - -: In the following dollars and backticks do not need the extra backslash. -$spitshell >>writemain <<'!NO!SUBS!' -# This script takes the plain miniperlmain.c and writes out perlmain.c -# which includes all the extensions. -# The command line arguments name extensions to be used. -# E.g.: sh writemain SDBM_File POSIX > perlmain.c -# - -orig="$*" -args='' -: Remove any .a suffixes and any leading path components -for file in $orig ; do - case "$file" in - *.a) file=`echo $file | sed 's/\.a//g'`;; - *.o) file=`echo $file | sed 's/\.o//g'`;; - esac - case "$file" in - ext/*) file=`echo $file | sed 's:ext/\(.*\)/[^/]*:\1:'` - ;; - lib/auto/*) file=`echo $file | sed 's:lib/auto/\(.*\)/[^/]*:\1:'` - ;; - */*) - file=`expr X$file : 'X.*/\(.*\)'` - ;; - esac - args="$args $file" -done - - -sed '/Do not delete this line--writemain depends on it/q' miniperlmain.c - - -if test X"$args" != "X" ; then - for ext in $args ; do -: $ext will either be 'Name' or 'Name1/Name2' etc -: convert ext into cname and mname -mname=`echo $ext | sed 's!/!::!g'` -cname=`echo $mname | sed 's!:!_!g'` - -echo "EXTERN_C void boot_${cname} (pTHX_ CV* cv);" - done -fi - -cat << 'EOP' - -static void -xs_init(pTHX) -{ -EOP - -if test X"$args" != "X" ; then - echo " static const char file[] = __FILE__;" - echo " dXSUB_SYS;" - - ai='' - - for ext in $args ; do - - : $ext will either be 'Name' or 'Name1/Name2' etc - : convert ext into cname and mname - mname=`echo $ext | sed 's!/!::!g'` - cname=`echo $mname | sed 's!:!_!g'` - - if test "$ext" = "DynaLoader"; then - : Must NOT install 'DynaLoader::boot_DynaLoader' as 'bootstrap'! - : boot_DynaLoader is called directly in DynaLoader.pm - echo " newXS(\"${mname}::boot_${ext}\", boot_${cname}, file);" - else - echo " newXS(\"${mname}::bootstrap\", boot_${cname}, file);" - fi - done -fi - -cat << 'EOP' -} -EOP - -!NO!SUBS! -chmod 755 writemain -$eunicefix writemain |