[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index][Thread Index][Top&Search][Original]

[PATCH-34456] RE: [PATCH-34435] cross-compile for linux



Hi,

attached is updated patch for cross-compilation, as a replacement of my previous un-noticed patch.

All my previous comments apply:

> attached is a patch which enables perl cross compile for linux, full 
> perl with extensions.
> 
> Not finished yet, but now usable in its current shape.
> 
> File ./Cross/Makefile-cross-SH is deleted (as seen in change 
> in ./MANIFEST).
> 
> The file ./lib/ExtUtils/MM_Unix.pm is touched - I am not sure whether 
> version of MakeMaker should be changed.
> IMO the changes in ./lib/ExtUtils/MM_Unix.pm are few and innocent - I 
> will be happy to provide my motivation to the maintainer of 
> the module.

Please let me know if I should bother makemaker@perl.org mailing list for discussion about its ExtUtils::MakeMaker part.

More to follow, as usual :)

Best regards,
Vadim.
diff -ru bperl-orig/Cross/README perl-34456/Cross/README
--- bperl-orig/Cross/README	2008-09-20 01:04:03.000000000 +0400
+++ perl-34456/Cross/README	2008-10-06 00:39:01.000000000 +0400
@@ -55,7 +55,9 @@
 
 1)	Copy the Perl source code onto your TARGET machine.
 2)	Execute sh Configure as normal and configure as required,
-	do not "make".
+	do not "make". Note that you should have C compiler on
+	the TARGET, because Configure depends on it (among other
+	essential *nix commands).
 3)	Copy the config.sh file that is generated to your BUILD
 	machine and place it in the Cross directory with the
 	filename config.sh-ARCH-OS.  For example,
diff -ru bperl-orig/Cross/README.new perl-34456/Cross/README.new
--- bperl-orig/Cross/README.new	2008-09-20 01:04:03.000000000 +0400
+++ perl-34456/Cross/README.new	2008-10-06 04:38:04.000000000 +0400
@@ -8,75 +8,106 @@
 
 =head1 DESCRIPTION
 
-This is second approach to linux cross-compilation, which should allow
-building full perl and entensions for target platform. Cross-compilation
-for linux uses similar approach and shares the same files as
-cross-compilation for WinCE.
+This approach to linux cross-compilation allows building full perl and
+extensions for target platform. Cross-compilation for linux uses similar
+approach as cross-compilation for WinCE, and there are many similarities
+within generated files.
 
-We refer to HOST as the platform where the build is performed, and to
-TARGET as where final executables will run.
+We refer as HOST the platform where the build is performed, and the TARGET
+is where final executables will run.
 
-=head2 Basic ideas
+=head2 How to cross-compile
 
-=head3 common
+Look into the shell script ./Cross/build-arm-n770-sh, modify it and run.
+You should only modify few parameters: path to cross-compiler GCC and may
+be your cross-compilation identifier, which should be named "properly"
+(no minuses in its name, better name it "arm" or "scale" but not "arm-1").
 
-Unlike WinCE, output files from GCC cross-compiler are produced in the same
-directory where C files are. All TARGET binaries have different extensions
-so to distinguish HOST and TARGET binaries. Namely, object files for C<arm>
-cross-compilation will have extension C<.armo>, executable files will have
-C<.arm>.
+All should be smooth and you'll get your binaries for TARGET. Following below
+is the explanation of the build process, which is not even needed if you
+have no errors.
 
-After typical cross-compilation the following files will be built, among
-others:
+=head2 Build process
 
-  sv.c
-  sv.o
-  sv.armo
-  libperl.arma
+During cross-compilation following stages occur:
 
-(this approach may be reconsidered, however.)
+=over 1
 
-=head3 build process
+=item C<miniperl> for HOST by running:
 
-C<miniperl> is built. This executable is intended to run on HOST, and it
-will facilitate the remaining build process; all binaries built after it are
-foreign (TARGET) and should not run locally (HOST).
 
-Unlike HOST build, miniperl will not have C<Config.pm> of HOST within reach;
-it rather will use the C<Config.pm> from the cross-compilation directories.
-In fact, if the build process does have Config.pm within reach, this is only
-an indication of a mistake somewhere in the middle.
+=over 2
 
-  # following command is okay:
-  ./miniperl -Ilib -MCross -MConfig -e 1
-  # following command should cluck, and it is bad if it does not:
-  ./miniperl -Ilib -MConfig -e 1
+=item C<Configure> for HOST
+
+=item generation of C<Makefile>
+
+=item building C<miniperl> using C<Makefile>
+
+=back
+
+=item generation of C<Makefile-cross-XXX>
+
+=item C<Config.pm> for TARGET
+
+=item C<miniperl> for TARGET
+
+=item C<perl> for TARGET
+
+=item extensions for TARGET
+
+=back
+
+=head3 Configure, Makefile
+
+In order to build C<miniperl> for HOST, the usual C<Configure> is run, which
+will generate C<Makefile> by running C<Makefile.SH> - this is no different
+compared to standard building process.
 
