From 16fa9806894bd4142496305e1d9d0317f5e7c14f Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Tue, 12 Nov 2013 14:24:53 -0400 Subject: [PATCH] separate android 4.0 and 4.3 builds needed Also, parameterize the abdroid abi version --- Makefile | 14 ++++++++------ debian/changelog | 2 ++ doc/bugs/git-annex_broken_on_Android_4.3.mdwn | 4 ++++ doc/install/Android.mdwn | 11 ++++++++--- git-annex.cabal | 2 -- standalone/android/Makefile | 13 +++++++++---- standalone/android/abiversion | 1 + standalone/android/buildchroot | 1 + standalone/android/buildchroot-inchroot-asuser | 3 +-- standalone/android/clean-haskell-packages | 4 ++-- standalone/android/install-haskell-packages | 2 +- 11 files changed, 37 insertions(+), 20 deletions(-) create mode 100644 standalone/android/abiversion diff --git a/Makefile b/Makefile index eb53ac8438..3f3ed350a4 100644 --- a/Makefile +++ b/Makefile @@ -189,14 +189,16 @@ android: Build/EvilSplicer sed -i 's/GHC-Options: \(.*\)-Wall/GHC-Options: \1-Wall -fno-warn-unused-imports /i' tmp/androidtree/git-annex.cabal # Cabal cannot cross compile with custom build type, so workaround. sed -i 's/Build-type: Custom/Build-type: Simple/' tmp/androidtree/git-annex.cabal +# Build just once, but link twice, for 2 different versions of Android. + mkdir -p tmp/androidtree/dist/build/git-annex/4.0 tmp/androidtree/dist/build/git-annex/4.3 if [ ! -e tmp/androidtree/dist/setup/setup ]; then \ - cd tmp/androidtree && $$HOME/.ghc/android-14/arm-linux-androideabi-4.8/arm-linux-androideabi/bin/cabal configure -fAndroid $(ANDROID_FLAGS); \ + cd tmp/androidtree && $$HOME/.ghc/$(shell cat standalone/android/abiversion)/arm-linux-androideabi/bin/cabal configure -fAndroid $(ANDROID_FLAGS); \ fi - cd tmp/androidtree && $$HOME/.ghc/android-14/arm-linux-androideabi-4.8/arm-linux-androideabi/bin/cabal build - -adb: - ANDROID_FLAGS="-Production" $(MAKE) android - adb push tmp/androidtree/dist/build/git-annex/git-annex /data/data/ga.androidterm/bin/git-annex + cd tmp/androidtree && $$HOME/.ghc/$(shell cat standalone/android/abiversion)/arm-linux-androideabi/bin/cabal build \ + && mv dist/build/git-annex/git-annex dist/build/git-annex/4.0/git-annex + cd tmp/androidtree && $$HOME/.ghc/$(shell cat standalone/android/abiversion)/arm-linux-androideabi/bin/cabal build \ + --ghc-options=-optl-z --ghc-options=-optlnocopyreloc \ + && mv dist/build/git-annex/git-annex dist/build/git-annex/4.3/git-annex androidapp: $(MAKE) android diff --git a/debian/changelog b/debian/changelog index bdc7c5e686..0f2ad007cd 100644 --- a/debian/changelog +++ b/debian/changelog @@ -24,6 +24,8 @@ git-annex (5.20131102) UNRELEASED; urgency=low remote monitoring interfaceat http://localhost:4242/ * Fix bug that caused bad information to be written to the git-annex branch when running describe or other commands with a remote that has no uuid. + * Work around Android linker problem that had prevented git-annex from + running on Android 4.3 and 4.4. -- Joey Hess Wed, 06 Nov 2013 16:14:14 -0400 diff --git a/doc/bugs/git-annex_broken_on_Android_4.3.mdwn b/doc/bugs/git-annex_broken_on_Android_4.3.mdwn index da1f7fd282..4c1b356fb4 100644 --- a/doc/bugs/git-annex_broken_on_Android_4.3.mdwn +++ b/doc/bugs/git-annex_broken_on_Android_4.3.mdwn @@ -1,3 +1,7 @@ As per [[install/Android/#comment-e218073735d67691a2c3f66cc53ca6ac]] and [[install/Android/#comment-29bd13ab9cb830ffcd7850b84fb111c8]] : git-annex is broken on Android 4.3; both on Nexus 4 and Nexus 7. + +> [[Fixed|done]]. A 4.3 build of the apk is now available. +> (Unfortunately the fix breaks support for older versions of Android, +> so two versions of the apk have to be built now.) --[[Joey]] diff --git a/doc/install/Android.mdwn b/doc/install/Android.mdwn index c39d115684..e7eac8b3cf 100644 --- a/doc/install/Android.mdwn +++ b/doc/install/Android.mdwn @@ -7,15 +7,20 @@ Now git-annex can be used on Android! First, ensure your Android device is configured to allow installation of the app. Go to Setup -> Security, and enable "Unknown Sources". -[Download the git-annex.apk](http://downloads.kitenet.net/git-annex/android/current/) -onto your Android device, and open it to install. +Then download the git-annex.apk for your version of Android, and +open it to install. + +* [Android 4.4 and 4.3 git-annex.apk](http://downloads.kitenet.net/git-annex/android/current/4.3/git-annex.apk) +* [Android 4.0 to 4.2 git-annex.apk](http://downloads.kitenet.net/git-annex/android/current/4.0/git-annex.apk) ## autobuilds A daily build is also available, thanks to Mesar Hameed and the University of Bath CS department. -* [download apk](http://downloads.kitenet.net/git-annex/autobuild/android/git-annex.apk) ([build logs](http://downloads.kitenet.net/git-annex/autobuild/android/)) +* [Android 4.4 and 4.3 git-annex.apk](http://downloads.kitenet.net/git-annex/autobuild/android/4.3/git-annex.apk) +* [Android 4.0 and 4.2 git-annex.apk](http://downloads.kitenet.net/git-annex/autobuild/android/4.0/git-annex.apk) +* [build logs](http://downloads.kitenet.net/git-annex/autobuild/android/) ## building it yourself diff --git a/git-annex.cabal b/git-annex.cabal index 905b77f97d..848477c187 100644 --- a/git-annex.cabal +++ b/git-annex.cabal @@ -131,8 +131,6 @@ Executable git-annex if flag(Android) Build-Depends: data-endian CPP-Options: -D__ANDROID__ - -- Avoid R_ARM_COPY problem which breaks Android linker - GHC-Options: -optl-z -optlnocopyreloc if flag(Assistant) if os(linux) && flag(Inotify) diff --git a/standalone/android/Makefile b/standalone/android/Makefile index 2b326abc72..d80d568dbb 100644 --- a/standalone/android/Makefile +++ b/standalone/android/Makefile @@ -2,7 +2,7 @@ # and builds the Android app. # Add Android cross-compiler to PATH (as installed by ghc-android) -ANDROID_CROSS_COMPILER?=$(HOME)/.ghc/android-14/arm-linux-androideabi-4.8/bin +ANDROID_CROSS_COMPILER?=$(HOME)/.ghc/$(shell cat abiversion)/bin PATH:=$(ANDROID_CROSS_COMPILER):$(PATH) # Paths to the Android SDK and NDK. @@ -31,7 +31,6 @@ build: start # Install executables as pseudo-libraries so they will be # unpacked from the .apk. mkdir -p $(GIT_ANNEX_ANDROID_SOURCETREE)/term/libs/armeabi - cp ../../tmp/androidtree/dist/build/git-annex/git-annex $(GIT_ANNEX_ANDROID_SOURCETREE)/term/libs/armeabi/lib.git-annex.so cp $(GIT_ANNEX_ANDROID_SOURCETREE)/busybox/busybox $(GIT_ANNEX_ANDROID_SOURCETREE)/term/libs/armeabi/lib.busybox.so cp $(GIT_ANNEX_ANDROID_SOURCETREE)/openssh/ssh $(GIT_ANNEX_ANDROID_SOURCETREE)/term/libs/armeabi/lib.ssh.so cp $(GIT_ANNEX_ANDROID_SOURCETREE)/openssh/ssh-keygen $(GIT_ANNEX_ANDROID_SOURCETREE)/term/libs/armeabi/lib.ssh-keygen.so @@ -74,9 +73,15 @@ build: start git rev-parse HEAD > $(GIT_ANNEX_ANDROID_SOURCETREE)/term/libs/armeabi/lib.version.so + mkdir -p ../../tmp/4.0 ../../tmp/4.3 + + cp ../../tmp/androidtree/dist/build/git-annex/4.3/git-annex $(GIT_ANNEX_ANDROID_SOURCETREE)/term/libs/armeabi/lib.git-annex.so cd $(GIT_ANNEX_ANDROID_SOURCETREE)/term && ant debug - mkdir -p ../../tmp - cp $(GIT_ANNEX_ANDROID_SOURCETREE)/term/bin/Term-debug.apk ../../tmp/git-annex.apk + cp $(GIT_ANNEX_ANDROID_SOURCETREE)/term/bin/Term-debug.apk ../../tmp/4.3/git-annex.apk + + cp ../../tmp/androidtree/dist/build/git-annex/4.0/git-annex $(GIT_ANNEX_ANDROID_SOURCETREE)/term/libs/armeabi/lib.git-annex.so + cd $(GIT_ANNEX_ANDROID_SOURCETREE)/term && ant debug + cp $(GIT_ANNEX_ANDROID_SOURCETREE)/term/bin/Term-debug.apk ../../tmp/4.0/git-annex.apk $(GIT_ANNEX_ANDROID_SOURCETREE)/openssl/build-stamp: cd $(GIT_ANNEX_ANDROID_SOURCETREE)/openssl && CC=$$(which cc) ./Configure android diff --git a/standalone/android/abiversion b/standalone/android/abiversion new file mode 100644 index 0000000000..4cc4c14cdb --- /dev/null +++ b/standalone/android/abiversion @@ -0,0 +1 @@ +android-14/arm-linux-androideabi-4.8 diff --git a/standalone/android/buildchroot b/standalone/android/buildchroot index b759ae6ce0..44337eb0c1 100755 --- a/standalone/android/buildchroot +++ b/standalone/android/buildchroot @@ -8,6 +8,7 @@ fi debootstrap --arch=i386 stable debian-stable-android cp $0-inchroot debian-stable-android/tmp cp $0-inchroot-asuser debian-stable-android/tmp +cp $(dirname $0)/abiversion debian-stable-android/tmp # Don't use these vars in the chroot. unset TMP diff --git a/standalone/android/buildchroot-inchroot-asuser b/standalone/android/buildchroot-inchroot-asuser index c3d7bdf76f..710e76e468 100755 --- a/standalone/android/buildchroot-inchroot-asuser +++ b/standalone/android/buildchroot-inchroot-asuser @@ -29,8 +29,7 @@ mv adt-bundle-linux-x86-* adt-bundle-linux-x86 rm -rf adt-bundle-linux-x86/eclipse # The git-annex android Makefile needs this cc symlink. -ln -s arm-linux-androideabi-gcc \ - $HOME/.ghc/android-14/arm-linux-androideabi-4.8/bin/cc +ln -s arm-linux-androideabi-gcc $HOME/.ghc/$(cat /tmp/abiversion)/bin/cc cd git clone git://git-annex.branchable.com/ git-annex diff --git a/standalone/android/clean-haskell-packages b/standalone/android/clean-haskell-packages index 49a2ad7136..b8c6132d6b 100755 --- a/standalone/android/clean-haskell-packages +++ b/standalone/android/clean-haskell-packages @@ -2,5 +2,5 @@ # Removes all currently installed cross-compiled haskell packages # except those part of ghc. # Useful if the build failed. -rm -f $(grep -l $HOME/.ghc/android-14/arm-linux-androideabi-4.8/.cabal/lib/ $HOME/.ghc/android-14/arm-linux-androideabi-4.8/lib/*-ghc-*/package.conf.d/*.conf) -$HOME/.ghc/android-14/arm-linux-androideabi-4.8/arm-linux-androideabi/bin/ghc-pkg recache +rm -f $(grep -l $HOME/.ghc/$(cat abiversion)/.cabal/lib/ $HOME/.ghc/android-14/arm-linux-androideabi-4.8/lib/*-ghc-*/package.conf.d/*.conf) +$HOME/.ghc/$(cat abiversion)/arm-linux-androideabi/bin/ghc-pkg recache diff --git a/standalone/android/install-haskell-packages b/standalone/android/install-haskell-packages index 10272919d3..f0a4b91139 100755 --- a/standalone/android/install-haskell-packages +++ b/standalone/android/install-haskell-packages @@ -115,6 +115,6 @@ echo echo echo cross build echo -PATH=$HOME/.ghc/android-14/arm-linux-androideabi-4.8/bin:$HOME/.ghc/android-14/arm-linux-androideabi-4.8/arm-linux-androideabi/bin:$PATH +PATH=$HOME/.ghc/$(cat abiversion)/bin:$HOME/.ghc/$(cat abiversion)/arm-linux-androideabi/bin:$PATH cabal update install_pkgs