rework build process

This commit is contained in:
m2049r 2018-09-27 18:24:22 +02:00 committed by m2049r
parent d398416a3d
commit 4211687981
25 changed files with 900 additions and 9 deletions

View File

@ -52,8 +52,7 @@ android {
abi { abi {
enable true enable true
reset() reset()
//include 'armeabi-v7a', 'arm64-v8a', 'x86', 'x86_64' include 'armeabi-v7a', 'arm64-v8a', 'x86', 'x86_64'
include 'arm64-v8a'
universalApk true universalApk true
} }
} }

1
external-libs/.gitignore vendored Normal file
View File

@ -0,0 +1 @@
build

122
external-libs/Makefile Normal file
View File

@ -0,0 +1,122 @@
#.PHONY: f-droid-sign f-droid-clean \
#build-external-libs use-prebuilt-external-libs \
#toolchain openssl boost wownero collect \
#clean-external-libs \
#f-droid-sign f-droid-clean \
#gradle-release gradle-build gradle-sign gradle-clean \
#apk-install remove-exif
#all: build-external-libs
#build-external-libs: clean-external-libs collect
all: monero
monero: toolchain libsodium openssl boost monero_dl openssl_sysroot
script/monero-build.sh
monero_dl:
script/monero-fetch.sh
# script/monero-patch.sh
toolchain:
script/toolchain-build.sh
openssl: toolchain openssl_dl
script/openssl-build.sh
openssl_sysroot:
script/openssl-install.sh
openssl_dl:
script/openssl-fetch.sh
script/openssl-patch.sh
boost: toolchain boost_dl
script/boost-build.sh
boost_dl:
script/boost-fetch.sh
libsodium: toolchain libsodium_dl
script/libsodium-build.sh
libsodium_dl:
script/libsodium-fetch.sh
install: all
script/install.sh
clean:
script/clean.sh
distclean: clean
find monero -type f -a ! -name ".gitignore" -a ! -name "wallet2_api.h" -exec rm {} \;
find boost -type f -a ! -name ".gitignore" -exec rm {} \;
find libsodium -type f -a ! -name ".gitignore" -exec rm {} \;
find openssl -type f -a ! -name ".gitignore" -exec rm {} \;
archive: libsodium openssl boost monero
echo "Packing external-libs"
tar czfv libsodium openssl boost monero external-libs.tgz
# dev shortcut
# faster build for testing f-droid release
use-prebuilt-external-libs:
script/build-external-libs/use-archive.sh
wownero-unsafe:
script/build-external-libs/fetch-wownero.sh
script/build-external-libs/patch-wownero.sh
script/build-external-libs/build-wownero.sh
fdroid_apk_path := vendor/fdroiddata/unsigned
app_id := com.wownero.wownerujo
gradle_apk_path := app/build/outputs/apk/release
gradle_app_name := wownerujo-${gradle_app_version}_universal
f-droid-sign:
zipalign -v -p 4 \
$(fdroid_apk_path)/$(app_id)_${app_version}.apk \
$(fdroid_apk_path)/$(app_id)_${app_version}-aligned.apk
apksigner sign --ks ${release_key} \
--out $(fdroid_apk_path)/$(app_id)_${app_version}-release.apk \
$(fdroid_apk_path)/$(app_id)_${app_version}-aligned.apk
f-droid-clean:
@rm -f $(fdroid_apk_path)/$(app_id)_${app_version}-aligned.apk
@rm -f $(fdroid_apk_path)/$(app_id)_${app_version}-release.apk
gradle-release: gradle-build gradle-sign
gradle-build:
./gradlew assembleRelease
gradle-sign: gradle-clean
zipalign -v -p 4 \
$(gradle_apk_path)/$(gradle_app_name).apk \
$(gradle_apk_path)/$(gradle_app_name)-aligned.apk
apksigner sign --ks ${release_key} \
--out $(gradle_apk_path)/$(gradle_app_name)-release.apk \
$(gradle_apk_path)/$(gradle_app_name)-aligned.apk
gradle-clean:
@rm -f $(gradle_apk_path)/$(gradle_app_name)-aligned.apk
@rm -f $(gradle_apk_path)/$(gradle_app_name)-release.apk
apk-install:
adb install -r ./app/build/outputs/apk/release/wownerujo-$(gradle_app_version)_universal-release.apk
remove-exif:
exiftool -all= `find app/ -name '*.jp*g' -o -name '*.png'`

View File

@ -0,0 +1,4 @@
# Ignore everything in this directory
*
# Except this file
!.gitignore

View File

@ -0,0 +1,4 @@
# Ignore everything in this directory
*
# Except this file
!.gitignore

View File

@ -0,0 +1,4 @@
# Ignore everything in this directory
*
# Except this file
!.gitignore

View File