-After C<miniperl> is built, C<configpm> is invoked to create an
-appropriate C<Config.pm> in the right place and its corresponding
+=head3 Makefile-cross-XXXX
+
+To create Makefile for cross-compilation the script Makefile.SH is
+executed with variable CROSS_NAME set to the name of cross-compilation.
+
+=head3 miniperl
+
+The C<miniperl> executable is intended to run on HOST, and it
+will facilitate the remaining build process; binaries built after it are
+foreign (TARGET) and should not run locally (HOST).
+
+=head3 Config.pm
+
+After C<miniperl> is built, C<configpm --cross=XXX> is invoked to create an
+appropriate C<Config.pm> for TARGET and its corresponding
 C<Cross.pm>.
 
 File C<Cross.pm> is dead simple: for given cross-architecture places in @INC
 a path where perl modules are, and right C<Config.pm> in that place.
 
-That said, C<miniperl -Ilib -MConfig -we 1> should report an error, because
-it cannot find C<Config.pm>. If it does not give an error, a wrong C<Config.pm>
-is substituted, and resulting binaries will be a mess.
+C<miniperl> will not have workable C<Config.pm> of HOST within reach;
+it rather will use C<Config.pm> for TARGET from the cross-compilation directories.
+In fact, Config.pm for HOST during the cross-compilation does nothing except
+signalling the error.
+
+  # following command is okay:
+  ./miniperl -Ilib -MCross -MConfig -e 1
+  # following command will report an error
+  ./miniperl -Ilib -MConfig -e 1
 
 C<miniperl -MCross -MConfig -we 1> should run okay, and it will provide a
 correct C<Config.pm> for further compilations.
 
 During extensions build phase, the script C<./ext/util/make_ext_cross> is
-invoked.
-
-All invocations of C<Makefile.PL> are provided with C<-MCross> so to enable
+invoked.  It will invoke C<Makefile.PL> with C<-MCross> so to enable
 cross-compilation.
 
-=head2 BUILD
+=head2 Tools & SDK
 
-=head3 Tools & SDK
+To compile, you need native compiler (to build miniperl) and cross-compiler
+to build the entire perl.
 
-To compile, you need the following:
+Look at the sample script C<build-arm-n770-sh> and its comments as an
+example how the cross-compiling environment could be established.
 
 =over 4
 
@@ -84,6 +115,24 @@
 
 =back
 
+=head1 miscellaneous
+
+Unlike WinCE, output files from GCC cross-compiler are produced in the same
+directory where C files are. All TARGET binaries have different extensions
+so to distinguish HOST and TARGET binaries. Namely, object files for C<arm>
+cross-compilation will have extension C<.armo>, executable files will have
+C<.arm>.
+
+After typical cross-compilation the following files will be built, among
+others:
+
+  sv.c
+  sv.o
+  sv.armo
+  libperl.arma
+
+(this approach may be reconsidered, however.)
+
 =head1 Things to be done
 
 =over 4
diff -ru bperl-orig/Cross/TODO perl-34456/Cross/TODO
--- bperl-orig/Cross/TODO	2008-09-20 01:04:03.000000000 +0400
+++ perl-34456/Cross/TODO	2008-10-06 01:14:06.000000000 +0400
@@ -1 +1,3 @@
-Provide a better sandbox for building additional XS libraries.
+* move logic from ./Cross/build-arm-n770-sh to Makefile
+* construct automatic generation process of configs like ./Cross/config.sh-arm-linux-n770
+* generate object files in './xlib/xxx/' subdir?
diff -ru bperl-orig/Cross/build-arm-n770-sh perl-34456/Cross/build-arm-n770-sh
--- bperl-orig/Cross/build-arm-n770-sh	2008-09-20 01:04:03.000000000 +0400
+++ perl-34456/Cross/build-arm-n770-sh	2008-10-06 04:47:21.000000000 +0400
@@ -1,13 +1,20 @@
 # this is a build script for ARM-linux cross-compiling.
-# it builds miniperl on HOST and then perl for TARGET
-# this approach is like Perl-CE cross-compiling, and allows
+#
+# Cross-compiling SDK could be downloaded from the URL
+#   http://www.codesourcery.com/gnu_toolchains/arm
+# or alternatively from
+#   http://www.handhelds.org/download/projects/toolchain/
+#
+# SDK also could be downloaded from www.maemo.org, somehow (how - TBD)
+#
+# Cross-compile process similar to Perl-CE cross-compiling, and allows
 # for full TARGET perl (as opposed to renamed miniperl)
-
-# to skip Configure/build for HOST miniperl, pass "noconf" argument to this script
-
+#
 # some trick is different, however - the file extension for objects files
 # are choosen to be .${CROSS_NAME}, .armo in our case
 
+# to skip Configure/build for HOST miniperl, pass "noconf" argument to this script
+
 # note how invoked Makefile.PL for cross-compilation:
 #   miniperl -MCross Makefile.PL
 
@@ -28,7 +35,8 @@
 export CROSSCC
 export CROSS_NAME
 
-cp config.sh-arm-linux-n770 config-${CROSS_NAME}.sh
+# (re-)building this config-xxxx.sh is TBD
+cp config.sh-arm-linux-n770 ../config-${CROSS_NAME}.sh
 
 # following should be done better:
 cd ..
@@ -38,50 +46,43 @@
 CROSS_NAME= ./Configure -des -D prefix=./dummy -Dusedevel
 make miniperl
 make uudmap.h
