secp256k1-kmp/native/build-android.sh
Fabrice Drouin 202b0c94b6
Add support for musig2 (#93)
* Use Jonas Nick's musig2 branch

* Reformat c code (no functional changes)

* Implement musig2

* Add documentation to musig2 functions (#97)

Usage of the Musig2 functions isn't intuitive at all, especially with
the key aggregation cache and session data. It's important to provide
accurate documentation to help users understand how to correctly produce
musig2 signatures.

We also change argument names to match Kotlin best practices instead of
using the same argument names as C functions.

* Add musig2 reference tests (no functional changes)

---------

Co-authored-by: Bastien Teinturier <31281497+t-bast@users.noreply.github.com>
2024-02-14 13:28:22 +01:00

44 lines
1.3 KiB
Bash
Executable File

#!/usr/bin/env bash
set -e
[[ -z "$ANDROID_NDK" ]] && echo "Please set the ANDROID_NDK variable" && exit 1
[[ -z "$ARCH" ]] && echo "Please set the ARCH variable" && exit 1
[[ -z "$TOOLCHAIN" ]] && echo "Please set the TOOLCHAIN variable" && exit 1
if [ "$ARCH" == "x86_64" ]; then
SYS=x86_64
elif [ "$ARCH" == "x86" ]; then
SYS=i686
elif [ "$ARCH" == "arm64-v8a" ]; then
SYS=aarch64
elif [ "$ARCH" == "armeabi-v7a" ]; then
SYS=armv7a
else
echo "Unsupported ARCH: $ARCH"
exit 1
fi
TARGET=$SYS-linux-android
if [ "$SYS" == "armv7a" ]; then
TARGET=armv7a-linux-androideabi
fi
export CC=$ANDROID_NDK/toolchains/llvm/prebuilt/$TOOLCHAIN/bin/${TARGET}21-clang
export LD=$ANDROID_NDK/toolchains/llvm/prebuilt/$TOOLCHAIN/bin/ld
export AR=$ANDROID_NDK/toolchains/llvm/prebuilt/$TOOLCHAIN/bin/llvm-ar
export AS=$CC
export RANLIB=$ANDROID_NDK/toolchains/llvm/prebuilt/$TOOLCHAIN/bin/llvm-ranlib
export STRIP=$ANDROID_NDK/toolchains/llvm/prebuilt/$TOOLCHAIN/bin/llvm-strip
cd secp256k1
./autogen.sh
./configure CFLAGS=-fpic --host=$TARGET --enable-experimental --enable-module_ecdh --enable-module-recovery --enable-module-schnorrsig --enable-module-musig --enable-benchmark=no --enable-shared=no --enable-exhaustive-tests=no --enable-tests=no
make clean
make
cd ..
mkdir -p build/android-$ARCH
cp -v secp256k1/.libs/libsecp256k1.a build/android-$ARCH