Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Jrobinson/configure for cross #2

Closed
wants to merge 17 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
451 changes: 278 additions & 173 deletions Configure

Large diffs are not rendered by default.

31 changes: 29 additions & 2 deletions Makefile.SH
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,11 @@ 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

# These variables may need to be manually set for non-Unix systems.
AR = $full_ar
Expand Down Expand Up @@ -664,10 +668,22 @@ 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 test "X$hostgenerate" != X; then
$spitshell >>$Makefile <<'!NO!SUBS!'
generate_uudmap$(HOST_EXE_EXT): generate_uudmap$(OBJ_EXT)
-@rm generate_uudmap$(HOST_EXE_EXT)
ln -s $(HOST_GENERATE) generate_uudmap$(HOST_EXE_EXT)
!NO!SUBS!
else
$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!
fi

$spitshell >>$Makefile <<'!NO!SUBS!'
miniperlmain$(OBJ_EXT): miniperlmain.c patchlevel.h
$(CCCMD) $(PLDLFLAGS) $*.c

Expand Down Expand Up @@ -875,13 +891,23 @@ $(MINIPERL_EXE): $& $(mini_obj)
!NO!SUBS!
;;
*)
$spitshell >>$Makefile <<'!NO!SUBS!'
if test "X$hostperl" != X; then
$spitshell >>$Makefile <<'!NO!SUBS!'
$(MINIPERL_EXE): $& $(mini_obj)
-@rm -f miniperl.xok
-@rm $(MINIPERL_EXE)
ln -s $(HOST_PERL) $(MINIPERL_EXE)
$(LDLIBPTH) $(RUN) ./miniperl$(HOST_EXE_EXT) -w -Ilib -MExporter -e '<?>' || $(MAKE) minitest
!NO!SUBS!
else
$spitshell >>$Makefile <<'!NO!SUBS!'
$(MINIPERL_EXE): $& $(mini_obj)
-@rm -f miniperl.xok
$(LDLIBPTH) $(CC) $(CLDFLAGS) -o $(MINIPERL_EXE) \
$(mini_obj) $(libs)
$(LDLIBPTH) $(RUN) ./miniperl$(HOST_EXE_EXT) -w -Ilib -MExporter -e '<?>' || $(MAKE) minitest
!NO!SUBS!
fi
;;
esac

Expand Down Expand Up @@ -1248,6 +1274,7 @@ realclean: _realcleaner _mopup

_clobber:
-@rm -f Cross/run-* Cross/to-* Cross/from-*
-rm -r host
rm -f t/test_state
rm -f config.sh cppstdin Policy.sh extras.lst

