From 417ea4e1679ca654dcc686abb41cc098db3e7f54 Mon Sep 17 00:00:00 2001 From: Martin Date: Sat, 6 Jul 2019 22:45:09 +0200 Subject: [PATCH] Use Android NDK to build Linux binaries --- create_linux_installer.sh | 19 ++++++++++++------- install_client_linux.sh | 18 +++++++++--------- 2 files changed, 21 insertions(+), 16 deletions(-) diff --git a/create_linux_installer.sh b/create_linux_installer.sh index c9a4e41e..7373e5db 100755 --- a/create_linux_installer.sh +++ b/create_linux_installer.sh @@ -1,12 +1,12 @@ #!/bin/bash -set -e +set -ex -#git reset --hard -#cd client -#git reset --hard -#cd .. -#python3 build/replace_versions.py +git reset --hard +cd client +git reset --hard +cd .. +python3 build/replace_versions.py ./switch_build.sh client ./download_cryptopp.sh @@ -57,6 +57,10 @@ export CC=$TOOLCHAIN/bin/$TARGET2-clang export CXX=$TOOLCHAIN/bin/$TARGET2-clang++ export LD=$TOOLCHAIN/bin/$TARGET-ld export RANLIB=$TOOLCHAIN/bin/$TARGET-ranlib +export STRIP_CMD=$TOOLCHAIN/bin/$TARGET-strip +if [ ! -e $STRIP_CMD ]; then + export STRIP_CMD=$TOOLCHAIN/bin/$TARGET_FOLDER-strip +fi if [ ! -e $RANLIB ]; then export RANLIB=$TOOLCHAIN/bin/$TARGET_FOLDER-ranlib fi @@ -73,7 +77,7 @@ do if [ $arch = x86_64-linux-glibc ] then - ./configure --enable-headles --enable-clientupdate --enable-embedded-cryptopp CFLAGS="-ggdb -Os" CPPFLAGS="-DURB_WITH_CLIENTUPDATE -ffunction-sections -fdata-sections -flto -DCRYPTOPP_DISABLE_SSSE3" LDFLAGS="-Wl,--gc-sections -static-libstdc++ -flto" CXX="g++" CC="gcc" CXXFLAGS="-ggdb -Os" AR=gcc-ar RANLIB=gcc-ranlib + ./configure --enable-headless --enable-clientupdate --enable-embedded-cryptopp CFLAGS="-ggdb -Os" CPPFLAGS="-DURB_WITH_CLIENTUPDATE -ffunction-sections -fdata-sections -flto -DCRYPTOPP_DISABLE_SSSE3" LDFLAGS="-Wl,--gc-sections -static-libstdc++ -flto" CXX="g++" CC="gcc" CXXFLAGS="-ggdb -Os" AR=gcc-ar RANLIB=gcc-ranlib STRIP_CMD="strip" else build_ndk $arch @@ -96,6 +100,7 @@ do if [ $arch = x86_64-linux-glibc ] then + #Switching from embedded cryptopp ./switch_build.sh client fi done diff --git a/install_client_linux.sh b/install_client_linux.sh index eb119fa8..5d5bdade 100755 --- a/install_client_linux.sh +++ b/install_client_linux.sh @@ -92,12 +92,12 @@ TARGET=no arch=`uname -m` case "$arch" in - i?86) TARGET=i386-linux-eng ;; + i?86) TARGET=i686-linux-android ;; x86_64) TARGET=x86_64-linux-glibc ;; - armv6*) TARGET=armv6-linux-engeabihf ;; - armv7*) TARGET=armv6-linux-engeabihf ;; - armv8*) TARGET=aarch64-linux-eng ;; - aarch64) TARGET=aarch64-linux-eng ;; + armv6*) TARGET=arm-linux-androideabi ;; + armv7*) TARGET=arm-linux-androideabi ;; + armv8*) TARGET=aarch64-linux-android ;; + aarch64) TARGET=aarch64-linux-android ;; esac if [ $TARGET = no ] @@ -117,13 +117,13 @@ if [ $TARGET = x86_64-linux-glibc ] then if ! "$PREFIX/bin/urbackupclientctl" --version 2>&1 | grep "UrBackup Client Controller" > /dev/null 2>&1 then - echo "Glibc not installed or too old. Falling back to ellcc build..." - TARGET=x86_64-linux-eng + echo "Glibc not installed or too old. Falling back to Android NDK build..." + TARGET=x86_64-linux-android else if ! "$PREFIX/sbin/urbackupclientbackend" --version 2>&1 | grep "UrBackup Client Backend" > /dev/null 2>&1 then - echo "Glibc not installed or too old. Falling back to ellcc build..." - TARGET=x86_64-linux-eng + echo "Glibc not installed or too old (2). Falling back to Android NDK..." + TARGET=x86_64-linux-android fi fi