-
Notifications
You must be signed in to change notification settings - Fork 7
925 lines (801 loc) · 29.8 KB
/
build.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
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
name: Build V8
on:
push:
branches:
- '**'
tags-ignore:
- '**'
release:
types: [published]
# github.head_ref is only defined on pull_request events
concurrency:
group: ${{ github.workflow }}-${{ github.actor }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
jobs:
build_mac:
strategy:
fail-fast: false
matrix:
arch: [arm64, x64]
name: "macOS"
runs-on: macos-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Select XCode Version
uses: maxim-lobanov/setup-xcode@60606e260d2fc5762a71e64e74b2174e8ea3c8bd
with:
xcode-version: latest-stable
- name: Clone DepotTools
run: |
cd ..
DEPOT_TOOLS_PATH=$(pwd)/depot_tools
git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git
echo "DEPOT_TOOLS_PATH=$DEPOT_TOOLS_PATH" >> $GITHUB_ENV
echo "DEPOT_TOOLS_PATH=$DEPOT_TOOLS_PATH"
- name: Print env
run: |
echo "${{ env.DEPOT_TOOLS_PATH }}"
ls -l ${{ env.DEPOT_TOOLS_PATH }}
xcrun clang++ -v
- name: Install gn
run: |
wget https://chrome-infra-packages.appspot.com/dl/gn/gn/mac-amd64/+/latest -O ./gn.zip
unzip gn.zip -d buildtools/mac/
- name: Install dsymutil
run: |
export PATH=${{ env.DEPOT_TOOLS_PATH }}:$PATH
python3 ${{ env.DEPOT_TOOLS_PATH }}/download_from_google_storage.py --no_resume --no_auth --bucket chromium-browser-clang -s tools/clang/dsymutil/bin/dsymutil.x64.sha1 -o tools/clang/dsymutil/bin/dsymutil
- name: Install ninja
run: |
brew install ninja
NINJA_PATH=$(which ninja)
CURRENT_DIR=$(pwd)
mkdir -p ${CURRENT_DIR}/third_party/ninja
ln -s ${NINJA_PATH} ${CURRENT_DIR}/third_party/ninja/ninja
- name: Build ${{ matrix.arch }}
run: |
export PATH=${{ env.DEPOT_TOOLS_PATH }}:$PATH
which gn
CURRENT_DIR=$(pwd)
./build-mac.sh ${{ matrix.arch }}
- name: Copy to dist folder
run: |
ls -l ./out/mac
echo "---------------------"
ls -l ./out/mac/obj
mkdir dist
cp ./out/mac/d8 ./dist/
cp ./out/mac/obj/libv8_monolith.a ./dist/
cp -r ./include ./dist/
- name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: v8-mac-${{ matrix.arch }}
path: ./dist
build_mac_fat:
permissions:
contents: write
if: github.event_name == 'release'
name: "macOS (fat)"
runs-on: macos-latest
needs: build_mac
steps:
- name: Download arm64 artifact
uses: actions/download-artifact@v3
with:
name: v8-mac-arm64
path: v8-mac-arm64
- name: Download x64 artifact
uses: actions/download-artifact@v3
with:
name: v8-mac-x64
path: v8-mac-x64
- name: Build a fat library
run: |
mkdir v8-mac-fat
lipo -create ./v8-mac-arm64/libv8_monolith.a ./v8-mac-x64/libv8_monolith.a -output ./v8-mac-fat/libv8_monolith.a
lipo -create ./v8-mac-arm64/d8 ./v8-mac-x64/d8 -output ./v8-mac-fat/d8
cp -r ./v8-mac-arm64/include ./v8-mac-fat/
- name: Pack dist files
uses: thedoctor0/zip-release@a24011d8d445e4da5935a7e73c1f98e22a439464
with:
type: 'zip'
directory: 'v8-mac-fat'
path: '.'
filename: 'v8-mac.zip'
- name: Upload to Release
uses: svenstaro/upload-release-action@e74ff71f7d8a4c4745b560a485cc5fdb9b5b999d
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: v8-mac-fat/v8-mac.zip
asset_name: v8-mac.zip
tag: ${{ github.ref }}
build_ios:
strategy:
fail-fast: false
matrix:
arch: [arm64, x64, simulator-arm64]
name: "iOS"
runs-on: macos-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Select XCode Version
uses: maxim-lobanov/setup-xcode@60606e260d2fc5762a71e64e74b2174e8ea3c8bd
with:
xcode-version: latest-stable
- name: Clone DepotTools
run: |
cd ..
DEPOT_TOOLS_PATH=$(pwd)/depot_tools
git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git
echo "DEPOT_TOOLS_PATH=$DEPOT_TOOLS_PATH" >> $GITHUB_ENV
echo "DEPOT_TOOLS_PATH=$DEPOT_TOOLS_PATH"
- name: Print env
run: |
echo "${{ env.DEPOT_TOOLS_PATH }}"
ls -l ${{ env.DEPOT_TOOLS_PATH }}
xcrun clang++ -v
- name: Install gn
run: |
wget https://chrome-infra-packages.appspot.com/dl/gn/gn/mac-amd64/+/latest -O ./gn.zip
unzip gn.zip -d buildtools/mac/
- name: Install dsymutil
run: |
export PATH=${{ env.DEPOT_TOOLS_PATH }}:$PATH
python3 ${{ env.DEPOT_TOOLS_PATH }}/download_from_google_storage.py --no_resume --no_auth --bucket chromium-browser-clang -s tools/clang/dsymutil/bin/dsymutil.x64.sha1 -o tools/clang/dsymutil/bin/dsymutil
- name: Install ninja
run: |
brew install ninja
NINJA_PATH=$(which ninja)
CURRENT_DIR=$(pwd)
mkdir -p ${CURRENT_DIR}/third_party/ninja
ln -s ${NINJA_PATH} ${CURRENT_DIR}/third_party/ninja/ninja
- name: Install llvm
run: |
brew install llvm
echo "Install llvm succeed!"
export PATH="/opt/homebrew/opt/llvm/bin:$PATH"
LLVM_AR_PATH=$(which llvm-ar)
echo "LLVM_AR_PATH: ${LLVM_AR_PATH}"
XCODE_DEV_PATH=$(xcode-select -p)
echo "XCODE_DEV_PATH: ${XCODE_DEV_PATH}"
sudo ln -s ${LLVM_AR_PATH} ${XCODE_DEV_PATH}/Toolchains/XcodeDefault.xctoolchain/usr/bin/llvm-ar
- name: Build ${{ matrix.arch }}
run: |
export PATH=${{ env.DEPOT_TOOLS_PATH }}:$PATH
which gn
CURRENT_DIR=$(pwd)
if [[ "${{ matrix.arch }}" == "simulator-arm64" ]];then
./build-ios.sh arm64 simulator
else
./build-ios.sh ${{ matrix.arch }}
fi
- name: Copy to dist folder
run: |
ls -l ./out/ios
echo "---------------------"
ls -l ./out/ios/obj
mkdir dist
cp ./out/ios/obj/d8 ./dist/
cp ./out/ios/obj/libv8_monolith.a ./dist/
cp -r ./include ./dist/
- name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: v8-ios-${{ matrix.arch }}
path: ./dist
build_ios_fat:
permissions:
contents: write
if: github.event_name == 'release'
name: "iOS (fat)"
runs-on: macos-latest
needs: build_ios
steps:
- name: Download arm64 artifact
uses: actions/download-artifact@v3
with:
name: v8-ios-arm64
path: v8-ios-arm64
- name: Download x64 artifact
uses: actions/download-artifact@v3
with:
name: v8-ios-x64
path: v8-ios-x64
- name: Download simulator-arm64 artifact
uses: actions/download-artifact@v3
with:
name: v8-ios-simulator-arm64
path: v8-ios-simulator-arm64
- name: Build a fat library
run: |
mkdir v8-ios-fat
lipo -create ./v8-ios-arm64/libv8_monolith.a ./v8-ios-x64/libv8_monolith.a -output ./v8-ios-fat/libv8_monolith.a
lipo -create ./v8-ios-arm64/d8 ./v8-ios-x64/d8 -output ./v8-ios-fat/d8
cp -r ./v8-ios-arm64/include ./v8-ios-fat/
cp -r ./v8-ios-simulator-arm64 ./v8-ios-fat/
rm -rf ./v8-ios-fat/v8-ios-simulator-arm64/include
- name: Pack dist files
uses: thedoctor0/zip-release@a24011d8d445e4da5935a7e73c1f98e22a439464
with:
type: 'zip'
directory: 'v8-ios-fat'
path: '.'
filename: 'v8-ios.zip'
- name: Upload to Release
uses: svenstaro/upload-release-action@e74ff71f7d8a4c4745b560a485cc5fdb9b5b999d
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: v8-ios-fat/v8-ios.zip
asset_name: v8-ios.zip
tag: ${{ github.ref }}
build_android:
strategy:
fail-fast: false
matrix:
arch: [arm64, arm, x64, x86]
name: "android"
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install NDK r23c
uses: nttld/setup-ndk@v1
id: setup-ndk
with:
ndk-version: r23c
add-to-path: false
local-cache: true
- name: Clone DepotTools
run: |
cd ..
DEPOT_TOOLS_PATH=$(pwd)/depot_tools
git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git
echo "DEPOT_TOOLS_PATH=$DEPOT_TOOLS_PATH" >> $GITHUB_ENV
echo "DEPOT_TOOLS_PATH=$DEPOT_TOOLS_PATH"
- name: Print env
run: |
echo "${{ env.DEPOT_TOOLS_PATH }}"
ls -l ${{ env.DEPOT_TOOLS_PATH }}
- name: Install gn
run: |
wget https://chrome-infra-packages.appspot.com/dl/gn/gn/linux-amd64/+/latest -O ./gn.zip
unzip gn.zip -d buildtools/linux64/
- name: Install ninja
run: |
if ! command -v ninja &> /dev/null; then
echo "Ninja not found, installing..."
# sudo apt update
sudo apt install ninja-build
else
echo "Ninja is already installed."
fi
which ninja
NINJA_PATH=$(which ninja)
CURRENT_DIR=$(pwd)
mkdir -p ${CURRENT_DIR}/third_party/ninja
ln -s ${NINJA_PATH} ${CURRENT_DIR}/third_party/ninja/ninja
- name: Install linux sysroot
run: |
if [[ "${{ matrix.arch }}" == "arm64" || "${{ matrix.arch }}" == "x64" ]];then
INSTALL_SYSROOT_ARCH="amd64"
else
INSTALL_SYSROOT_ARCH="i386"
fi
python3 build/linux/sysroot_scripts/install-sysroot.py --arch=${INSTALL_SYSROOT_ARCH}
- name: Patch
run: |
sed -i "s@\"-gsimple-template-names\"@@g" build/config/compiler/BUILD.gn
sed -i "s@\"-ffile-compilation-dir=.\"@@g" build/config/compiler/BUILD.gn
sed -i "s@if (is_ubsan && (v8_current_cpu@if ((v8_current_cpu@g" BUILD.gn
if [[ "${{ matrix.arch }}" == "arm" || "${{ matrix.arch }}" == "x86" ]];then
sed -i "s@#error@//#error@g" src/base/ubsan.cc
fi
rm $NDK_ROOT/toolchains/llvm/prebuilt/linux-x86_64/lib64/clang/12.0.9/lib/linux/x86_64/libatomic.a
rm $NDK_ROOT/toolchains/llvm/prebuilt/linux-x86_64/lib64/clang/12.0.9/lib/linux/i386/libatomic.a
env:
NDK_ROOT: ${{ steps.setup-ndk.outputs.ndk-path }}
- name: Build ${{ matrix.arch }}
run: |
export PATH=${{ env.DEPOT_TOOLS_PATH }}:$PATH
which gn
CURRENT_DIR=$(pwd)
./build-android.sh ${{ matrix.arch }}
env:
NDK_ROOT: ${{ steps.setup-ndk.outputs.ndk-path }}
- name: Copy to dist folder
run: |
ls -l ./out/android
echo "---------------------"
ls -l ./out/android/obj
mkdir dist
cp ./out/android/d8 ./dist/
cp ./out/android/obj/libv8_monolith.a ./dist/
cp -r ./include ./dist/
- name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: v8-android-${{ matrix.arch }}
path: ./dist
build_android_fat:
permissions:
contents: write
if: github.event_name == 'release'
name: "android (fat)"
runs-on: ubuntu-latest
needs: build_android
steps:
- name: Download arm64 artifact
uses: actions/download-artifact@v3
with:
name: v8-android-arm64
path: v8-android-arm64
- name: Download arm artifact
uses: actions/download-artifact@v3
with:
name: v8-android-arm
path: v8-android-arm
- name: Download x64 artifact
uses: actions/download-artifact@v3
with:
name: v8-android-x64
path: v8-android-x64
- name: Download x86 artifact
uses: actions/download-artifact@v3
with:
name: v8-android-x86
path: v8-android-x86
- name: Build a fat library
run: |
mkdir v8-android-fat
cp -r ./v8-android-arm64 ./v8-android-fat/arm64-v8a
cp -r ./v8-android-arm ./v8-android-fat/armeabi-v7a
cp -r ./v8-android-x64 ./v8-android-fat/x86_64
cp -r ./v8-android-x86 ./v8-android-fat/x86
cp -r ./v8-android-arm64/include ./v8-android-fat/
rm -rf ./v8-android-fat/arm64-v8a/include
rm -rf ./v8-android-fat/armeabi-v7a/include
rm -rf ./v8-android-fat/x86_64/include
rm -rf ./v8-android-fat/x86/include
- name: Pack dist files
uses: thedoctor0/zip-release@a24011d8d445e4da5935a7e73c1f98e22a439464
with:
type: 'zip'
directory: 'v8-android-fat'
path: '.'
filename: 'v8-android.zip'
- name: Upload to Release
uses: svenstaro/upload-release-action@e74ff71f7d8a4c4745b560a485cc5fdb9b5b999d
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: v8-android-fat/v8-android.zip
asset_name: v8-android.zip
tag: ${{ github.ref }}
build_windows:
strategy:
fail-fast: false
matrix:
arch: [x64]
build_type: [debug, release]
name: "Windows"
runs-on: windows-2019
steps:
- name: Checkout
uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.8'
- name: Check is_debug
shell: bash
run: |
if [[ "${{matrix.build_type}}" == "debug" ]];then
echo "IS_DEBUG=true" >> $GITHUB_ENV
else
echo "IS_DEBUG=false" >> $GITHUB_ENV
fi
- name: Print env
run: |
echo "env.IS_DEBUG=${{ env.IS_DEBUG }}"
echo "----- python version -----"
python --version
- name: Clone DepotTools
shell: bash
run: |
cd /c
git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git
ls -l /c/depot_tools
- name: Install gn
run: |
Invoke-WebRequest -OutFile gn.zip https://chrome-infra-packages.appspot.com/dl/gn/gn/windows-amd64/+/latest
Expand-Archive gn.zip -DestinationPath buildtools\win\
- name: Setup Ninja
uses: ashutoshvarma/setup-ninja@66ad2db9ed7d211c065daeeb849e9c8c895773c9
with:
version: 1.10.0
- name: Install ninja
shell: bash
run: |
which ninja
NINJA_PATH=$(which ninja)
CURRENT_DIR=$(pwd)
mkdir -p ${CURRENT_DIR}/third_party/ninja
cp ${NINJA_PATH} ${CURRENT_DIR}/third_party/ninja/
- name: GN gen ${{ matrix.arch }}
shell: cmd
run: |
dir C:\depot_tools
set DEPOT_TOOLS_WIN_TOOLCHAIN=0
set PATH=C:\depot_tools;%PATH%
set ARGS="is_clang=false is_debug=${{ env.IS_DEBUG }} target_cpu=""${{ matrix.arch }}"" v8_target_cpu=""${{ matrix.arch }}"" use_thin_lto=false use_lld=false clang_use_chrome_plugins=false chrome_pgo_phase=0 is_component_build=true use_custom_libcxx=false v8_use_external_startup_data=false is_official_build=false v8_enable_i18n_support=true icu_use_data_file=false treat_warnings_as_errors=false symbol_level=0 v8_enable_webassembly=true use_cxx17=true v8_enable_sandbox=false"
gn gen out/windows --args=%ARGS%
- name: Build ${{ matrix.arch }}-${{ matrix.build_type }}
run:
ninja -C out/windows v8_hello_world -v
- name: Copy to dist folder
shell: bash
run: |
ls -l ./out/windows
echo "---------------------"
ls -l ./out/windows/obj
mkdir dist
cp ./out/windows/*.exe ./dist/
cp ./out/windows/*.lib ./dist/
cp ./out/windows/*.dll ./dist/
cp -r ./include ./dist/
- name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: v8-windows-${{ matrix.arch }}-${{ matrix.build_type }}
path: ./dist
build_windows_fat:
permissions:
contents: write
if: github.event_name == 'release'
name: "windows (fat)"
runs-on: ubuntu-latest
needs: build_windows
steps:
- name: Download x64(debug) artifact
uses: actions/download-artifact@v3
with:
name: v8-windows-x64-debug
path: v8-windows-x64-debug
- name: Download x64(release) artifact
uses: actions/download-artifact@v3
with:
name: v8-windows-x64-release
path: v8-windows-x64-release
- name: Build a fat library
shell: bash
run: |
mkdir v8-windows-fat
cp -r ./v8-windows-x64-debug ./v8-windows-fat/Debug
cp -r ./v8-windows-x64-release ./v8-windows-fat/Release
cp -r ./v8-windows-x64-debug/include ./v8-windows-fat/
rm -rf ./v8-windows-fat/Debug/include
rm -rf ./v8-windows-fat/Release/include
- name: Pack dist files
uses: thedoctor0/zip-release@a24011d8d445e4da5935a7e73c1f98e22a439464
with:
type: 'zip'
directory: 'v8-windows-fat'
path: '.'
filename: 'v8-windows.zip'
- name: Upload to Release
uses: svenstaro/upload-release-action@e74ff71f7d8a4c4745b560a485cc5fdb9b5b999d
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: v8-windows-fat/v8-windows.zip
asset_name: v8-windows.zip
tag: ${{ github.ref }}
build_openharmony:
strategy:
fail-fast: false
matrix:
arch: [arm64, arm]
name: "Openharmony"
runs-on: ubuntu-latest
steps:
- name: Show ubuntu libraries
run: |
if [[ -d "/usr/lib/i386-linux-gnu" ]]; then
echo "/usr/lib/i386-linux-gnu exists."
ls -la /usr/lib/i386-linux-gnu/libatomic.so.1*
else
echo "/usr/lib/i386-linux-gnu doesn't not exist."
fi
sudo dpkg --add-architecture i386
sudo apt-get update
sudo apt-get install -y libc6:i386 libstdc++6:i386 libatomic1:i386
if [[ -d "/usr/lib/i386-linux-gnu" ]]; then
echo "/usr/lib/i386-linux-gnu exists."
ls -la /usr/lib/i386-linux-gnu/
ls -la /usr/lib/i386-linux-gnu/libatomic.so.1*
else
echo "/usr/lib/i386-linux-gnu doesn't not exist."
fi
if [[ -d "/usr/lib/x86_64-linux-gnu" ]]; then
echo "/usr/lib/x86_64-linux-gnu exists."
ls -la /usr/lib/x86_64-linux-gnu/libatomic.so.1*
else
echo "/usr/lib/x86_64-linux-gnu doesn't not exist."
fi
- uses: actions/checkout@v4
- uses: actions/setup-java@v3
id: setup-jdk
with:
distribution: 'zulu'
java-version: '17'
- name: Get oh sdk cache directory path
id: oh-sdk-cache-dir-path
run: |
echo "cache dir: "
echo "dir=$HOME/openharmony" >> $GITHUB_OUTPUT
- name: Output cache dir
run: |
echo "Output cache dir: ${{ steps.oh-sdk-cache-dir-path.outputs.dir }}"
- name: Cache OH SDK
id: cache-oh-sdk
uses: actions/cache@v3
env:
cache-name: cache-oh-sdk-9
with:
path: ${{ steps.oh-sdk-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-build-${{ env.cache-name }}
- name: Add package.json
run: |
echo "{}" > package.json
echo "{\"name\": \"tests\",\"lockfileVersion\": 3,\"requires\": true,\"packages\": {}}" > package-lock.json
- uses: actions/setup-node@v3
with:
node-version: 14
cache: 'npm'
- if: ${{ steps.cache-oh-sdk.outputs.cache-hit != 'true' }}
name: No Cache found, install oh sdk
continue-on-error: false
run: |
if [ ! -d "$HOME/openharmony" ]; then
mkdir -p $HOME/openharmony
echo "Download commandline-tools-linux.zip ..."
curl -o commandline-tools-linux.zip "https://contentcenter-vali-drcn.dbankcdn.cn/pvt_2/DeveloperAlliance_package_901_9/b1/v3/E6zhv5UFQ2-inIwNJhTN6Q/commandline-tools-linux-2.0.0.2.zip?HW-CC-KV=V1&HW-CC-Date=20230621T074401Z&HW-CC-Expire=315360000&HW-CC-Sign=621224257B02079B1E76C0A56FDF21483400B1E3556213F88DC79BC9BE7D595D"
echo "Unzip commandline-tools-linux.zip ..."
unzip commandline-tools-linux.zip -d $HOME/openharmony > /dev/null
cd $HOME/openharmony
ls -l
cd command-line-tools
echo "=============== PATCHING sdkmanager/bin/sdkmgr file ==============="
sed -i "[email protected][email protected]=UTF-8 -Duser.country=CN@g" ./sdkmanager/bin/sdkmgr
cd bin
./sdkmgr list
echo "=============== INSTALL HOS toolchains:9 ==============="
./sdkmgr install toolchains:9 --accept-license > /dev/null
echo "=============== INSTALL OH SDK ets:9 ==============="
./sdkmgr install OpenHarmony/ets:9 --accept-license > /dev/null
echo "=============== INSTALL OH SDK js:9 ==============="
./sdkmgr install OpenHarmony/js:9 --accept-license > /dev/null
echo "=============== INSTALL OH SDK native:9 ==============="
./sdkmgr install OpenHarmony/native:9 --accept-license > /dev/null
echo "=============== INSTALL OH SDK toolchains:9 ==============="
./sdkmgr install OpenHarmony/toolchains:9 --accept-license > /dev/null
echo "=============== INSTALL OH SDK DONE ==============="
./sdkmgr list
fi
- name: Clone DepotTools
run: |
cd ..
DEPOT_TOOLS_PATH=$(pwd)/depot_tools
git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git
echo "DEPOT_TOOLS_PATH=$DEPOT_TOOLS_PATH" >> $GITHUB_ENV
echo "DEPOT_TOOLS_PATH=$DEPOT_TOOLS_PATH"
- name: Print env
run: |
echo "${{ env.DEPOT_TOOLS_PATH }}"
ls -l ${{ env.DEPOT_TOOLS_PATH }}
- name: Install gn
run: |
wget https://chrome-infra-packages.appspot.com/dl/gn/gn/linux-amd64/+/latest -O ./gn.zip
unzip gn.zip -d buildtools/linux64/
- name: Install ninja
run: |
if ! command -v ninja &> /dev/null; then
echo "Ninja not found, installing..."
# sudo apt update
sudo apt install ninja-build
else
echo "Ninja is already installed."
fi
which ninja
NINJA_PATH=$(which ninja)
CURRENT_DIR=$(pwd)
mkdir -p ${CURRENT_DIR}/third_party/ninja
ln -s ${NINJA_PATH} ${CURRENT_DIR}/third_party/ninja/ninja
- name: Install linux sysroot
run: |
if [[ "${{ matrix.arch }}" == "arm64" || "${{ matrix.arch }}" == "x64" ]];then
INSTALL_SYSROOT_ARCH="amd64"
else
INSTALL_SYSROOT_ARCH="i386"
fi
python3 build/linux/sysroot_scripts/install-sysroot.py --arch=${INSTALL_SYSROOT_ARCH}
- name: Show execution files
run: |
which node
which npm
which java
node -v
npm -v
java --version
echo "=============== list files in oh sdk ($HOME/openharmony) ==============="
pushd $HOME/openharmony
ls -l
popd
- name: Patch args
run: |
touch ${HOME}/openharmony/hwsdk/openharmony/9/native/llvm/lib/arm-linux-ohos/c++/libatomic.a
touch ${HOME}/openharmony/hwsdk/openharmony/9/native/llvm/lib/aarch64-linux-ohos/c++/libatomic.a
sed -i "s@arm-linux-gnueabihf@arm-linux-ohos@g" build/config/compiler/BUILD.gn
sed -i "s@aarch64-linux-gnu@aarch64-linux-ohos@g" build/config/compiler/BUILD.gn
sed -i "s@\"-gsimple-template-names\"@@g" build/config/compiler/BUILD.gn
sed -i "s@strip_absolute_paths_from_debug_symbols = true@strip_absolute_paths_from_debug_symbols = false@g" build/config/compiler/compiler.gni
sed -i "s@__builtin_assume_aligned((ptr), (alignment))@(ptr)@g" include/v8config.h
sed -i "s@if (is_ubsan && (v8_current_cpu@if ((v8_current_cpu@g" BUILD.gn
if [[ "${{ matrix.arch }}" == "arm" || "${{ matrix.arch }}" == "x86" ]];then
sed -i "s@#error@//#error@g" src/base/ubsan.cc
fi
echo "---------- Show patch -----------"
git diff
- name: Build ${{ matrix.arch }}
run: |
export PATH=${{ env.DEPOT_TOOLS_PATH }}:$PATH
which gn
./build-oh.sh ${{ matrix.arch }}
- name: Copy to dist folder
run: |
ls -l ./out/oh
echo "---------------------"
ls -l ./out/oh/obj
mkdir dist
cp ./out/oh/d8 ./dist/
cp ./out/oh/obj/libv8_monolith.a ./dist/
cp -r ./include ./dist/
- name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: v8-oh-${{ matrix.arch }}
path: ./dist
build_openharmony_fat:
permissions:
contents: write
if: github.event_name == 'release'
name: "openharmony (fat)"
runs-on: ubuntu-latest
needs: build_openharmony
steps:
- name: Download arm64 artifact
uses: actions/download-artifact@v3
with:
name: v8-oh-arm64
path: v8-oh-arm64
- name: Download arm artifact
uses: actions/download-artifact@v3
with:
name: v8-oh-arm
path: v8-oh-arm
- name: Build a fat library
run: |
mkdir v8-oh-fat
cp -r ./v8-oh-arm64 ./v8-oh-fat/arm64-v8a
cp -r ./v8-oh-arm ./v8-oh-fat/armeabi-v7a
cp -r ./v8-oh-arm64/include ./v8-oh-fat/
rm -rf ./v8-oh-fat/arm64-v8a/include
rm -rf ./v8-oh-fat/armeabi-v7a/include
- name: Pack dist files
uses: thedoctor0/zip-release@a24011d8d445e4da5935a7e73c1f98e22a439464
with:
type: 'zip'
directory: 'v8-oh-fat'
path: '.'
filename: 'v8-oh.zip'
- name: Upload to Release
uses: svenstaro/upload-release-action@e74ff71f7d8a4c4745b560a485cc5fdb9b5b999d
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: v8-oh-fat/v8-oh.zip
asset_name: v8-oh.zip
tag: ${{ github.ref }}
build_linux:
permissions:
contents: write
strategy:
fail-fast: false
matrix:
arch: [x64]
name: "linux"
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Clone DepotTools
run: |
cd ..
DEPOT_TOOLS_PATH=$(pwd)/depot_tools
git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git
echo "DEPOT_TOOLS_PATH=$DEPOT_TOOLS_PATH" >> $GITHUB_ENV
echo "DEPOT_TOOLS_PATH=$DEPOT_TOOLS_PATH"
- name: Print env
run: |
echo "${{ env.DEPOT_TOOLS_PATH }}"
ls -l ${{ env.DEPOT_TOOLS_PATH }}
- name: Install gn
run: |
wget https://chrome-infra-packages.appspot.com/dl/gn/gn/linux-amd64/+/latest -O ./gn.zip
unzip gn.zip -d buildtools/linux64/
- name: Install ninja
run: |
if ! command -v ninja &> /dev/null; then
echo "Ninja not found, installing..."
# sudo apt update
sudo apt install ninja-build
else
echo "Ninja is already installed."
fi
which ninja
NINJA_PATH=$(which ninja)
CURRENT_DIR=$(pwd)
mkdir -p ${CURRENT_DIR}/third_party/ninja
ln -s ${NINJA_PATH} ${CURRENT_DIR}/third_party/ninja/ninja
- name: Install linux sysroot
run: |
if [[ "${{ matrix.arch }}" == "arm64" || "${{ matrix.arch }}" == "x64" ]];then
INSTALL_SYSROOT_ARCH="amd64"
else
INSTALL_SYSROOT_ARCH="i386"
fi
python3 build/linux/sysroot_scripts/install-sysroot.py --arch=${INSTALL_SYSROOT_ARCH}
- name: Install builtin clang
run: |
./tools/clang/scripts/update.py
- name: Build ${{ matrix.arch }}
run: |
export PATH=${{ env.DEPOT_TOOLS_PATH }}:$PATH
which gn
CURRENT_DIR=$(pwd)
./build-linux.sh ${{ matrix.arch }}
- name: Copy to dist folder
run: |
ls -l ./out/linux
echo "---------------------"
ls -l ./out/linux/obj
mkdir dist
cp ./out/linux/d8 ./dist/
cp ./out/linux/obj/libv8_monolith.a ./dist/
cp -r ./include ./dist/
- name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: v8-linux-${{ matrix.arch }}
path: ./dist
- name: Pack dist files
if: github.event_name == 'release'
uses: thedoctor0/zip-release@a24011d8d445e4da5935a7e73c1f98e22a439464
with:
type: 'zip'
directory: 'dist'
path: '.'
filename: 'v8-linux.zip'
- name: Upload to Release
if: github.event_name == 'release'
uses: svenstaro/upload-release-action@e74ff71f7d8a4c4745b560a485cc5fdb9b5b999d
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: dist/v8-linux.zip
asset_name: v8-linux.zip
tag: ${{ github.ref }}