Expand Down
2 changes: 0 additions & 2 deletions cpan/ExtUtils-MakeMaker/lib/ExtUtils/MM_Unix.pm
Original file line number Diff line number Diff line change
Expand Up @@ -1036,8 +1036,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.
Expand Down
7 changes: 5 additions & 2 deletions ext/Errno/Errno_pm.PL
Original file line number Diff line number Diff line change
Expand Up @@ -136,10 +136,13 @@ sub get_files {
$Config{gccversion} !~ /intel/i
# might be using, say, Intel's icc
) {
# When cross-compiling we may store a path for gcc's "sysroot" option:
my $sysroot = $Config{sysroot} || '';
# Some Linuxes have weird errno.hs which generate
# no #file or #line directives
my $linux_errno_h = -e '/usr/include/errno.h' ?
'/usr/include/errno.h' : '/usr/local/include/errno.h';
my $linux_errno_h = -e "$sysroot/usr/include/errno.h"
? "$sysroot/usr/include/errno.h"
: "$sysroot/usr/local/include/errno.h";
$file{$linux_errno_h} = 1;
} elsif ($^O eq 'beos' || $^O eq 'haiku') {
# hidden in a special place
Expand Down
100 changes: 100 additions & 0 deletions hints/linux-androideabi.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
# set -x

# Having fun with the dlopen check.. :(
#d_dlopen='define'
#d_dlerror='define'


case "$src" in
/*) run=$src/Cross/run
targetmkdir=$src/Cross/mkdir
to=$src/Cross/to
from=$src/Cross/from
;;
*) pwd=`test -f ../Configure && cd ..; pwd`
run=$pwd/Cross/run
targetmkdir=$pwd/Cross/mkdir
to=$pwd/Cross/to
from=$pwd/Cross/from
;;
esac

targetrun=adb-shell
targetto=adb-push
targetfrom=adb-pull
run=$run-$targetrun
to=$to-$targetto
from=$from-$targetfrom

cat >$run <<EOF
#!/bin/sh
doexit="echo \\\$?"
case "\$1" in
-cwd)
shift
cwd=\$1
shift
;;
esac
case "\$cwd" in
'') cwd=$targetdir ;;
esac
exe=\$1
shift
$to \$exe > /dev/null 2>&1

# send copy results to /dev/null as otherwise it outputs speed stats which gets in our way.
foo=\`adb -s $targethost shell "sh -c '(cd \$cwd && \$exe \$@ > \$exe.stdout) ; \$doexit '"\`
# We get back Ok\r\n on android for some reason, grrr:
$from \$exe.stdout
result=\`cat \$exe.stdout\`
rm \$exe.stdout
foo=\`echo \$foo | sed -e 's|\r||g'\`
# Also, adb doesn't exit with the commands exit code, like ssh does, double-grr
echo \$result
exit \$foo
# if test "X\$doexit" != X; then
# exit \$foo
#else
# echo \$foo
#fi

EOF
chmod a+rx $run

cat >$targetmkdir <<EOF
#!/bin/sh
adb -s $targethost shell "mkdir -p \$@"
EOF
chmod a+rx $targetmkdir

cat >$to <<EOF
#!/bin/sh
for f in \$@
do
case "\$f" in
/*)
$targetmkdir \`dirname \$f\`
adb -s $targethost push \$f \$f || exit 1
;;
*)
$targetmkdir $targetdir/\`dirname \$f\`
(adb -s $targethost push \$f $targetdir/\$f < /dev/null 2>&1) || exit 1
;;
esac
done
exit 0
EOF
chmod a+rx $to

cat >$from <<EOF
#!/bin/sh
for f in \$@
do
$rm -f \$f
(adb -s $targethost pull $targetdir/\$f . > /dev/null 2>&1) || exit 1
done
exit 0
EOF
chmod a+rx $from

13 changes: 5 additions & 8 deletions make_ext.pl
Original file line number Diff line number Diff line change
Expand Up @@ -118,9 +118,6 @@
# 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 '') {
Expand Down Expand Up @@ -425,8 +422,8 @@ sub build_extension {
}
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
Expand Down Expand Up @@ -482,11 +479,11 @@ sub build_extension {
# 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: $!";
Expand Down
6 changes: 1 addition & 5 deletions perl.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,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
Expand Down
6 changes: 1 addition & 5 deletions perlio.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,7 @@
#ifdef PERL_MICRO
# include "uconfig.h"
#else
# ifndef USE_CROSS_COMPILE
# include "config.h"
# else
# include "xconfig.h"
# endif
# include "config.h"
#endif

#define PERLIO_NOT_STDIO 0
Expand Down
2 changes: 1 addition & 1 deletion utils/Makefile.SH
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ cat >Makefile <<!GROK!THIS!

PERL = $perl
REALPERL = ../perl
RUN = $run # Used mainly cross-compilation setups.
RUN = # Used mainly cross-compilation setups.

!GROK!THIS!

Expand Down
2 changes: 2 additions & 0 deletions write_buildcustomize.pl
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#!./miniperl -w

use strict;
use Config;
if (@ARGV) {
my $dir = shift;
chdir $dir or die "Can't chdir '$dir': $!";
Expand Down Expand Up @@ -52,4 +53,5 @@
# Reset \@INC completely, adding the directories we need, and removing the
# installed directories (which we don't need to read, and may confuse us)
\@INC = ($inc);
\$^O = '$Config{osname}';
EOT
2 changes: 1 addition & 1 deletion x2p/Makefile.SH
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ OPTIMIZE = $optimize

.SUFFIXES: .c \$(OBJ_EXT)

RUN = $run
RUN =
PERL = $perl

!GROK!THIS!
Expand Down