Skip to content
This repository has been archived by the owner on Mar 25, 2024. It is now read-only.

Commit

Permalink
fix ndk missing
Browse files Browse the repository at this point in the history
  • Loading branch information
segfault-bilibili committed Feb 10, 2022
1 parent 423c909 commit 09870e9
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion build.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
set -e
NDK_VERSION_IF_MISSING=r23b
GOST_VERSION=2.11.1
GOLANG_VERSION=1.13.8
cd $( cd "$( dirname "$0" )" && pwd )
Expand Down Expand Up @@ -27,8 +28,25 @@ cd gost
patch -p1 -r . < ../../gost.patch
cd ..
fi
IS_NDK_MISSING=true
if find $ANDROID_NDK_ROOT | grep clang$
then
IS_NDK_MISSING=false
fi
echo "IS_NDK_MISSING=$IS_NDK_MISSING"
if $IS_NDK_MISSING
then
mkdir -p ndk
cd ndk
curl https://dl.google.com/android/repository/android-ndk-${NDK_VERSION_IF_MISSING}-linux.zip -L -o ndk.zip
unzip ndk.zip > /dev/null || exit $?
rm -f ndk.zip
[ ! -d android-ndk-${NDK_VERSION_IF_MISSING} ] && echo "Missing directory: android-ndk-${NDK_VERSION_IF_MISSING}" && exit 1
export ANDROID_NDK_ROOT=$PWD/android-ndk-${NDK_VERSION_IF_MISSING}
cd ..
fi
echo "ANDROID_NDK_ROOT=$ANDROID_NDK_ROOT"
cd gost
echo $ANDROID_NDK_ROOT
CC=$(find $ANDROID_NDK_ROOT | grep 'armv7a-linux-androideabi21-clang$') \
GOOS="android" GOARCH="arm" CGO_ENABLED="1" \
go build -ldflags "-s -w" -a -o ../../app/src/main/jniLibs/armeabi-v7a/libgost-plugin.so ./cmd/gost
Expand Down

0 comments on commit 09870e9

Please sign in to comment.