-# fake uudmap, which should be on HOST
-# TODO - all host utilities should be clearly stated and not built for TARGET
-cp generate_uudmap generate_uudmap.${CROSS_NAME}
 fi
 
-#?? cd Cross
-
 # do the rest for TARGET
 $CROSSCC --version
 
-# call make thusly so it will crosscompile...
+# call make this way so it will crosscompile...
 XCOREDIR=xlib/$CROSS_NAME/CORE
-PERL_CONFIG_SH=Cross/config-${CROSS_NAME}.sh
-
-#?? . $PERL_CONFIG_SH 
+PERL_CONFIG_SH=config-${CROSS_NAME}.sh
 
 # make cflags do cross-compile work (now its hackish, will be improved!)
 rm cflags-cross-$CROSS_NAME
 cp Cross/cflags-cross-$CROSS_NAME .
 rm Makefile-cross-$CROSS_NAME
 CROSS_NAME=$CROSS_NAME sh Makefile.SH
-cp Cross/Makefile-cross-$CROSS_NAME .
 
 mkdir xlib
 mkdir xlib/$CROSS_NAME
 mkdir ${XCOREDIR}
 
-#??OBJ_EXT=.${CROSS_NAME}o
-# TODO these -- AR=${CCPREF}ar LD=${CCPREF}ld
 cmd="make -f Makefile-cross-$CROSS_NAME xconfig.h"
 echo "running $cmd"
-$cmd
+$cmd || exit
 
-echo "running $cmd"
-cmd="make -f Makefile-cross-$CROSS_NAME libperl.${CROSS_NAME}a  OBJ_EXT=.${CROSS_NAME}o EXE_EXT=.$CROSS_NAME LIB_EXT=.${CROSS_NAME}a  AR=${CCPREF}ar LD=${CCPREF}ld"
-$cmd
 
-exit
-
-cmd="make -f Makefile-cross-$CROSS_NAME DynaLoader.${CROSS_NAME}o  OBJ_EXT=.${CROSS_NAME}o EXE_EXT=.$CROSS_NAME LIB_EXT=.${CROSS_NAME}a  AR=${CCPREF}ar LD=${CCPREF}ld"
-echo "running $cmd"
-$cmd
+#cmd="make -f Makefile-cross-$CROSS_NAME DynaLoader.${CROSS_NAME}o  OBJ_EXT=.${CROSS_NAME}o EXE_EXT=.$CROSS_NAME LIB_EXT=.${CROSS_NAME}a  AR=${CCPREF}ar LD=${CCPREF}ld"
+#echo "running $cmd"
+#$cmd || exit
+#
 
-cmd="make -f Makefile-cross-$CROSS_NAME perl.${CROSS_NAME}"
+cmd="make -f Makefile-cross-$CROSS_NAME all"
 echo "running $cmd"
-$cmd
+$cmd || exit
 
+# extensions not currently built here:
+#  DB_File
+#  GDBM_File
+#  NDBM_File
+#  ODBM_File
+#  SDBM_File
+#
diff -ru bperl-orig/Cross/cflags-cross-arm perl-34456/Cross/cflags-cross-arm
--- bperl-orig/Cross/cflags-cross-arm	2008-09-20 01:04:03.000000000 +0400
+++ perl-34456/Cross/cflags-cross-arm	2008-10-05 20:01:56.000000000 +0400
@@ -11,15 +11,15 @@
 
 case $PERL_CONFIG_SH in
 '')
-	if test -f Cross/config-arm.sh; then TOP=.;
-	elif test -f ../Cross/config-arm.sh; then TOP=..;
-	elif test -f ../../Cross/config-arm.sh; then TOP=../..;
-	elif test -f ../../../Cross/config-arm.sh; then TOP=../../..;
-	elif test -f ../../../../Cross/config-arm.sh; then TOP=../../../..;
+	if test -f ./config-arm.sh; then TOP=.;
+	elif test -f ../config-arm.sh; then TOP=..;
+	elif test -f ../../config-arm.sh; then TOP=../..;
+	elif test -f ../../../config-arm.sh; then TOP=../../..;
+	elif test -f ../../../../config-arm.sh; then TOP=../../../..;
 	else
 		echo "Can't find config-arm.sh."; exit 1
 	fi
-	. $TOP/Cross/config-arm.sh
+	. $TOP/config-arm.sh
 	;;
 esac
 
@@ -152,6 +152,6 @@
     echo "$CROSSCC -c -DUSE_CROSS_COMPILE -DPERL_CORE $ccflags $stdflags $optimize $warn $extra"
     eval "$also "'"$CROSSCC -DUSE_CROSS_COMPILE -DPERL_CORE -c $ccflags $stdflags $optimize $warn $extra"'
 
-    . $TOP/Cross/config-arm.sh
+    . $TOP/config-arm.sh
 
 done
diff -ru bperl-orig/Cross/config.sh-arm-linux-n770 perl-34456/Cross/config.sh-arm-linux-n770
--- bperl-orig/Cross/config.sh-arm-linux-n770	2008-09-20 01:04:03.000000000 +0400
+++ perl-34456/Cross/config.sh-arm-linux-n770	2008-10-05 20:37:22.000000000 +0400
@@ -482,6 +482,12 @@
 d_tcsetpgrp='define'
 d_telldir='define'
 d_telldirproto='define'