@ -0,0 +1,4 @@
# Ignore everything in this directory
*
# Except this file
!.gitignore

View File

@ -0,0 +1,87 @@
#!/bin/bash
#
# http://wiki.openssl.org/index.php/Android
#
# needs ANDROID_NDK_ROOT set correctly (e.g. to /opt/android/android-ndk-r15c)
set -e
SRC_DIR=$EXTERNAL_LIBS_BUILD_ROOT/android-openssl
TARGET_DIR=$EXTERNAL_LIBS_ROOT/openssl
archs=(arm arm64 x86 x86_64)
for arch in ${archs[@]}; do
xLIB="/lib"
case ${arch} in
"arm")
_ANDROID_TARGET_SELECT=arch-arm
_ANDROID_ARCH=arch-arm
_ANDROID_EABI=arm-linux-androideabi-4.9
_ANDROID_EABI_INC=arm-linux-androideabi
configure_platform="android-armv7" ;;
"arm64")
_ANDROID_TARGET_SELECT=arch-arm64-v8a
_ANDROID_ARCH=arch-arm64
_ANDROID_EABI=aarch64-linux-android-4.9
_ANDROID_EABI_INC=aarch64-linux-android
configure_platform="linux-generic64 -DB_ENDIAN" ;;
"x86")
_ANDROID_TARGET_SELECT=arch-x86
_ANDROID_ARCH=arch-x86
_ANDROID_EABI=x86-4.9
_ANDROID_EABI_INC=i686-linux-android
configure_platform="android-x86" ;;
"x86_64")
_ANDROID_TARGET_SELECT=arch-x86_64
_ANDROID_ARCH=arch-x86_64
_ANDROID_EABI=x86_64-4.9
_ANDROID_EABI_INC=x86_64-linux-android
xLIB="/lib64"
configure_platform="linux-generic64" ;;
*)
configure_platform="linux-elf" ;;
esac
TARGET_LIB_DIR=$TARGET_DIR/$arch/lib
if [ -f "$TARGET_LIB_DIR/libcrypto.a" ] && [ -f "$TARGET_LIB_DIR/libssl.a" ]; then
continue
fi
mkdir -p $TARGET_LIB_DIR
. ./setenv-android-mod.sh
echo "CROSS COMPILE ENV : $CROSS_COMPILE"
cd openssl-OpenSSL_1_0_2l
xCFLAGS="-DSHARED_EXTENSION=.so -fPIC -DOPENSSL_PIC -DDSO_DLFCN -DHAVE_DLFCN_H -I$ANDROID_NDK_ROOT/sysroot/usr/include -I$ANDROID_NDK_ROOT/sysroot/usr/include/$_ANDROID_EABI_INC -I$ANDROID_DEV/include -B$ANDROID_DEV/$xLIB -O -fomit-frame-pointer -W"
perl -pi -e 's/install: all install_docs install_sw/install: install_docs install_sw/g' Makefile.org
./Configure shared no-threads no-asm no-zlib no-ssl2 no-ssl3 no-comp no-hw no-engine -D__ANDROID_API__=21 $configure_platform $xCFLAGS
# patch SONAME
perl -pi -e 's/SHLIB_EXT=\.so\.\$\(SHLIB_MAJOR\)\.\$\(SHLIB_MINOR\)/SHLIB_EXT=\.so/g' Makefile
perl -pi -e 's/SHARED_LIBS_LINK_EXTS=\.so\.\$\(SHLIB_MAJOR\) \.so//g' Makefile
# quote injection for proper SONAME, fuck...
perl -pi -e 's/SHLIB_MAJOR=1/SHLIB_MAJOR=`/g' Makefile
perl -pi -e 's/SHLIB_MINOR=0.0/SHLIB_MINOR=`/g' Makefile
make clean
make depend
make -j 4 all
file libcrypto.so
file libssl.so
cp libcrypto.a $TARGET_LIB_DIR
cp libssl.a $TARGET_LIB_DIR
cp -aL $SRC_DIR/openssl-OpenSSL_1_0_2l/include/openssl/ $TARGET_DIR/include
# ln -sf $TARGET_DIR/include $TARGET_DIR/arm/include
cd ..
done
exit 0

View File

