mirror of
https://github.com/cake-tech/cake_wallet.git
synced 2024-11-16 17:27:37 +00:00
Added build scripts for android.
This commit is contained in:
parent
db75167302
commit
a319d1e6ef
11 changed files with 319 additions and 0 deletions
8
scripts/android/build_all.sh
Executable file
8
scripts/android/build_all.sh
Executable file
|
@ -0,0 +1,8 @@
|
|||
# /bin/bash
|
||||
|
||||
./build_iconv.sh
|
||||
./build_boost.sh
|
||||
./build_openssl.sh
|
||||
./build_sodium.sh
|
||||
./build_zmq.sh
|
||||
./build_monero.sh
|
16
scripts/android/build_boost.sh
Executable file
16
scripts/android/build_boost.sh
Executable file
|
@ -0,0 +1,16 @@
|
|||
# /bin/bash
|
||||
|
||||
WORKDIR=/opt/android
|
||||
TOOLCHAIN_BASE_DIR=${WORKDIR}/toolchain
|
||||
ORIGINAL_PATH=$PATH
|
||||
|
||||
for arch in "aarch" "aarch64" "i686" "x86_64"
|
||||
do
|
||||
|
||||
PREFIX=$WORKDIR/prefix_${arch}
|
||||
PATH="${TOOLCHAIN_BASE_DIR}_${arch}/bin:${ORIGINAL_PATH}"
|
||||
|
||||
./init_boost.sh $arch
|
||||
./finish_boost.sh $arch
|
||||
|
||||
done
|
38
scripts/android/build_iconv.sh
Executable file
38
scripts/android/build_iconv.sh
Executable file
|
@ -0,0 +1,38 @@
|
|||
# /bin/bash
|
||||
|
||||
export WORKDIR=/opt/android
|
||||
export ICONV_FILENAME=libiconv-1.15.tar.gz
|
||||
export ICONV_FILE_PATH=$WORKDIR/$ICONV_FILENAME
|
||||
export ICONV_SRC_DIR=$WORKDIR/libiconv-1.15
|
||||
|
||||
wget http://ftp.gnu.org/pub/gnu/libiconv/$ICONV_FILENAME -O $ICONV_FILE_PATH
|
||||
|
||||
ORIGINAL_PATH=$PATH
|
||||
TOOLCHAIN_BASE_DIR=${WORKDIR}/toolchain
|
||||
|
||||
for arch in aarch aarch64 i686 x86_64
|
||||
do
|
||||
|
||||
PREFIX=${WORKDIR}/prefix_${arch}
|
||||
PATH="${TOOLCHAIN_BASE_DIR}_${arch}/bin:${ORIGINAL_PATH}"
|
||||
|
||||
case $arch in
|
||||
"aarch" )
|
||||
CLANG=arm-linux-androideabi-clang
|
||||
CXXLANG=arm-linux-androideabi-clang++
|
||||
HOST="arm-linux-android";;
|
||||
* )
|
||||
CLANG=${arch}-linux-android-clang
|
||||
CXXLANG=${arch}-linux-android-clang++
|
||||
HOST="${arch}-linux-android";;
|
||||
esac
|
||||
|
||||
cd $WORKDIR
|
||||
rm -rf $ICONV_SRC_DIR
|
||||
tar -xzf $ICONV_FILE_PATH -C $WORKDIR
|
||||
cd $ICONV_SRC_DIR
|
||||
CC=${CLANG} CXX=${CXXLANG} ./configure --build=x86_64-linux-gnu --host=${HOST} --prefix=${PREFIX} --disable-rpath
|
||||
make
|
||||
make install
|
||||
|
||||
done
|
70
scripts/android/build_monero.sh
Executable file
70
scripts/android/build_monero.sh
Executable file
|
@ -0,0 +1,70 @@
|
|||
# /bin/bash
|
||||
|
||||
WORKDIR=/opt/android
|
||||
TOOLCHAIN_BASE_DIR=${WORKDIR}/toolchain
|
||||
ORIGINAL_PATH=$PATH
|
||||
MONERO_BRANCH=v0.17.1.9-android
|
||||
MONERO_SRC_DIR=${WORKDIR}/monero
|
||||
|
||||
git clone https://github.com/cake-tech/monero.git ${MONERO_SRC_DIR} --branch ${MONERO_BRANCH}
|
||||
cd $MONERO_SRC_DIR
|
||||
git submodule init
|
||||
git submodule update
|
||||
|
||||
for arch in "aarch" "aarch64" "i686" "x86_64"
|
||||
do
|
||||
FLAGS=""
|
||||
PREFIX=${WORKDIR}/prefix_${arch}
|
||||
ANDROID_STANDALONE_TOOLCHAIN_PATH="${TOOLCHAIN_BASE_DIR}_${arch}"
|
||||
PATH="${ANDROID_STANDALONE_TOOLCHAIN_PATH}/bin:${ORIGINAL_PATH}"
|
||||
DEST_LIB_DIR=${PREFIX}/lib/monero
|
||||
DEST_INCLUDE_DIR=${PREFIX}/include
|
||||
export CMAKE_INCLUDE_PATH="${PREFIX}/include"
|
||||
export CMAKE_LIBRARY_PATH="${PREFIX}/lib"
|
||||
|
||||
mkdir -p $DEST_LIB_DIR
|
||||
mkdir -p $DEST_INCLUDE_DIR
|
||||
|
||||
case $arch in
|
||||
"aarch" )
|
||||
CLANG=arm-linux-androideabi-clang
|
||||
CXXLANG=arm-linux-androideabi-clang++
|
||||
BUILD_64=OFF
|
||||
TAG="android-armv7"
|
||||
ARCH="armv7-a"
|
||||
ARCH_ABI="armeabi-v7a"
|
||||
FLAGS="-D CMAKE_ANDROID_ARM_MODE=ON -D NO_AES=true";;
|
||||
"aarch64" )
|
||||
CLANG=aarch64-linux-androideabi-clang
|
||||
CXXLANG=aarch64-linux-androideabi-clang++
|
||||
BUILD_64=ON
|
||||
TAG="android-armv8"
|
||||
ARCH="armv8-a"
|
||||
ARCH_ABI="arm64-v8a";;
|
||||
"i686" )
|
||||
CLANG=i686-linux-androideabi-clang
|
||||
CXXLANG=i686-linux-androideabi-clang++
|
||||
BUILD_64=OFF
|
||||
TAG="android-x86"
|
||||
ARCH="i686"
|
||||
ARCH_ABI="x86";;
|
||||
"x86_64" )
|
||||
CLANG=x86_64-linux-androideabi-clang
|
||||
CXXLANG=x86_64-linux-androideabi-clang++
|
||||
BUILD_64=ON
|
||||
TAG="android-x86_64"
|
||||
ARCH="x86-64"
|
||||
ARCH_ABI="x86_64";;
|
||||
esac
|
||||
|
||||
cd $MONERO_SRC_DIR
|
||||
rm -rf ./build/release
|
||||
mkdir -p ./build/release
|
||||
cd ./build/release
|
||||
CC=${CLANG} CXX=${CXXLANG} cmake -D USE_DEVICE_TREZOR=OFF -D BUILD_GUI_DEPS=1 -D BUILD_TESTS=OFF -D ARCH=${ARCH} -D STATIC=ON -D BUILD_64=${BUILD_64} -D CMAKE_BUILD_TYPE=release -D ANDROID=true -D INSTALL_VENDORED_LIBUNBOUND=ON -D BUILD_TAG=${TAG} -D CMAKE_SYSTEM_NAME="Android" -D CMAKE_ANDROID_STANDALONE_TOOLCHAIN="${ANDROID_STANDALONE_TOOLCHAIN_PATH}" -D CMAKE_ANDROID_ARCH_ABI=${ARCH_ABI} $FLAGS ../..
|
||||
make wallet_api -j4
|
||||
find . -path ./lib -prune -o -name '*.a' -exec cp '{}' lib \;
|
||||
|
||||
cp -r ./lib/* $DEST_LIB_DIR
|
||||
cp ../../src/wallet/api/wallet2_api.h $DEST_INCLUDE_DIR
|
||||
done
|
44
scripts/android/build_openssl.sh
Executable file
44
scripts/android/build_openssl.sh
Executable file
|
@ -0,0 +1,44 @@
|
|||
# /bin/bash
|
||||
|
||||
WORKDIR=/opt/android
|
||||
OPENSSL_FILENAME=openssl-1.0.2p.tar.gz
|
||||
OPENSSL_FILE_PATH=$WORKDIR/$OPENSSL_FILENAME
|
||||
OPENSSL_SRC_DIR=$WORKDIR/openssl-1.0.2p
|
||||
ZLIB_FILENAME=zlib-1.2.11.tar.gz
|
||||
ZLIB_FILE_PATH=$WORKDIR/$ZLIB_FILENAME
|
||||
ZLIB_SRC_DIR=$WORKDIR/zlib-1.2.11
|
||||
ORIGINAL_PATH=$PATH
|
||||
TOOLCHAIN_BASE_DIR=${WORKDIR}/toolchain
|
||||
|
||||
wget https://zlib.net/$ZLIB_FILENAME -O $ZLIB_FILE_PATH
|
||||
tar -xzf $ZLIB_FILE_PATH -C $WORKDIR
|
||||
cd $ZLIB_SRC_DIR
|
||||
CC=clang CXX=clang++ ./configure --static
|
||||
make
|
||||
|
||||
wget https://www.openssl.org/source/$OPENSSL_FILENAME -O $OPENSSL_FILE_PATH
|
||||
|
||||
for arch in "aarch" "aarch64" "i686" "x86_64"
|
||||
do
|
||||
|
||||
PREFIX=$WORKDIR/prefix_${arch}
|
||||
PATH="${TOOLCHAIN_BASE_DIR}_${arch}/bin:${ORIGINAL_PATH}"
|
||||
|
||||
case $arch in
|
||||
"aarch" ) TARGET="armv7";;
|
||||
* ) TARGET="${arch}";;
|
||||
esac
|
||||
|
||||
cd $WORKDIR
|
||||
rm -rf $OPENSSL_SRC_DIR
|
||||
tar -xzf $OPENSSL_FILE_PATH -C $WORKDIR
|
||||
cd $OPENSSL_SRC_DIR
|
||||
sed -i -e "s/mandroid/target\ ${TARGET}\-linux\-android/" Configure
|
||||
CC=clang CXX=clang++ ./Configure android no-asm no-shared --static --with-zlib-include=${WORKDIR}/zlib --with-zlib-lib=${ZLIB_SRC_DIR} --prefix=${PREFIX} --openssldir=${PREFIX}
|
||||
make
|
||||
make install
|
||||
|
||||
|
||||
done
|
||||
|
||||
|
31
scripts/android/build_sodium.sh
Executable file
31
scripts/android/build_sodium.sh
Executable file
|
@ -0,0 +1,31 @@
|
|||
# /bin/bash
|
||||
|
||||
WORKDIR=/opt/android
|
||||
TOOLCHAIN_BASE_DIR=${WORKDIR}/toolchain
|
||||
SODIUM_SRC_DIR=${WORKDIR}/libsodium
|
||||
SODIUM_BRANCH=1.0.16
|
||||
ORIGINAL_PATH=$PATH
|
||||
|
||||
for arch in "aarch" "aarch64" "i686" "x86_64"
|
||||
do
|
||||
|
||||
PREFIX=$WORKDIR/prefix_${arch}
|
||||
PATH="${TOOLCHAIN_BASE_DIR}_${arch}/bin:${ORIGINAL_PATH}"
|
||||
|
||||
case $arch in
|
||||
"aarch" ) TARGET="arm";;
|
||||
"i686" ) TARGET="x86";;
|
||||
* ) TARGET="${arch}";;
|
||||
esac
|
||||
|
||||
HOST="${TARGET}-linux-android"
|
||||
cd $WORKDIR
|
||||
rm -rf $SODIUM_SRC_DIR
|
||||
git clone https://github.com/jedisct1/libsodium.git $SODIUM_SRC_DIR -b $SODIUM_BRANCH
|
||||
cd $SODIUM_SRC_DIR
|
||||
./autogen.sh
|
||||
CC=clang CXX=clang++ ./configure --prefix=${PREFIX} --host=${HOST} --enable-static --disable-shared
|
||||
make
|
||||
make install
|
||||
|
||||
done
|
34
scripts/android/build_zmq.sh
Executable file
34
scripts/android/build_zmq.sh
Executable file
|
@ -0,0 +1,34 @@
|
|||
# /bin/bash
|
||||
|
||||
WORKDIR=/opt/android
|
||||
TOOLCHAIN_BASE_DIR=${WORKDIR}/toolchain
|
||||
ZMQ_SRC_DIR=$WORKDIR/libzmq
|
||||
ZMQ_BRANCH=master
|
||||
ZMQ_COMMIT_HASH=501d0815bf2b0abb93be8214fc66519918ef6c40
|
||||
ORIGINAL_PATH=$PATH
|
||||
|
||||
|
||||
for arch in "aarch" "aarch64" "i686" "x86_64"
|
||||
do
|
||||
|
||||
PREFIX=$WORKDIR/prefix_${arch}
|
||||
PATH="${TOOLCHAIN_BASE_DIR}_${arch}/bin:${ORIGINAL_PATH}"
|
||||
|
||||
case $arch in
|
||||
"aarch" ) TARGET="arm";;
|
||||
"i686" ) TARGET="x86";;
|
||||
* ) TARGET="${arch}";;
|
||||
esac
|
||||
|
||||
HOST="${TARGET}-linux-android"
|
||||
cd $WORKDIR
|
||||
rm -rf $ZMQ_SRC_DIR
|
||||
git clone https://github.com/zeromq/libzmq.git ${ZMQ_SRC_DIR} -b ${ZMQ_BRANCH}
|
||||
cd $ZMQ_SRC_DIR
|
||||
git checkout ${ZMQ_COMMIT_HASH}
|
||||
./autogen.sh
|
||||
CC=clang CXX=clang++ ./configure --prefix=${PREFIX} --host=${HOST} --enable-static --disable-shared
|
||||
make
|
||||
make install
|
||||
|
||||
done
|
34
scripts/android/copy_monero_deps.sh
Executable file
34
scripts/android/copy_monero_deps.sh
Executable file
|
@ -0,0 +1,34 @@
|
|||
# /bin/bash
|
||||
|
||||
WORKDIR=/opt/android
|
||||
CW_DIR=${WORKDIR}/cake_wallet
|
||||
CW_EXRTERNAL_DIR=${CW_DIR}/cw_monero/ios/External/android
|
||||
|
||||
for arch in "aarch" "aarch64" "i686" "x86_64"
|
||||
do
|
||||
|
||||
PREFIX=${WORKDIR}/prefix_${arch}
|
||||
ABI=""
|
||||
|
||||
case $arch in
|
||||
"aarch" )
|
||||
ABI="armeabi-v7a";;
|
||||
"aarch64" )
|
||||
ABI="arm64-v8a";;
|
||||
"i686" )
|
||||
ABI="x86";;
|
||||
"x86_64" )
|
||||
ABI="x86_64";;
|
||||
esac
|
||||
|
||||
LIB_DIR=${CW_EXRTERNAL_DIR}/${ABI}/lib
|
||||
INCLUDE_DIR=${CW_EXRTERNAL_DIR}/${ABI}/include
|
||||
|
||||
mkdir -p $LIB_DIR
|
||||
mkdir -p $INCLUDE_DIR
|
||||
|
||||
cp -r ${PREFIX}/lib/* $LIB_DIR
|
||||
cp -r ${PREFIX}/include/* $INCLUDE_DIR
|
||||
|
||||
|
||||
done
|
9
scripts/android/finish_boost.sh
Executable file
9
scripts/android/finish_boost.sh
Executable file
|
@ -0,0 +1,9 @@
|
|||
# /bin/bash
|
||||
|
||||
WORKDIR=/opt/android
|
||||
ARCH=$1
|
||||
PREFIX="${WORKDIR}/prefix_${ARCH}"
|
||||
BOOST_SRC_DIR=$WORKDIR/boost_1_68_0
|
||||
|
||||
cd $BOOST_SRC_DIR
|
||||
./b2 --build-type=minimal link=static runtime-link=static --with-chrono --with-date_time --with-filesystem --with-program_options --with-regex --with-serialization --with-system --with-thread --with-locale --build-dir=android --stagedir=android toolset=clang threading=multi threadapi=pthread target-os=android -sICONV_PATH=${PREFIX} install
|
18
scripts/android/init_boost.sh
Executable file
18
scripts/android/init_boost.sh
Executable file
|
@ -0,0 +1,18 @@
|
|||
# /bin/bash
|
||||
|
||||
WORKDIR=/opt/android
|
||||
ARCH=$1
|
||||
PREFIX="${WORKDIR}/prefix_${ARCH}"
|
||||
BOOST_FILENAME=boost_1_68_0.tar.bz2
|
||||
BOOST_FILE_PATH=$WORKDIR/$BOOST_FILENAME
|
||||
BOOST_SRC_DIR=$WORKDIR/boost_1_68_0
|
||||
|
||||
if [ ! -e "$BOOST_FILE_PATH" ]; then
|
||||
wget https://dl.bintray.com/boostorg/release/1.68.0/source/$BOOST_FILENAME -O $BOOST_FILE_PATH
|
||||
fi
|
||||
|
||||
cd $WORKDIR
|
||||
rm -rf $BOOST_SRC_DIR
|
||||
tar -xvf $BOOST_FILE_PATH -C $WORKDIR
|
||||
cd $BOOST_SRC_DIR
|
||||
./bootstrap.sh --prefix=${PREFIX}
|
17
scripts/android/install_ndk.sh
Executable file
17
scripts/android/install_ndk.sh
Executable file
|
@ -0,0 +1,17 @@
|
|||
# /bin/bash
|
||||
|
||||
WORKDIR=/opt/android
|
||||
ANDROID_NDK_ZIP=${WORKDIR}/android-ndk-r17c.zip
|
||||
ANDROID_NDK_ROOT=${WORKDIR}/android-ndk-r17c
|
||||
TOOLCHAIN_DIR=${WORKDIR}/toolchain
|
||||
TOOLCHAIN_A32_DIR=${TOOLCHAIN_DIR}_aarch
|
||||
TOOLCHAIN_A64_DIR=${TOOLCHAIN_DIR}_aarch64
|
||||
TOOLCHAIN_x86_DIR=${TOOLCHAIN_DIR}_i686
|
||||
TOOLCHAIN_x86_64_DIR=${TOOLCHAIN_DIR}_x86_64
|
||||
|
||||
wget https://dl.google.com/android/repository/android-ndk-r17c-linux-x86_64.zip -O /opt/android/android-ndk-r17c.zip
|
||||
unzip /opt/android/android-ndk-r17c.zip -d $WORKDIR
|
||||
${ANDROID_NDK_ROOT}/build/tools/make_standalone_toolchain.py --arch arm64 --api 21 --install-dir ${TOOLCHAIN_A64_DIR} --stl=libc++
|
||||
${ANDROID_NDK_ROOT}/build/tools/make_standalone_toolchain.py --arch arm --api 21 --install-dir ${TOOLCHAIN_A32_DIR} --stl=libc++
|
||||
${ANDROID_NDK_ROOT}/build/tools/make_standalone_toolchain.py --arch x86 --api 21 --install-dir ${TOOLCHAIN_x86_DIR} --stl=libc++
|
||||
${ANDROID_NDK_ROOT}/build/tools/make_standalone_toolchain.py --arch x86_64 --api 21 --install-dir ${TOOLCHAIN_x86_64_DIR} --stl=libc++
|
Loading…
Reference in a new issue