Skip to content

Commit

Permalink
CI: Support custom gcc (issue by #75)
Browse files Browse the repository at this point in the history
Signed-off-by: xiaoleGun <1592501605@qq.com>
  • Loading branch information
xiaoleGun committed Jul 31, 2023
1 parent 30d831e commit 345c483
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 1 deletion.
45 changes: 44 additions & 1 deletion .github/workflows/build-kernel.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,12 @@ jobs:
echo "CLANG_VERSION=$(cat $CONFIG_ENV | grep -w "CLANG_VERSION" | head -n 1 | cut -d "=" -f 2)" >> $GITHUB_ENV
echo "ENABLE_GCC_ARM64=$(cat $CONFIG_ENV | grep -w "ENABLE_GCC_ARM64" | head -n 1 | cut -d "=" -f 2)" >> $GITHUB_ENV
echo "ENABLE_GCC_ARM32=$(cat $CONFIG_ENV | grep -w "ENABLE_GCC_ARM32" | head -n 1 | cut -d "=" -f 2)" >> $GITHUB_ENV
echo "USE_CUSTOM_GCC_64=$(cat $CONFIG_ENV | grep -w "USE_CUSTOM_GCC_64" | head -n 1 | cut -d "=" -f 2)" >> $GITHUB_ENV
echo "CUSTOM_GCC_64_SOURCE=$(cat $CONFIG_ENV | grep -w "CUSTOM_GCC_64_SOURCE" | head -n 1 | cut -d "=" -f 2)" >> $GITHUB_ENV
echo "CUSTOM_GCC_64_BRANCH=$(cat $CONFIG_ENV | grep -w "CUSTOM_GCC_64_BRANCH" | head -n 1 | cut -d "=" -f 2)" >> $GITHUB_ENV
echo "USE_CUSTOM_GCC_32=$(cat $CONFIG_ENV | grep -w "USE_CUSTOM_GCC_32" | head -n 1 | cut -d "=" -f 2)" >> $GITHUB_ENV
echo "CUSTOM_GCC_32_SOURCE=$(cat $CONFIG_ENV | grep -w "CUSTOM_GCC_32_SOURCE" | head -n 1 | cut -d "=" -f 2)" >> $GITHUB_ENV
echo "CUSTOM_GCC_32_BRANCH=$(cat $CONFIG_ENV | grep -w "CUSTOM_GCC_32_BRANCH" | head -n 1 | cut -d "=" -f 2)" >> $GITHUB_ENV
echo "ENABLE_KERNELSU=$(cat $CONFIG_ENV | grep -w "ENABLE_KERNELSU" | head -n 1 | cut -d "=" -f 2)" >> $GITHUB_ENV
echo "KERNELSU_TAG=$(cat $CONFIG_ENV | grep -w "KERNELSU_TAG" | head -n 1 | cut -d "=" -f 2)" >> $GITHUB_ENV
echo "ADD_KPROBES_CONFIG=$(cat $CONFIG_ENV | grep -w "ADD_KPROBES_CONFIG" | head -n 1 | cut -d "=" -f 2)" >> $GITHUB_ENV
Expand All @@ -55,7 +61,7 @@ jobs:
mkdir -p $GITHUB_WORKSPACE/kernel_workspace
- name: Download Clang-aosp
if: env.USE_CUSTOM_CLANG == 'false'
if: env.USE_CUSTOM_CLANG != 'true'
run: |
cd $GITHUB_WORKSPACE/kernel_workspace
mkdir clang-aosp
Expand All @@ -82,6 +88,7 @@ jobs:
- name: Download Gcc-aosp
run: |
if: env.USE_CUSTOM_GCC_64 != 'true' || env.USE_CUSTOM_GCC_32 != 'true'
cd $GITHUB_WORKSPACE/kernel_workspace
if [ ${{ env.ENABLE_GCC_ARM64 }} = true ]; then
mkdir gcc-64
Expand All @@ -97,6 +104,42 @@ jobs:
echo "GCC_32=CROSS_COMPILE_ARM32=$GITHUB_WORKSPACE/kernel_workspace/gcc-32/bin/arm-linux-androideabi-" >> $GITHUB_ENV
fi
- name: Download Custom-Gcc
if: env.USE_CUSTOM_GCC_64 == 'true' || env.USE_CUSTOM_GCC_32 == 'true'
run: |
cd $GITHUB_WORKSPACE/kernel_workspace
if [ ${{ env.USE_CUSTOM_GCC_64 }} = true ]; then
if [[ ${{ env.CUSTOM_GCC_64_SOURCE }} =~ git ]]; then
if [[ ${{ env.CUSTOM_GCC_64_SOURCE }} == *'.tar.gz' ]]; then
wget -O gcc-64.tar.gz ${{ env.CUSTOM_CLANG_SOURCE }}
mkdir gcc-64
tar -C gcc-64/ -zxvf gcc-64.tar.gz
else
git clone ${{ env.CUSTOM_GCC_64_SOURCE }} -b ${{ env.CUSTOM_GCC_64_BRANCH }} gcc-64 --depth=1
fi
else
wget -O gcc-64.zip ${{ env.CUSTOM_GCC_64_SOURCE }}
mkdir gcc-64
unzip gcc-64.zip -d gcc-64/
fi
fi
if [ ${{ env.USE_CUSTOM_GCC_64 }} = true ]; then
if [[ ${{ env.CUSTOM_GCC_32_SOURCE }} =~ git ]]; then
if [[ ${{ env.CUSTOM_GCC_32_SOURCE }} == *'.tar.gz' ]]; then
wget -O gcc-32.tar.gz ${{ env.CUSTOM_CLANG_SOURCE }}
mkdir gcc-32
tar -C gcc-32/ -zxvf gcc-32.tar.gz
else
git clone ${{ env.CUSTOM_GCC_32_SOURCE }} -b ${{ env.CUSTOM_GCC_32_BRANCH }} gcc-32 --depth=1
fi
else
wget -O gcc-32.zip ${{ env.CUSTOM_GCC_32_SOURCE }}
mkdir gcc-32
unzip gcc-32.zip -d gcc-32/
fi
fi
- name: Download mkbootimg tools
if: env.BUILD_BOOT_IMG == 'true'
run: |
Expand Down
6 changes: 6 additions & 0 deletions config.env
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,12 @@ CLANG_VERSION=r450784d
# GCC
ENABLE_GCC_ARM64=true
ENABLE_GCC_ARM32=true
USE_CUSTOM_GCC_64=false
CUSTOM_GCC_64_SOURCE=
CUSTOM_GCC_64_BRANCH=
USE_CUSTOM_GCC_32=false
CUSTOM_GCC_32_SOURCE=
CUSTOM_GCC_32_BRANCH=

# KernelSU flags
ENABLE_KERNELSU=false
Expand Down

0 comments on commit 345c483

Please sign in to comment.