-
Notifications
You must be signed in to change notification settings - Fork 9
344 lines (295 loc) · 10.9 KB
/
build-tdlib.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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
name: tdlib-build
on:
push:
paths:
- '.github/workflows/td-version.json'
- '.github/workflows/build-tdlib.yml'
jobs:
build-android:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- name: JSON to variables
uses: rgarcia-phi/[email protected]
with:
filename: '.github/workflows/td-version.json'
prefix: td
- name: setup
run: |
sudo apt-get install -y make git zlib1g-dev libssl-dev gperf cmake clang libc++-dev libc++abi-dev ninja-build
- name: download ndk
run: |
mkdir /opt/android-ndk-tmp
cd /opt/android-ndk-tmp
wget -q https://dl.google.com/android/repository/android-ndk-r20-linux-x86_64.zip
unzip -q android-ndk-r20-linux-x86_64.zip
mv ./android-ndk-r20 /opt/android-ndk
cd /opt/android-ndk
rm -rf /opt/android-ndk-tmp
export PATH=$PATH:/opt/android-ndk
- name: clone
run: |
git clone https://github.com/tdlib/td.git
cd td
git checkout ${{ env.td_commit_hash }}
git show --summary
- name: setup td
run: |
cd td/example
curl https://github.com/tdlib/td/files/4746919/libtdjsonandroid.zip -o libtdjsonandroid.zip -L
unzip -o libtdjsonandroid.zip
mv libtdjsonandroid/* .
rmdir libtdjsonandroid
rm libtdjsonandroid.zip
chmod +x build.sh
chmod +x export.sh
chmod +x build-all.sh
chmod +x third_party/crypto/build.sh
chmod +x third_party/crypto/build-all.sh
sed -i '3s/.*/set(TD_DIR ${CMAKE_CURRENT_SOURCE_DIR}\/..)/' CMakeLists.txt
curl https://github.com/openssl/openssl/archive/refs/tags/OpenSSL_1_1_1g.tar.gz -o third_party/crypto/openssl-OpenSSL_1_1_1g.tar.gz -L
sed -i '5s/.*/cmake .. -DCMAKE_TOOLCHAIN_FILE=\/opt\/android-ndk\/build\/cmake\/android.toolchain.cmake -DCMAKE_BUILD_TYPE=MinSizeRel -GNinja -DANDROID_ABI=${ABI} || exit 1/' build.sh
sed -i '1s/.*/#!\/bin\/bash/' third_party/crypto/build.sh
sed -i '21s/.*/HOST_ARCH=linux-x86_64/' third_party/crypto/build.sh
sed -i '20s/.*/export ANDROID_NDK=\/opt\/android-ndk/' third_party/crypto/build.sh
- name: build ssl
run: |
export ANDROID_NDK_HOME=/opt/android-ndk
export ANDROID_NDK_ROOT=/opt/android-ndk
cd td/example/third_party/crypto
./build-all.sh
- name: build
run: |
cd td/example
./export.sh
# - name: fake build
# run: |
# mkdir -p td/example/libs
# mkdir -p td/example/libs/arm64-v8a
# mkdir -p td/example/libs/armeabi-v7a
# mkdir -p td/example/libs/x86
# mkdir -p td/example/libs/x86_64
# echo arm64-v8a > td/example/libs/arm64-v8a/libtdjsonandroid.so
# echo arm64-v8a > td/example/libs/arm64-v8a/libtdjsonandroid.so.debug
# echo armeabi-v7a > td/example/libs/armeabi-v7a/libtdjsonandroid.so
# echo armeabi-v7a > td/example/libs/armeabi-v7a/libtdjsonandroid.so.debug
# echo x86 > td/example/libs/x86/libtdjsonandroid.so
# echo x86 > td/example/libs/x86/libtdjsonandroid.so.debug
# echo x86_64 > td/example/libs/x86_64/libtdjsonandroid.so
# echo x86_64 > td/example/libs/x86_64/libtdjsonandroid.so.debug
- name: zip
run: |
cd td/example/libs
zip libs.zip arm64-v8a/libtdjsonandroid.so armeabi-v7a/libtdjsonandroid.so x86/libtdjsonandroid.so x86_64/libtdjsonandroid.so
- name: Release
uses: ncipollo/release-action@v1
with:
tag: android-${{ env.td_version }}-${{ env.td_commit_hash }}
name: Android ${{ env.td_version }}-${{ env.td_commit_hash }}
body: https://github.com/tdlib/td/tree/${{ env.td_commit_hash }}
token: ${{ secrets.GITHUB_TOKEN }}
artifacts: 'td/example/libs/libs.zip'
build-macos-intel:
runs-on: macos-11
steps:
- uses: actions/checkout@v2
- name: JSON to variables
uses: rgarcia-phi/[email protected]
with:
filename: '.github/workflows/td-version.json'
prefix: td
- name: setup
run: |
brew install gperf cmake coreutils
- name: clone
run: |
git clone https://github.com/tdlib/td.git
cd td
git checkout ${{ env.td_commit_hash }}
git show --summary
- name: setup td
run: |
cd td/example/ios
sed -i '.bak' '11s/.*/platforms="macOS"/' build-openssl.sh
sed -i '.bak' '24s/.*/platforms="macOS"/' build.sh
- name: build ssl
run: |
cd td/example/ios
./build-openssl.sh
- name: build
run: |
cd td/example/ios
./build.sh
# - name: fake build
# run: |
# mkdir -p td/example/ios/tdjson/macOS/lib/
# cd td/example/ios/tdjson/macOS/lib/
# echo "libtdjson" > libtdjson.dylib
- name: zip
run: |
cd td/example/ios/tdjson/macOS/lib/
zip libtdjson.zip libtdjson.dylib
- name: Release
uses: ncipollo/release-action@v1
with:
tag: macos-intel-${{ env.td_version }}-${{ env.td_commit_hash }}
name: MacOS Intel ${{ env.td_version }}-${{ env.td_commit_hash }}
body: https://github.com/tdlib/td/tree/${{ env.td_commit_hash }}
token: ${{ secrets.GITHUB_TOKEN }}
artifacts: 'td/example/ios/tdjson/macOS/lib/libtdjson.zip'
build-ios:
runs-on: macos-11
steps:
- uses: actions/checkout@v2
- name: JSON to variables
uses: rgarcia-phi/[email protected]
with:
filename: '.github/workflows/td-version.json'
prefix: td
- name: setup
run: |
brew install gperf cmake coreutils
- name: clone
run: |
git clone https://github.com/tdlib/td.git
cd td
git checkout ${{ env.td_commit_hash }}
git show --summary
- name: setup td
run: |
cd td
mkdir native-build
cd native-build
cmake ..
cmake --build . --target prepare_cross_compiling
cd ../example/ios
sed -i '.bak' '11s/.*/platforms="iOS"/' build-openssl.sh
sed -i '.bak' '24s/.*/platforms="iOS"/' build.sh
- name: build ssl
run: |
cd td/example/ios
./build-openssl.sh
- name: build
run: |
cd td/example/ios
./build.sh
# - name: fake build
# run: |
# mkdir -p td/example/ios/tdjson/iOS/lib/
# cd td/example/ios/tdjson/iOS/lib/
# echo "libtdjson" > libtdjson.dylib
- name: zip
run: |
cd td/example/ios/tdjson/iOS/lib/
zip libtdjson.zip libtdjson.dylib
- name: Release
uses: ncipollo/release-action@v1
with:
tag: ios-${{ env.td_version }}-${{ env.td_commit_hash }}
name: iOS ${{ env.td_version }}-${{ env.td_commit_hash }}
body: https://github.com/tdlib/td/tree/${{ env.td_commit_hash }}
token: ${{ secrets.GITHUB_TOKEN }}
artifacts: 'td/example/ios/tdjson/iOS/lib/libtdjson.zip'
build-linux-x64:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- name: JSON to variables
uses: rgarcia-phi/[email protected]
with:
filename: '.github/workflows/td-version.json'
prefix: td
- name: setup
run: |
sudo apt-get install make git zlib1g-dev libssl-dev gperf php-cli cmake g++
- name: clone
run: |
git clone https://github.com/tdlib/td.git
cd td
git checkout ${{ env.td_commit_hash }}
git show --summary
- name: build
run: |
cd td
rm -rf build
mkdir build
cd build
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX:PATH=../tdlib ..
cmake --build . --target prepare_cross_compiling
cd ..
php SplitSource.php
cd build
cmake --build . --target install
cd ..
php SplitSource.php --undo
# - name: fake build
# run: |
# mkdir -p td/tdlib/lib
# echo test > td/tdlib/lib/libtdjson.so.1.8.4
# echo test > td/tdlib/lib/libtdjson.so
# rm td/tdlib/lib/libtdjson.so
# mv td/tdlib/lib/libtdjson.so.1.8.4 td/tdlib/lib/libtdjson.so
- name: zip
run: |
cd td/tdlib/lib
zip libtdjson.zip libtdjson.so
- name: Release
uses: ncipollo/release-action@v1
with:
tag: linux-x64-${{ env.td_version }}-${{ env.td_commit_hash }}
name: Linux x64 ${{ env.td_version }}-${{ env.td_commit_hash }}
body: https://github.com/tdlib/td/tree/${{ env.td_commit_hash }}
token: ${{ secrets.GITHUB_TOKEN }}
artifacts: 'td/tdlib/lib/libtdjson.zip'
build-windows-x64:
runs-on: windows-2022
steps:
- uses: actions/checkout@v2
- name: JSON to variables
uses: rgarcia-phi/[email protected]
with:
filename: '.github/workflows/td-version.json'
prefix: td
- name: clone
run: |
git clone https://github.com/tdlib/td.git
cd td
git checkout ${{ env.td_commit_hash }}
git show --summary
- name: setup vcpkg
run: |
cd td
git clone https://github.com/Microsoft/vcpkg.git
cd vcpkg
git checkout cd5e746ec203c8c3c61647e0886a8df8c1e78e41
./bootstrap-vcpkg.bat
./vcpkg.exe install gperf:x64-windows openssl:x64-windows zlib:x64-windows
- name: build
run: |
cd td
mkdir build
cd build
cmake -A x64 -DCMAKE_INSTALL_PREFIX:PATH=../tdlib -DCMAKE_TOOLCHAIN_FILE:FILEPATH=../vcpkg/scripts/buildsystems/vcpkg.cmake ..
cmake --build . --target install --config Release
# - name: fake build
# run: |
# mkdir -p td/tdlib/bin
# echo test > td/tdlib/bin/libcrypto-3-x64.dll
# echo test > td/tdlib/bin/libssl-3-x64.dll
# echo test > td/tdlib/bin/tdjson.dll
# echo test > td/tdlib/bin/zlib1.dll
- name: zip
run: |
cd td/tdlib/bin
ls
mv libcrypto-3-x64.dll libcrypto-1_1.dll
mv libssl-3-x64.dll libssl-1_1.dll
7z a -tzip dlls.zip libcrypto-1_1.dll libssl-1_1.dll tdjson.dll zlib1.dll
- name: Release
uses: ncipollo/release-action@v1
with:
tag: windows-x64-${{ env.td_version }}-${{ env.td_commit_hash }}
name: Windows x64 ${{ env.td_version }}-${{ env.td_commit_hash }}
body: https://github.com/tdlib/td/tree/${{ env.td_commit_hash }}
token: ${{ secrets.GITHUB_TOKEN }}
artifacts: 'td/tdlib/bin/dlls.zip'