+d_ctime64='undef'
+d_localtime64='undef'
+d_gmtime64='undef'
+d_mktime64='undef'
+d_difftime64='undef'
+d_asctime64='undef'
 d_time='define'
 d_timegm='define'
 d_times='define'
@@ -531,7 +537,7 @@
 doublesize='8'
 drand01='drand48()'
 drand48_r_proto='0'
-dynamic_ext='B ByteLoader Cwd Data/Dumper Devel/DProf Devel/PPPort Devel/Peek Digest/MD5 Encode Fcntl File/Glob Filter/Util/Call I18N/Langinfo IO IPC/SysV List/Util MIME/Base64 Opcode POSIX PerlIO/encoding PerlIO/scalar PerlIO/via SDBM_File Socket Storable Sys/Hostname Sys/Syslog Time/HiRes Unicode/Normalize XS/APItest XS/Typemap attrs re threads threads/shared'
+dynamic_ext='B Compress/Raw/Zlib Cwd Data/Dumper Devel/DProf Devel/PPPort Devel/Peek Digest/MD5 Digest/SHA Encode Fcntl File/Glob Filter/Util/Call Hash/Util I18N/Langinfo IO IPC/SysV List/Util MIME/Base64 Math/BigInt/FastCalc Opcode POSIX PerlIO/encoding PerlIO/scalar PerlIO/via Socket Storable Sys/Hostname Sys/Syslog Text/Soundex Time/HiRes Time/Piece Unicode/Normalize XS/APItest XS/Typemap attrs re threads threads/shared Hash/Util/FieldHash'
 eagain='EAGAIN'
 ebcdic='undef'
 echo='echo'
@@ -546,7 +552,7 @@
 eunicefix=':'
 exe_ext=''
 expr='expr'
-extensions='B ByteLoader Cwd Data/Dumper Devel/DProf Devel/PPPort Devel/Peek Digest/MD5 Encode Fcntl File/Glob Filter/Util/Call I18N/Langinfo IO IPC/SysV List/Util MIME/Base64 Opcode POSIX PerlIO/encoding PerlIO/scalar PerlIO/via SDBM_File Socket Storable Sys/Hostname Sys/Syslog Time/HiRes Unicode/Normalize XS/APItest XS/Typemap attrs re threads threads/shared Errno'
+extensions='B Compress/Raw/Zlib Cwd Data/Dumper Devel/DProf Devel/PPPort Devel/Peek Digest/MD5 Digest/SHA Encode Fcntl File/Glob Filter/Util/Call Hash/Util I18N/Langinfo IO IPC/SysV List/Util MIME/Base64 Math/BigInt/FastCalc Opcode POSIX PerlIO/encoding PerlIO/scalar PerlIO/via Socket Storable Sys/Hostname Sys/Syslog Text/Soundex Time/HiRes Time/Piece Unicode/Normalize XS/APItest XS/Typemap attrs re threads threads/shared Hash/Util/FieldHash Compress/Zlib Errno IO_Compress_Base IO_Compress_Zlib Module/Pluggable Test/Harness'
 extras=''
 fflushNULL='define'
 fflushall='undef'
@@ -736,7 +742,7 @@
 ivdformat='"ld"'
 ivsize='4'
 ivtype='long'
-known_extensions='B ByteLoader Cwd DB_File Data/Dumper Devel/DProf Devel/PPPort Devel/Peek Digest/MD5 Encode Fcntl File/Glob Filter/Util/Call GDBM_File I18N/Langinfo IO IPC/SysV List/Util MIME/Base64 NDBM_File ODBM_File Opcode POSIX PerlIO/encoding PerlIO/scalar PerlIO/via SDBM_File Socket Storable Sys/Hostname Sys/Syslog Time/HiRes Unicode/Normalize XS/APItest XS/Typemap attrs re threads threads/shared'
+known_extensions='B Compress/Raw/Zlib Cwd Data/Dumper Devel/DProf Devel/PPPort Devel/Peek Digest/MD5 Digest/SHA Encode Fcntl File/Glob Filter/Util/Call Hash/Util I18N/Langinfo IO IPC/SysV List/Util MIME/Base64 Math/BigInt/FastCalc Opcode POSIX PerlIO/encoding PerlIO/scalar PerlIO/via Socket Storable Sys/Hostname Sys/Syslog Text/Soundex Time/HiRes Time/Piece Unicode/Normalize Win32 Win32API/File Win32CORE XS/APItest XS/Typemap attrs re threads threads/shared Hash/Util/FieldHash'
 ksh=''
 ld='arm-none-linux-gnueabi-gcc'
 lddlflags='-shared -L/usr/local/lib'
@@ -943,7 +949,7 @@
 ssizetype='ssize_t'
 startperl='#!/usr/bin/perl'
 startsh='#!/bin/sh'
-static_ext='DynaLoader '
+static_ext=' '
 stdchar='char'
 stdio_base='((fp)->_IO_read_base)'
 stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)'
