diff options
author | Brian Fraser <fraserbn@gmail.com> | 2014-01-22 22:46:07 -0300 |
---|---|---|
committer | Brian Fraser <fraserbn@gmail.com> | 2014-01-22 22:46:07 -0300 |
commit | b200d446d039db61da737bce424ec470309c0f70 (patch) | |
tree | 7e6d85b4af34424143adf6122f7d1cdabf77f1b5 | |
parent | 9c213c250ec5aeaa30aa3d4c8ff3a1ccb02330a9 (diff) | |
parent | 8b6a017ccef7126ae5bcac137fa9a45de4f2c155 (diff) | |
download | perl-b200d446d039db61da737bce424ec470309c0f70.tar.gz |
Merge branch 'cross-compile-revamp' into blead
This branch modifies how the cross-compilation model works.
The main change is that we now build a host miniperl to use locally,
rather than running each call to miniperl remotely.
It also removes several of the exceptions from the old model (no xlib,
xconfig.h, or Cross.pm).
-rw-r--r-- | .gitignore | 11 | ||||
-rw-r--r-- | AUTHORS | 1 | ||||
-rwxr-xr-x | Configure | 69 | ||||
-rwxr-xr-x | Makefile.SH | 265 | ||||
-rw-r--r-- | Porting/Glossary | 18 | ||||
-rwxr-xr-x | configpm | 201 | ||||
-rw-r--r-- | cpan/ExtUtils-MakeMaker/lib/ExtUtils/MM_Any.pm | 9 | ||||
-rw-r--r-- | cpan/ExtUtils-MakeMaker/lib/ExtUtils/MM_Unix.pm | 17 | ||||
-rw-r--r-- | make_ext.pl | 78 | ||||
-rw-r--r-- | makedef.pl | 2 | ||||
-rw-r--r-- | perl.h | 6 | ||||
-rw-r--r-- | pod/perldelta.pod | 20 | ||||
-rw-r--r-- | utils/Makefile.PL | 2 | ||||
-rw-r--r-- | win32/Makefile.ce | 144 | ||||
-rw-r--r-- | win32/ce-helpers/makedist.pl | 8 | ||||
-rw-r--r-- | write_buildcustomize.pl | 12 | ||||
-rwxr-xr-x | x2p/Makefile.SH | 2 |
17 files changed, 533 insertions, 332 deletions
diff --git a/.gitignore b/.gitignore index b6d1a0d776..54c5d10e2b 100644 --- a/.gitignore +++ b/.gitignore @@ -11,6 +11,17 @@ bug*.pl # Exists during ./Configure /UU +/host + +# Tools for cross-compile remote testing: +/Cross/from-adb-pull +/Cross/from-scp +/Cross/mkdir +/Cross/run-adb-shell +/Cross/run-ssh +/Cross/to-adb-push +/Cross/to-scp + # files produced by './configure.gnu' on a Linux machine /Makefile @@ -848,6 +848,7 @@ Nathan Trapuzzano <nbtrap@nbtrap.com> Neale Ferguson <neale@VMA.TABNSW.COM.AU> Neil Bowers <neil@bowers.com> Neil Watkiss <neil.watkiss@sophos.com> +Neil Williams <codehelp@debian.org> Nicholas Clark <nick@ccl4.org> Nicholas Oxhøj Nicholas Perez <nperez@cpan.org> @@ -214,6 +214,9 @@ targetmkdir='' targetport='' to='' usecrosscompile='' +hostperl='' +hostgenerate='' +hostosname='' extern_C='' mistrustnm='' usedevel='' @@ -2871,6 +2874,55 @@ $define|true|[yY]*) case "$croak" in y) echo "Cannot continue, aborting." >&4; exit 1 ;; esac + : compile a host miniperl and generate_uudmap, unless we got passed them + if $test "X$hostperl" = X; then + echo "Building host miniperl and generate_uudmap binaries" >&4 + before_host=`pwd` + cd .. + cd $src + src=`pwd` + test -d $src/host || mkdir $src/host + cd $src/host && rm -rf ./* + $src/Configure -des -Dusedevel -Dmksymlinks + $make miniperl + case "$hostgenerate" in + '') $make generate_uudmap + hostgenerate=$src/host/generate_uudmap + ;; + "$undef") hostgenerate='' + ;; + esac + hostperl=$src/host/miniperl + cd $before_host + fi + hostosname=`$hostperl -le 'print $^O'` + ;; +*) + usecrosscompile='undef' + ;; +esac + +: Define -Dtargethost=somecomputer to run compiled tests on another machine +case "$targethost" in + '') echo "Checking for cross-compile" >&4 + case "$usecrosscompile$multiarch" in + *$define*) echo "Skipping the try tests in the rest of Configure as no targethost was defined when cross-compiling" >&4 + if [ -f Makefile ]; then + echo " " + echo "Now you must ensure config.sh, config.h and the generated headers exist and run a $make." + else + echo "Configure done." + fi + exit 0 + ;; + *) echo "No targethost for running compiler tests against defined, running locally" >&4 + run='' + to=: + from=: + ;; + esac + ;; + *) echo "Using targethost $targethost." >&4 case "$src" in /*) run=$src/Cross/run targetmkdir=$src/Cross/mkdir @@ -2919,6 +2971,7 @@ $define|true|[yY]*) ssh|rsh) cat >$run <<EOF #!/bin/sh +env='' case "\$1" in -cwd) shift @@ -2926,13 +2979,20 @@ case "\$1" in shift ;; esac +case "\$1" in +-env) + shift + env=\$1 + shift + ;; +esac case "\$cwd" in '') cwd=$targetdir ;; esac exe=\$1 shift $to \$exe -$targetrun -p $targetport -l $targetuser $targethost "cd \$cwd && ./\$exe \$@" +$targetrun -p $targetport -l $targetuser $targethost "cd \$cwd && \$env \$exe \$@" EOF ;; *) echo "Unknown targetrun '$targetrun'" >&4 @@ -2960,11 +3020,11 @@ do case "\$f" in /*) $targetmkdir \`dirname \$f\` - $targetto -P $targetport $q \$f $targetuser@$targethost:\$f || exit 1 + $targetto -P $targetport -r $q \$f $targetuser@$targethost:\$f || exit 1 ;; *) $targetmkdir $targetdir/\`dirname \$f\` - $targetto -P $targetport $q \$f $targetuser@$targethost:$targetdir/\$f || exit 1 + $targetto -P $targetport -r $q \$f $targetuser@$targethost:$targetdir/\$f 2>/dev/null || exit 1 ;; esac done @@ -23380,6 +23440,9 @@ html1dir='$html1dir' html1direxp='$html1direxp' html3dir='$html3dir' html3direxp='$html3direxp' +hostgenerate='$hostgenerate' +hostperl='$hostperl' +hostosname='$hostosname' i16size='$i16size' i16type='$i16type' i32size='$i32size' diff --git a/Makefile.SH b/Makefile.SH index 9e55e65a0f..2bf79428de 100755 --- a/Makefile.SH +++ b/Makefile.SH @@ -20,16 +20,7 @@ case $PERL_CONFIG_SH in ;; esac -case $CROSS_NAME in -'') - Makefile=Makefile - ;; -*) - # if cross-compilation, the Makefile named accordingly - Makefile=Makefile-cross-$CROSS_NAME - . Cross/config-${CROSS_NAME}.sh - ;; -esac +Makefile=Makefile : 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. @@ -302,7 +293,12 @@ STATIC_LDFLAGS = $static_ldflags LDLIBPTH = $ldlibpth # Sometimes running an executable is an adventure. -RUN = $run +RUN = + +# When cross-compiling we want to use a (mini)perl built for the host, not the target +HOST_PERL = $hostperl +HOST_GENERATE = $hostgenerate +SYSTEM_PERL = $perl # These variables may need to be manually set for non-Unix systems. AR = $full_ar @@ -315,12 +311,28 @@ PATH_SEP = $p_ # Macros to invoke a copy of miniperl during the build. Targets which # are built using these macros should depend on \$(MINIPERL_EXE) MINIPERL_EXE = miniperl\$(EXE_EXT) -MINIPERL = \$(LDLIBPTH) \$(RUN) ./miniperl\$(EXE_EXT) -Ilib +MINIPERL = \$(LDLIBPTH) ./miniperl\$(EXE_EXT) -Ilib + +!GROK!THIS! +case "$usecrosscompile$perl" in +define?*) + $spitshell >>$Makefile <<!GROK!THIS! # Macros to invoke a copy of our fully operational perl during the build. PERL_EXE = perl\$(EXE_EXT) -RUN_PERL = \$(LDLIBPTH) \$(RUN) ./perl\$(EXE_EXT) +RUN_PERL = \$(LDLIBPTH) \$(RUN) $perl\$(EXE_EXT) +!GROK!THIS! + ;; +*) + $spitshell >>$Makefile <<!GROK!THIS! +# Macros to invoke a copy of our fully operational perl during the build. +PERL_EXE = perl\$(EXE_EXT) +RUN_PERL = \$(LDLIBPTH) \$(RUN) ./perl\$(EXE_EXT) -Ilib +!GROK!THIS! + ;; +esac +$spitshell >>$Makefile <<!GROK!THIS! # Macros to run our tests RUN_TESTS = \$(LDLIBPTH) ./runtests @@ -404,8 +416,6 @@ EOF ;; esac -case $CROSS_NAME in -'') ## In the following dollars and backticks do not need the extra backslash. $spitshell >>$Makefile <<'!NO!SUBS!' @@ -420,28 +430,6 @@ CONFIGPOD = lib/Config.pod CONFIGH = config.h !NO!SUBS! - ;; -*) - # if cross-compilation -$spitshell >>$Makefile <<!GROK!THIS! -CROSS_NAME = $CROSS_NAME -CROSS_LIB = xlib/$CROSS_NAME - -CCCMD = \`sh \$(shellflags) cflags-cross-$CROSS_NAME "optimize='\$(OPTIMIZE)'" \$@\` -I\$(CROSS_LIB) -CCCMDSRC = \`sh \$(shellflags) cflags-cross-$CROSS_NAME "optimize='\$(OPTIMIZE)'" \$<\` -I\$(CROSS_LIB) -CONFIGPM = xlib/\$(CROSS_NAME)/Config.pm -CONFIGPOD = xlib/\$(CROSS_NAME)/Config.pod -CONFIGH = xconfig.h - -xconfig.h: config_h.SH Cross/config-\$(CROSS_NAME).sh - CONFIG_SH=Cross/config-\$(CROSS_NAME).sh CONFIG_H=xconfig.h \$(SHELL) config_h.SH - #TODO \$(LDLIBPTH) ./miniperl$(EXE_EXT) -Ilib -MCross=\$(CROSS_NAME) config_h.PL "INST_VER=\$(INST_VER)" "CORE_DIR=\$(CROSS_LIB)" "CONFIG_H=xconfig.h" - cp xconfig.h \$(CROSS_LIB)/ - cp xconfig.h \$(CROSS_LIB)/config.h - -!GROK!THIS! - ;; -esac SH_to_target() { echo $@ | sed -e s/\\\.SH//g -e s/_/./g @@ -680,14 +668,46 @@ globals$(OBJ_EXT): $(generated_headers) uudmap.h mg_data.h: bitcount.h -bitcount.h: generate_uudmap$(HOST_EXE_EXT) - $(RUN) ./generate_uudmap$(HOST_EXE_EXT) $(generated_headers) - generate_uudmap$(OBJ_EXT): mg_raw.h +!NO!SUBS! + +# If hostgerenate isn't defined, then we have to build +# generate_uudmap and run it. This can potentially mean running +# it on the target system if we're cross-compiling. +# If it is defined, then we just run it locally. +case "$hostgenerate" in +'') +$spitshell >>$Makefile <<!GROK!THIS! +bitcount.h: generate_uudmap\$(HOST_EXE_EXT) + $run ./generate_uudmap\$(HOST_EXE_EXT) \$(generated_headers) + -@for f in \$(generated_headers); do \\ + $from \$\$f; \\ + done + +!GROK!THIS! + +$spitshell >>$Makefile <<'!NO!SUBS!' generate_uudmap$(HOST_EXE_EXT): generate_uudmap$(OBJ_EXT) $(CC) -o generate_uudmap$(EXE_EXT) $(LDFLAGS) generate_uudmap$(OBJ_EXT) $(libs) +!NO!SUBS! +;; +*) +$spitshell >>$Makefile <<'!NO!SUBS!' +bitcount.h: generate_uudmap$(HOST_EXE_EXT) + ./generate_uudmap$(HOST_EXE_EXT) $(generated_headers) + +generate_uudmap$(HOST_EXE_EXT): generate_uudmap$(OBJ_EXT) + -@rm generate_uudmap$(HOST_EXE_EXT) + $(LNS) $(HOST_GENERATE) generate_uudmap$(HOST_EXE_EXT) + +!NO!SUBS! +;; +esac + + +$spitshell >>$Makefile <<'!NO!SUBS!' perlmain.c: $(MINIPERL_EXE) ext/ExtUtils-Miniperl/pm_to_blib $(MINIPERL) -Ilib -MExtUtils::Miniperl -e 'writemain(\"perlmain.c", @ARGV)' DynaLoader $(static_ext) @@ -866,7 +886,7 @@ $(MINIPERL_EXE): lib/buildcustomize.pl $spitshell >>$Makefile <<'!NO!SUBS!' lib/buildcustomize.pl: $& $(mini_obj) $(CC) -o $(MINIPERL_EXE) $(CLDFLAGS) $(mini_obj) $(libs) - $(LDLIBPTH) $(RUN) ./miniperl$(HOST_EXE_EXT) -w -Ilib -Idist/Exporter/lib -MExporter -e '<?>' || sh -c 'echo >&2 Failed to build miniperl. Please run make minitest; exit 1' + $(LDLIBPTH) ./miniperl$(HOST_EXE_EXT) -w -Ilib -Idist/Exporter/lib -MExporter -e '<?>' || sh -c 'echo >&2 Failed to build miniperl. Please run make minitest; exit 1' $(MINIPERL) -f write_buildcustomize.pl !NO!SUBS! ;; @@ -874,7 +894,7 @@ lib/buildcustomize.pl: $& $(mini_obj) $spitshell >>$Makefile <<'!NO!SUBS!' lib/buildcustomize.pl: $& $(mini_obj) write ldcustomize.pl $(CC) -o $(MINIPERL_EXE) $(mini_obj libs) - $(LDLIBPTH) $(RUN) ./miniperl$(HOST _EXT) -w -Ilib -Idist/Exporter/lib -MExporter -e '<?>' || sh -c 'echo >&2 Failed to build miniperl. Please run make minitest; exit 1' + $(LDLIBPTH) ./miniperl$(HOST _EXT) -w -Ilib -Idist/Exporter/lib -MExporter -e '<?>' || sh -c 'echo >&2 Failed to build miniperl. Please run make minitest; exit 1' $(MINIPERL) -f write_buildcustomize.pl !NO!SUBS! ;; @@ -896,19 +916,30 @@ lib/buildcustomize.pl: $& $(mini_obj) write_buildcustomize.pl -@rm -f miniperl.xok $(CC) $(CLDFLAGS) $(NAMESPACEFLAGS) -o $(MINIPERL_EXE) \ $(mini_obj) $(libs) - $(LDLIBPTH) $(RUN) ./miniperl$(HOST_EXE_EXT) -w -Ilib -Idist/Exporter/lib -MExporter -e '<?>' || sh -c 'echo >&2 Failed to build miniperl. Please run make minitest; exit 1' + $(LDLIBPTH) ./miniperl$(HOST_EXE_EXT) -w -Ilib -Idist/Exporter/lib -MExporter -e '<?>' || sh -c 'echo >&2 Failed to build miniperl. Please run make minitest; exit 1' $(MINIPERL) -f write_buildcustomize.pl !NO!SUBS! ;; *) - $spitshell >>$Makefile <<'!NO!SUBS!' + if test "X$hostperl" != X; then + $spitshell >>$Makefile <<!GROK!THIS! +lib/buildcustomize.pl: \$& \$(mini_obj) write_buildcustomize.pl + -@rm -f miniperl.xok + -@rm \$(MINIPERL_EXE) + \$(LNS) \$(HOST_PERL) \$(MINIPERL_EXE) + \$(LDLIBPTH) ./miniperl\$(HOST_EXE_EXT) -w -Ilib -Idist/Exporter/lib -MExporter -e '<?>' || sh -c 'echo >&2 Failed to build miniperl. Please run make minitest; exit 1' + \$(MINIPERL) -f write_buildcustomize.pl 'osname' "$osname" +!GROK!THIS! + else + $spitshell >>$Makefile <<'!NO!SUBS!' lib/buildcustomize.pl: $& $(mini_obj) write_buildcustomize.pl -@rm -f miniperl.xok $(CC) $(CLDFLAGS) -o $(MINIPERL_EXE) \ $(mini_obj) $(libs) - $(LDLIBPTH) $(RUN) ./miniperl$(HOST_EXE_EXT) -w -Ilib -Idist/Exporter/lib -MExporter -e '<?>' || sh -c 'echo >&2 Failed to build miniperl. Please run make minitest; exit 1' + $(LDLIBPTH) ./miniperl$(HOST_EXE_EXT) -w -Ilib -Idist/Exporter/lib -MExporter -e '<?>' || sh -c 'echo >&2 Failed to build miniperl. Please run make minitest; exit 1' $(MINIPERL) -f write_buildcustomize.pl !NO!SUBS! + fi ;; esac @@ -975,7 +1006,7 @@ uni.data: $(MINIPERL_EXE) $(CONFIGPM) lib/unicore/mktables $(nonxs_ext) # But also this ensures that all extensions are built before we try to scan # them, which picks up Devel::PPPort's documentation. pod/perltoc.pod: $(perltoc_pod_prereqs) $(PERL_EXE) $(ext) pod/buildtoc - $(RUN_PERL) -f -Ilib pod/buildtoc -q + $(RUN_PERL) -f pod/buildtoc -q pod/perlapi.pod: pod/perlintern.pod @@ -999,13 +1030,13 @@ extra.pods: $(MINIPERL_EXE) done extras.make: $(PERL_EXE) - -@test ! -s extras.lst || PATH="`pwd`:${PATH}" PERL5LIB="`pwd`/lib" $(RUN_PERL) -Ilib -MCPAN -e '@ARGV&&make(@ARGV)' `cat extras.lst` + -@test ! -s extras.lst || PATH="`pwd`:${PATH}" PERL5LIB="`pwd`/lib" $(RUN_PERL) -MCPAN -e '@ARGV&&make(@ARGV)' `cat extras.lst` extras.test: $(PERL_EXE) - -@test ! -s extras.lst || PATH="`pwd`:${PATH}" PERL5LIB="`pwd`/lib" $(RUN_PERL) -Ilib -MCPAN -e '@ARGV&&test(@ARGV)' `cat extras.lst` + -@test ! -s extras.lst || PATH="`pwd`:${PATH}" PERL5LIB="`pwd`/lib" $(RUN_PERL) -MCPAN -e '@ARGV&&test(@ARGV)' `cat extras.lst` extras.install: $(PERL_EXE) - -@test ! -s extras.lst || PATH="`pwd`:${PATH}" PERL5LIB="`pwd`/lib" $(RUN_PERL) -Ilib -MCPAN -e '@ARGV&&install(@ARGV)' `cat extras.lst` + -@test ! -s extras.lst || PATH="`pwd`:${PATH}" PERL5LIB="`pwd`/lib" $(RUN_PERL) -MCPAN -e '@ARGV&&install(@ARGV)' `cat extras.lst` .PHONY: install install-strip install-all install-verbose install-silent \ no-install install.perl install.man install.html @@ -1018,20 +1049,52 @@ no_install no-install: install-notify install: install-all !NO!SUBS! + for name in all notify silent strip verbose; do flags="--$name"; - $spitshell >>$Makefile <<EOT + if test "X$hostperl" != X; then + $spitshell >>$Makefile <<EOT + +install_$name install-$name: \$(INSTALL_DEPENDENCE) installperl all installman + \$(HOST_PERL) installperl --destdir=\$(DESTDIR) ${flags%--all} \$(INSTALLFLAGS) \$(STRIPFLAGS) + \$(HOST_PERL) installman --destdir=\$(DESTDIR) ${flags%--all} +EOT + else + $spitshell >>$Makefile <<EOT install_$name install-$name: \$(INSTALL_DEPENDENCE) installperl all installman \$(RUN_PERL) installperl --destdir=\$(DESTDIR) ${flags%--all} \$(INSTALLFLAGS) \$(STRIPFLAGS) \$(RUN_PERL) installman --destdir=\$(DESTDIR) ${flags%--all} EOT + fi test $name = notify || echo ' -@test ! -s extras.lst || PATH="`pwd`:${PATH}" PERL5LIB="`pwd`/lib" $(RUN_PERL) -Ilib -MCPAN -e '\''@ARGV&&install(@ARGV)'\'' `cat extras.lst`' >>$Makefile done -$spitshell >>$Makefile <<'!NO!SUBS!' +if test "X$hostperl" != X; then + $spitshell >>$Makefile <<'!NO!SUBS!' +install.perl: $(INSTALL_DEPENDENCE) installperl + $(HOST_PERL) installperl --destdir=$(DESTDIR) $(INSTALLFLAGS) $(STRIPFLAGS) + -@test ! -s extras.lst || $(MAKE) extras.install +install.man: all installman + $(HOST_PERL) installman --destdir=$(DESTDIR) $(INSTALLFLAGS) + +# XXX Experimental. Hardwired values, but useful for testing. +# Eventually Configure could ask for some of these values. +install.html: all installhtml + -@test -f README.vms && cd vms && $(LNS) ../README.vms README_vms.pod && cd .. + $(HOST_PERL) installhtml \ + --podroot=. --podpath=. --recurse \ + --htmldir=$(privlib)/html \ + --htmlroot=$(privlib)/html \ + --splithead=pod/perlipc \ + --splititem=pod/perlfunc \ + --ignore=Porting/Maintainers.pm,Porting/pumpkin.pod,Porting/repository.pod \ + --verbose +!NO!SUBS! +else + $spitshell >>$Makefile <<'!NO!SUBS!' install.perl: $(INSTALL_DEPENDENCE) installperl $(RUN_PERL) installperl --destdir=$(DESTDIR) $(INSTALLFLAGS) $(STRIPFLAGS) -@test ! -s extras.lst || PATH="`pwd`:\${PATH}" PERL5LIB="`pwd`/lib" \$(RUN_PERL) -Ilib -MCPAN -e '@ARGV&&install(@ARGV)' `cat extras.lst` @@ -1051,7 +1114,10 @@ install.html: all installhtml --splititem=pod/perlfunc \ --ignore=Porting/Maintainers.pm,Porting/pumpkin.pod,Porting/repository.pod \ --verbose +!NO!SUBS! +fi +$spitshell >>$Makefile <<'!NO!SUBS!' # I now supply perly.c with the kits, so the following section is # used only if you force bison to run by saying @@ -1112,10 +1178,10 @@ regen_headers regen-headers: FORCE regen_meta regen-meta: META.yml META.json META.yml: FORCE - PATH="`pwd`:${PATH}" PERL5LIB="`pwd`/lib" $(RUN_PERL) -Ilib Porting/makemeta -y + PATH="`pwd`:${PATH}" PERL5LIB="`pwd`/lib" $(RUN_PERL) Porting/makemeta -y META.json: FORCE - PATH="`pwd`:${PATH}" PERL5LIB="`pwd`/lib" $(RUN_PERL) -Ilib Porting/makemeta -j + PATH="`pwd`:${PATH}" PERL5LIB="`pwd`/lib" $(RUN_PERL) Porting/makemeta -j regen_all regen-all: regen regen_meta @@ -1160,7 +1226,7 @@ $spitshell >>$Makefile <<'!NO!SUBS!' .PHONY: printconfig printconfig: - @eval `$(RUN_PERL) -Ilib -V:$(CONFIGVAR)`; echo $$$(CONFIGVAR) + @eval `$(RUN_PERL) -V:$(CONFIGVAR)`; echo $$$(CONFIGVAR) .PHONY: clean _tidy _mopup _cleaner1 _cleaner2 \ realclean _realcleaner clobber _clobber \ @@ -1172,7 +1238,8 @@ realclean: _realcleaner _mopup @echo "Note that '$(MAKE) realclean' does not delete config.sh or Policy.sh" _clobber: - -@rm -f Cross/run-* Cross/to-* Cross/from-* + -@rm -f Cross/run-* Cross/to-* Cross/from-* Cross/mkdir + -rm -rf host rm -f t/test_state rm -f config.sh cppstdin Policy.sh extras.lst @@ -1337,19 +1404,91 @@ _test: # Architecture-neutral stuff: test_prep_pre: preplibrary utilities $(nonxs_ext) +!NO!SUBS! +case "$targethost" in +'') $spitshell >>$Makefile <<'!NO!SUBS!' test_prep test-prep: test_prep_pre $(MINIPERL_EXE) $(unidatafiles) $(PERL_EXE) \ $(dynamic_ext) $(TEST_PERL_DLL) runtests x2p/s2p x2p/find2perl \ $(generated_pods) cd t && (rm -f $(PERL_EXE); $(LNS) ../$(PERL_EXE) $(PERL_EXE)) +!NO!SUBS! +;; +*) $spitshell >>$Makefile <<!GROK!THIS! +test_prep test-prep: test_prep_pre \$(MINIPERL_EXE) \$(unidatafiles) \$(PERL_EXE) \ + \$(dynamic_ext) \$(TEST_PERL_DLL) runtests x2p/s2p x2p/find2perl \ + \$(generated_pods) + $to libperl.* + $to t/* + $to lib/* + $to TestInit.pm + $to win32/FindExt.pm + $to regen/* + $to pod/* + $to MANIFEST + $to Porting/* + $to cpan/*/t + $to dist/*/t + $to ext/*/t + $to cpan/Term-Cap/test.pl + $to cpan/Pod-Usage/* + $to cpan/Pod-Parser/* + $to cpan/IO-Compress/* + $to cpan/HTTP-Tiny/lib/* + $to cpan/Filter-Util-Call/filter-util.pl + $to cpan/Digest-MD5/* + $to cpan/Digest-SHA/* + $to cpan/Test-Simple/* + $to cpan/Pod-Parser/lib/* + $to cpan/Test-Harness/* + $to cpan/Scalar-List-Utils/* + $to ext/IPC-Open3/* + $to ext/Tie-Memoize/* + $to ext/POSIX/* + $to dist/IO/* +# --- These three are needed by ExtUtils::MM_Unix to verify PERL_CORE + $to config_h.SH + $to perl.h + $to cflags +# --- For Module::Build + $to cpan/Module-Build/lib/* + $to *.h +# --- For t/x2p/s2p.t + $to x2p +# --- For lib/diagnostics.t with -Duseshrplib + $to \$(PERL_EXE) + cd t && (rm -f \$(PERL_EXE); \$(LNS) ../\$(PERL_EXE) \$(PERL_EXE)) && cd .. + $to t/\$(PERL_EXE) + +!GROK!THIS! +;; +esac + +$spitshell >>$Makefile <<'!NO!SUBS!' test_prep_reonly: $(MINIPERL_EXE) $(PERL_EXE) $(dynamic_ext_re) $(TEST_PERL_DLL) $(MINIPERL) make_ext.pl $(dynamic_ext_re) MAKE=$(MAKE) LIBPERL_A=$(LIBPERL) LINKTYPE=dynamic cd t && (rm -f $(PERL_EXE); $(LNS) ../$(PERL_EXE) $(PERL_EXE)) +!NO!SUBS! + +case "$targethost" in +'') $spitshell >>$Makefile <<'!NO!SUBS!' test check: test_prep $(RUN_TESTS) choose +!NO!SUBS! +;; +*) $spitshell >>$Makefile <<!GROK!THIS! + +test check: test_prep + $run -cwd $targetdir/t -env LD_LIBRARY_PATH=$targetdir:$targetdir/lib:$targetdir/lib/auto ./TEST + +!GROK!THIS! +;; +esac + +$spitshell >>$Makefile <<'!NO!SUBS!' test_tty test-tty: test_prep $(RUN_TESTS) tty @@ -1412,28 +1551,28 @@ test_porting test-porting: test_prep .PHONY: ok okfile oknack okfilenack nok nokfile noknack nokfilenack ok: utilities - $(RUN_PERL) -Ilib utils/perlbug -ok -s '(UNINSTALLED)' + $(RUN_PERL) utils/perlbug -ok -s '(UNINSTALLED)' okfile: utilities - $(RUN_PERL) -Ilib utils/perlbug -ok -s '(UNINSTALLED)' -F perl.ok + $(RUN_PERL) utils/perlbug -ok -s '(UNINSTALLED)' -F perl.ok oknack: utilities - $(RUN_PERL) -Ilib utils/perlbug -ok -s '(UNINSTALLED)' -A + $(RUN_PERL) utils/perlbug -ok -s '(UNINSTALLED)' -A okfilenack: utilities - $(RUN_PERL) -Ilib utils/perlbug -ok -s '(UNINSTALLED)' -F perl.ok -A + $(RUN_PERL) utils/perlbug -ok -s '(UNINSTALLED)' -F perl.ok -A nok: utilities - $(RUN_PERL) -Ilib utils/perlbug -nok -s '(UNINSTALLED)' + $(RUN_PERL) utils/perlbug -nok -s '(UNINSTALLED)' nokfile: utilities - $(RUN_PERL) -Ilib utils/perlbug -nok -s '(UNINSTALLED)' -F perl.nok + $(RUN_PERL) utils/perlbug -nok -s '(UNINSTALLED)' -F perl.nok noknack: utilities - $(RUN_PERL) -Ilib utils/perlbug -nok -s '(UNINSTALLED)' -A + $(RUN_PERL) utils/perlbug -nok -s '(UNINSTALLED)' -A nokfilenack: utilities - $(RUN_PERL) -Ilib utils/perlbug -nok -s '(UNINSTALLED)' -F perl.nok -A + $(RUN_PERL) utils/perlbug -nok -s '(UNINSTALLED)' -F perl.nok -A .PHONY: clist hlist diff --git a/Porting/Glossary b/Porting/Glossary index 7f649a868e..e761380e7d 100644 --- a/Porting/Glossary +++ b/Porting/Glossary @@ -2945,6 +2945,24 @@ hint (Oldconfig.U): Gives the type of hints used for previous answers. May be one of "default", "recommended" or "previous". +hostperl (Cross.U) + This variable contains the path to a miniperl binary that can be + run on the host OS when cross-compiling. Useful and available only + during Perl build. + Empty string '' if not cross-compiling. + +hostgenerate (Cross.U) + This variable contains the path to a generate_uudmap binary that + can be run on the host OS when cross-compiling. Useful and + available only during Perl build. + Empty string '' if not cross-compiling. + +hostosname (Cross.U) + This variable contains the original value of '$^O' for hostperl + when cross-compiling. This is useful to pick the proper tools + when running build code in the host. + Empty string '' if not cross-compiling. + hostcat (nis.U): This variable contains a command that produces the text of the /etc/hosts file. This is normally "cat /etc/hosts", but can be @@ -11,7 +11,6 @@ # lib/Config.pm # lib/Config_heavy.pl # lib/Config.pod -# lib/Cross.pm (optionally) # # # from the contents of the static files @@ -23,7 +22,6 @@ # # config.sh # -# Note that output directory is xlib/[cross-name]/ for cross-compiling # # It will only update Config.pm and Config_heavy.pl if the contents of # either file would be different. Note that *both* files are updated in @@ -32,7 +30,6 @@ sub usage { die <<EOF } usage: $0 [ options ] - --cross=PLATFORM cross-compile for a different platform --no-glossary don't include Porting/Glossary in lib/Config.pod --chdir=dir change directory before writing files EOF @@ -92,7 +89,6 @@ $header_files =~ s/(?=.{64}) # If line is still overlength # allowed opts as well as specifies default and initial values my %Allowed_Opts = ( - 'cross' => '', # --cross=PLATFORM - crosscompiling for PLATFORM 'glossary' => 1, # --no-glossary - no glossary file inclusion, # for compactness 'chdir' => '', # --chdir=dir - change directory before writing files @@ -128,19 +124,10 @@ if ($Opts{chdir}) { my ($Config_SH, $Config_PM, $Config_heavy, $Config_POD); my $Glossary = 'Porting/Glossary'; -if ($Opts{cross}) { - # creating cross-platform config file - mkdir "xlib"; - mkdir "xlib/$Opts{cross}"; - $Config_PM = "xlib/$Opts{cross}/Config.pm"; - $Config_POD = "xlib/$Opts{cross}/Config.pod"; - $Config_SH = "Cross/config-$Opts{cross}.sh"; -} -else { - $Config_PM = "lib/Config.pm"; - $Config_POD = "lib/Config.pod"; - $Config_SH = "config.sh"; -} +$Config_PM = "lib/Config.pm"; +$Config_POD = "lib/Config.pod"; +$Config_SH = "config.sh"; + ($Config_heavy = $Config_PM) =~ s/\.pm$/_heavy.pl/; die "Can't automatically determine name for Config_heavy.pl from '$Config_PM'" if $Config_heavy eq $Config_PM; @@ -148,76 +135,6 @@ die "Can't automatically determine name for Config_heavy.pl from '$Config_PM'" my $config_txt; my $heavy_txt; -my $from = $^O eq 'VMS' ? 'PERLSHR image' : 'binary (from libperl)'; -my $env_cygwin = $^O eq 'cygwin' - ? 'push @env, "CYGWIN=\"$ENV{CYGWIN}\"" if $ENV{CYGWIN};' . "\n" : ""; -$heavy_txt .= sprintf <<'ENDOFBEG', $^O, $^O, $from, $^O, $env_cygwin; -# This file was created by configpm when Perl was built. Any changes -# made to this file will be lost the next time perl is built. - -package Config; -use strict; -use warnings; -use vars '%%Config'; - -sub bincompat_options { - return split ' ', (Internals::V())[0]; -} - -sub non_bincompat_options { - return split ' ', (Internals::V())[1]; -} - -sub compile_date { - return (Internals::V())[2] -} - -sub local_patches { - my (undef, undef, undef, @patches) = Internals::V(); - return @patches; -} - -sub _V { - die "Perl lib was built for '%s' but is being run on '$^O'" - unless "%s" eq $^O; - - my ($bincompat, $non_bincompat, $date, @patches) = Internals::V(); - - my $opts = join ' ', sort split ' ', "$bincompat $non_bincompat"; - - # wrap at 76 columns. - - $opts =~ s/(?=.{53})(.{1,53}) /$1\n /mg; - - print Config::myconfig(); - print "\nCharacteristics of this %s: \n"; - - print " Compile-time options: $opts\n"; - - if (@patches) { - print " Locally applied patches:\n"; - print "\t$_\n" foreach @patches; - } - - print " Built under %s\n"; - - print " $date\n" if defined $date; - - my @env = map { "$_=\"$ENV{$_}\"" } sort grep {/^PERL/} keys %%ENV; -%s - if (@env) { - print " \%%ENV:\n"; - print " $_\n" foreach @env; - } - print " \@INC:\n"; - print " $_\n" foreach @INC; -} - -sub header_files { -ENDOFBEG - -$heavy_txt .= $header_files . "\n}\n\n"; - my $export_funcs = <<'EOT'; my %Export_Cache = (myconfig => 1, config_sh => 1, config_vars => 1, config_re => 1, compile_date => 1, local_patches => 1, @@ -524,6 +441,78 @@ sub relocate_inc { } EOT +my $osname = fetch_string({}, 'osname'); +my $from = $osname eq 'VMS' ? 'PERLSHR image' : 'binary (from libperl)'; +my $env_cygwin = $osname eq 'cygwin' + ? 'push @env, "CYGWIN=\"$ENV{CYGWIN}\"" if $ENV{CYGWIN};' . "\n" : ""; + +$heavy_txt .= sprintf <<'ENDOFBEG', $osname, $osname, $from, $osname, $env_cygwin; +# This file was created by configpm when Perl was built. Any changes +# made to this file will be lost the next time perl is built. + +package Config; +use strict; +use warnings; +use vars '%%Config'; + +sub bincompat_options { + return split ' ', (Internals::V())[0]; +} + +sub non_bincompat_options { + return split ' ', (Internals::V())[1]; +} + +sub compile_date { + return (Internals::V())[2] +} + +sub local_patches { + my (undef, undef, undef, @patches) = Internals::V(); + return @patches; +} + +sub _V { + die "Perl lib was built for '%s' but is being run on '$^O'" + unless "%s" eq $^O; + + my ($bincompat, $non_bincompat, $date, @patches) = Internals::V(); + + my $opts = join ' ', sort split ' ', "$bincompat $non_bincompat"; + + # wrap at 76 columns. + + $opts =~ s/(?=.{53})(.{1,53}) /$1\n /mg; + + print Config::myconfig(); + print "\nCharacteristics of this %s: \n"; + + print " Compile-time options: $opts\n"; + + if (@patches) { + print " Locally applied patches:\n"; + print "\t$_\n" foreach @patches; + } + + print " Built under %s\n"; + + print " $date\n" if defined $date; + + my @env = map { "$_=\"$ENV{$_}\"" } sort grep {/^PERL/} keys %%ENV; +%s + if (@env) { + print " \%%ENV:\n"; + print " $_\n" foreach @env; + } + print " \@INC:\n"; + print " $_\n" foreach @INC; +} + +sub header_files { +ENDOFBEG + +$heavy_txt .= $header_files . "\n}\n\n"; + if (%need_relocation) { my $relocations_in_common; # otherlibdirs only features in the hash @@ -1101,46 +1090,8 @@ if ($orig_config_txt ne $config_txt or $orig_heavy_txt ne $heavy_txt) { print "updated $Config_heavy\n"; } - -# Now create Cross.pm if needed -if ($Opts{cross}) { - open CROSS, ">lib/Cross.pm" or die "Can not open >lib/Cross.pm: $!"; - my $cross = <<'EOS'; -# typical invocation: -# perl -MCross Makefile.PL -# perl -MCross=wince -V:cc -package Cross; - -sub import { - my ($package,$platform) = @_; - unless (defined $platform) { - # if $platform is not specified, then use last one when - # 'configpm; was invoked with --cross option - $platform = '***replace-marker***'; - } - #a Perl debugger can load a bunch of modules before -MCross with PERL5DB env - #var, stopping a cross compile Config.pm from being loaded because the native - #Config.pm was already use'd - if(exists $INC{'Config.pm'}) { - warn "Cross.pm found Config.pm is already loaded, reload required, will delete from %INC"; - delete $INC{'Config.pm'}; - } - @INC = map {/\blib\b/?(do{local $_=$_;s/\blib\b/xlib\/$platform/;$_},$_):($_)} @INC; - $::Cross::platform = $platform; -} - -1; -EOS - $cross =~ s/\*\*\*replace-marker\*\*\*/$Opts{cross}/g; - print CROSS $cross; - close CROSS; - print "written lib/Cross.pm\n"; - unshift(@INC,"xlib/$Opts{cross}"); -} - # Now do some simple tests on the Config.pm file we have created unshift(@INC,'lib'); -unshift(@INC,'xlib/symbian') if $Opts{cross}; require $Config_PM; require $Config_heavy; import Config; diff --git a/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MM_Any.pm b/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MM_Any.pm index a185b42495..be18560f06 100644 --- a/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MM_Any.pm +++ b/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MM_Any.pm @@ -1633,14 +1633,7 @@ sub init_INST { # you to build directly into, say $Config{privlibexp}. unless ($self->{INST_LIB}){ if ($self->{PERL_CORE}) { - if (defined $Cross::platform) { - $self->{INST_LIB} = $self->{INST_ARCHLIB} = - $self->catdir($self->{PERL_LIB},"..","xlib", - $Cross::platform); - } - else { - $self->{INST_LIB} = $self->{INST_ARCHLIB} = $self->{PERL_LIB}; - } + $self->{INST_LIB} = $self->{INST_ARCHLIB} = $self->{PERL_LIB}; } else { $self->{INST_LIB} = $self->catdir($Curdir,"blib","lib"); } diff --git a/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MM_Unix.pm b/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MM_Unix.pm index 72d04fbb62..ec8d48edb1 100644 --- a/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MM_Unix.pm +++ b/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MM_Unix.pm @@ -1039,8 +1039,6 @@ WARNING print "Executing $abs\n" if ($trace >= 2); my $version_check = qq{$abs -le "require $ver; print qq{VER_OK}"}; - $version_check = "$Config{run} $version_check" - if defined $Config{run} and length $Config{run}; # To avoid using the unportable 2>&1 to suppress STDERR, # we close it before running the command. @@ -1637,18 +1635,9 @@ sub init_main { if ($self->{PERL_SRC}){ $self->{PERL_LIB} ||= $self->catdir("$self->{PERL_SRC}","lib"); - if (defined $Cross::platform) { - $self->{PERL_ARCHLIB} = - $self->catdir("$self->{PERL_SRC}","xlib",$Cross::platform); - $self->{PERL_INC} = - $self->catdir("$self->{PERL_SRC}","xlib",$Cross::platform, - $Is{Win32}?("CORE"):()); - } - else { - $self->{PERL_ARCHLIB} = $self->{PERL_LIB}; - $self->{PERL_INC} = ($Is{Win32}) ? - $self->catdir($self->{PERL_LIB},"CORE") : $self->{PERL_SRC}; - } + $self->{PERL_ARCHLIB} = $self->{PERL_LIB}; + $self->{PERL_INC} = ($Is{Win32}) ? + $self->catdir($self->{PERL_LIB},"CORE") : $self->{PERL_SRC}; # catch a situation that has occurred a few times in the past: unless ( diff --git a/make_ext.pl b/make_ext.pl index 885322f442..98ed3cc6e1 100644 --- a/make_ext.pl +++ b/make_ext.pl @@ -1,8 +1,8 @@ #!./miniperl use strict; use warnings; -use constant IS_CROSS => defined $::Cross::platform ? 1 : 0; use Config; +use constant IS_CROSS => defined $Config::Config{usecrosscompile} ? 1 : 0; my $is_Win32 = $^O eq 'MSWin32'; my $is_VMS = $^O eq 'VMS'; @@ -120,9 +120,6 @@ unless(defined $makecmd and $makecmd =~ /^MAKE=(.*)$/) { # names, but neither did what it replaced. Once there is a use case that needs # it, please supply patches. Until then, I'm sticking to KISS my @make = split ' ', $1 || $Config{make} || $ENV{MAKE}; -# Using an array of 0 or 1 elements makes the subsequent code simpler. -my @run = $Config{run}; -@run = () if not defined $run[0] or $run[0] eq ''; if ($target eq '') { @@ -313,31 +310,32 @@ sub build_extension { } } } - if(IS_CROSS){ - seek($mfh, 0, 0) or die "Cannot seek $makefile: $!"; - while (<$mfh>) { - #this is used to stop the while loop early for efficiency when - #the line is reached, and possibly match a cross build - my $header = quotemeta '# These definitions are from config.sh (via '; - if(/^$header.+? - (xlib[\/\\] - $::Cross::platform\Q\/Config.pm\E)?\)\./x) { - unless (defined $1){ - print "Deleting non-Cross makefile\n"; - close $mfh or die "close $makefile: $!"; - _unlink($makefile); - { - no warnings 'deprecated'; - goto NO_MAKEFILE; - } - } else { #have a cross makefile - goto CROSS_OK_MF; - } - } - } #catch breakage from future changes - die "non-standard makefile found in $mname"; - CROSS_OK_MF: - } + + if (IS_CROSS) { + # If we're cross-compiling, it's possible that the host's + # Makefiles are around. + seek($mfh, 0, 0) or die "Cannot seek $makefile: $!"; + + my $cross_makefile; + while (<$mfh>) { + # XXX This might not be throughout enough. + # For example, it's possible to cause a false-positive + # if cross compiling on and for the Raspberry Pi, + # which is insane but plausible. + # False positives are really not troublesome, though; + # all they mean is that the module gets rebuilt. + if (/^CC = \Q$Config{cc}\E/) { + $cross_makefile = 1; + last; + } + } + + if (!$cross_makefile) { + print "Deleting non-Cross makefile\n"; + close $mfh or die "close $makefile: $!"; + _unlink($makefile); + } + } } if (!-f $makefile) { @@ -444,17 +442,7 @@ EOM } print "\nRunning Makefile.PL in $ext_dir\n"; - # Presumably this can be simplified - my @cross; - if (IS_CROSS) { - # Inherited from win32/buildext.pl - @cross = "-MCross=$::Cross::platform"; - } elsif ($opts{cross}) { - # Inherited from make_ext.pl - @cross = '-MCross'; - } - - my @args = ("-I$lib_dir", @cross, 'Makefile.PL'); + my @args = ("-I$lib_dir", 'Makefile.PL'); if ($is_VMS) { my $libd = VMS::Filespec::vmspath($lib_dir); push @args, "INST_LIB=$libd", "INST_ARCHLIB=$libd"; @@ -464,8 +452,8 @@ EOM } push @args, @$pass_through; _quote_args(\@args) if $is_VMS; - print join(' ', @run, $perl, @args), "\n"; - my $code = system @run, $perl, @args; + print join(' ', $perl, @args), "\n"; + my $code = system $perl, @args; warn "$code from $ext_dir\'s Makefile.PL" if $code; # Right. The reason for this little hack is that we're sitting inside @@ -521,11 +509,11 @@ EOS # Give makefile an opportunity to rewrite itself. # reassure users that life goes on... my @args = ('config', @$pass_through); - system(@run, @make, @args) and print "@run @make @args failed, continuing anyway...\n"; + system(@make, @args) and print "@make @args failed, continuing anyway...\n"; } my @targ = ($target, @$pass_through); - print "Making $target in $ext_dir\n@run @make @targ\n"; - my $code = system(@run, @make, @targ); + print "Making $target in $ext_dir\n@make @targ\n"; + my $code = system(@make, @targ); die "Unsuccessful make($ext_dir): code=$code" if $code != 0; chdir $return_dir || die "Cannot cd to $return_dir: $!"; diff --git a/makedef.pl b/makedef.pl index c97fdc46db..27f71ff19c 100644 --- a/makedef.pl +++ b/makedef.pl @@ -104,7 +104,7 @@ my %exportperlmalloc = my $exportperlmalloc = $ARGS{PLATFORM} eq 'os2'; -my $config_h = $ARGS{PLATFORM} eq 'wince' ? 'xconfig.h' : 'config.h'; +my $config_h = 'config.h'; open(CFG, '<', $config_h) || die "Cannot open $config_h: $!\n"; while (<CFG>) { $define{$1} = 1 if /^\s*\#\s*define\s+(MYMALLOC|MULTIPLICITY @@ -25,11 +25,7 @@ #ifdef PERL_MICRO # include "uconfig.h" #else -# ifndef USE_CROSS_COMPILE -# include "config.h" -# else -# include "xconfig.h" -# endif +# include "config.h" #endif /* See L<perlguts/"The Perl API"> for detailed notes on diff --git a/pod/perldelta.pod b/pod/perldelta.pod index e9db1bf944..95478f9634 100644 --- a/pod/perldelta.pod +++ b/pod/perldelta.pod @@ -243,7 +243,25 @@ L</Platform Support> section, instead. =item * -XXX +The cross-compilation model has been renovated. +There's several new options, and some backwards-incompatible changes: + +We now build binaries for miniperl and generate_uudmap to be used on the host, rather than running +every miniperl call on the target; this means that, short of 'make test', +we no longer need access to the target system once Configure is done. +You can provide already-built binaries through the C<hostperl> and +C<hostgenerate> options to Configure. + +Additionally, if targeting an EBCDIC platform from an ASCII host, +or viceversa, you'll need to run Configure with C<-Uhostgenerate>, to +indicate that generate_uudmap should be run on the target. + +Finally, there's also a way of having Configure end early, right after +building the host binaries, by cross-compiling without specifying a +C<targethost>. + +The incompatible changes include no longer using xconfig.h, xlib, or +Cross.pm, so canned config files and Makefiles will have to be updated. =back diff --git a/utils/Makefile.PL b/utils/Makefile.PL index c5e3694b8a..8e461d41eb 100644 --- a/utils/Makefile.PL +++ b/utils/Makefile.PL @@ -26,7 +26,7 @@ my $perl = defined $Config{usedl} ? '../miniperl' : '../perl'; print $fh <<"EOT"; PERL = $perl REALPERL = ../perl -RUN = $Config{run} # Used mainly cross-compilation setups. +RUN = # Used mainly cross-compilation setups. EOT diff --git a/win32/Makefile.ce b/win32/Makefile.ce index bdaeef5f48..b8fd8cb6d4 100644 --- a/win32/Makefile.ce +++ b/win32/Makefile.ce @@ -497,7 +497,6 @@ PROCESSOR_ARCHITECTURE = $(TARGETCPU) ARCHNAME = $(PLATFORM)-$(OSVERSION)-$(PROCESSOR_ARCHITECTURE) ARCHDIR = ..\lib\$(ARCHNAME) COREDIR = ..\lib\CORE -XCOREDIR = ..\xlib\$(CROSS_NAME)\CORE AUTODIR = ..\lib\auto LIBDIR = ..\lib EXTDIR = ..\ext @@ -582,14 +581,20 @@ $(o).dll: $(RSC) -i.. $< # This must be relative to ../lib/CORE, else the ext dll build fails... -PERLIMPLIB_EXP = ..\..\..\xlib\$(CROSS_NAME)\CORE\perl$(PV).lib +PERLIMPLIB_EXP = perl$(PV).lib PERLIMPLIB = $(PERLCEDIR)\$(MACHINE)\perl$(PV).lib PERLDLL = $(MACHINE)\perl$(PV).dll DLLDIR = $(MACHINE)\dll PERLEXE = $(MACHINE)\perl.exe -CONFIGPM = ..\xlib\$(CROSS_NAME)\Config.pm +CONFIGPM = ..\lib\Config.pm ..\lib\Config_heavy.pl +GENUUDMAP = ..\generate_uudmap.exe + +UUDMAP_H = ..\uudmap.h +BITCOUNT_H = ..\bitcount.h +MG_DATA_H = ..\mg_data.h +GENERATED_HEADERS = $(UUDMAP_H) $(BITCOUNT_H) $(MG_DATA_H) # Unicode data files generated by mktables FIRSTUNIFILE = ..\lib\unicore\Decomposition.pl @@ -771,7 +776,7 @@ CFG_VARS = \ # # filenames given to xsubpp must have forward slashes (since it puts # full pathnames in #line strings) -XSUBPP = $(HPERL) -I..\..\lib -MCross=$(CROSS_NAME) ..\$(EXTUTILSDIR)\xsubpp \ +XSUBPP = $(HPERL) -I..\..\lib ..\$(EXTUTILSDIR)\xsubpp \ -C++ -prototypes @@ -779,29 +784,49 @@ XSUBPP = $(HPERL) -I..\..\lib -MCross=$(CROSS_NAME) ..\$(EXTUTILSDIR)\xsubpp \ # Top targets # -all: hostminiperl $(CONFIGPM) $(UNIDATAFILES) $(PERLEXE) MakePPPort Extensions +all: hostminiperl force_config_h ..\lib\buildcustomize.pl .\config.h ..\git_version.h $(CONFIGPM) $(UNIDATAFILES) $(PERLEXE) MakePPPort Extensions -$(DYNALOADER)$(o) : $(DYNALOADER).c xconfig.h $(EXTDIR)\DynaLoader\dlutils.c +$(DYNALOADER)$(o) : $(DYNALOADER).c config.h $(EXTDIR)\DynaLoader\dlutils.c #convenience target configpm_targ : $(CONFIGPM) -$(CONFIGPM) : $(HPERL) ..\Cross\config-$(MACHINE).sh config_h.PL ..\git_version.h - cd .. && $(HPERL) -Ilib configpm --cross=$(CROSS_NAME) --no-glossary - -mkdir $(XCOREDIR) - $(XCOPY) ..\*.h $(XCOREDIR)\*.* - $(XCOPY) *.h $(XCOREDIR)\*.* - $(XCOPY) ..\ext\re\re.pm $(LIBDIR)\*.* - $(RCOPY) include $(XCOREDIR)\*.* - -.\xconfig.h: - -del /f xconfig.h - -mkdir $(XCOREDIR) - -$(HPERL) -I..\lib -MCross=$(CROSS_NAME) config_h.PL "INST_VER=$(INST_VER)" "CORE_DIR=$(XCOREDIR)" "CONFIG_H=xconfig.h" -#prevent accidents where the desktop config.h is used - $(DEL) $(XCOREDIR)\config.h - echo "#error This is a cross build. Use xconfig.h. \ -" > $(XCOREDIR)\config.h +force_config_h: + -@$(DEL) /f config.h + -@$(DEL) /f config.sh + -@$(DEL) /f ..\config.h + -@$(DEL) /f ..\config.sh + -@$(DEL) $(PERLEXE_RES) + -@mkdir ..\host + -@copy $(HPERL) ..\host\miniperl.exe + -@copy $(GENUUDMAP) ..\host\generate_uudmap.exe + -@$(MAKE) -f Makefile distclean + -@copy ..\host\miniperl.exe $(HPERL) + -@copy ..\host\generate_uudmap.exe $(GENUUDMAP) + $(GENUUDMAP) $(GENERATED_HEADERS) + type NUL > force_config_h + +$(UUDMAP_H) $(MG_DATA_H) : $(BITCOUNT_H) + +$(BITCOUNT_H) : + $(GENUUDMAP) $(GENERATED_HEADERS) + +$(CONFIGPM) : $(HPERL) ..\config.sh config_h.PL ..\git_version.h + cd .. && $(HPERL) -Ilib configpm --no-glossary + if exist lib\* $(RCOPY) lib\*.* ..\lib\$(NULL) + $(XCOPY) ..\*.h $(COREDIR)\*.* + $(XCOPY) *.h $(COREDIR)\*.* + $(RCOPY) include $(COREDIR)\*.* + if errorlevel 1 $(MAKE) /$(MAKEFLAGS) $(CONFIGPM) + +.\config.h: $(CONFIGPM) ..\config.sh + -@$(DEL) /f config.h + -$(HPERL) -I..\lib config_h.PL "INST_VER=$(INST_VER)" "CORE_DIR=$(COREDIR)" "CONFIG_H=config.h" + copy config.h ..\config.h + +..\config.sh : config.ce config_sh.PL FindExt.pm + -@$(DEL) /f config.sh + $(HPERL) -I..\lib -I. config_sh.PL $(CFG_VARS) config.ce > ..\config.sh ..\git_version.h : ..\make_patchnum.pl cd .. && $(HPERL) -Ilib make_patchnum.pl && cd win32 @@ -809,11 +834,8 @@ $(CONFIGPM) : $(HPERL) ..\Cross\config-$(MACHINE).sh config_h.PL ..\git_version. # make sure that we recompile perl.c if the git version changes $(DLLDIR)\perl.obj : ..\git_version.h -..\Cross\config-$(MACHINE).sh: config.ce config_sh.PL - $(HPERL) -I..\lib -I. config_sh.PL $(CFG_VARS) config.ce > ..\Cross\config-$(MACHINE).sh - -MakePPPort: $(HPERL) $(CONFIGPM) - $(HPERL) -I..\lib -MCross=$(CROSS_NAME) ..\mkppport +MakePPPort: $(HPERL) $(CONFIGPM) Extensions_nonxs + $(HPERL) -I..\lib ..\mkppport MakePPPort_clean: -if exist $(HPERL) $(HPERL) -I..\lib ..\mkppport --clean @@ -828,8 +850,13 @@ NOT_COMPILE_EXT = $(NOT_COMPILE_EXT) !XS/Typemap !endif Extensions: ..\make_ext.pl $(CONFIGPM) - $(HPERL) -I..\lib -I. -MCross=$(CROSS_NAME) ..\make_ext.pl "MAKE=$(MAKE)" --dir=$(CPANDIR) --dir=$(DISTDIR) --dir=$(EXTDIR) --all \ - !POSIX !Errno !Win32 !Win32API/File !Time/HiRes !Time/Piece !re !SDBM_File $(NOT_COMPILE_EXT) + $(HPERL) -I..\lib -I. ..\make_ext.pl "MAKE=$(MAKE)" --dir=$(CPANDIR) --dir=$(DISTDIR) --dir=$(EXTDIR) --all \ + !POSIX !Win32 !Win32API/File !Time/HiRes !Time/Piece !re !SDBM_File $(NOT_COMPILE_EXT) + + +Extensions_nonxs: ..\make_ext.pl ..\lib\buildcustomize.pl $(CONFIGPM) ..\pod\perlfunc.pod + $(XCOPY) ..\*.h $(COREDIR)\*.* + $(HPERL) -I..\lib ..\make_ext.pl "MAKE=$(MAKE)" --dir=$(CPANDIR) --dir=$(DISTDIR) --dir=$(EXTDIR) --nonxs Extensions_clean: -if exist $(HPERL) $(HPERL) -I..\lib ..\make_ext.pl "MAKE=$(MAKE)" --dir=$(CPANDIR) --dir=$(DISTDIR) --dir=$(EXTDIR) --all --target=clean @@ -847,11 +874,8 @@ clean: Extensions_clean -@$(DEL) .\$(MACHINE)\*.lib -@$(DEL) .\$(MACHINE)\*.exp -@$(DEL) .\$(MACHINE)\*.pdb - -@$(DEL) ..\Cross\config-$(MACHINE).sh - -if exist ..\xlib rmdir /s /q ..\xlib - -if exist .\$(MACHINE) rmdir /s /q .\$(MACHINE) - -@$(DEL) config.h xconfig.h perl.res -@$(DEL) ..\git_version.h + -@$(DEL) config.h perl.res -@$(DEL) ..\t\test_state XDLLOBJS = \ @@ -945,9 +969,9 @@ $(DLLDIR)\perllib$(o) : perllib.c .\perlhost.h .\vdir.h .\vmem.h rem (frustrated) mv perllib.obj $(DLLDIR) !ENDIF -perldll.def : $(HPERL) $(CONFIGPM) ..\embed.fnc ..\makedef.pl create_perllibst_h.pl .\xconfig.h - $(HPERL) -I..\lib -MCross create_perllibst_h.pl - $(HPERL) -I..\lib -MCross -w ..\makedef.pl PLATFORM=wince $(OPTIMIZE) $(DEFINES) $(BUILDOPT) \ +perldll.def : $(HPERL) $(CONFIGPM) ..\embed.fnc ..\makedef.pl create_perllibst_h.pl .\config.h + $(HPERL) -I..\lib create_perllibst_h.pl + $(HPERL) -I..\lib -w ..\makedef.pl PLATFORM=wince $(OPTIMIZE) $(DEFINES) $(BUILDOPT) \ CCTYPE=$(CCTYPE) -DPERL_DLL=$(PERLDLL) TARG_DIR=..\ > perldll.def $(PERLDLL) : header_check lib_check $(DLLDIR) perldll.def $(XDLLOBJS) $(PERLDLL_RES) @@ -960,7 +984,7 @@ $(DLLDIR) : if not exist "$(DLLDIR)" mkdir "$(DLLDIR)" $(EXTDIR)\DynaLoader\DynaLoader.c : - $(HPERL) -I..\lib -I. -MCross=$(CROSS_NAME) ..\make_ext.pl "MAKE=$(MAKE)" --dir=$(EXTDIR) --dynaloader + $(HPERL) -I..\lib -I. ..\make_ext.pl "MAKE=$(MAKE)" --dir=$(EXTDIR) --dynaloader $(DLLDIR)\DynaLoader.obj: $(EXTDIR)\DynaLoader\DynaLoader.c $(CC) -c $(CFLAGS_O) -DPERL_EXTERNAL_GLOB -Fo$(DLLDIR)\ \ @@ -969,8 +993,11 @@ $(DLLDIR)\DynaLoader.obj: $(EXTDIR)\DynaLoader\DynaLoader.c XPERLEXEOBJS = \ $(MACHINE)\perlmaince.obj +..\lib\buildcustomize.pl : + $(HPERL) -I..\lib -f ..\write_buildcustomize.pl .. + $(PERLEXE) : $(PERLDLL) $(CONFIGPM) $(XPERLEXEOBJS) $(PERLEXE_RES) $(STARTOBJS) - $(XCOPY) $(MACHINE)\*.lib $(XCOREDIR) + $(XCOPY) $(MACHINE)\*.lib $(COREDIR) $(LINK32) $(SUBSYS) $(LDLIBPATH) \ -entry:wWinMainCRTStartup \ -out:$(MACHINE)\perl.exe \ @@ -986,20 +1013,20 @@ dumperdll: $(DUMPER_DLL) dlls: socketdll iodll dumperdll -xmkdir -p $(MACHINE)/lib/auto/IO - cp ../lib/auto/IO/IO.bs $(MACHINE)/lib/auto/IO - cp ../lib/auto/IO/IO.dll $(MACHINE)/lib/auto/IO + copy ../lib/auto/IO/IO.bs $(MACHINE)/lib/auto/IO + copy ../lib/auto/IO/IO.dll $(MACHINE)/lib/auto/IO -xmkdir $(MACHINE)/lib/auto/Socket - cp ../lib/auto/Socket/Socket.bs $(MACHINE)/lib/auto/Socket - cp ../lib/auto/Socket/Socket.dll $(MACHINE)/lib/auto/Socket + copy ../lib/auto/Socket/Socket.bs $(MACHINE)/lib/auto/Socket + copy ../lib/auto/Socket/Socket.dll $(MACHINE)/lib/auto/Socket -xmkdir -p $(MACHINE)/lib/auto/Data/Dumper - cp ../lib/auto/Data/Dumper/Dumper.bs $(MACHINE)/lib/auto/Data/Dumper - cp ../lib/auto/Data/Dumper/Dumper.dll $(MACHINE)/lib/auto/Data/Dumper + copy ../lib/auto/Data/Dumper/Dumper.bs $(MACHINE)/lib/auto/Data/Dumper + copy ../lib/auto/Data/Dumper/Dumper.dll $(MACHINE)/lib/auto/Data/Dumper makedist: all dlls $(COPY) $(CELIBPATH)\celib.dll $(MACHINE) - cp perl.txt $(MACHINE) - cp registry.bat $(MACHINE) - cp ../lib/Config.pm $(MACHINE)/lib + copy perl.txt $(MACHINE) + copy registry.bat $(MACHINE) + copy ../lib/Config.pm $(MACHINE)/lib cd $(MACHINE) -@$(DEL) perl-$(MACHINE).tar.gz sh -c "tar cf perl-$(MACHINE).tar *.exe *.dll *.txt *.bat lib" @@ -1013,21 +1040,21 @@ install: all -cemkdir "$(INSTALL_ROOT)\lib" $(CECOPY) "pc:$(MACHINE)/perl.exe" "ce:$(INSTALL_ROOT)/bin" $(CECOPY) "pc:$(MACHINE)/perl$(PV).dll" "ce:$(INSTALL_ROOT)/bin" - $(CECOPY) "pc:../xlib/$(CROSS_NAME)/Config.pm" "ce:$(INSTALL_ROOT)/lib" + $(CECOPY) "pc:../lib/Config.pm" "ce:$(INSTALL_ROOT)/lib" -$(UNIDATAFILES) : $(HPERL) $(CONFIGPM) ..\lib\unicore\mktables +$(UNIDATAFILES) : $(HPERL) $(CONFIGPM) ..\lib\unicore\mktables MakePPPort cd ..\lib\unicore && \ - $(HPERL) -I.. -I..\..\lib -MCross=$(CROSS_NAME) mktables -P ..\..\pod -maketest -makelist -p -check $@ $(FIRSTUNIFILE) + $(HPERL) -I.. -I..\..\lib mktables -P ..\..\pod -maketest -makelist -p -check $@ $(FIRSTUNIFILE) dist: all - $(HPERL) -I..\lib -MCross=$(CROSS_NAME) ce-helpers\makedist.pl --distdir=dist-$(CROSS_NAME) --cross-name=$(CROSS_NAME) + $(HPERL) -I..\lib ce-helpers\makedist.pl --distdir=dist-$(CROSS_NAME) --cross-name=$(CROSS_NAME) zipdist: all - $(HPERL) -I..\lib -MCross=$(CROSS_NAME) ce-helpers\makedist.pl --distdir=dist-$(CROSS_NAME) --cross-name=$(CROSS_NAME) - $(HPERL) -I..\lib -MCross=$(CROSS_NAME) ce-helpers\makedist.pl --distdir=dist-$(CROSS_NAME) --cross-name=$(CROSS_NAME) --zip + $(HPERL) -I..\lib ce-helpers\makedist.pl --distdir=dist-$(CROSS_NAME) --cross-name=$(CROSS_NAME) + $(HPERL) -I..\lib ce-helpers\makedist.pl --distdir=dist-$(CROSS_NAME) --cross-name=$(CROSS_NAME) --zip zip: - $(HPERL) -I..\lib -MCross=$(CROSS_NAME) ce-helpers\makedist.pl --distdir=dist-$(CROSS_NAME) --cross-name=$(CROSS_NAME) --zip + $(HPERL) -I..\lib ce-helpers\makedist.pl --distdir=dist-$(CROSS_NAME) --cross-name=$(CROSS_NAME) --zip hostminiperl: ..\miniperl.exe @@ -1036,10 +1063,9 @@ hostminiperl: ..\miniperl.exe $(MAKE) -f Makefile "CCHOME=$(MSVCDIR)" "CCINCDIR=$(CCHOME)\include" "CCLIBDIR=$(CCHOME)\lib" "INCLUDE=$(CCHOME)\include" "LIB=$(CCHOME)\lib" "LINK_FLAGS=" .\config.h ..\miniperl.exe host-install: - perl -MConfig -MExtUtils::Install -we "install({'../lib/CORE', qq#$$Config{installprefixexp}/xlib/$(CROSS_NAME)/CORE#},1)" - perl -MConfig -MExtUtils::Install -we "install({'../xlib/$(CROSS_NAME)', qq#$$Config{installprefixexp}/xlib/$(CROSS_NAME)#},1)" - perl -MConfig -MFile::Copy -we "copy qq#./$(MACHINE)/perl$(PV).lib#, qq#$$Config{installprefixexp}/xlib/$(CROSS_NAME)/CORE#" - perl -MConfig -MFile::Copy -we "copy qq#../lib/Cross.pm#, qq#$$Config{installprefixexp}/lib#" + perl -MConfig -MExtUtils::Install -we "install({'../lib/CORE', qq#$$Config{installprefixexp}/lib/CORE#},1)" + perl -MConfig -MExtUtils::Install -we "install({'../lib', qq#$$Config{installprefixexp}/lib#},1)" + perl -MConfig -MFile::Copy -we "copy qq#./$(MACHINE)/perl$(PV).lib#, qq#$$Config{installprefixexp}/lib/CORE#" perl -MConfig -we "system qq#perl -pi.bak -we \"s{((arch^|priv)libexp)='.*'}{\$$1='# . \ quotemeta($$Config{installprefixexp}) . \ - qq#/xlib/$(CROSS_NAME)'}\" $$Config{installprefixexp}/xlib/$(CROSS_NAME)/Config.pm#" + qq#/lib'}\" $$Config{installprefixexp}/lib/Config.pm#" diff --git a/win32/ce-helpers/makedist.pl b/win32/ce-helpers/makedist.pl index 4d1f576621..7cfdc366d9 100644 --- a/win32/ce-helpers/makedist.pl +++ b/win32/ce-helpers/makedist.pl @@ -110,7 +110,7 @@ if ($opts{adaptation}) { if ($opts{'verbose'} >=1) { print STDERR "Copying Config.pm, perl.dll and perl.exe...\n"; } -copy "../xlib/$opts{'cross-name'}/Config.pm", "$opts{distdir}/lib/Config.pm"; +copy "../lib/Config.pm", "$opts{distdir}/lib/Config.pm"; copy "$opts{'cross-name'}/perl.exe", "$opts{distdir}/bin/perl.exe"; copy "$opts{'cross-name'}/perl.dll", "$opts{distdir}/bin/perl.dll"; # how do we know exact name of perl.dll? @@ -121,7 +121,7 @@ my %aexcl = (socket=>'Socket_1'); # on WinCE, %aexcl needed to replace it with a different name that however # will be found by Dynaloader my @afiles; -chdir "../xlib/$opts{'cross-name'}/auto"; +chdir "../lib/auto"; find({no_chdir=>1,wanted=>sub{push @afiles, $_ if /\.(dll|bs)$/}},'.'); chdir $cwd; if ($opts{'verbose'} >=1) { @@ -129,10 +129,10 @@ if ($opts{'verbose'} >=1) { } for (@afiles) { if (/^(.*)\/(\w+)\.dll$/i && exists $aexcl{lc($2)}) { - copy "../xlib/$opts{'cross-name'}/auto/$_", "$opts{distdir}/lib/auto/$1/$aexcl{lc($2)}.dll"; + copy "../lib/auto/$_", "$opts{distdir}/lib/auto/$1/$aexcl{lc($2)}.dll"; } else { - copy "../xlib/$opts{'cross-name'}/auto/$_", "$opts{distdir}/lib/auto/$_"; + copy "../lib/auto/$_", "$opts{distdir}/lib/auto/$_"; } } diff --git a/write_buildcustomize.pl b/write_buildcustomize.pl index 3f78264a7a..64bf4ce6cb 100644 --- a/write_buildcustomize.pl +++ b/write_buildcustomize.pl @@ -1,13 +1,20 @@ #!./miniperl -w use strict; -if (@ARGV) { + +my $osname = $^O; +my $file = 'lib/buildcustomize.pl'; + +if ( @ARGV % 2 ) { my $dir = shift; chdir $dir or die "Can't chdir '$dir': $!"; unshift @INC, 'lib'; } -my $file = 'lib/buildcustomize.pl'; +if ( @ARGV ) { + # Used during cross-compilation. + $osname = $ARGV[1]; +} # To clarify, this isn't the entire suite of modules considered "toolchain" # It's not even all modules needed to build ext/ @@ -68,6 +75,7 @@ print $fh <<"EOT" or $error = "Can't print to $file: $!"; # Replace the first entry of \@INC ("lib") with the list of # directories we need. splice(\@INC, 0, 1, $inc); +\$^O = '$osname'; EOT if ($error) { diff --git a/x2p/Makefile.SH b/x2p/Makefile.SH index ae017b6436..2e554014c5 100755 --- a/x2p/Makefile.SH +++ b/x2p/Makefile.SH @@ -69,7 +69,7 @@ OPTIMIZE = $optimize .SUFFIXES: .c \$(OBJ_EXT) -RUN = $run +RUN = PERL = $perl !GROK!THIS! |