2013-02-21 16:47:16 +00:00
|
|
|
# Cross-compiles utilities needed for git-annex on Android,
|
|
|
|
# and builds the Android app.
|
2013-02-13 20:23:06 +00:00
|
|
|
|
|
|
|
# Add Android cross-compiler to PATH (as installed by ghc-android)
|
2013-11-12 18:24:53 +00:00
|
|
|
ANDROID_CROSS_COMPILER?=$(HOME)/.ghc/$(shell cat abiversion)/bin
|
2013-02-26 02:41:54 +00:00
|
|
|
PATH:=$(ANDROID_CROSS_COMPILER):$(PATH)
|
2013-02-13 20:23:06 +00:00
|
|
|
|
2013-02-21 16:47:16 +00:00
|
|
|
# Paths to the Android SDK and NDK.
|
2013-09-23 18:20:13 +00:00
|
|
|
export ANDROID_SDK_ROOT?=$(HOME)/.android/adt-bundle-linux-x86/sdk
|
|
|
|
export ANDROID_NDK_ROOT?=$(HOME)/.android/android-ndk
|
2013-02-13 20:23:06 +00:00
|
|
|
|
2013-06-01 01:28:37 +00:00
|
|
|
# Where to store the source tree used to build utilities. This
|
2013-02-28 06:42:59 +00:00
|
|
|
# directory will be created by `make source`.
|
2013-09-23 18:20:13 +00:00
|
|
|
GIT_ANNEX_ANDROID_SOURCETREE?=$(HOME)/.android/git-annex-sourcetree
|
2013-02-28 06:42:59 +00:00
|
|
|
|
|
|
|
GITTREE=$(GIT_ANNEX_ANDROID_SOURCETREE)/git/installed-tree
|
2013-02-21 16:47:16 +00:00
|
|
|
|
2013-11-26 17:24:24 +00:00
|
|
|
VER=$(shell perl -e '$$_=<>;print m/\((.*?)\)/'<../../CHANGELOG)
|
|
|
|
|
2013-02-26 03:05:45 +00:00
|
|
|
build: start
|
2013-09-23 02:23:08 +00:00
|
|
|
if [ ! -e "$(GIT_ANNEX_ANDROID_SOURCETREE)" ]; then $(MAKE) source; fi
|
2013-04-26 20:43:40 +00:00
|
|
|
$(MAKE) $(GIT_ANNEX_ANDROID_SOURCETREE)/openssl/build-stamp
|
|
|
|
$(MAKE) $(GIT_ANNEX_ANDROID_SOURCETREE)/openssh/build-stamp
|
|
|
|
$(MAKE) $(GIT_ANNEX_ANDROID_SOURCETREE)/busybox/build-stamp
|
|
|
|
$(MAKE) $(GIT_ANNEX_ANDROID_SOURCETREE)/rsync/build-stamp
|
|
|
|
$(MAKE) $(GIT_ANNEX_ANDROID_SOURCETREE)/gnupg/build-stamp
|
|
|
|
$(MAKE) $(GIT_ANNEX_ANDROID_SOURCETREE)/git/build-stamp
|
|
|
|
$(MAKE) $(GIT_ANNEX_ANDROID_SOURCETREE)/term/build-stamp
|
2013-02-26 03:05:45 +00:00
|
|
|
|
2013-11-26 17:24:24 +00:00
|
|
|
perl -i -pe 's/(android:versionName=)"[^"]+"/$$1"'$(VER)'"/' $(GIT_ANNEX_ANDROID_SOURCETREE)/term/AndroidManifest.xml
|
|
|
|
|
2013-02-21 16:47:16 +00:00
|
|
|
# Debug build because it does not need signing keys.
|
2013-02-28 06:42:59 +00:00
|
|
|
cd $(GIT_ANNEX_ANDROID_SOURCETREE)/term && tools/build-debug
|
2013-02-21 16:47:16 +00:00
|
|
|
|
|
|
|
# Install executables as pseudo-libraries so they will be
|
|
|
|
# unpacked from the .apk.
|
2013-02-28 06:42:59 +00:00
|
|
|
mkdir -p $(GIT_ANNEX_ANDROID_SOURCETREE)/term/libs/armeabi
|
|
|
|
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
|
|
|
|
cp $(GIT_ANNEX_ANDROID_SOURCETREE)/rsync/rsync $(GIT_ANNEX_ANDROID_SOURCETREE)/term/libs/armeabi/lib.rsync.so
|
|
|
|
cp $(GIT_ANNEX_ANDROID_SOURCETREE)/gnupg/g10/gpg $(GIT_ANNEX_ANDROID_SOURCETREE)/term/libs/armeabi/lib.gpg.so
|
|
|
|
cp $(GIT_ANNEX_ANDROID_SOURCETREE)/git/git $(GIT_ANNEX_ANDROID_SOURCETREE)/term/libs/armeabi/lib.git.so
|
|
|
|
cp $(GIT_ANNEX_ANDROID_SOURCETREE)/git/git-shell $(GIT_ANNEX_ANDROID_SOURCETREE)/term/libs/armeabi/lib.git-shell.so
|
|
|
|
cp $(GIT_ANNEX_ANDROID_SOURCETREE)/git/git-upload-pack $(GIT_ANNEX_ANDROID_SOURCETREE)/term/libs/armeabi/lib.git-upload-pack.so
|
|
|
|
arm-linux-androideabi-strip --strip-unneeded --remove-section=.comment --remove-section=.note $(GIT_ANNEX_ANDROID_SOURCETREE)/term/libs/armeabi/*
|
|
|
|
cp runshell $(GIT_ANNEX_ANDROID_SOURCETREE)/term/libs/armeabi/lib.runshell.so
|
|
|
|
cp start $(GIT_ANNEX_ANDROID_SOURCETREE)/term/libs/armeabi/lib.start.so
|
2013-02-21 16:47:16 +00:00
|
|
|
|
|
|
|
# remove git stuff we don't need to save space
|
|
|
|
rm -rf $(GITTREE)/bin/git-cvsserver \
|
|
|
|
$(GITTREE)/libexec/git-core/git-daemon \
|
|
|
|
$(GITTREE)/libexec/git-core/git-show-index \
|
|
|
|
$(GITTREE)/libexec/git-core/mergetools \
|
|
|
|
$(GITTREE)/libexec/git-core/git-credential-* \
|
|
|
|
$(GITTREE)/libexec/git-core/git-cvsserver \
|
|
|
|
$(GITTREE)/libexec/git-core/git-cvsimport \
|
|
|
|
$(GITTREE)/libexec/git-core/git-fast-import \
|
|
|
|
$(GITTREE)/libexec/git-core/git-http-backend \
|
|
|
|
$(GITTREE)/libexec/git-core/git-imap-send \
|
|
|
|
$(GITTREE)/libexec/git-core/git-instaweb \
|
|
|
|
$(GITTREE)/libexec/git-core/git-p4 \
|
|
|
|
$(GITTREE)/libexec/git-core/git-remote-test* \
|
|
|
|
$(GITTREE)/libexec/git-core/git-submodule \
|
|
|
|
$(GITTREE)/libexec/git-core/git-svn \
|
|
|
|
$(GITTREE)/libexec/git-core/git-web--browse
|
|
|
|
# Most of git is in one multicall binary, but a few important
|
|
|
|
# commands are still shell scripts. Those are put into
|
2013-05-23 17:54:49 +00:00
|
|
|
# a tarball, along with a list of all the links that should be
|
2013-02-21 16:47:16 +00:00
|
|
|
# set up.
|
|
|
|
cd $(GITTREE) && mkdir -p links
|
2013-02-22 20:31:10 +00:00
|
|
|
cd $(GITTREE) && find -samefile bin/git -not -wholename ./bin/git > links/git
|
|
|
|
cd $(GITTREE) && find -samefile bin/git-shell -not -wholename ./bin/git-shell > links/git-shell
|
|
|
|
cd $(GITTREE) && find -samefile bin/git-upload-pack -not -wholename ./bin/git-upload-pack > links/git-upload-pack
|
2013-02-21 16:47:16 +00:00
|
|
|
cd $(GITTREE) && find -type f -not -samefile bin/git -not -samefile bin/git-shell -not -samefile bin/git-upload-pack|tar czf ../git.tar.gz -T -
|
2013-02-28 06:42:59 +00:00
|
|
|
cp $(GIT_ANNEX_ANDROID_SOURCETREE)/git/git.tar.gz $(GIT_ANNEX_ANDROID_SOURCETREE)/term/libs/armeabi/lib.git.tar.gz.so
|
2013-02-21 16:47:16 +00:00
|
|
|
|
2013-02-28 06:42:59 +00:00
|
|
|
git rev-parse HEAD > $(GIT_ANNEX_ANDROID_SOURCETREE)/term/libs/armeabi/lib.version.so
|
2014-04-23 17:30:30 +00:00
|
|
|
cp ../trustedkeys.gpg $(GIT_ANNEX_ANDROID_SOURCETREE)/term/libs/armeabi/lib.trustedkeys.so
|
2013-02-22 19:03:12 +00:00
|
|
|
|
2013-11-12 18:24:53 +00:00
|
|
|
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
|
2013-11-26 17:24:24 +00:00
|
|
|
arm-linux-androideabi-strip --strip-unneeded --remove-section=.comment --remove-section=.note $(GIT_ANNEX_ANDROID_SOURCETREE)/term/libs/armeabi/lib.git-annex.so
|
2013-11-12 18:24:53 +00:00
|
|
|
cd $(GIT_ANNEX_ANDROID_SOURCETREE)/term && ant debug
|
|
|
|
cp $(GIT_ANNEX_ANDROID_SOURCETREE)/term/bin/Term-debug.apk ../../tmp/4.3/git-annex.apk
|
2013-11-26 17:24:24 +00:00
|
|
|
|
2013-11-12 18:24:53 +00:00
|
|
|
cp ../../tmp/androidtree/dist/build/git-annex/4.0/git-annex $(GIT_ANNEX_ANDROID_SOURCETREE)/term/libs/armeabi/lib.git-annex.so
|
2013-11-26 17:24:24 +00:00
|
|
|
arm-linux-androideabi-strip --strip-unneeded --remove-section=.comment --remove-section=.note $(GIT_ANNEX_ANDROID_SOURCETREE)/term/libs/armeabi/lib.git-annex.so
|
2013-02-28 06:42:59 +00:00
|
|
|
cd $(GIT_ANNEX_ANDROID_SOURCETREE)/term && ant debug
|
2013-11-12 18:24:53 +00:00
|
|
|
cp $(GIT_ANNEX_ANDROID_SOURCETREE)/term/bin/Term-debug.apk ../../tmp/4.0/git-annex.apk
|
2013-02-21 16:47:16 +00:00
|
|
|
|
2013-04-26 20:43:40 +00:00
|
|
|
$(GIT_ANNEX_ANDROID_SOURCETREE)/openssl/build-stamp:
|
2013-02-28 06:42:59 +00:00
|
|
|
cd $(GIT_ANNEX_ANDROID_SOURCETREE)/openssl && CC=$$(which cc) ./Configure android
|
|
|
|
cd $(GIT_ANNEX_ANDROID_SOURCETREE)/openssl && $(MAKE)
|
2013-02-26 03:05:45 +00:00
|
|
|
touch $@
|
2013-02-18 22:50:28 +00:00
|
|
|
|
2013-04-26 20:43:40 +00:00
|
|
|
$(GIT_ANNEX_ANDROID_SOURCETREE)/openssh/build-stamp: openssh.patch openssh.config.h
|
2013-09-23 02:36:00 +00:00
|
|
|
# This is a known-good version that the patch works with.
|
|
|
|
# TODO: Upgrade
|
|
|
|
cd $(GIT_ANNEX_ANDROID_SOURCETREE)/openssh && git reset --hard 0a8617ed5af2f0248d0e9648e26b224e16ada742
|
2013-02-28 06:42:59 +00:00
|
|
|
cd $(GIT_ANNEX_ANDROID_SOURCETREE)/openssh && ./configure --host=arm-linux-androideabi --with-ssl-dir=../openssl --without-openssl-header-check
|
|
|
|
cat openssh.patch | (cd $(GIT_ANNEX_ANDROID_SOURCETREE)/openssh && patch -p1)
|
|
|
|
cp openssh.config.h $(GIT_ANNEX_ANDROID_SOURCETREE)/openssh/config.h
|
|
|
|
cd $(GIT_ANNEX_ANDROID_SOURCETREE)/openssh && sed -i -e 's/getrrsetbyname.o //' openbsd-compat/Makefile
|
|
|
|
cd $(GIT_ANNEX_ANDROID_SOURCETREE)/openssh && sed -i -e 's/auth-passwd.o //' Makefile
|
|
|
|
cd $(GIT_ANNEX_ANDROID_SOURCETREE)/openssh && $(MAKE) ssh ssh-keygen
|
2013-02-26 03:05:45 +00:00
|
|
|
touch $@
|
2013-02-18 22:50:28 +00:00
|
|
|
|
2013-04-26 20:43:40 +00:00
|
|
|
$(GIT_ANNEX_ANDROID_SOURCETREE)/busybox/build-stamp: busybox_config
|
2013-02-28 06:42:59 +00:00
|
|
|
cp busybox_config $(GIT_ANNEX_ANDROID_SOURCETREE)/busybox/.config
|
2013-12-29 20:56:01 +00:00
|
|
|
cd $(GIT_ANNEX_ANDROID_SOURCETREE)/busybox && git reset --hard a758e3e1e04e7705f5d37b2f27be654cd0e7282c
|
2013-02-28 06:42:59 +00:00
|
|
|
cd $(GIT_ANNEX_ANDROID_SOURCETREE)/busybox && yes '' | $(MAKE) oldconfig
|
|
|
|
cd $(GIT_ANNEX_ANDROID_SOURCETREE)/busybox && $(MAKE)
|
2013-02-26 03:05:45 +00:00
|
|
|
touch $@
|
2013-02-18 19:43:40 +00:00
|
|
|
|
2014-07-03 20:02:42 +00:00
|
|
|
$(GIT_ANNEX_ANDROID_SOURCETREE)/git/build-stamp: git.patch
|
|
|
|
cat git.patch | (cd $(GIT_ANNEX_ANDROID_SOURCETREE)/git && git am)
|
2013-02-28 06:42:59 +00:00
|
|
|
cd $(GIT_ANNEX_ANDROID_SOURCETREE)/git && $(MAKE) install NO_OPENSSL=1 NO_GETTEXT=1 NO_GECOS_IN_PWENT=1 NO_GETPASS=1 NO_NSEC=1 NO_MKDTEMP=1 NO_PTHREADS=1 NO_PERL=1 NO_CURL=1 NO_EXPAT=1 NO_TCLTK=1 NO_ICONV=1 prefix= DESTDIR=installed-tree
|
2013-02-26 03:05:45 +00:00
|
|
|
touch $@
|
2013-02-13 20:23:06 +00:00
|
|
|
|
2013-04-26 20:43:40 +00:00
|
|
|
$(GIT_ANNEX_ANDROID_SOURCETREE)/rsync/build-stamp: rsync.patch
|
2013-09-23 02:40:36 +00:00
|
|
|
# This is a known-good version that the patch works with.
|
|
|
|
cat rsync.patch | (cd $(GIT_ANNEX_ANDROID_SOURCETREE)/rsync && git reset --hard eec26089b1c7bdbb260674480ffe6ece257bca63 && git am)
|
2013-02-28 06:42:59 +00:00
|
|
|
cp $(GIT_ANNEX_ANDROID_SOURCETREE)/automake/lib/config.sub $(GIT_ANNEX_ANDROID_SOURCETREE)/automake/lib/config.guess $(GIT_ANNEX_ANDROID_SOURCETREE)/rsync/
|
|
|
|
cd $(GIT_ANNEX_ANDROID_SOURCETREE)/rsync && ./configure --host=arm-linux-androideabi --disable-locale --disable-iconv-open --disable-iconv --disable-acl-support --disable-xattr-support
|
|
|
|
cd $(GIT_ANNEX_ANDROID_SOURCETREE)/rsync && $(MAKE)
|
2013-02-26 03:05:45 +00:00
|
|
|
touch $@
|
2013-02-13 20:23:06 +00:00
|
|
|
|
2013-04-26 20:43:40 +00:00
|
|
|
$(GIT_ANNEX_ANDROID_SOURCETREE)/gnupg/build-stamp:
|
2013-10-12 16:08:18 +00:00
|
|
|
cd $(GIT_ANNEX_ANDROID_SOURCETREE)/gnupg && git checkout gnupg-1.4.15
|
2013-02-28 06:42:59 +00:00
|
|
|
cd $(GIT_ANNEX_ANDROID_SOURCETREE)/gnupg && ./autogen.sh
|
2013-07-08 19:59:52 +00:00
|
|
|
cd $(GIT_ANNEX_ANDROID_SOURCETREE)/gnupg && ./configure --host=arm-linux-androideabi --disable-gnupg-iconv --disable-card-support --disable-agent-support --disable-photo-viewers --disable-keyserver-helpers --disable-nls
|
2013-02-28 06:42:59 +00:00
|
|
|
cd $(GIT_ANNEX_ANDROID_SOURCETREE)/gnupg; $(MAKE) || true # expected failure in doc build
|
2013-02-26 03:05:45 +00:00
|
|
|
touch $@
|
2013-02-21 16:47:16 +00:00
|
|
|
|
2013-04-26 20:43:40 +00:00
|
|
|
$(GIT_ANNEX_ANDROID_SOURCETREE)/term/build-stamp: term.patch icons
|
2013-09-23 02:47:20 +00:00
|
|
|
# This is a known-good version that the patch works with.
|
|
|
|
cd $(GIT_ANNEX_ANDROID_SOURCETREE)/term && git reset --hard 3d34b3c42295c215b62e70f3ee696dd664ba08ce
|
2013-02-28 06:42:59 +00:00
|
|
|
cat term.patch | (cd $(GIT_ANNEX_ANDROID_SOURCETREE)/term && patch -p1)
|
|
|
|
(cd icons && tar c .) | (cd $(GIT_ANNEX_ANDROID_SOURCETREE)/term/res && tar x)
|
2013-02-21 16:47:16 +00:00
|
|
|
# This renaming has a purpose. It makes the path to the app's
|
|
|
|
# /data directory shorter, which makes ssh connection caching
|
|
|
|
# sockets placed there have more space for their filenames.
|
|
|
|
# Also, it avoids overlap with the Android Terminal Emulator
|
|
|
|
# app, if it's also installed.
|
2013-02-28 06:42:59 +00:00
|
|
|
cd $(GIT_ANNEX_ANDROID_SOURCETREE)/term && find -name .git -prune -o -type f -print0 | xargs -0 perl -pi -e 's/jackpal/ga/g'
|
|
|
|
cd $(GIT_ANNEX_ANDROID_SOURCETREE)/term && perl -pi -e 's/Terminal Emulator/Git Annex/g' res/*/strings.xml
|
2013-09-23 02:55:40 +00:00
|
|
|
cd $(GIT_ANNEX_ANDROID_SOURCETREE)/term && echo y | tools/update.sh
|
2013-02-26 03:05:45 +00:00
|
|
|
touch $@
|
2013-02-21 16:47:16 +00:00
|
|
|
|
2013-02-28 06:42:59 +00:00
|
|
|
source: $(GIT_ANNEX_ANDROID_SOURCETREE)
|
|
|
|
|
|
|
|
$(GIT_ANNEX_ANDROID_SOURCETREE):
|
|
|
|
mkdir -p $(GIT_ANNEX_ANDROID_SOURCETREE)
|
2013-09-23 02:27:02 +00:00
|
|
|
git clone git://git.savannah.gnu.org/automake.git $(GIT_ANNEX_ANDROID_SOURCETREE)/automake
|
|
|
|
git clone git://git.debian.org/git/d-i/busybox $(GIT_ANNEX_ANDROID_SOURCETREE)/busybox
|
|
|
|
git clone git://git.kernel.org/pub/scm/git/git.git $(GIT_ANNEX_ANDROID_SOURCETREE)/git
|
|
|
|
git clone git://git.samba.org/rsync.git $(GIT_ANNEX_ANDROID_SOURCETREE)/rsync
|
|
|
|
git clone git://git.gnupg.org/gnupg.git $(GIT_ANNEX_ANDROID_SOURCETREE)/gnupg
|
|
|
|
git clone git://git.openssl.org/openssl $(GIT_ANNEX_ANDROID_SOURCETREE)/openssl
|
|
|
|
git clone git://github.com/CyanogenMod/android_external_openssh.git $(GIT_ANNEX_ANDROID_SOURCETREE)/openssh
|
|
|
|
git clone git://github.com/jackpal/Android-Terminal-Emulator.git $(GIT_ANNEX_ANDROID_SOURCETREE)/term
|
2013-02-13 20:23:06 +00:00
|
|
|
|
|
|
|
clean:
|
2013-02-24 17:25:55 +00:00
|
|
|
rm -rf $(GITTREE)
|
2013-02-26 03:05:45 +00:00
|
|
|
rm -f start
|
|
|
|
|
|
|
|
reallyclean: clean
|
2013-02-28 06:42:59 +00:00
|
|
|
rm -rf $(GIT_ANNEX_ANDROID_SOURCETREE)
|