generated from HuskyDG/sample_cpp_build
-
Notifications
You must be signed in to change notification settings - Fork 8
/
build.sh
executable file
·45 lines (34 loc) · 1.11 KB
/
build.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
#!/usr/bin/env bash
set -euo pipefail
declare -a commands=("wget" "xz")
for command in "${commands[@]}"; do
if ! command -v $command &> /dev/null
then
echo "$command could not be found. Please install it."
exit
fi
done
build_mode="${1:-release}"
cd "$(dirname "$0")"
pushd native
rm -fr libs obj
debug_mode=1
if [[ "$build_mode" == "release" ]]; then
debug_mode=0
fi
ndk-build -j4 NDK_DEBUG=$debug_mode
popd
rm -rf out
mkdir -p out
cp -af magisk-module out
mv -fT native/libs out/magisk-module/libs
FRIDA_VERSION="16.1.2"
TEMP_DIR=$(mktemp -d)
OUT_DIR="out/magisk-module/libs"
declare -A arch_dirs=(["arm"]="armeabi-v7a" ["arm64"]="arm64-v8a" ["x86"]="x86" ["x86_64"]="x86_64")
for arch in "${!arch_dirs[@]}"; do
wget -P "${TEMP_DIR}" "https://github.com/frida/frida/releases/download/$FRIDA_VERSION/frida-inject-$FRIDA_VERSION-android-$arch.xz"
xz -d "${TEMP_DIR}/frida-inject-$FRIDA_VERSION-android-$arch.xz"
mv "${TEMP_DIR}/frida-inject-$FRIDA_VERSION-android-$arch" "${OUT_DIR}/${arch_dirs[$arch]}/frida-inject"
done
# zip -r9 out/magisk-module-release.zip out/magisk-module