@ -0,0 +1,269 @@
#!/bin/bash
# Cross-compile environment for Android on ARMv7 and x86
#
# Contents licensed under the terms of the OpenSSL license
# http://www.openssl.org/source/license.html
#
# See http://wiki.openssl.org/index.php/FIPS_Library_and_Android
# and http://wiki.openssl.org/index.php/Android
#####################################################################
# Set ANDROID_NDK_ROOT to you NDK location. For example,
# /opt/android-ndk-r8e or /opt/android-ndk-r9. This can be done in a
# login script. If ANDROID_NDK_ROOT is not specified, the script will
# try to pick it up with the value of _ANDROID_NDK_ROOT below. If
# ANDROID_NDK_ROOT is set, then the value is ignored.
# _ANDROID_NDK="android-ndk-r8e"
_ANDROID_NDK="android-ndk-r18"
# _ANDROID_NDK="android-ndk-r10"
# Set _ANDROID_EABI to the EABI you want to use. You can find the
# list in $ANDROID_NDK_ROOT/toolchains. This value is always used.
# _ANDROID_EABI="x86-4.6"
# _ANDROID_EABI="arm-linux-androideabi-4.6"
#_ANDROID_EABI="arm-linux-androideabi-4.9"
# Set _ANDROID_ARCH to the architecture you are building for.
# This value is always used.
# _ANDROID_ARCH=arch-x86
#_ANDROID_ARCH=arch-arm
# Set _ANDROID_API to the API you want to use. You should set it
# to one of: android-14, android-9, android-8, android-14, android-5
# android-4, or android-3. You can't set it to the latest (for
# example, API-17) because the NDK does not supply the platform. At
# Android 5.0, there will likely be another platform added (android-22?).
# This value is always used.
# _ANDROID_API="android-14"
#_ANDROID_API="android-18"
# _ANDROID_API="android-21"
_ANDROID_API="android-21"
#####################################################################
# If the user did not specify the NDK location, try and pick it up.
# We expect something like ANDROID_NDK_ROOT=/opt/android-ndk-r8e
# or ANDROID_NDK_ROOT=/usr/local/android-ndk-r8e.
if [ -z "$ANDROID_NDK_ROOT" ]; then
_ANDROID_NDK_ROOT=""
if [ -z "$_ANDROID_NDK_ROOT" ] && [ -d "/usr/local/$_ANDROID_NDK" ]; then
_ANDROID_NDK_ROOT="/usr/local/$_ANDROID_NDK"
fi
if [ -z "$_ANDROID_NDK_ROOT" ] && [ -d "/opt/$_ANDROID_NDK" ]; then
_ANDROID_NDK_ROOT="/opt/$_ANDROID_NDK"
fi
if [ -z "$_ANDROID_NDK_ROOT" ] && [ -d "$HOME/$_ANDROID_NDK" ]; then
_ANDROID_NDK_ROOT="$HOME/$_ANDROID_NDK"
fi
if [ -z "$_ANDROID_NDK_ROOT" ] && [ -d "$PWD/$_ANDROID_NDK" ]; then
_ANDROID_NDK_ROOT="$PWD/$_ANDROID_NDK"
fi
# If a path was set, then export it
if [ ! -z "$_ANDROID_NDK_ROOT" ] && [ -d "$_ANDROID_NDK_ROOT" ]; then
export ANDROID_NDK_ROOT="$_ANDROID_NDK_ROOT"
fi
fi
# Error checking
# ANDROID_NDK_ROOT should always be set by the user (even when not running this script)
# http://groups.google.com/group/android-ndk/browse_thread/thread/a998e139aca71d77
if [ -z "$ANDROID_NDK_ROOT" ] || [ ! -d "$ANDROID_NDK_ROOT" ]; then
echo "Error: ANDROID_NDK_ROOT is not a valid path. Please edit this script."
# echo "$ANDROID_NDK_ROOT"
# exit 1
fi
# Error checking
if [ ! -d "$ANDROID_NDK_ROOT/toolchains" ]; then
echo "Error: ANDROID_NDK_ROOT/toolchains is not a valid path. Please edit this script."
# echo "$ANDROID_NDK_ROOT/toolchains"
# exit 1
fi
# Error checking
if [ ! -d "$ANDROID_NDK_ROOT/toolchains/$_ANDROID_EABI" ]; then
echo "Error: ANDROID_EABI is not a valid path. Please edit this script."
# echo "$ANDROID_NDK_ROOT/toolchains/$_ANDROID_EABI"
# exit 1
fi
#####################################################################
# Based on ANDROID_NDK_ROOT, try and pick up the required toolchain. We expect something like:
# /opt/android-ndk-r83/toolchains/arm-linux-androideabi-4.7/prebuilt/linux-x86_64/bin
# Once we locate the toolchain, we add it to the PATH. Note: this is the 'hard way' of
# doing things according to the NDK documentation for Ice Cream Sandwich.
# https://android.googlesource.com/platform/ndk/+/ics-mr0/docs/STANDALONE-TOOLCHAIN.html
ANDROID_TOOLCHAIN=""
for host in "linux-x86_64" "linux-x86" "darwin-x86_64" "darwin-x86"
do
if [ -d "$ANDROID_NDK_ROOT/toolchains/$_ANDROID_EABI/prebuilt/$host/bin" ]; then
ANDROID_TOOLCHAIN="$ANDROID_NDK_ROOT/toolchains/$_ANDROID_EABI/prebuilt/$host/bin"
break
fi
done
# Error checking
if [ -z "$ANDROID_TOOLCHAIN" ] || [ ! -d "$ANDROID_TOOLCHAIN" ]; then
echo "Error: ANDROID_TOOLCHAIN is not valid. Please edit this script."
# echo "$ANDROID_TOOLCHAIN"
# exit 1
fi
case $_ANDROID_TARGET_SELECT in
arch-arm)
ANDROID_TOOLS="arm-linux-androideabi-gcc arm-linux-androideabi-ranlib arm-linux-androideabi-ld"
;;
arch-arm64-v8a)
ANDROID_TOOLS="aarch64-linux-android-gcc aarch64-linux-android-randlib aarch64-linux-android-ld"
;;
arch-x86)
ANDROID_TOOLS="i686-linux-android-gcc i686-linux-android-ranlib i686-linux-android-ld"
;;
arch-x86_64)
ANDROID_TOOLS="x86_64-linux-android-gcc x86_64-linux-android-ranlib x86_64-linux-android-ld"
;;
arch-mips)
ANDROID_TOOLS="mipsel-linux-android-gcc mipsel-linux-android-ranlib mipsel-linux-android-ld"
;;
arch-mips64)
ANDROID_TOOLS="mips64el-linux-android-gcc mips64el-linux-android-ranlib mips64el-linux-android-ld"
;;
*)
echo "ERROR ERROR ERROR"
;;
esac
for tool in $ANDROID_TOOLS
do
# Error checking
if [ ! -e "$ANDROID_TOOLCHAIN/$tool" ]; then
echo "Error: Failed to find $tool. Please edit this script."
# echo "$ANDROID_TOOLCHAIN/$tool"
# exit 1
fi
done
# Only modify/export PATH if ANDROID_TOOLCHAIN good
if [ ! -z "$ANDROID_TOOLCHAIN" ]; then
export ANDROID_TOOLCHAIN="$ANDROID_TOOLCHAIN"
export PATH="$ANDROID_TOOLCHAIN":"$PATH"
fi
#####################################################################
# For the Android SYSROOT. Can be used on the command line with --sysroot
# https://android.googlesource.com/platform/ndk/+/ics-mr0/docs/STANDALONE-TOOLCHAIN.html
export ANDROID_SYSROOT="$ANDROID_NDK_ROOT/platforms/$_ANDROID_API/$_ANDROID_ARCH"
export SYSROOT="$ANDROID_SYSROOT"
export NDK_SYSROOT="$ANDROID_SYSROOT"
# Error checking
if [ -z "$ANDROID_SYSROOT" ] || [ ! -d "$ANDROID_SYSROOT" ]; then
echo "Error: ANDROID_SYSROOT is not valid. Please edit this script."
# echo "$ANDROID_SYSROOT"
# exit 1
fi
#####################################################################
# If the user did not specify the FIPS_SIG location, try and pick it up
# If the user specified a bad location, then try and pick it up too.
if [ -z "$FIPS_SIG" ] || [ ! -e "$FIPS_SIG" ]; then
# Try and locate it
_FIPS_SIG=""
if [ -d "/usr/local/ssl/$_ANDROID_API" ]; then
_FIPS_SIG=`find "/usr/local/ssl/$_ANDROID_API" -name incore`
fi
if [ ! -e "$_FIPS_SIG" ]; then
_FIPS_SIG=`find $PWD -name incore`
fi
# If a path was set, then export it
if [ ! -z "$_FIPS_SIG" ] && [ -e "$_FIPS_SIG" ]; then
export FIPS_SIG="$_FIPS_SIG"
fi
fi
# Error checking. Its OK to ignore this if you are *not* building for FIPS
if [ -z "$FIPS_SIG" ] || [ ! -e "$FIPS_SIG" ]; then
echo "Error: FIPS_SIG does not specify incore module. Please edit this script."
# echo "$FIPS_SIG"
# exit 1
fi
#####################################################################
# Most of these should be OK (MACHINE, SYSTEM, ARCH). RELEASE is ignored.
export MACHINE=armv7
export RELEASE=2.6.37
export SYSTEM=android
export ARCH=arm
export CROSS_COMPILE="arm-linux-androideabi-"
if [ "$_ANDROID_TARGET_SELECT" == "arch-arm64-v8a" ]; then
export MACHINE=armv7
export ARCH=arm64
export CROSS_COMPILE="aarch64-linux-android-"
fi
if [ "$_ANDROID_TARGET_SELECT" == "arch-x86" ]; then
export MACHINE=i686
export ARCH=x86
export CROSS_COMPILE="i686-linux-android-"
fi
if [ "$_ANDROID_TARGET_SELECT" == "arch-x86_64" ]; then
export MACHINE=i686
export ARCH=x86_64
export CROSS_COMPILE="x86_64-linux-android-"
fi
if [ "$_ANDROID_TARGET_SELECT" == "arch-mips" ]; then
export MACHINE=i686
export ARCH=mips
export CROSS_COMPILE="mipsel-linux-android-"
fi
if [ "$_ANDROID_TARGET_SELECT" == "arch-mips64" ]; then
export MACHINE=i686
export ARCH=mips64
export CROSS_COMPILE="mips64el-linux-android-"
fi
echo "CHECK_CROSS_COMPILER = $CROSS_COMPILE"
# For the Android toolchain
# https://android.googlesource.com/platform/ndk/+/ics-mr0/docs/STANDALONE-TOOLCHAIN.html
export ANDROID_SYSROOT="$ANDROID_NDK_ROOT/platforms/$_ANDROID_API/$_ANDROID_ARCH"
export SYSROOT="$ANDROID_SYSROOT"
export NDK_SYSROOT="$ANDROID_SYSROOT"
export ANDROID_NDK_SYSROOT="$ANDROID_SYSROOT"
export ANDROID_API="$_ANDROID_API"
# CROSS_COMPILE and ANDROID_DEV are DFW (Don't Fiddle With). Its used by OpenSSL build system.
# export CROSS_COMPILE="arm-linux-androideabi-"
export ANDROID_DEV="$ANDROID_NDK_ROOT/platforms/$_ANDROID_API/$_ANDROID_ARCH/usr"
export HOSTCC=gcc
VERBOSE=1
if [ ! -z "$VERBOSE" ] && [ "$VERBOSE" != "0" ]; then
echo "ANDROID_NDK_ROOT: $ANDROID_NDK_ROOT"
echo "ANDROID_ARCH: $_ANDROID_ARCH"
echo "ANDROID_EABI: $_ANDROID_EABI"
echo "ANDROID_API: $ANDROID_API"
echo "ANDROID_SYSROOT: $ANDROID_SYSROOT"
echo "ANDROID_TOOLCHAIN: $ANDROID_TOOLCHAIN"
echo "FIPS_SIG: $FIPS_SIG"
echo "CROSS_COMPILE: $CROSS_COMPILE"
echo "ANDROID_DEV: $ANDROID_DEV"
fi

