From 52a5a3b993f6651961b3b2e2b53e395cd365d406 Mon Sep 17 00:00:00 2001 From: eventlOwOp <3064273390@qq.com> Date: Sat, 11 May 2024 15:26:39 +0800 Subject: [PATCH] add gcc toolchains --- .github/workflows/build-gcc.yml | 102 ++++++++++++++++++ .../workflows/{build.yml => build-ndk.yml} | 15 ++- 2 files changed, 113 insertions(+), 4 deletions(-) create mode 100644 .github/workflows/build-gcc.yml rename .github/workflows/{build.yml => build-ndk.yml} (88%) diff --git a/.github/workflows/build-gcc.yml b/.github/workflows/build-gcc.yml new file mode 100644 index 0000000..4b651f0 --- /dev/null +++ b/.github/workflows/build-gcc.yml @@ -0,0 +1,102 @@ +# This is a basic workflow to help you get started with Actions + +name: build with GCC toolchains + +# Controls when the workflow will run +on: + # Triggers the workflow on push or pull request events but only for the "master" branch + # push: + # branches: [ "master" ] + # pull_request: + # branches: [ "master" ] + + # Allows you to run this workflow manually from the Actions tab + workflow_dispatch: + +# A workflow run is made up of one or more jobs that can run sequentially or in parallel +jobs: + # This workflow contains a single job called "build" + build: + # The type of runner that the job will run on + runs-on: ubuntu-latest + + # Steps represent a sequence of tasks that will be executed as part of the job + steps: + # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it + - name: Checkout zerotier-magisk + uses: actions/checkout@v4 + + - name: Checkout ZeroTierOne + uses: actions/checkout@v4 + with: + repository: zerotier/ZeroTierOne + path: ZeroTierOne + + - name: Checkout libnatpmp + uses: actions/checkout@v4 + with: + repository: miniupnp/libnatpmp + path: libnatpmp + + # Runs a single command using the runners shell + - name: Prepare GCC Toolchain + run: | + apt-get install -y gcc-aarch64-linux-gnu gcc-arm-linux-gnueabihf g++-aarch64-linux-gnu g++-arm-linux-gnueabihf + + - name: Build for aarch64 + run: | + CC=aarch64-linux-gnu-gcc + CXX=aarch64-linux-gnu-g++ + + cd libnatpmp + make --silent CC=$CC natpmpc-shared + cd .. + + cd ZeroTierOne + make --silent -j $(nproc) ZT_STATIC=1 ZT_DEBUG=0 ZT_SSO_SUPPORTED=0 CC=$CC CXX=$CXX LDFLAGS="-L../libnatpmp -s" DEFS="-I../libnatpmp" + cd .. + + mkdir -p magisk/zerotier/lib + cp ZeroTierOne/zerotier-one magisk/zerotier + cd magisk + zip -q -r ../zerotier-magisk-aarch64-gcc.zip . + + - name: Build for arm + run: | + PATH=`pwd`/android-ndk-$ndk/toolchains/llvm/prebuilt/linux-x86_64/bin:$PATH + PATH=`pwd`/libnatpmp:$PATH + NDK_ROOT=`pwd`/android-ndk-$ndk/toolchains/llvm/prebuilt/linux-x86_64 + + CC=arm-linux-gnueabihf-gcc + CXX=arm-linux-gnueabihf-g++ + + cd libnatpmp + make clean + make CC=$CC natpmpc-shared + cd .. + + cd ZeroTierOne + make clean + # sed -i "s/armv7ve/armv7a/g" make-linux.mk + make -j $(nproc) ZT_STATIC=1 ZT_DEBUG=0 ZT_SSO_SUPPORTED=0 CC=$CC CXX=$CXX LDFLAGS="-L../libnatpmp -s" DEFS="-I../libnatpmp" + cd .. + + cp ZeroTierOne/zerotier-one magisk/zerotier/ + cd magisk + zip -q -r ../zerotier-magisk-arm-gcc.zip . + + # - name: Debugging with tmate + # uses: mxschmitt/action-tmate@v3.18 + + - name: Get Date + id: date + run: echo "::set-output name=date::$(date +'%Y-%m-%d')" + + - name: Release + uses: softprops/action-gh-release@v2 + with: + files: | + zerotier-magisk-aarch64-gcc.zip + zerotier-magisk-arm-gcc.zip + tag_name: SNAPSHOT-${{ steps.date.outputs.date }} + release_name: SNAPSHOT-${{ steps.date.outputs.date }} diff --git a/.github/workflows/build.yml b/.github/workflows/build-ndk.yml similarity index 88% rename from .github/workflows/build.yml rename to .github/workflows/build-ndk.yml index b675778..13c8e44 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build-ndk.yml @@ -1,6 +1,6 @@ # This is a basic workflow to help you get started with Actions -name: build +name: build with NDK toolchains # Controls when the workflow will run on: @@ -68,7 +68,7 @@ jobs: cp ZeroTierOne/zerotier-one magisk/zerotier cp $NDK_ROOT/sysroot/usr/lib/aarch64-linux-android/libc++_shared.so magisk/zerotier/lib cd magisk - zip -q -r ../zerotier-magisk-aarch64.zip . + zip -q -r ../zerotier-magisk-aarch64-ndk.zip . # - name: Build for arm # run: | @@ -93,12 +93,19 @@ jobs: # cp ZeroTierOne/zerotier-one magisk/zerotier/ # cp $NDK_ROOT/sysroot/usr/lib/arm-linux-android/libc++_shared.so magisk/zerotier/lib # cd magisk - # zip -q -r ../zerotier-magisk-arm.zip . + # zip -q -r ../zerotier-magisk-arm-ndk.zip . # - name: Debugging with tmate # uses: mxschmitt/action-tmate@v3.18 + - name: Get Date + id: date + run: echo "::set-output name=date::$(date +'%Y-%m-%d')" + - name: Release uses: softprops/action-gh-release@v2 with: - files: zerotier-magisk-aarch64.zip + files: | + zerotier-magisk-aarch64-ndk.zip + tag_name: SNAPSHOT-${{ steps.date.outputs.date }} + release_name: SNAPSHOT-${{ steps.date.outputs.date }}