X-Git-Url: https://perl5.git.perl.org/perl5.git/blobdiff_plain/8995f03f98085ffc6f8f1458d5d32bcb87ed7964..6fa2dc60899234df7bde728354b58afa2779105e:/hints/linux-android.sh diff --git a/hints/linux-android.sh b/hints/linux-android.sh index 8566f62..6a59cb7 100644 --- a/hints/linux-android.sh +++ b/hints/linux-android.sh @@ -1,7 +1,9 @@ # set -x # Install the perl and its libraries anywhere: -userelocatableinc='define' +case "$userelocatableinc" in +'') userelocatableinc='define' ;; +esac # The Android linker has some unusual behavior: No matter what # path is passed in to dlopen(), it'll only use the path's @@ -18,12 +20,22 @@ d_libname_unique='define' # On Android the shell is /system/bin/sh: targetsh='/system/bin/sh' +case "$usecrosscompile" in +define) ;; + # If we aren't cross-compiling, then sh should also point + # to /system/bin/sh. +*) sh=$targetsh ;; +esac + +# Make sure that we look for libm +libswanted="$libswanted m" # Down with locales! # https://github.com/android/platform_bionic/blob/master/libc/CAVEATS d_locconv='undef' d_setlocale='undef' d_setlocale_r='undef' +d_lc_monetary_2008='undef' i_locale='undef' # https://code.google.com/p/android-source-browsing/source/browse/libc/netbsd/net/getservent_r.c?repo=platform--bionic&r=ca6fe7bebe3cc6ed7e2db5a3ede2de0fcddf411d#95 @@ -40,14 +52,14 @@ d_getservent_r='undef' # getusershell setusershell endusershell # This script UU/archname.cbu will get 'called-back' by Configure. -cat > UU/archname.cbu <<'EOCBU' +$cat > UU/archname.cbu <<'EOCBU' # egrep pattern to detect a stub warning on Android. # Right now we're checking for: # Android 2.x: FIX ME! implement FUNC # Android 4.x: FUNC is not implemented on Android android_stub='FIX|Android' -cat > try.c << 'EOM' +$cat > try.c << 'EOM' #include int main() { (void) getnetbyname("foo"); return(0); } EOM @@ -57,7 +69,7 @@ if test "X$android_warn" != X; then d_getnbyname="$undef" fi -cat > try.c << 'EOM' +$cat > try.c << 'EOM' #include int main() { (void) getnetbyaddr((uint32_t)1, AF_INET); return(0); } EOM @@ -67,7 +79,7 @@ if test "X$android_warn" != X; then d_getnbyaddr="$undef" fi -cat > try.c << 'EOM' +$cat > try.c << 'EOM' #include #include #include @@ -79,7 +91,7 @@ if test "X$android_warn" != X; then d_getmntent="$undef" fi -cat > try.c << 'EOM' +$cat > try.c << 'EOM' #include int main() { (void) getprotobyname("foo"); return(0); } EOM @@ -89,7 +101,7 @@ if test "X$android_warn" != X; then d_getpbyname="$undef" fi -cat > try.c << 'EOM' +$cat > try.c << 'EOM' #include int main() { (void) getprotobynumber(1); return(0); } EOM @@ -99,7 +111,7 @@ if test "X$android_warn" != X; then d_getpbynumber="$undef" fi -cat > try.c << 'EOM' +$cat > try.c << 'EOM' #include #include int main() { endpwent(); return(0); } @@ -110,7 +122,7 @@ if test "X$android_warn" != X; then d_endpwent="$undef" fi -cat > try.c << 'EOM' +$cat > try.c << 'EOM' #include int main() { (void) ttyname(STDIN_FILENO); return(0); } EOM @@ -122,6 +134,10 @@ fi EOCBU +if $test "X$targetrun" = "Xadb"; then + +$rm $run $to $from $targetmkdir + case "$src" in /*) run=$src/Cross/run targetmkdir=$src/Cross/mkdir @@ -135,7 +151,7 @@ case "$src" in from=$pwd/Cross/from ;; esac - + targetrun=adb-shell targetto=adb-push targetfrom=adb-pull @@ -143,7 +159,7 @@ run=$run-$targetrun to=$to-$targetto from=$from-$targetfrom -cat >$run <$run < /dev/null 2>&1 # sometimes there is no $?, I dunno why? we then get Cross/run-adb-shell: line 39: exit: XX: numeric argument required adb -s $targethost shell "sh -c '(cd \$cwd && \$env ; \$exe \$args > $targetdir/output.stdout 2>$targetdir/output.stderr) ; \$doexit '" > /dev/null +rm output.stdout output.stderr output.status 2>/dev/null + $from output.stdout $from output.stderr $from output.status -result=\`cat output.stdout\` -result_err=\`cat output.stderr\` -result_status=\`cat output.status\` -rm output.stdout output.stderr output.status - # We get back Ok\r\n on android for some reason, grrr: -result=\`echo "\$result" | sed -e 's|\r||g'\` -result_err=\`echo "\$result_err" | sed -e 's|\r||g'\` -result_status=\`echo \$result_status | sed -e 's|\r||g'\` - -echo "\$result" -if test "X\$result_err" != X; then - echo "\$result_err" >&2 +$cat output.stdout | $tr -d '\r' +if test -s output.stderr; then + $cat output.stderr | $tr -d '\r' >&2 fi +result_status=\`$cat output.status | $tr -d '\r'\` + +rm output.stdout output.stderr output.status + # Also, adb doesn't exit with the commands exit code, like ssh does, double-grr exit \$result_status EOF -chmod a+rx $run +$chmod a+rx $run -cat >$targetmkdir <$targetmkdir <$to <$to <&1) || exit 1 ;; esac done exit 0 EOF -chmod a+rx $to +$chmod a+rx $to -cat >$from <$from <> $pwd/config.arch + +osname='android' +eval "libpth='$libpth /system/lib /vendor/lib'" + +if $test "X$procselfexe" = X; then + case "$d_procselfexe" in + define) procselfexe='"/proc/self/exe"';; + esac +fi +EOO +# Android is a linux variant, so run those hints. +. ./hints/linux.sh