forked from HuskyDG/magic_overlayfs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.sh
38 lines (31 loc) · 969 Bytes
/
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
#!/usr/bin/env bash
set -euo pipefail
build_mode="${1:-release}"
cd "$(dirname "$0")"
ANDROID_NDK_HOME=./android-ndk-r23b
export PATH=${PATH}:${ANDROID_NDK_HOME}/toolchains/llvm/prebuilt/linux-x86_64/bin
rm -rf out
mkdir -p out
cp -af magisk-module out
cp -af README.md out/magisk-module
mkdir -p out/magisk-module/libs
( cat << EOF
arm64-v8a aarch64-linux-android31-clang++
armeabi-v7a armv7a-linux-androideabi31-clang++
x86 i686-linux-android31-clang++
x86_64 x86_64-linux-android31-clang++
EOF
) | while read line; do
ARCH="$(echo $line | awk '{ print $1 }')"
CXX="$(echo $line | awk '{ print $2 }')"
if [ ! -z "$ARCH" ]; then
mkdir "out/magisk-module/libs/${ARCH}"
${CXX} \
native/jni/main.cpp \
native/jni/logging.cpp native/jni/utils.cpp native/jni/mountinfo.cpp \
-static \
-std=c++17 \
-o "out/magisk-module/libs/${ARCH}/overlayfs_system"
fi
done
zip -r9 out/magisk-module-release.zip out/magisk-module