diff -ru bperl-orig/INSTALL perl-34456/INSTALL
--- bperl-orig/INSTALL	2008-09-20 01:04:03.000000000 +0400
+++ perl-34456/INSTALL	2008-10-06 00:14:17.000000000 +0400
@@ -1661,7 +1661,7 @@
 
 README.ce
 
-=item Open Zaurus
+=item arm-linux (Open Zaurus, N770, etc)
 
 Cross/README
 
@@ -1690,19 +1690,13 @@
 C<-Dinstallprefix=...> might be handy, see L<Changing the installation
 directory>.
 
-About the cross-compilation support of Configure: what is known to
-work is running Configure in a cross-compilation environment and
-building the miniperl executable.  What is known not to work is
-building the perl executable because that would require building
-extensions: Dynaloader statically and File::Glob dynamically, for
-extensions one needs MakeMaker and MakeMaker is not yet
-cross-compilation aware, and neither is the main Makefile.
-
-The cross-compilation setup of Configure has successfully been used in
-at least two Linux cross-compilation environments.  The setups were
-both such that the host system was Intel Linux with a gcc built for
-cross-compiling into ARM Linux, and there was a SSH connection to the
-target system.
+About the cross-compilation support of Configure: it supports
+cross-compilation process up to building the miniperl executable.
+You should go this way if your platform is not supported for perl
+cross-compilation (i.e. it is not arm-linux, wince or another platform
+mentioned above).
+
+If this is your case, keep reading this section.
 
 To run Configure in cross-compilation mode the basic switch that
 has to be used is C<-Dusecrosscompile>.
diff -ru bperl-orig/MANIFEST perl-34456/MANIFEST
--- bperl-orig/MANIFEST	2008-10-01 20:54:30.000000000 +0400
+++ perl-34456/MANIFEST	2008-10-05 20:01:56.000000000 +0400
@@ -34,7 +34,6 @@
 Cross/generate_config_sh	Cross-compilation
 Cross/installperl.patch		Cross-compilation
 Cross/Makefile		Cross-compilation
-Cross/Makefile-cross-SH	Cross-compilation
 Cross/Makefile.SH.patch	Cross-compilation
 Cross/README		Cross-compilation
 Cross/README.new	Cross-compilation
diff -ru bperl-orig/Makefile.SH perl-34456/Makefile.SH
--- bperl-orig/Makefile.SH	2008-09-20 01:04:03.000000000 +0400
+++ perl-34456/Makefile.SH	2008-10-05 20:01:57.000000000 +0400
@@ -13,11 +13,23 @@
 case $CROSS_NAME in
 '')
 	Makefile=Makefile
+	make_ext=make_ext
+	utilities="utilities"
+	translators="translators"
+	MCROSS=""
 	;;
 *)
 	# if cross-compilation, the Makefile named accordingly
 	Makefile=Makefile-cross-$CROSS_NAME
-	. Cross/config-${CROSS_NAME}.sh
+	make_ext=make_ext_cross
+
+	# MCROSS is either empty or -MCross so proper TARGET machine config.pm
+	# will be activated
+	MCROSS="-MCross"
+	# cross-compiling of utilities (in utils), translators (in x2p) not yet here
+	utilities=""
+	translators=""
+	. config-${CROSS_NAME}.sh
 	;;
 esac
 
@@ -270,6 +282,7 @@
 # These variables may need to be manually set for non-Unix systems.
 AR = $full_ar
 HOST_EXE_EXT = 
+HOST_OBJ_EXT = .o
 EXE_EXT = $_exe
 LIB_EXT = $_a
 OBJ_EXT = $_o
@@ -284,7 +297,7 @@
 
 libs = $perllibs $cryptlib
 
-public = perl\$(EXE_EXT) $suidperl utilities translators
+public = perl\$(EXE_EXT) $suidperl $utilities $translators
 
 shellflags = $shellflags
 
@@ -357,6 +370,10 @@
 CONFIGPOD = lib/Config.pod
 
 CONFIGH = config.h
+
+$(CONFIGPOD): config.sh miniperl$(EXE_EXT) configpm Porting/Glossary
+	$(LDLIBPTH) $(RUN) ./miniperl -Ilib configpm
+
 !NO!SUBS!
 	;;
 *)
@@ -371,12 +388,20 @@
 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
+xconfig.h: config_h.SH config-\$(CROSS_NAME).sh
+	CONFIG_SH=config-\$(CROSS_NAME).sh CONFIG_H=xconfig.h \$(SHELL) config_h.SH
 	#TODO \$(LDLIBPTH) ./miniperl -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
 
+\$(CONFIGPM): config.sh miniperl configpm Porting/Glossary
+	\$(LDLIBPTH) ./miniperl -Ilib configpm --cross=\$(CROSS_NAME)
+	cp *.h \$(CROSS_LIB)/
+	cp ext/re/re.pm \$(CROSS_LIB)/
+
+\$(CONFIGPOD): config.sh miniperl\$(EXE_EXT) configpm Porting/Glossary
+	\$(LDLIBPTH) \$(RUN) ./miniperl -Ilib configpm --cross=\$(CROSS_NAME)
+
 !GROK!THIS!
 	;;
 esac