View File

@ -0,0 +1,50 @@
#!/usr/bin/env bash
set -e
source script/env.sh
TARGET_DIR=$EXTERNAL_LIBS_ROOT/boost
version=1_58_0
dot_version=1.58.0
cd $EXTERNAL_LIBS_BUILD_ROOT/boost_${version}
if [ ! -f "b2" ]; then
./bootstrap.sh
fi
args="--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 \
--includedir=$TARGET_DIR/include \
toolset=clang threading=multi threadapi=pthread target-os=android"
if [ ! -d "$TARGET_DIR/arm" ]; then
PATH=$NDK_TOOL_DIR/arm/arm-linux-androideabi/bin:$NDK_TOOL_DIR/arm/bin:$PATH \
./b2 --build-dir=android-arm --prefix=$TARGET_DIR/arm $args \
install
ln -sf ../include $TARGET_DIR/arm
fi
if [ ! -d "$TARGET_DIR/arm64" ]; then
PATH=$NDK_TOOL_DIR/arm64/aarch64-linux-androideabi/bin:$NDK_TOOL_DIR/arm64/bin:$PATH \
./b2 --build-dir=android-arm64 --prefix=$TARGET_DIR/arm64 $args \
install
ln -sf ../include $TARGET_DIR/arm64
fi
if [ ! -d "$TARGET_DIR/x86" ]; then
PATH=$NDK_TOOL_DIR/x86/i686-linux-android/bin:$NDK_TOOL_DIR/x86/bin:$PATH \
./b2 --build-dir=android-x86 --prefix=$TARGET_DIR/x86 $args \
install
ln -sf ../include $TARGET_DIR/x86
fi
if [ ! -d "$TARGET_DIR/x86_64" ]; then
PATH=$NDK_TOOL_DIR/x86_64/x86_64-linux-android/bin:$NDK_TOOL_DIR/x86_64/bin:$PATH \
./b2 --build-dir=android-x86_64 --prefix=$TARGET_DIR/x86_64 $args \
install
ln -sf ../include $TARGET_DIR/x86_64
fi

