Skip to content

Commit 9b64adf

Browse files
vbajsFiqri Ardyansyah
andcommitted
scripts: build.sh: use evagcc alongside aosp clang
Inspired by fiqri19102002/android_kernel_xiaomi_sweet@143ec50 Co-authored-by: Fiqri Ardyansyah <fiqri0927936@gmail.com> Signed-off-by: Yahya Wessam <yahyawessam2002@gmail.com>
1 parent 474ba38 commit 9b64adf

1 file changed

Lines changed: 25 additions & 6 deletions

File tree

build.sh

Lines changed: 25 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,27 @@ else
4848
echo "Local clang dir found, will not download clang and using that instead"
4949
fi
5050

51-
export PATH="$PWD/clang/bin/:$PATH"
52-
export KBUILD_COMPILER_STRING="$($PWD/clang/bin/clang --version | head -n 1 | perl -pe 's/\(http.*?\)//gs' | sed -e 's/ */ /g' -e 's/[[:space:]]*$//')"
51+
if [ ! -d "$PWD/gcc32" ] && [ ! -d "$PWD/gcc64" ]; then
52+
ASSET_URLS=$(curl -s "https://api.github.com/repos/mvaisakh/gcc-build/releases/latest" | grep "browser_download_url" | cut -d '"' -f 4 | grep -E "eva-gcc-arm.*\.xz")
53+
for url in $ASSET_URLS; do
54+
wget --content-disposition -L "$url"
55+
done
56+
for file in eva-gcc-arm*.xz; do
57+
#The files are actually just plain tarballs named as .xz, do not call xz to decompress
58+
if [[ "$file" == *arm64* ]]; then
59+
tar -xf "$file" && mv gcc-arm64 gcc64
60+
else
61+
tar -xf "$file" && mv gcc-arm gcc32
62+
fi
63+
rm -rf "$file"
64+
done
65+
else
66+
echo "Local gcc dirs found, will not download clang and using those instead"
67+
fi
68+
69+
export GCC64_DIR=$PWD/gcc64
70+
export GCC32_DIR=$PWD/gcc32
71+
export PATH="$PWD/clang/bin/:$GCC64_DIR/bin/:$GCC32_DIR/bin/:/usr/bin:$PATH"
5372

5473
#if [ "$local" = true ]; then
5574
# echo -e "\nLocal build, disabling LTO...\n"
@@ -68,8 +87,8 @@ make -j$(nproc --all) \
6887
ARCH=arm64 \
6988
LLVM=1 \
7089
LLVM_IAS=1 \
71-
CROSS_COMPILE=aarch64-linux-gnu- \
72-
CROSS_COMPILE_ARM32=arm-linux-gnueabi-
90+
CROSS_COMPILE=$GCC64_DIR/bin/aarch64-elf- \
91+
CROSS_COMPILE_COMPAT=$GCC32_DIR/bin/arm-eabi-
7392

7493
kernel="out/arch/arm64/boot/Image.gz"
7594
dtbo="out/arch/arm64/boot/dtbo.img"
@@ -127,8 +146,8 @@ make -j$(nproc --all) \
127146
ARCH=arm64 \
128147
LLVM=1 \
129148
LLVM_IAS=1 \
130-
CROSS_COMPILE=aarch64-linux-gnu- \
131-
CROSS_COMPILE_ARM32=arm-linux-gnueabi
149+
CROSS_COMPILE=$GCC64_DIR/bin/aarch64-elf- \
150+
CROSS_COMPILE_COMPAT=$GCC32_DIR/bin/arm-eabi-
132151

133152
if [ ! -f "$kernel" ]; then
134153
echo -e "\nCompilation failed!"

0 commit comments

Comments
 (0)