@@ -552,8 +577,8 @@
 uudmap.h: generate_uudmap\$(HOST_EXE_EXT)
 	\$(RUN) ./generate_uudmap\$(HOST_EXE_EXT) >uudmap.h
 
-generate_uudmap\$(HOST_EXE_EXT): generate_uudmap\$(OBJ_EXT)
-	\$(CC) -o generate_uudmap\$(EXE_EXT) \$(LDFLAGS) generate_uudmap\$(OBJ_EXT) \$(libs)
+generate_uudmap\$(HOST_EXE_EXT): generate_uudmap\$(HOST_OBJ_EXT)
+	\$(CC) -o generate_uudmap\$(HOST_EXE_EXT) \$(LDFLAGS) generate_uudmap\$(HOST_OBJ_EXT) \$(libs)
 
 !GROK!THIS!
 $spitshell >>$Makefile <<'!NO!SUBS!'
@@ -561,7 +586,7 @@
 	$(CCCMD) $(PLDLFLAGS) $*.c
 
 perlmain.c: miniperlmain.c config.sh $(FIRSTMAKEFILE)
-	sh writemain $(DYNALOADER) $(static_ext) > perlmain.c
+	sh writemain DynaLoader $(static_ext) > perlmain.c
 
 perlmain$(OBJ_EXT): perlmain.c
 	$(CCCMD) $(PLDLFLAGS) $*.c
@@ -777,18 +802,18 @@
 
 perl$(EXE_EXT): $& perlmain$(OBJ_EXT) $(LIBPERL) $(static_ext) ext.libs $(PERLEXPORT)
 	-@rm -f miniperl.xok
-	$(SHRPENV) $(LDLIBPTH) $(CC) -o perl$(PERL_SUFFIX) $(PERL_PROFILE_LDFLAGS) $(CLDFLAGS) $(CCDLFLAGS) perlmain$(OBJ_EXT) $(static_ext) $(LLIBPERL) `cat ext.libs` $(libs)
+	$(SHRPENV) $(LDLIBPTH) $(CC) -o perl$(PERL_SUFFIX)$(EXE_EXT) $(PERL_PROFILE_LDFLAGS) $(CLDFLAGS) $(CCDLFLAGS) perlmain$(OBJ_EXT) $(static_ext) $(LLIBPERL) `cat ext.libs` $(libs)
 
 # Purify/Quantify Perls.
 
 pureperl$(EXE_EXT): $& perlmain$(OBJ_EXT) $(LIBPERL) $(static_ext) ext.libs $(PERLEXPORT)
-	$(SHRPENV) $(LDLIBPTH) purify $(CC) -o pureperl $(CLDFLAGS) $(CCDLFLAGS) perlmain$(OBJ_EXT) $(static_ext) $(LLIBPERL) `cat ext.libs` $(libs)
+	$(SHRPENV) $(LDLIBPTH) purify $(CC) -o pureperl$(EXE_EXT) $(CLDFLAGS) $(CCDLFLAGS) perlmain$(OBJ_EXT) $(static_ext) $(LLIBPERL) `cat ext.libs` $(libs)
 
 purecovperl$(EXE_EXT): $& perlmain$(OBJ_EXT) $(LIBPERL) $(static_ext) ext.libs $(PERLEXPORT)
-	$(SHRPENV) $(LDLIBPTH) purecov $(CC) -o purecovperl $(CLDFLAGS) $(CCDLFLAGS) perlmain$(OBJ_EXT) $(static_ext) $(LLIBPERL) `cat ext.libs` $(libs)
+	$(SHRPENV) $(LDLIBPTH) purecov $(CC) -o purecovperl$(EXE_EXT) $(CLDFLAGS) $(CCDLFLAGS) perlmain$(OBJ_EXT) $(static_ext) $(LLIBPERL) `cat ext.libs` $(libs)
 
 quantperl$(EXE_EXT): $& perlmain$(OBJ_EXT) $(LIBPERL) $(static_ext) ext.libs $(PERLEXPORT)
-	$(SHRPENV) $(LDLIBPTH) quantify $(CC) -o quantperl $(CLDFLAGS) $(CCDLFLAGS) perlmain$(OBJ_EXT) $(static_ext) $(LLIBPERL) `cat ext.libs` $(libs)
+	$(SHRPENV) $(LDLIBPTH) quantify $(CC) -o quantperl$(EXE_EXT) $(CLDFLAGS) $(CCDLFLAGS) perlmain$(OBJ_EXT) $(static_ext) $(LLIBPERL) `cat ext.libs` $(libs)
 
 # Valgrind perl (currently Linux only)
 
@@ -906,34 +931,38 @@
 !GROK!THIS!
 ;;
 *)
-$spitshell >>$Makefile <<'!NO!SUBS!'
+$spitshell >>$Makefile <<!GROK!THIS!
 .PHONY: makeppport
-makeppport: miniperl$(EXE_EXT) $(CONFIGPM)
-	$(LDLIBPTH) $(RUN) ./miniperl$(EXE_EXT) -Ilib mkppport
+makeppport: miniperl\$(HOST_EXE_EXT) \$(CONFIGPM)
+	\$(LDLIBPTH) \$(RUN) ./miniperl\$(HOST_EXE_EXT) $MCROSS -Ilib mkppport
 
