-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbuild.sh
98 lines (91 loc) · 3.37 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
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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
#!/usr/bin/env bash
echo "Cloning dependencies"
rm -rf AnyKernel
git clone --depth=1 https://github.com/kdrag0n/proton-clang clang
git clone --depth=1 https://github.com/UsiFX/AnyKernel3.git AnyKernel
git clone --depth=1 https://github.com/LineageOS/android_prebuilts_gcc_linux-x86_aarch64_aarch64-linux-android-4.9 los-4.9-64
git clone --depth=1 https://github.com/LineageOS/android_prebuilts_gcc_linux-x86_arm_arm-linux-androideabi-4.9 los-4.9-32
echo "Done"
IMAGE=$(pwd)/out/arch/arm64/boot/Image.gz-dtb
TANGGAL=$(date +"%Y%m%d")
START=$(date +"%s")
KERNEL_DIR=$(pwd)
export PATH=$KERNEL_DIR/clang/bin:$PATH
export KBUILD_COMPILER_STRING="$(${KERNEL_DIR}/clang/bin/clang --version | head -n 1 | perl -pe 's/\(http.*?\)//gs' | sed -e 's/ */ /g')"
export ARCH=arm64
export KBUILD_BUILD_HOST=UsiF
export KBUILD_BUILD_USER="liquid-CI"
status="EAS-STABLE"
# Send info plox channel
function sendinfo() {
curl -s -X POST "https://api.telegram.org/bot${token}/sendMessage" \
-d chat_id="${chat_id}" \
-d "disable_web_page_preview=true" \
-d "parse_mode=html" \
-d text="%0ABuild started on <code>liquidCI</code>%0Adevice: <b>Redmi Note 7</b>%0Abranch: <code>$(git rev-parse --abbrev-ref HEAD)</code> (master)%0AUsing compiler: <code>${KBUILD_COMPILER_STRING}</code>%0AStarted on <code>$(date)</code>%0ABuild Status: <code>${status}</code> %0AStarted by: <code>${KBUILD_BUILD_HOST}</code>"
}
# Push kernel to channel
function push() {
curl -s -X POST "https://api.telegram.org/bot${token}/sendMessage" \
-d chat_id="${chat_id}" \
-d "disable_web_page_preview=true" \
-d "parse_mode=html" \
-d text="Build finished For <b>Redmi note 7</b>"
}
# Fin Error
function finerr() {
log=$(echo *.log)
curl -F document=@$log "https://api.telegram.org/bot${token}/sendDocument" \
-F chat_id="${chat_id}" \
-F "disable_web_page_preview=true" \
-F "parse_mode=html" \
-F caption="Build failed..."
}
# Compile plox
function compile() {
make O=out ARCH=arm64 lavender-perf_defconfig
make -j$(nproc --all) O=out \
LLVM=1 \
PATH=$KERNEL_DIR/clang/bin:$PATH \
ARCH=arm64 \
CC=clang \
AR=llvm-ar \
NM=llvm-nm \
STRIP=llvm-strip \
OBJCOPY=llvm-objcopy \
OBJDUMP=llvm-objdump \
OBJSIZE=llvm-size \
HOSTCC=clang \
HOSTCXX=clang++ \
HOSTAR=llvm-ar \
CROSS_COMPILE=aarch64-linux-gnu- \
CROSS_COMPILE_ARM32=arm-linux-gnueabi- \
V=0 2>&1 | tee build.log
if [ -d "$IMAGE" ]; then
finerr
else
cp out/arch/arm64/boot/Image.gz-dtb AnyKernel
zipping
kpush
fi
}
# Zipping
function zipping() {
cd AnyKernel
zip -r9 liquid-${VER}-lavender-${STATUS}-${TANGGAL}.zip *
cd ..
}
# Push kernel to channel
function kpush() {
cd AnyKernel
ZIP=$(echo *.zip)
curl -F document=@$ZIP "https://api.telegram.org/bot${token}/sendDocument" \
-F chat_id="${chat_id}" \
-F "disable_web_page_preview=true" \
-F "parse_mode=html" \
-F caption="Build For <b>Redmi Note 7</b>"
}
sendinfo
compile
END=$(date +"%s")
DIFF=$(($END - $START))