-
Notifications
You must be signed in to change notification settings - Fork 142
/
Copy pathbuild_android_libraries.sh
executable file
·55 lines (44 loc) · 1.53 KB
/
build_android_libraries.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#! /usr/bin/env bash
#
# Build native android libraries with JNI bindings, for use with C or Java.
# Requires JAVA_HOME and ANDROID_NDK to be set.
#
set -e
if [ ! -f "src/secp256k1/Makefile.am" ]; then
git submodule sync --recursive
git submodule update --init --recursive
fi
if [ -z "$ANDROID_NDK" ]; then
export ANDROID_NDK=$(dirname `command -v ndk-build 2>/dev/null`)
fi
echo ${ANDROID_NDK:?}
if [ -z "$JAVA_HOME" ]; then
export JAVA_HOME=$JAVA7_HOME
fi
echo ${JAVA_HOME:?}
source $PWD/tools/android_helpers.sh
$PWD/tools/cleanup.sh && $PWD/tools/autogen.sh
# Build everything unless the user passed a single target name
ARCH_LIST=$(android_get_arch_list)
if [ -n "$1" ]; then
ARCH_LIST="$1"
fi
for arch in $ARCH_LIST; do
# Use API level 23
api="23"
# Location of the NDK tools to build with
toolsdir=$(android_get_build_tools_dir)
# Extra configure options
useropts=""
# Configure and build with the above options
android_build_wally $arch $toolsdir $api $useropts
# Copy and strip the build result
archdir=$PWD/release/lib/$arch
mkdir -p $archdir
$toolsdir/bin/llvm-strip -o $archdir/libwallycore.so $PWD/src/.libs/libwallycore.so
done
# Copy headers and Java wrapper
# The android release files can be used from Java or in native code
mkdir -p $PWD/release/include $PWD/release/src/swig_java/src/com/blockstream/libwally
cp $PWD/include/*.h $PWD/release/include
cp $PWD/src/swig_java/src/com/blockstream/libwally/Wally.java $PWD/release/src/swig_java/src/com/blockstream/libwally