-!NO!SUBS!
+!GROK!THIS!
 ;;
 esac
 
-$spitshell >>$Makefile <<'!NO!SUBS!'
+$spitshell >>$Makefile <<!GROK!THIS!
+
+lib/lib.pm:	miniperl\$(EXE_EXT) \$(CONFIGPM)
+	@-rm -f \$@
+	\$(LDLIBPTH) \$(RUN) ./miniperl -Ilib $MCROSS lib/lib_pm.PL
 
 # We have to call our ./makedir because Ultrix 4.3 make can't handle the line
 #	test -d lib/auto || mkdir lib/auto
 # We need to autosplit in two steps because VOS can't handle so many args
 #
 .PHONY: preplibrary
-preplibrary: miniperl$(EXE_EXT) $(CONFIGPM) lib/lib.pm $(PREPLIBRARY_LIBPERL)
+preplibrary: miniperl\$(EXE_EXT) \$(CONFIGPM) lib/lib.pm \$(PREPLIBRARY_LIBPERL)
 	@sh ./makedir lib/auto
 	@echo "	AutoSplitting perl library"
-	$(LDLIBPTH) $(RUN) ./miniperl -Ilib -MAutoSplit -MFile::Find -e ' \
+	\$(LDLIBPTH) \$(RUN) ./miniperl -Ilib $MCROSS -MAutoSplit -MFile::Find -e ' \
 		find ({no_chdir=>1, wanted => \
-		       sub {autosplit_lib_modules($$_) if /\.pm$$/}}, \
+		       sub {autosplit_lib_modules(\$\$_) if /\.pm\$\$/}}, \
 		      "lib")'
-	$(MAKE) lib/re.pm
+	\$(MAKE) lib/re.pm
 
-$(CONFIGPOD): config.sh miniperl$(EXE_EXT) configpm Porting/Glossary
-	$(LDLIBPTH) $(RUN) ./miniperl -Ilib configpm
+!GROK!THIS!
 
+$spitshell >>$Makefile <<'!NO!SUBS!'
 $(CONFIGPM): $(CONFIGPOD)
 
 lib/ExtUtils/Miniperl.pm: miniperlmain.c miniperl$(EXE_EXT) minimod.pl $(CONFIGPM)
@@ -950,10 +979,6 @@
 x2p/s2p: miniperl$(EXE_EXT) $(CONFIGPM) x2p/s2p.PL
 	cd x2p; $(LDLIBPTH) $(MAKE) s2p
 
-lib/lib.pm:	miniperl$(EXE_EXT) $(CONFIGPM)
-	@-rm -f $@
-	$(LDLIBPTH) $(RUN) ./miniperl -Ilib lib/lib_pm.PL
-
 unidatafiles $(unidatafiles): uni.data
 
 uni.data: miniperl$(EXE_EXT) $(CONFIGPM) lib/unicore/mktables
@@ -1113,18 +1138,22 @@
 #
 # DynaLoader may be needed for extensions that use Makefile.PL.
 
-$(DYNALOADER):	miniperl$(EXE_EXT) preplibrary FORCE
-	@$(LDLIBPTH) sh ext/util/make_ext $(STATIC) $@ MAKE=$(MAKE) LIBPERL_A=$(LIBPERL)
+!NO!SUBS!
 
-d_dummy $(dynamic_ext):	miniperl$(EXE_EXT) preplibrary makeppport $(DYNALOADER) FORCE
-	@$(LDLIBPTH) sh ext/util/make_ext dynamic $@ MAKE=$(MAKE) LIBPERL_A=$(LIBPERL)
+$spitshell >>$Makefile <<!GROK!THIS!
+\$(DYNALOADER):	miniperl preplibrary FORCE
+	@\$(LDLIBPTH) sh ext/util/$make_ext \$(STATIC) \$@ MAKE=\$(MAKE) LIBPERL_A=\$(LIBPERL)
 
-s_dummy $(static_ext):	miniperl$(EXE_EXT) preplibrary makeppport $(DYNALOADER) FORCE
-	@$(LDLIBPTH) sh ext/util/make_ext $(STATIC) $@ MAKE=$(MAKE) LIBPERL_A=$(LIBPERL)
+d_dummy \$(dynamic_ext):	miniperl preplibrary makeppport \$(DYNALOADER) FORCE
+	@\$(LDLIBPTH) sh ext/util/$make_ext dynamic \$@ MAKE=\$(MAKE) LIBPERL_A=\$(LIBPERL)
 
-n_dummy $(nonxs_ext):	miniperl$(EXE_EXT) preplibrary FORCE
-	@$(LDLIBPTH) sh ext/util/make_ext nonxs $@ MAKE=$(MAKE) LIBPERL_A=$(LIBPERL)
-!NO!SUBS!
+s_dummy \$(static_ext):	miniperl preplibrary makeppport \$(DYNALOADER) FORCE
+	@\$(LDLIBPTH) sh ext/util/$make_ext \$(STATIC) \$@ MAKE=\$(MAKE) LIBPERL_A=\$(LIBPERL)
+
+n_dummy \$(nonxs_ext):	miniperl preplibrary FORCE
+	@\$(LDLIBPTH) sh ext/util/$make_ext nonxs \$@ MAKE=\$(MAKE) LIBPERL_A=\$(LIBPERL)
+
+!GROK!THIS!
 
 $spitshell >>$Makefile <<EOF
 $extra_dep
