-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.bash
More file actions
73 lines (55 loc) · 1.22 KB
/
Copy pathbuild.bash
File metadata and controls
73 lines (55 loc) · 1.22 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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
set -e
shopt -s globstar
source script/config.bash
# Checking
if [[ -v CLEAN ]]; then
echo "Cleaning build artifacts..."
rm -rf $BUILD $OBJ
echo "Done"
exit 0
fi
if [[ ! -v KS ]]; then
echo "Keystore file is not set"
exit 1
elif [[ ! -f "$KS" ]]; then
echo "Keystore \"$KS\" file does not exist"
exit 1
fi
if [[ ! -v KS_ALIAS ]]; then
echo "Keystore alias is not set"
exit 1
fi
if [[ ! -v KS_PASS ]]; then
echo "Keystore password is not set"
exit 1
fi
rm -rf $BUILD
mkdir -p $OBJ $APK $RES_GEN $LIB/$LIB_ARCH
# Build
echo "Compiling resources..."
$AAPT2 $AAPT2_CF
echo "Linking resources..."
$AAPT2 $AAPT2_LF
echo "Compiling C libraries..."
cd $OBJ
printf "$C_INCL/%s\n" "${C_SRC_LIBS[@]}" | parallel -j $PROC $CLANG $CLANG_COF_L {}
cd $OLDPWD
echo "Compiling C sources..."
cd $OBJ
printf "$C_SRC/%s\n" "${C_SRC_FILES[@]}" | parallel -j $PROC $CLANG $CLANG_COF {}
cd $OLDPWD
echo "Linking C objects..."
$CLANG $CLANG_CFF -o $LIB_MAIN $OBJ/*.o $CLANG_CLF
echo "Zipping libraries..."
cd $BUILD
$ZIP $ZIP_F
cd $OLDPWD
echo "Aligning APK..."
$ZIPALIGN $ZIPALIGN_F
echo "Signing APK..."
$APKSIGNER $APKSIGNER_F
if [[ -v COPY ]]; then
echo "Copying APK to $CP_DEST..."
cp $APK_SIGNED $CP_DEST
fi
echo "Done"