-
Notifications
You must be signed in to change notification settings - Fork 10
96 lines (76 loc) · 2.93 KB
/
build-ndk.yml
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
name: build with NDK toolchains
on:
workflow_dispatch:
env:
api_version: 28 # min. 21
ndk: r26d # android-ndk-$ndk-linux.zip
jobs:
build:
runs-on: ubuntu-22.04
steps:
- 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
- id: commit
uses: prompt/actions-commit-hash@v3
- name: Prepare NDK Toolchain
run: |
wget -qO ndk.zip https://dl.google.com/android/repository/android-ndk-$ndk-linux.zip
unzip -qq ndk.zip "android-ndk-$ndk/toolchains/*" && rm ndk.zip -f
- name: Patch ZeroTier for Cross-Compile
run: |
pip3 install toml
python3 build/patch.py
- name: Build for AArch64
run: |
PATH=`pwd`/android-ndk-$ndk/toolchains/llvm/prebuilt/linux-x86_64/bin:$PATH
NDK_ROOT=`pwd`/android-ndk-$ndk/toolchains/llvm/prebuilt/linux-x86_64
CC=aarch64-linux-android$api_version-clang
CXX=aarch64-linux-android$api_version-clang++
cd libnatpmp
make clean
make --silent CC=$CC natpmpc-shared
cd ..
cd ZeroTierOne
make clean
make --silent -j $(nproc) ZT_DEBUG=0 ZT_SSO_SUPPORTED=0 CC=$CC CXX=$CXX LDFLAGS="-L../libnatpmp" DEFS="-I../libnatpmp -D__GLIBC__=0"
cd ..
mkdir -p magisk/zerotier/lib
cp ZeroTierOne/zerotier-one magisk/zerotier
cp $NDK_ROOT/sysroot/usr/lib/aarch64-linux-android/libc++_shared.so magisk/zerotier/lib
- name: Upload AArch64
uses: actions/upload-artifact@v4
with:
name: zerotier-magisk-aarch64-ndk-${{ steps.commit.outputs.short }}
path: magisk/
- name: Build for Arm
run: |
PATH=`pwd`/android-ndk-$ndk/toolchains/llvm/prebuilt/linux-x86_64/bin:$PATH
NDK_ROOT=`pwd`/android-ndk-$ndk/toolchains/llvm/prebuilt/linux-x86_64
CC=armv7a-linux-androideabi$api_version-clang
CXX=armv7a-linux-androideabi$api_version-clang++
cd libnatpmp
make clean
make CC=$CC natpmpc-shared
cd ..
cd ZeroTierOne
mv make-linux.mk.arm.ndk make-linux.mk
make clean
make --silent -j $(nproc) ZT_DEBUG=0 ZT_SSO_SUPPORTED=0 CC=$CC CXX=$CXX LDFLAGS="-L../libnatpmp" DEFS="-I../libnatpmp -D__GLIBC__=0"
cd ..
cp ZeroTierOne/zerotier-one magisk/zerotier/
cp $NDK_ROOT/sysroot/usr/lib/arm-linux-androideabi/libc++_shared.so magisk/zerotier/lib
- name: Upload Arm
uses: actions/upload-artifact@v4
with:
name: zerotier-magisk-arm-ndk-${{ steps.commit.outputs.short }}
path: magisk/