diff -ru bperl-orig/ext/POSIX/Makefile.PL perl-34456/ext/POSIX/Makefile.PL
--- bperl-orig/ext/POSIX/Makefile.PL	2008-09-20 01:04:09.000000000 +0400
+++ perl-34456/ext/POSIX/Makefile.PL	2008-10-05 20:01:57.000000000 +0400
@@ -1,6 +1,6 @@
 # Explicitly avoid including '.' in @INC; autoloader gets confused since it
 # can find POSIX.pm, but can't find autosplit.ix.
-BEGIN { @INC = '../../lib';}
+BEGIN { @INC = '../../lib' unless defined $Cross::platform;}
 #
 use ExtUtils::MakeMaker;
 use ExtUtils::Constant 0.11 'WriteConstants';
diff -ru bperl-orig/lib/ExtUtils/MM_Unix.pm perl-34456/lib/ExtUtils/MM_Unix.pm
--- bperl-orig/lib/ExtUtils/MM_Unix.pm	2008-09-29 13:14:49.000000000 +0400
+++ perl-34456/lib/ExtUtils/MM_Unix.pm	2008-10-05 20:01:57.000000000 +0400
@@ -146,7 +146,7 @@
 	$command -S $flags \$*.c
 
 .c\$(OBJ_EXT):
-	$command $flags \$*.c
+	$command $flags -o \$*\$(OBJ_EXT) \$*.c
 
 .cpp\$(OBJ_EXT):
 	$command $flags \$*.cpp
@@ -2583,7 +2583,7 @@
     my $newer_than_target = $Is{VMS} ? '$(MMS$SOURCE_LIST)' : '$?';
     my $mpl_args = join " ", map qq["$_"], @ARGV;
 
-    $m .= sprintf <<'MAKE_FRAG', $newer_than_target, $mpl_args;
+    $m .= sprintf <<'MAKE_FRAG', $newer_than_target, $mpl_args unless defined $Cross::platform;
 # We take a very conservative approach here, but it's worth it.
 # We move Makefile to Makefile.old here to avoid gnu make looping.
 $(FIRST_MAKEFILE) : Makefile.PL $(CONFIGDEP)
@@ -2788,19 +2788,30 @@
     my($self) = shift;
     my(@m);
 
+    my $configsh = "config.sh";
     my $make_config = $self->cd('$(PERL_SRC)', '$(MAKE) lib/Config.pm');
 
-    push @m, sprintf <<'MAKE_FRAG', $make_config if $self->{PERL_SRC};
+    if (defined $Cross::platform) {
+	# in cross-compiling the dependant config.sh contains cross-identifier
+	# in its name, yet Config.pm is located in ./xlib/xxxx/
+	$make_config = $self->cd('$(PERL_SRC)', "\$(MAKE) xlib/$Cross::platform/Config.pm");
+	$configsh = "config-$Cross::platform.sh";
+    }
+
+    if ($self->{PERL_SRC}) {
+	push @m, "CONFIGSH = \$(PERL_SRC)/$configsh\n";
+	push @m, sprintf <<'MAKE_FRAG', $make_config;
 # Check for unpropogated config.sh changes. Should never happen.
 # We do NOT just update config.h because that is not sufficient.
 # An out of date config.h is not fatal but complains loudly!
-$(PERL_INC)/config.h: $(PERL_SRC)/config.sh
-	-$(NOECHO) $(ECHO) "Warning: $(PERL_INC)/config.h out of date with $(PERL_SRC)/config.sh"; false
+$(PERL_INC)/config.h: $(CONFIGSH)
+	-$(NOECHO) $(ECHO) "Warning: $(PERL_INC)/config.h out of date with $(CONFIGSH)"; false
 
-$(PERL_ARCHLIB)/Config.pm: $(PERL_SRC)/config.sh
-	$(NOECHO) $(ECHO) "Warning: $(PERL_ARCHLIB)/Config.pm may be out of date with $(PERL_SRC)/config.sh"
+$(PERL_ARCHLIB)/Config.pm: $(CONFIGSH)
+	$(NOECHO) $(ECHO) "Warning: $(PERL_ARCHLIB)/Config.pm may be out of date with $(CONFIGSH)"
 	%s
 MAKE_FRAG
+    }
 
     return join "", @m unless $self->needs_linking;
 
@@ -3716,7 +3727,7 @@
     '
 .xs$(OBJ_EXT):
 	$(XSUBPPRUN) $(XSPROTOARG) $(XSUBPPARGS) $*.xs > $*.xsc && $(MV) $*.xsc $*.c
-	$(CCCMD) $(CCCDLFLAGS) "-I$(PERL_INC)" $(PASTHRU_DEFINE) $(DEFINE) $*.c
+	$(CCCMD) $(CCCDLFLAGS) "-I$(PERL_INC)" $(PASTHRU_DEFINE) $(DEFINE) -o $*$(OBJ_EXT) $*.c
 ';
 }
 

[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index][Thread Index][Top&Search][Original]