View File

@ -0,0 +1,18 @@
#!/usr/bin/env bash
set -e
source script/env.sh
cd $EXTERNAL_LIBS_BUILD_ROOT
version=1_58_0
dot_version=1.58.0
if [ ! -f "boost_${version}.tar.gz" ]; then
wget https://downloads.sourceforge.net/project/boost/boost/${dot_version}/boost_${version}.tar.gz
fi
if [ ! -d "boost_${version}" ]; then
tar xfz boost_${version}.tar.gz
fi

8
external-libs/script/clean.sh Executable file
View File

@ -0,0 +1,8 @@
#!/usr/bin/env bash
set -e
source script/env.sh
rm -rf $EXTERNAL_LIBS_BUILD
mkdir -p $EXTERNAL_LIBS_BUILD

20
external-libs/script/env.sh Executable file
View File

@ -0,0 +1,20 @@
DEFAULT_ANDROID_NDK_ROOT=/opt/android/ndk-r15c
ANDROID_NDK_ROOT="${ANDROID_NDK_ROOT:-${DEFAULT_ANDROID_NDK_ROOT}}"
export ANDROID_NDK_ROOT=`realpath $ANDROID_NDK_ROOT`
DEFAULT_EXTERNAL_LIBS_BUILD=`pwd`/build/
EXTERNAL_LIBS_BUILD="${EXTERNAL_LIBS_BUILD:-${DEFAULT_EXTERNAL_LIBS_BUILD}}"
export EXTERNAL_LIBS_BUILD=${EXTERNAL_LIBS_BUILD%/}
DEFAULT_EXTERNAL_LIBS_BUILD_ROOT=${EXTERNAL_LIBS_BUILD}/src/
EXTERNAL_LIBS_BUILD_ROOT="${EXTERNAL_LIBS_BUILD_ROOT:-${DEFAULT_EXTERNAL_LIBS_BUILD_ROOT}}"
export EXTERNAL_LIBS_BUILD_ROOT=${EXTERNAL_LIBS_BUILD_ROOT%/}
DEFAULT_EXTERNAL_LIBS_ROOT=${EXTERNAL_LIBS_BUILD}/build/
EXTERNAL_LIBS_ROOT="${EXTERNAL_LIBS_ROOT:-${DEFAULT_EXTERNAL_LIBS_ROOT}}"
export EXTERNAL_LIBS_ROOT=${EXTERNAL_LIBS_ROOT%/}
DEFAULT_NDK_TOOL_DIR=${EXTERNAL_LIBS_BUILD}/tool/
NDK_TOOL_DIR="${NDK_TOOL_DIR:-${DEFAULT_NDK_TOOL_DIR}}"
export NDK_TOOL_DIR=${NDK_TOOL_DIR%/}

