From d8255522334e488c56fc499cd07648e3b291905d Mon Sep 17 00:00:00 2001 From: UjuiUjuMandan <125150101+UjuiUjuMandan@users.noreply.github.com> Date: Sat, 11 Jan 2025 10:28:06 +0000 Subject: [PATCH] ABI parameter for compile-tun2socks.sh --- .gitignore | 3 +++ compile-tun2socks.sh | 25 ++++++++++++++++++++++++- 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index d1d8265b..d06d1b37 100644 --- a/.gitignore +++ b/.gitignore @@ -7,3 +7,6 @@ conf/demo/ demo/ assets/ libv2ray*.[a|j]ar + +*.so +*.so.tgz diff --git a/compile-tun2socks.sh b/compile-tun2socks.sh index 467eb655..cdcfb92b 100755 --- a/compile-tun2socks.sh +++ b/compile-tun2socks.sh @@ -22,13 +22,36 @@ clear_tmp () { trap 'echo -e "Aborted, error $? in command: $BASH_COMMAND"; trap ERR; clear_tmp; exit 1' ERR INT install -m644 $__dir/tun2socks.mk $TMPDIR/ +abi_filter="all" +if [ "$#" -eq 1 ]; then + case $1 in + arm64-v8a) + abi_filter="arm64-v8a" + ;; + armeabi-v7a) + abi_filter="armeabi-v7a" + ;; + x86_64) + abi_filter="x86_64" + ;; + x86) + abi_filter="x86" + ;; + *) + echo "Invalid ABI specified: $1" + echo "Valid options are: arm64-v8a, armeabi-v7a, x86_64, x86" + exit 1 + ;; + esac +fi + pushd $TMPDIR ln -s $__dir/badvpn badvpn ln -s $__dir/libancillary libancillary $NDK_HOME/ndk-build \ NDK_PROJECT_PATH=. \ APP_BUILD_SCRIPT=./tun2socks.mk \ - APP_ABI=all \ + APP_ABI=$abi_filter \ APP_PLATFORM=android-19 \ NDK_LIBS_OUT=$TMPDIR/libs \ NDK_OUT=$TMPDIR/tmp \