-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathbuild.sh
More file actions
executable file
·50 lines (46 loc) · 1.48 KB
/
build.sh
File metadata and controls
executable file
·50 lines (46 loc) · 1.48 KB
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
46
47
48
49
50
#!/bin/bash
set -e
if [ ! -d "$ANDROID_NDK_HOME" ]; then
echo "Failed: \$ANDROID_NDK_HOME is space."
exit 1
fi
if [ "$M_API" = "" ]; then
echo "Failed: \$M_API is space."
exit 1
fi
if [ "$M_TARGET" = "" ]; then
echo "Failed: \$M_TARGET is space."
exit 1
elif [ "$M_TARGET" = "aarch64" ]; then
export TARGET=aarch64-linux-android
elif [ "$M_TARGET" = "armv7a" ]; then
export TARGET=armv7a-linux-androideabi
elif [ "$M_TARGET" = "x86_64" ]; then
export TARGET=x86_64-linux-android
elif [ "$M_TARGET" = "i686" ]; then
export TARGET=i686-linux-android
elif [ "$M_TARGET" = "riscv64" ]; then
export TARGET=riscv64-linux-android
else
echo "TARGET Error! "
exit 1
fi
export NDKTOOL="$ANDROID_NDK_HOME/toolchains/llvm/prebuilt/linux-x86_64"
export CC="$NDKTOOL/bin/${TARGET}${M_API}-clang"
export AR="$NDKTOOL/bin/llvm-ar"
export STRIP="$NDKTOOL/bin/llvm-strip"
export CFLAGS="-target ${TARGET}${M_API} -fPIC -D__ANDROID_API__=$M_API"
export CXXFLAGS="$CFLAGS"
export LDFLAGS="-target ${TARGET}${M_API}"
make -j$(nproc)
if [ "$1" = "-build-apk" ] || [ "$1" = "--build-apk" ]; then
cd AppSource/
if [ ! -f "keystore.properties" ]; then
echo "KEY Error! "
exit 1
fi
chmod +x gradlew
./gradlew assembleRelease --no-daemon
fi
make module_tar && echo -e " » 打包完成,成品:ClearBox_${M_TARGET}_${M_API}.zip!\n » Tar Done, Is: ClearBox_${M_TARGET}_${M_API}.zip! "
make clean && echo -e " » 清理完成!\n » Clean Done! "