View File

@ -4,10 +4,8 @@
set -e set -e
orig_path=$PATH packages=(boost openssl monero libsodium)
archs=(arm arm64 x86 x86_64)
packages=(boost openssl monero)
archs=(arm64 x86_64)
for arch in ${archs[@]}; do for arch in ${archs[@]}; do
case ${arch} in case ${arch} in
@ -29,14 +27,15 @@ for arch in ${archs[@]}; do
esac esac
for package in ${packages[@]}; do for package in ${packages[@]}; do
INPUT_DIR=`pwd`/build/build/$package
OUTPUT_DIR=`pwd`/$package/lib/$xarch OUTPUT_DIR=`pwd`/$package/lib/$xarch
mkdir -p $OUTPUT_DIR mkdir -p $OUTPUT_DIR
rm -f $OUTPUT_DIR/*.a rm -f $OUTPUT_DIR/*.a
cp -a /media/m2049r/DATA/android/external-libs/build/$package/$arch/lib/*.a $OUTPUT_DIR cp -a $INPUT_DIR/$arch/lib/*.a $OUTPUT_DIR
if [ $package = "monero" -a -d "/opt/android/build/$package/include" ]; then if [ $package = "monero" ]; then
rm -rf $OUTPUT_DIR/../../include rm -rf $OUTPUT_DIR/../../include
cp -a /media/m2049r/DATA/android/external-libs/build/$package/include $OUTPUT_DIR/../.. cp -a $INPUT_DIR/include $OUTPUT_DIR/../..
fi fi
done done

View File

@ -0,0 +1,55 @@
#!/bin/bash
set -e
source script/env.sh
cd $EXTERNAL_LIBS_BUILD_ROOT/libsodium
if [ ! -f "configure" ]; then
./autogen.sh
fi
archs=(arm arm64 x86 x86_64)
for arch in ${archs[@]}; do
case ${arch} in
"arm")
target_host=arm-linux-androideabi
;;
"arm64")
target_host=aarch64-linux-android
;;
"x86")
target_host=i686-linux-android
;;
"x86_64")
target_host=x86_64-linux-android
;;
*)
exit 16
;;
esac
TARGET_DIR=$EXTERNAL_LIBS_ROOT/libsodium/$arch
if [ -f "$TARGET_DIR/lib/libsodium.la" ]; then
continue
fi
mkdir -p $TARGET_DIR
echo "building for ${arch}"
PATH=$NDK_TOOL_DIR/$arch/$target_host/bin:$NDK_TOOL_DIR/$arch/bin:$PATH \
CC=clang CXX=clang++; \
./configure \
--prefix=${TARGET_DIR} \
--host=${target_host} \
--enable-static \
--disable-shared \
&& make -j 4 \
&& make install \
&& make clean
done
exit 0

View File

@ -0,0 +1,16 @@
#!/usr/bin/env bash
set -e
source script/env.sh
cd $EXTERNAL_LIBS_BUILD_ROOT
version=1.0.16
if [ ! -d "libsodium" ]; then
git clone https://github.com/jedisct1/libsodium.git -b ${version}
else
cd libsodium
git checkout ${version}
fi

View File

@ -0,0 +1,100 @@
#!/bin/bash
set -e
source script/env.sh
cd $EXTERNAL_LIBS_BUILD_ROOT/monero
orig_path=$PATH
base_dir=`pwd`
build_root=$EXTERNAL_LIBS_BUILD_ROOT
lib_root=$EXTERNAL_LIBS_ROOT
build_type=release # or debug
android_api=21
archs=(arm arm64 x86 x86_64)
for arch in ${archs[@]}; do
ldflags=""
extra_cmake_flags=""
case ${arch} in
"arm")
target_host=arm-linux-androideabi
xarch=armv7-a
sixtyfour=OFF
extra_cmake_flags="-D NO_AES=true"
;;
"arm64")
target_host=aarch64-linux-android
xarch="armv8-a"
sixtyfour=ON
;;
"x86")
target_host=i686-linux-android
xarch="i686"
sixtyfour=OFF
;;
"x86_64")
target_host=x86_64-linux-android
xarch="x86-64"
sixtyfour=ON
;;
*)
exit 16
;;
esac
TARGET_LIB_DIR=$lib_root/monero/$arch/lib
if [ -f "$TARGET_LIB_DIR/libwallet_api.a" ]; then
continue
fi
OUTPUT_DIR=$base_dir/build/$build_type.$arch
rm -rf $OUTPUT_DIR
mkdir -p $OUTPUT_DIR
cd $OUTPUT_DIR
PATH=$NDK_TOOL_DIR/$arch/$target_host/bin:$NDK_TOOL_DIR/$arch/bin:$PATH \
CC=clang CXX=clang++ \
CMAKE_LIBRARY_PATH=$lib_root/libsodium/$arch/lib \
cmake \
-D BUILD_GUI_DEPS=1 \
-D BUILD_TESTS=OFF \
-D ARCH="$xarch" \
-D STATIC=ON \
-D BUILD_64=$sixtyfour \
-D CMAKE_BUILD_TYPE=$build_type \
-D CMAKE_CXX_FLAGS="-D__ANDROID_API__=$android_api" \
-D ANDROID=true \
-D BUILD_TAG="android" \
-D BOOST_ROOT=$lib_root/boost/$arch \
-D BOOST_LIBRARYDIR=$lib_root/boost/$arch/lib \
-D OPENSSL_ROOT_DIR=$lib_root/openssl/$arch \
-D OPENSSL_INCLUDE_DIR=$lib_root/openssl/$arch \
-D OPENSSL_CRYPTO_LIBRARY=$lib_root/openssl/$arch/lib/libcrypto.so \
-D OPENSSL_SSL_LIBRARY=$lib_root/openssl/$arch/lib/libssl.so \
-D CMAKE_POSITION_INDEPENDENT_CODE:BOOL=true \
-D MONERUJO_HIDAPI=ON \
-D LIBSODIUM_INCLUDE_DIR=$lib_root/libsodium/$arch/include \
$extra_cmake_flags \
../..
make -j 4 wallet_api
find . -path ./lib -prune -o -name '*.a' -exec cp '{}' lib \;
rm -rf $TARGET_LIB_DIR
mkdir -p $TARGET_LIB_DIR
cp $OUTPUT_DIR/lib/*.a $TARGET_LIB_DIR
TARGET_INC_DIR=$lib_root/monero/include
rm -rf $TARGET_INC_DIR
mkdir -p $TARGET_INC_DIR
cp -a src/wallet/api/wallet2_api.h $TARGET_INC_DIR
cd $base_dir
done
exit 0

View File

@ -0,0 +1,20 @@
#!/usr/bin/env bash
set -e
source script/env.sh
cd $EXTERNAL_LIBS_BUILD_ROOT
url="https://github.com/m2049r/monero"
version="release-v0.13-prep"
if [ ! -d "monero" ]; then
git clone ${url} -b ${version}
cd monero
git submodule update --recursive --init
else
cd monero
git submodule update --recursive
git checkout ${version}
fi

View File

@ -0,0 +1,26 @@
#!/usr/bin/env bash
set -e
source script/build-external-libs/env.sh
cp script/build-external-libs/wownero/build-all-arch.sh $EXTERNAL_LIBS_BUILD_ROOT/wownero
cd $EXTERNAL_LIBS_BUILD_ROOT
cd wownero
sed -i 's/-Werror/-Wall/g' CMakeLists.txt
sed -i 's/program_options locale/program_options/g' CMakeLists.txt
sed -i 's/find_path(ZMQ_INCLUDE_PATH zmq.hpp)//g' CMakeLists.txt
sed -i 's/find_library(ZMQ_LIB zmq)//g' CMakeLists.txt
sed -i 's/message(FATAL_ERROR "Could not find required header zmq.hpp")//g' CMakeLists.txt
sed -i 's/message(FATAL_ERROR "Could not find required libzmq")//g' CMakeLists.txt
sed -i 's/bool create_address_file = false/bool create_address_file = true/g' src/wallet/wallet2.h
sodium_pattern="find_library(SODIUM_LIBRARY sodium)"
include_sodium='find_library(SODIUM_LIBRARY sodium)\
\
message(STATUS "Using SODIUM include dir at ${LIBSODIUM_INCLUDE_DIR}")\
include_directories(${LIBSODIUM_INCLUDE_DIR})'
sed -i "s/${sodium_pattern}/${include_sodium}/g" CMakeLists.txt

View File

@ -0,0 +1,9 @@
#!/usr/bin/env bash
set -e
source script/env.sh
cd $EXTERNAL_LIBS_BUILD_ROOT/android-openssl
./build-all-arch.sh

View File

@ -0,0 +1,16 @@
#!/usr/bin/env bash
set -e
source script/env.sh
cd $EXTERNAL_LIBS_BUILD_ROOT
if [ ! -f "OpenSSL_1_0_2l.tar.gz" ]; then
wget https://github.com/openssl/openssl/archive/OpenSSL_1_0_2l.tar.gz
fi
if [ ! -d "android-openssl" ]; then
mkdir android-openssl && cd android-openssl
tar xfz ../OpenSSL_1_0_2l.tar.gz
fi

View File

@ -0,0 +1,20 @@
#!/usr/bin/env bash
set -e
source script/env.sh
SRC_DIR=$EXTERNAL_LIBS_ROOT/android-openssl
TARGET_DIR=$EXTERNAL_LIBS_ROOT/openssl
ln -sf $TARGET_DIR/include $NDK_TOOL_DIR/arm/sysroot/usr/include/openssl
ln -sf $TARGET_DIR/arm/lib/*.so $NDK_TOOL_DIR/arm/sysroot/usr/lib
ln -sf $TARGET_DIR/include $NDK_TOOL_DIR/arm64/sysroot/usr/include/openssl
ln -sf $TARGET_DIR/arm64/lib/*.so $NDK_TOOL_DIR/arm64/sysroot/usr/lib
ln -sf $TARGET_DIR/include $NDK_TOOL_DIR/x86/sysroot/usr/include/openssl
ln -sf $TARGET_DIR/x86/lib/*.so $NDK_TOOL_DIR/x86/sysroot/usr/lib
ln -sf $TARGET_DIR/include $NDK_TOOL_DIR/x86_64/sysroot/usr/include/openssl
ln -sf $TARGET_DIR/x86_64/lib/*.so $NDK_TOOL_DIR/x86_64/sysroot/usr/lib64

View File

@ -0,0 +1,7 @@
#!/usr/bin/env bash
set -e
source script/env.sh
cp -a script/android-openssl $EXTERNAL_LIBS_BUILD_ROOT

View File

@ -0,0 +1,20 @@
#!/usr/bin/env bash
set -e
source script/env.sh
build_root=$EXTERNAL_LIBS_BUILD_ROOT
PATH=$ANDROID_NDK_ROOT/build/tools/:$PATH
args="--api 21 --stl=libc++"
archs=(arm arm64 x86 x86_64)
for arch in ${archs[@]}; do
if [ ! -d "$NDK_TOOL_DIR/$arch" ]; then
echo "installing $ANDROID_NDK_ROOT $arch $args"
make_standalone_toolchain.py $args --arch $arch --install-dir $NDK_TOOL_DIR/$arch
sed -i.orig "s|using ::fgetpos;|//using ::fgetpos;|" $NDK_TOOL_DIR/$arch/include/c++/4.9.x/cstdio
sed -i.orig "s|using ::fsetpos;|//using ::fsetpos;|" $NDK_TOOL_DIR/$arch/include/c++/4.9.x/cstdio
fi
done

View File

@ -0,0 +1,13 @@
#!/usr/bin/env bash
set -e
version=v1.5.10.5
curl -O -L https://github.com/fuwa0529/wownerujo/releases/download/${version}/external-libs.tgz
rm -rf external-libs
echo "unpacking external-libs"
tar zxfv external-libs.tgz
rm external-libs.tgz