summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitignore4
-rw-r--r--Makefile.am7
-rwxr-xr-xdist-build/android-arm.sh3
-rwxr-xr-xdist-build/android-armv7.sh3
-rwxr-xr-xdist-build/android-build.sh63
-rwxr-xr-xdist-build/android-mips.sh3
-rwxr-xr-xdist-build/android-x86.sh3
7 files changed, 85 insertions, 1 deletions
diff --git a/.gitignore b/.gitignore
index e903e3ca..43bbae7a 100644
--- a/.gitignore
+++ b/.gitignore
@@ -58,3 +58,7 @@ nbproject
58 58
59# astyle 59# astyle
60*.orig 60*.orig
61
62# Android buildscript
63android-toolchain-*
64toxcore-android-*
diff --git a/Makefile.am b/Makefile.am
index b58e7bae..9ef4afed 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -12,6 +12,11 @@ CLEANFILES = $(top_builddir)/libtoxcore.pc
12 12
13EXTRA_DIST = \ 13EXTRA_DIST = \
14 libtoxcore.pc.in \ 14 libtoxcore.pc.in \
15 dist-build/android-arm.sh \
16 dist-build/android-armv7.sh \
17 dist-build/android-x86.sh \
18 dist-build/android-mips.sh \
19 dist-build/android-build.sh \
15 $(top_srcdir)/docs/updates/Crypto.md \ 20 $(top_srcdir)/docs/updates/Crypto.md \
16 $(top_srcdir)/docs/updates/Spam-Prevention.md \ 21 $(top_srcdir)/docs/updates/Spam-Prevention.md \
17 $(top_srcdir)/docs/updates/Symmetric-NAT-Transversal.md \ 22 $(top_srcdir)/docs/updates/Symmetric-NAT-Transversal.md \
@@ -27,4 +32,4 @@ CLEANFILES += $(top_builddir)/libtoxav.pc
27 32
28EXTRA_DIST += libtoxav.pc.in 33EXTRA_DIST += libtoxav.pc.in
29 34
30endif \ No newline at end of file 35endif
diff --git a/dist-build/android-arm.sh b/dist-build/android-arm.sh
new file mode 100755
index 00000000..af736da3
--- /dev/null
+++ b/dist-build/android-arm.sh
@@ -0,0 +1,3 @@
1#!/bin/sh
2export CFLAGS="-Ofast -mthumb -marm -march=armv6"
3TARGET_ARCH=arm TOOLCHAIN_NAME=arm-linux-androideabi-4.8 HOST_COMPILER=arm-linux-androideabi "$(dirname "$0")/android-build.sh"
diff --git a/dist-build/android-armv7.sh b/dist-build/android-armv7.sh
new file mode 100755
index 00000000..838a62f9
--- /dev/null
+++ b/dist-build/android-armv7.sh
@@ -0,0 +1,3 @@
1#!/bin/sh
2export CFLAGS="-Ofast -mfloat-abi=softfp -mfpu=vfpv3-d16 -mthumb -marm -march=armv7-a"
3TARGET_ARCH=armv7 TOOLCHAIN_NAME=arm-linux-androideabi-4.8 HOST_COMPILER=arm-linux-androideabi "$(dirname "$0")/android-build.sh"
diff --git a/dist-build/android-build.sh b/dist-build/android-build.sh
new file mode 100755
index 00000000..984a531d
--- /dev/null
+++ b/dist-build/android-build.sh
@@ -0,0 +1,63 @@
1#!/bin/sh
2
3if [ -z "$ANDROID_NDK_HOME" ]; then
4 echo "You should probably set ANDROID_NDK_HOME to the directory containing"
5 echo "the Android NDK"
6 exit
7fi
8
9if [ -z "$SODIUM_HOME" ]; then
10 echo "You should probably set SODIUM_HOME to the directory containing root sodium sources"
11 exit
12fi
13
14if [[ -z $TARGET_ARCH ]] || [[ -z $HOST_COMPILER ]]; then
15 echo "You shouldn't use android-build.sh directly, use android-[arch].sh instead"
16 exit 1
17fi
18
19if [ ! -f ./configure ]; then
20 echo "Can't find ./configure. Wrong directory or haven't run autogen.sh?"
21 exit 1
22fi
23
24if [ -z "$TOOLCHAIN_DIR" ]; then
25 export TOOLCHAIN_DIR="$(pwd)/android-toolchain-${TARGET_ARCH}"
26 export MAKE_TOOLCHAIN="${ANDROID_NDK_HOME}/build/tools/make-standalone-toolchain.sh"
27
28 if [ -z "$MAKE_TOOLCHAIN" ]; then
29 echo "Cannot find a make-standalone-toolchain.sh in ndk dir, interrupt..."
30 exit 1
31 fi
32
33 $MAKE_TOOLCHAIN --platform="${NDK_PLATFORM:-android-14}" \
34 --arch="${TARGET_ARCH}" \
35 --toolchain="${TOOLCHAIN_NAME:-arm-linux-androideabi-4.8}" \
36 --install-dir="${TOOLCHAIN_DIR}"
37fi
38
39export PREFIX="$(pwd)/toxcore-android-${TARGET_ARCH}"
40export SYSROOT="${TOOLCHAIN_DIR}/sysroot"
41export PATH="${PATH}:${TOOLCHAIN_DIR}/bin"
42
43# Clean up before build
44rm -rf "${PREFIX}"
45
46export CFLAGS="${CFLAGS} --sysroot=${SYSROOT} -I${SYSROOT}/usr/include"
47export CPPFLAGS="${CFLAGS}"
48export LDFLAGS="${LDFLAGS} -L${SYSROOT}/usr/lib"
49
50./configure --host="${HOST_COMPILER}" \
51 --with-sysroot="${SYSROOT}" \
52 --with-libsodium-headers="${SODIUM_HOME}/libsodium-android-${TARGET_ARCH}/include" \
53 --with-libsodium-libs="${SODIUM_HOME}/libsodium-android-${TARGET_ARCH}/lib" \
54 --disable-soname-versions \
55 --disable-av \
56 --disable-ntox \
57 --disable-daemon \
58 --disable-phone \
59 --prefix="${PREFIX}" && \
60
61make clean && \
62make -j3 install && \
63echo "libtoxcore has been installed into ${PREFIX}"
diff --git a/dist-build/android-mips.sh b/dist-build/android-mips.sh
new file mode 100755
index 00000000..6e105c2f
--- /dev/null
+++ b/dist-build/android-mips.sh
@@ -0,0 +1,3 @@
1#!/bin/sh
2export CFLAGS="-Ofast"
3TARGET_ARCH=mips TOOLCHAIN_NAME=mipsel-linux-android-4.8 HOST_COMPILER=mipsel-linux-android "$(dirname "$0")/android-build.sh"
diff --git a/dist-build/android-x86.sh b/dist-build/android-x86.sh
new file mode 100755
index 00000000..6768b887
--- /dev/null
+++ b/dist-build/android-x86.sh
@@ -0,0 +1,3 @@
1#!/bin/sh
2export CFLAGS="-Ofast"
3TARGET_ARCH=x86 TOOLCHAIN_NAME=x86-4.8 HOST_COMPILER=i686-linux-android "$(dirname "$0")/android-build.sh"