3 ?RCS: Copyright (c) 2001 Jarkko Hietaniemi
5 ?RCS: You may distribute under the terms of either the GNU General Public
6 ?RCS: License or the Artistic License, as specified in the README file.
8 ?MAKE:run to from targetarch targetdir targetmkdir targethost targetport usecrosscompile: \
9 src test rm echo sed mkdir cp chmod
10 ?MAKE: -pick add $@ %<
13 ?S: This variable conditionally defines the USE_CROSS_COMPILE symbol,
14 ?S: and indicates that Perl has been cross-compiled.
17 ?S: This variable contains the command used by Configure
18 ?S: to copy and execute a cross-compiled executable in the
19 ?S: target host. Useful and available only during Perl build.
20 ?S: Empty string '' if not cross-compiling.
23 ?S: This variable contains the command used by Configure
24 ?S: to copy files from the target host. Useful and available
25 ?S: only during Perl build.
26 ?S: The string ':' if not cross-compiling.
29 ?S: This variable contains the command used by Configure
30 ?S: to copy to from the target host. Useful and available
31 ?S: only during Perl build.
32 ?S: The string ':' if not cross-compiling.
35 ?S: If cross-compiling, this variable contains the target architecture.
36 ?S: If not, this will be empty.
39 ?S: This variable contains a path that will be created on the target
40 ?S: host using targetmkdir, and then used to copy the cross-compiled
41 ?S: executables to. Defaults to '/tmp' if not set.
44 ?S: This variable contains the command used by Configure to create a
45 ?S: new directory on the target host.
48 ?S: This variable contains the name of a separate host machine that
49 ?S: can be used to run compiled test programs and perl tests on.
50 ?S: Set to empty string if not in use.
53 ?S: This variable contains the number of a network port to be used to
54 ?S: connect to the host in targethost, if unset defaults to 22 for ssh.
57 ?C: This symbol, if defined, indicates that Perl is being cross-compiled.
60 ?C: This symbol, if defined, indicates the target architecture
61 ?C: Perl has been cross-compiled to. Undefined if not a cross-compile.
63 ?H:?%<:#ifndef USE_CROSS_COMPILE
64 ?H:?%<:#$usecrosscompile USE_CROSS_COMPILE /**/
65 ?H:?%<:#define PERL_TARGETARCH "$targetarch" /**/
70 ?T:croak pwd exe f q cwd file xxx
71 ?LINT:extern usecrosscompile
77 ?LINT:extern targetport
78 ?LINT:extern targetdir
79 ?LINT:extern targetuser
80 ?LINT:change targetuser
81 ?LINT:extern targetrun
82 ?LINT:extern targetfrom
84 ?LINT:change targetrun
85 ?LINT:change targetfrom
89 ?LINT:extern locincpth
90 ?LINT:extern loclibpth
91 ?LINT:change locincpth
92 ?LINT:change loclibpth
94 ?LINT:extern hostgenerate
95 : Check for Cross-Compilation
96 ?X: targethost mainly set to allow ?S: documentation
97 ?X:otherwise it could have been declared extern
98 if $test "X$targethost" = "X"; then
101 case "$usecrosscompile" in
103 $echo "Cross-compiling..."
106 *-gcc*|*-g++*) # A cross-compiling gcc, probably.
107 # arm-linux-androideabi-gcc -> arm-linux-androideabi
108 # x86_64-w64-mingw32-gcc.exe -> x86_64-w64-mingw32
109 targetarch=`$echo $cc|$sed 's/-g[c\+][c\+].*$//'`
110 ar=`$echo $cc|$sed 's/-g[c\+][c\+]/-ar/'`
111 # leave out ld, choosing it is more complex
112 nm=`$echo $cc|$sed 's/-g[c\+][c\+]/-nm/'`
113 ranlib=`$echo $cc|$sed 's/-g[c\+][c\+]/-ranlib/'`
114 # We are in a weird spot. Just before us, some values
115 # were 'saved', to be restored after the hints are
116 # run. This means that the changes we made to ar,
117 # nm and ranlib will get reverted.
118 # To avoid that, we hijack the saving mechanism and
119 # have it save our new values.
120 for file in ar nm ranlib; do
127 case "$targetarch" in
128 '') echo "Targetarch not defined." >&4; croak=y ;;
129 *) echo "Using targetarch $targetarch." >&4 ;;
131 case "$targethost" in
132 '') echo "Targethost not defined." >&4; croak=y ;;
133 *) echo "Using targethost $targethost." >&4
138 y) echo "Cannot continue, aborting." >&4; exit 1 ;;
141 /*) run=$src/Cross/run
142 targetmkdir=$src/Cross/mkdir
146 *) pwd=`$test -f ../Configure & cd ..; pwd`
148 targetmkdir=$pwd/Cross/mkdir
159 case "$targetfrom" in
160 '') targetfrom=scp ;;
164 from=$from-$targetfrom
167 echo "Guessing targetdir $targetdir." >&4
170 case "$targetuser" in
172 echo "Guessing targetuser $targetuser." >&4
175 case "$targetport" in
177 echo "Guessing targetport $targetport." >&4
180 case "$targetfrom" in
196 '') cwd=$targetdir ;;
201 $targetrun -p $targetport -l $targetuser $targethost "cd \$cwd && ./\$exe \$@"
204 *) echo "Unknown targetrun '$targetrun'" >&4
208 case "$targetmkdir" in
210 cat >$targetmkdir <<EOF
212 $targetrun -p $targetport -l $targetuser $targethost "mkdir -p \$@"
214 $chmod a+rx $targetmkdir
216 *) echo "Unknown targetmkdir '$targetmkdir'" >&4
228 $targetmkdir \`dirname \$f\`
229 $targetto -P $targetport $q \$f $targetuser@$targethost:\$f || exit 1
232 $targetmkdir $targetdir/\`dirname \$f\`
233 $targetto -P $targetport $q \$f $targetuser@$targethost:$targetdir/\$f || exit 1
246 $mkdir -p $targetdir/\`dirname \$f\`
247 $cp \$f $targetdir/\$f || exit 1
250 $targetmkdir $targetdir/\`dirname \$f\`
251 $cp \$f $targetdir/\$f || exit 1
258 *) echo "Unknown targetto '$targetto'" >&4
262 case "$targetfrom" in
269 $targetfrom -P $targetport $q $targetuser@$targethost:$targetdir/\$f . || exit 1
279 cp $targetdir/\$f . || exit 1
284 *) echo "Unknown targetfrom '$targetfrom'" >&4
288 if $test ! -f $run; then
289 echo "Target 'run' script '$run' not found." >&4
293 if $test ! -f $to; then
294 echo "Target 'to' script '$to' not found." >&4
298 if $test ! -f $from; then
299 echo "Target 'from' script '$from' not found." >&4
303 if $test ! -f $run -o ! -f $to -o ! -f $from; then
307 Using '$run' for remote execution,
308 and '$from' and '$to'
309 for remote file transfer.
315 usecrosscompile='undef'