Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Android build #1556

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions auto_tests/Makefile.inc
Original file line number Diff line number Diff line change
Expand Up @@ -106,5 +106,14 @@ encryptsave_test_CFLAGS = $(AUTOTEST_CFLAGS)

encryptsave_test_LDADD = $(AUTOTEST_LDADD)

M=0
MORE_TESTS_1=\#
MORE_TESTS_TRUE = $(MORE_TESTS_$M)
$(MORE_TESTS_TRUE)onion_test.log: LOG_COMPILER=sh -c 'exit 77'
$(MORE_TESTS_TRUE)TCP_test.log: LOG_COMPILER=sh -c 'exit 77'
$(MORE_TESTS_TRUE)tox_test.log: LOG_COMPILER=sh -c 'exit 77'
$(MORE_TESTS_TRUE)dht_autotest.log: LOG_COMPILER=sh -c 'exit 77'

.PHONY: $(TESTS:%=%.log)

EXTRA_DIST += $(top_srcdir)/auto_tests/friends_test.c
31 changes: 23 additions & 8 deletions dist-build/android-build.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#!/bin/sh

[ -f android.settings ] && source ./android.settings

if [ -z "$ANDROID_NDK_HOME" ]; then
echo "You should probably set ANDROID_NDK_HOME to the directory containing"
echo "the Android NDK"
Expand All @@ -25,7 +27,7 @@ if [ -z "$TOOLCHAIN_DIR" ]; then
export TOOLCHAIN_DIR="$(pwd)/android-toolchain-${TARGET_ARCH}"
export MAKE_TOOLCHAIN="${ANDROID_NDK_HOME}/build/tools/make-standalone-toolchain.sh"

if [ -z "$MAKE_TOOLCHAIN" ]; then
if [ ! -f "$MAKE_TOOLCHAIN" ]; then
echo "Cannot find a make-standalone-toolchain.sh in ndk dir, interrupt..."
exit 1
fi
Expand All @@ -37,7 +39,7 @@ if [ -z "$TOOLCHAIN_DIR" ]; then
fi

export PREFIX="$(pwd)/toxcore-android-${TARGET_ARCH}"
export SYSROOT="${TOOLCHAIN_DIR}/sysroot"
export SYSROOT=${SYSROOT-${TOOLCHAIN_DIR}/sysroot}
export PATH="${PATH}:${TOOLCHAIN_DIR}/bin"

# Clean up before build
Expand All @@ -47,13 +49,26 @@ export CFLAGS="${CFLAGS} --sysroot=${SYSROOT} -I${SYSROOT}/usr/include"
export CPPFLAGS="${CFLAGS}"
export LDFLAGS="${LDFLAGS} -L${SYSROOT}/usr/lib"

./configure --host="${HOST_COMPILER}" \
# here SODIUM_ARCH must be armv6, while TARGET_ARCH is arm
# permit override...
SODIUM_ARCH=${SODIUM_ARCH-${TARGET_ARCH}}

SODIUM_PREFIX="${SODIUM_HOME}/libsodium-android-${SODIUM_ARCH}"
SODIUM_HDR=${SODIUM_HDR---with-libsodium-headers="${SODIUM_PREFIX}/include"}
SODIUM_LIB=${SODIUM_LIB---with-libsodium-libs="${SODIUM_PREFIX}/lib"}

builddir="build-${TARGET_ARCH}"
mkdir -p $builddir
cd $builddir

../configure --host="${HOST_COMPILER}" \
--with-sysroot="${SYSROOT}" \
--with-libsodium-headers="${SODIUM_HOME}/libsodium-android-${TARGET_ARCH}/include" \
--with-libsodium-libs="${SODIUM_HOME}/libsodium-android-${TARGET_ARCH}/lib" \
--disable-av \
--prefix="${PREFIX}" && \
"${SODIUM_HDR}" \
"${SODIUM_LIB}" \
--disable-rt \
--disable-testing \
--prefix=/ && \

make clean && \
make -j3 install && \
make -j3 install DESTDIR=${PREFIX} && \
echo "libtoxcore has been installed into ${PREFIX}"