Hints file for android cross-compiling.
authorJess Robinson <castaway@desert-island.me.uk>
Fri, 4 Jan 2013 10:48:34 +0000 (10:48 +0000)
committerBrian Fraser <fraserbn@gmail.com>
Sun, 26 Jan 2014 17:44:19 +0000 (14:44 -0300)
The hints file names for cross-compiling (currently) need to match the prefix of the cross-compiler used.

MANIFEST
hints/linux-android.sh [new file with mode: 0644]

index 878a915..7d7c2bf 100644 (file)
--- a/MANIFEST
+++ b/MANIFEST
@@ -4031,6 +4031,7 @@ hints/irix_6_1.sh         Hints for named architecture
 hints/irix_6.sh                        Hints for named architecture
 hints/isc_2.sh                 Hints for named architecture
 hints/isc.sh                   Hints for named architecture
+hints/linux-android.sh         Hints for named architecture
 hints/linux.sh                 Hints for named architecture
 hints/lynxos.sh                        Hints for named architecture
 hints/midnightbsd.sh           Hints for named architecture
diff --git a/hints/linux-android.sh b/hints/linux-android.sh
new file mode 100644 (file)
index 0000000..d2f4118
--- /dev/null
@@ -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
+