diff options
-rw-r--r-- | .gitignore | 4 | ||||
-rw-r--r-- | Makefile.am | 7 | ||||
-rwxr-xr-x | dist-build/android-arm.sh | 3 | ||||
-rwxr-xr-x | dist-build/android-armv7.sh | 3 | ||||
-rwxr-xr-x | dist-build/android-build.sh | 63 | ||||
-rwxr-xr-x | dist-build/android-mips.sh | 3 | ||||
-rwxr-xr-x | dist-build/android-x86.sh | 3 |
7 files changed, 85 insertions, 1 deletions
@@ -58,3 +58,7 @@ nbproject | |||
58 | 58 | ||
59 | # astyle | 59 | # astyle |
60 | *.orig | 60 | *.orig |
61 | |||
62 | # Android buildscript | ||
63 | android-toolchain-* | ||
64 | toxcore-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 | ||
13 | EXTRA_DIST = \ | 13 | EXTRA_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 | ||
28 | EXTRA_DIST += libtoxav.pc.in | 33 | EXTRA_DIST += libtoxav.pc.in |
29 | 34 | ||
30 | endif \ No newline at end of file | 35 | endif |
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 | ||
2 | export CFLAGS="-Ofast -mthumb -marm -march=armv6" | ||
3 | TARGET_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 | ||
2 | export CFLAGS="-Ofast -mfloat-abi=softfp -mfpu=vfpv3-d16 -mthumb -marm -march=armv7-a" | ||
3 | TARGET_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 | |||
3 | if [ -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 | ||
7 | fi | ||
8 | |||
9 | if [ -z "$SODIUM_HOME" ]; then | ||
10 | echo "You should probably set SODIUM_HOME to the directory containing root sodium sources" | ||
11 | exit | ||
12 | fi | ||
13 | |||
14 | if [[ -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 | ||
17 | fi | ||
18 | |||
19 | if [ ! -f ./configure ]; then | ||
20 | echo "Can't find ./configure. Wrong directory or haven't run autogen.sh?" | ||
21 | exit 1 | ||
22 | fi | ||
23 | |||
24 | if [ -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}" | ||
37 | fi | ||
38 | |||
39 | export PREFIX="$(pwd)/toxcore-android-${TARGET_ARCH}" | ||
40 | export SYSROOT="${TOOLCHAIN_DIR}/sysroot" | ||
41 | export PATH="${PATH}:${TOOLCHAIN_DIR}/bin" | ||
42 | |||
43 | # Clean up before build | ||
44 | rm -rf "${PREFIX}" | ||
45 | |||
46 | export CFLAGS="${CFLAGS} --sysroot=${SYSROOT} -I${SYSROOT}/usr/include" | ||
47 | export CPPFLAGS="${CFLAGS}" | ||
48 | export 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 | |||
61 | make clean && \ | ||
62 | make -j3 install && \ | ||
63 | echo "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 | ||
2 | export CFLAGS="-Ofast" | ||
3 | TARGET_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 | ||
2 | export CFLAGS="-Ofast" | ||
3 | TARGET_ARCH=x86 TOOLCHAIN_NAME=x86-4.8 HOST_COMPILER=i686-linux-android "$(dirname "$0")/android-build.sh" | ||