3 # Install the perl and its libraries anywhere:
4 case "$userelocatableinc" in
5 '') userelocatableinc='define' ;;
8 # The Android linker has some unusual behavior: No matter what
9 # path is passed in to dlopen(), it'll only use the path's
10 # basename when trying to find a cached library.
11 # Unfortunately, this is quite problematic for us, since for example,
12 # Hash::Util and List::Util both end up creating a Util.so --
13 # So if you load List::Util and then Hash::Util, the dlopen() for
14 # the latter will return the handle for the former.
15 # See the implementation for details:
16 # https://code.google.com/p/android-source-browsing/source/browse/linker/linker.c?repo=platform--bionic&r=9ec0f03a0d0b17bbb94ac0b9fef6add28a133c3a#1231
17 # What d_libname_unique does is inform MakeMaker that, rather than
18 # creating Hash/Util/Util.so, it needs to make Hash/Util/Perl_Hash_Util.so
19 d_libname_unique='define'
21 # On Android the shell is /system/bin/sh:
22 targetsh='/system/bin/sh'
23 case "$usecrosscompile" in
25 # If we aren't cross-compiling, then sh should also point
30 # Make sure that we look for libm
31 libswanted="$libswanted m log"
33 # Older Androids lack locale support and may need the following undefs
34 # uncommenting. This isn't necessary from at least Android 8.1 (Oreo)
35 # https://github.com/android/platform_bionic/blob/master/libc/CAVEATS
38 #d_setlocale_r='undef'
39 #d_lc_monetary_2008='undef'
43 # https://code.google.com/p/android-source-browsing/source/browse/libc/netbsd/net/getservent_r.c?repo=platform--bionic&r=ca6fe7bebe3cc6ed7e2db5a3ede2de0fcddf411d#95
44 d_getservent_r='undef'
46 # Bionic defines several stubs that warn (in older releases) and return NULL
47 # https://gitorious.org/0xdroid/bionic/blobs/70b2ef0ec89a9c9d4c2d4bcab728a0e72bafb18e/libc/bionic/stubs.c
48 # https://android.googlesource.com/platform/bionic/+/master/libc/bionic/stubs.cpp
50 # These tests originally looked for 'FIX' or 'Android' warnings, as they
51 # indicated stubs to avoid. At some point, Android stopped emitting
52 # those warnings; the tests were adapted to check function return values
53 # and hopefully now detect stubs on both older and newer Androids.
55 # These are all stubs as well, but the core doesn't use them:
56 # getusershell setusershell endusershell
58 # This script UU/archname.cbu will get 'called-back' by Configure.
59 $cat > UU/archname.cbu <<'EOCBU'
60 # original egrep pattern to detect a stub warning on Android.
61 # Right now we're checking for:
62 # Android 2.x: FIX ME! implement FUNC
63 # Android 4.x: FUNC is not implemented on Android
64 # Android 8.x: <no warnings; tests now printf a compatible warning>
65 android_stub='FIX|Android'
71 struct netent* test = getnetbyname("loopback");
73 printf("getnetbyname is still a stub function on Android");
78 $cc $ccflags try.c -o try
79 android_warn=`$run ./try 2>&1 | $egrep "$android_stub"`
80 if test "X$android_warn" != X; then
88 struct netent* test = getnetbyaddr(127, AF_INET);
90 printf("getnetbyaddr is still a stub function on Android");
95 $cc $ccflags try.c -o try
96 android_warn=`$run ./try 2>&1 | $egrep "$android_stub"`
97 if test "X$android_warn" != X; then
101 $cat > try.c << 'EOM'
105 int main() { (void) getmntent(stdout); return(0); }
107 $cc $ccflags try.c -o try
108 android_warn=`$run ./try 2>&1 | $egrep "$android_stub"`
109 if test "X$android_warn" != X; then
113 $cat > try.c << 'EOM'
117 struct protoent* test = getprotobyname("tcp");
119 printf("getprotobyname is still a stub function on Android");
124 $cc $ccflags try.c -o try
125 android_warn=`$run ./try 2>&1 | $egrep "$android_stub"`
126 if test "X$android_warn" != X; then
127 d_getpbyname="$undef"
130 $cat > try.c << 'EOM'
134 struct protoent* test = getprotobynumber(1);
136 printf("getprotobynumber is still a stub function on Android");
141 $cc $ccflags try.c -o try
142 android_warn=`$run ./try 2>&1 | $egrep "$android_stub"`
143 if test "X$android_warn" != X; then
144 d_getpbynumber="$undef"
147 $cat > try.c << 'EOM'
148 #include <sys/types.h>
150 int main() { endpwent(); return(0); }
152 $cc $ccflags try.c -o try
153 android_warn=`$run ./try 2>&1 | $egrep "$android_stub"`
154 if test "X$android_warn" != X; then
158 $cat > try.c << 'EOM'
162 char *tty = ttyname(STDIN_FILENO);
164 printf("ttyname is still a stub function on Android");
169 $cc $ccflags try.c -o try
170 android_warn=`$run ./try 2>&1 | $egrep "$android_stub"`
171 if test "X$android_warn" != X; then
177 if $test "X$targetrun" = "Xadb"; then
179 $rm $run $to $from $targetmkdir
182 /*) run=$src/Cross/run
183 targetmkdir=$src/Cross/mkdir
187 *) pwd=`test -f ../Configure && cd ..; pwd`
189 targetmkdir=$pwd/Cross/mkdir
200 from=$from-$targetfrom
204 doexit="echo \\\$? >$targetdir/output.status"
221 '') cwd=$targetdir ;;
229 $to \$exe > /dev/null 2>&1
231 # send copy results to /dev/null as otherwise it outputs speed stats which gets in our way.
232 # sometimes there is no $?, I dunno why? we then get Cross/run-adb-shell: line 39: exit: XX: numeric argument required
233 adb -s $targethost shell "sh -c '(cd \$cwd && \$env ; \$exe \$args > $targetdir/output.stdout 2>$targetdir/output.stderr) ; \$doexit '" > /dev/null
235 rm output.stdout output.stderr output.status 2>/dev/null
241 # We get back Ok\r\n on android for some reason, grrr:
242 $cat output.stdout | $tr -d '\r'
243 if test -s output.stderr; then
244 $cat output.stderr | $tr -d '\r' >&2
247 result_status=\`$cat output.status | $tr -d '\r'\`
249 rm output.stdout output.stderr output.status
251 # Also, adb doesn't exit with the commands exit code, like ssh does, double-grr
257 $cat >$targetmkdir <<EOF
259 adb -s $targethost shell "mkdir -p \$@"
261 $chmod a+rx $targetmkdir
269 adb -s $targethost push \$f \$f || exit 1
272 (adb -s $targethost push \$f $targetdir/\$f < /dev/null 2>&1) || exit 1
285 (adb -s $targethost pull $targetdir/\$f . > /dev/null 2>&1) || exit 1
291 fi # Cross-compiling with adb
293 case "$usecrosscompile" in
295 # The tests for this in Configure doesn't play nicely with
297 d_procselfexe="define"
298 if $test "X$hostosname" = "Xdarwin"; then
299 firstmakefile=GNUmakefile;
302 # When cross-compiling, full_csh and d_csh will get the
303 # host's values, which is all sorts of wrong. So unless
304 # full_csh has been set on the command line, set d_csh to
313 ldflags="$ldflags -L/system/lib"
317 osvers="`$run getprop ro.build.version.release`"
319 # We want osname to be linux-android during Configure,
320 # but plain 'android' afterwards.
323 *) pwd=`test -f ../Configure && cd ..; pwd`
327 $cat <<'EOO' >> $pwd/config.arch
330 eval "libpth='$libpth /system/lib /vendor/lib'"
332 if $test "X$procselfexe" = X; then
333 case "$d_procselfexe" in
334 define) procselfexe='"/proc/self/exe"';;
339 # Android is a linux variant, so run those hints.