Skip to content

Commit ba1b59f

Browse files
authored
Add pipeline to build and release emsdk arm64 dependencies (#2)
Pipeline to build arm64 version of LLVM, node.js, Binaryen Package wasm-binaries for arm64 based on LLVM, Binaryen and emscripten builds.
1 parent 87f83a7 commit ba1b59f

File tree

1 file changed

+213
-3
lines changed

1 file changed

+213
-3
lines changed

.github/workflows/build-deps.yml

Lines changed: 213 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,20 +3,230 @@ name: Build emsdk dependencies
33
on:
44
workflow_dispatch:
55
inputs:
6-
branch:
6+
llvm_build:
77
description: 'LLVM Webassembly arm64'
88
required: false
99
default: false
1010
type: boolean
11+
llvm_build_cross_compilation:
12+
description: 'LLVM Webassembly arm64 (cross compilation)'
13+
required: false
14+
default: false
15+
type: boolean
16+
binaryen_build:
17+
description: 'Binaryen Arm64'
18+
required: false
19+
default: false
20+
type: boolean
21+
emscripten_build:
22+
description: 'Emscripten'
23+
required: false
24+
default: false
25+
type: boolean
26+
nodejs_build:
27+
description: 'Node.js arm64'
28+
required: false
29+
default: false
30+
type: boolean
31+
wasm_binaries_build:
32+
description: 'WASM binaries arm64'
33+
required: false
34+
default: false
35+
type: boolean
1136

1237
jobs:
1338
build-llvm-webassembly-arm64:
39+
if: ${{ inputs.llvm_build || inputs.wasm_binaries_build }}
1440

15-
runs-on: windows-latest
41+
runs-on: [self-hosted, Windows, ARM64, WASM]
42+
timeout-minutes: 600
1643

1744
steps:
1845

1946
- name: Build LLVM WebAssembly arm64
47+
shell: cmd
48+
run: |
49+
git clone --config core.autocrlf=false https://github.com/llvm/llvm-project.git --single-branch --depth 1
50+
cd llvm-project
51+
if exist build_arm64 rmdir /s /q build_arm64
52+
call "%ProgramFiles%\Microsoft Visual Studio\2022\Preview\VC\Auxiliary\Build\vcvarsall.bat" arm64
53+
cmake -G Ninja -S llvm -B build_arm64 ^
54+
-DCLANG_ENABLE_ARCMT=OFF ^
55+
-DCLANG_ENABLE_STATIC_ANALYZER=OFF ^
56+
-DCMAKE_BUILD_TYPE=Release ^
57+
-DCMAKE_BUILD_WITH_INSTALL_RPATH=ON ^
58+
-DCMAKE_CXX_COMPILER_LAUNCHER='ccache' ^
59+
-DCMAKE_EXPORT_COMPILE_COMMANDS=ON ^
60+
-DCMAKE_LINKER="C:\Program Files\Microsoft Visual Studio\2022\Preview\VC\Tools\Llvm\x64\bin\lld-link.exe" ^
61+
-DLLVM_BUILD_LLVM_DYLIB=OFF ^
62+
-DLLVM_LINK_LLVM_DYLIB=OFF ^
63+
-DLLVM_DISTRIBUTION_COMPONENTS='clang;lld;llvm-ar;llvm-addr2line;llvm-cxxfilt;llvm-dwarfdump;llvm-dwp;llvm-nm;llvm-objcopy;llvm-objdump;llvm-ranlib;llvm-readobj;llvm-size;llvm-strings;llvm-strip;llvm-symbolizer;clang-resource-headers' ^
64+
-DLLVM_ENABLE_ASSERTIONS=OFF ^
65+
-DLLVM_ENABLE_BINDINGS=OFF ^
66+
-DLLVM_ENABLE_LIBXML2=OFF ^
67+
-DLLVM_ENABLE_PROJECTS='lld;clang' ^
68+
-DLLVM_ENABLE_TERMINFO=ON ^
69+
-DLLVM_INCLUDE_EXAMPLES=OFF ^
70+
-DLLVM_INCLUDE_TESTS=OFF ^
71+
-DLLVM_INSTALL_TOOLCHAIN_ONLY=ON ^
72+
-DLLVM_TARGETS_TO_BUILD='host;WebAssembly' ^
73+
-DLLVM_TOOL_LTO_BUILD=OFF ^
74+
-DLLVM_TOOLCHAIN_TOOLS='clang;lld;llvm-ar;llvm-addr2line;llvm-cxxfilt;llvm-dwarfdump;llvm-dwp;llvm-nm;llvm-objcopy;llvm-objdump;llvm-ranlib;llvm-readobj;llvm-size;llvm-strings;llvm-strip;llvm-symbolizer;clang-resource-headers' ^
75+
-DLLVM_USE_CRT_RELEASE=MT ^
76+
-DLLVM_USE_CRT_DEBUG=MTd
77+
cd build_arm64
78+
ninja -v install-distribution
79+
80+
- name: Pack llvm-arm64.zip
81+
run: |
82+
cd llvm-project/build_arm64
83+
$unneeded_tool = 'clang-check', 'clang-cl', 'clang-cpp',
84+
'clang-extdef-mapping', 'clang-format',
85+
'clang-func-mapping', 'clang-import-test',
86+
'clang-linker-wrapper', 'clang-offload-bundler',
87+
'clang-offload-packager', 'clang-refactor',
88+
'clang-rename', 'clang-repl', 'clang-scan-deps',
89+
'diagtool', 'git-clang-format', 'hmaptool', 'ld.lld',
90+
'ld64.lld', 'ld64.lld.darwinnew', 'ld64.lld.darwinold',
91+
'lld-link', 'libclang.dll', 'llvm-cov', 'llvm-ml',
92+
'llvm-lib', 'llvm-pdbutil', 'llvm-profdata',
93+
'llvm-rc'
94+
foreach ($tool in $unneeded_tool) {
95+
$tool = "bin" + $tool + ".exe"
96+
if (Test-Path $tool) {
97+
"Remove " + $tool
98+
Remove-Item $tool
99+
}
100+
}
101+
Compress-Archive -Path bin,lib\clang -DestinationPath llvm-arm64
102+
103+
- name: Archive llvm-arm64.zip
104+
uses: actions/upload-artifact@v3
105+
with:
106+
name: llvm-arm64.zip
107+
path: llvm-project/build_arm64/llvm-arm64.zip
108+
retention-days: 1
109+
110+
build-llvm-webassembly-arm64_cross_compilation:
111+
if: ${{ inputs.llvm_build_llvm_build_cross_compilation }}
112+
113+
runs-on: windows-latest
114+
115+
steps:
116+
117+
- name: Build LLVM WebAssembly arm64 (Cross Compilation)
118+
run: |
119+
Set-PSDebug -Trace 1
120+
git clone --config core.autocrlf=false https://github.com/llvm/llvm-project.git --single-branch --branch main --depth 1
121+
cd llvm-project
122+
cmake -S llvm -B build_host -DLLVM_ENABLE_PROJECTS='lld;clang' -DLLVM_TARGETS_TO_BUILD=""
123+
cmake --build build_host --target llvm-tblgen llvm-nm clang-tblgen --config MinSizeRel
124+
$llvm_root = Get-Location
125+
cmake -S llvm -B build_arm64 -A ARM64 `
126+
-DLLVM_TABLEGEN="$llvm_root\build_host\MinSizeRel\bin\llvm-tblgen.exe" `
127+
-DCLANG_TABLEGEN="$llvm_root\build_host\MinSizeRel\bin\clang-tblgen.exe" `
128+
-DLLVM_NM="$llvm_root\build_host\MinSizeRel\bin\llvm-nm.exe" `
129+
-DLLVM_ENABLE_PROJECTS='lld;clang' -DLLVM_TARGETS_TO_BUILD="host;WebAssembly" `
130+
-DLLVM_INCLUDE_EXAMPLES=OFF -DLLVM_INCLUDE_TESTS=OFF
131+
cmake --build build_arm64 --config MinSizeRel
132+
133+
build-binaryen:
134+
if: ${{ inputs.binaryen_build || inputs.wasm_binaries_build}}
135+
136+
runs-on: [self-hosted, Windows, ARM64, WASM]
137+
138+
steps:
139+
- name: Build Binaryen for Arm64
140+
shell: cmd
141+
run: |
142+
git clone https://github.com/WebAssembly/binaryen.git --single-branch --depth 1
143+
cd binaryen
144+
git submodule init
145+
git submodule update
146+
if exist bin rmdir /s /q bin
147+
call "%ProgramFiles%\Microsoft Visual Studio\2022\Preview\VC\Auxiliary\Build\vcvarsall.bat" arm64
148+
cmake -G Ninja -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_COMPILER_LAUNCHER='ccache' .
149+
ninja
150+
151+
152+
- name: Archive binaryen-arm64.zip
153+
uses: actions/upload-artifact@v3
154+
with:
155+
name: binaryen-arm64.zip
156+
path: binaryen/binaryen-arm64.zip
157+
retention-days: 1
158+
159+
build-nodejs:
160+
if: ${{ inputs.nodejs_build }}
161+
162+
runs-on: [self-hosted, Windows, ARM64, WASM]
163+
164+
steps:
165+
166+
- name: Build Node.js arm64
167+
run: |
168+
Set-PSDebug -Trace 1
169+
git clone https://github.com/Windows-on-ARM-Experiments/node.git --single-branch -b fix-arm64-compilation --depth 1
170+
cd node
171+
.\vcbuild openssl-no-asm arm64
172+
173+
build-emscripten:
174+
if: ${{ inputs.emscripten_build || inputs.wasm_binaries_build }}
175+
176+
runs-on: [ubuntu-latest]
177+
178+
steps:
179+
180+
- name: Build Emscripten
181+
run: |
182+
git clone https://github.com/emscripten-core/emscripten.git --single-branch --depth 1
183+
cd emscripten
184+
./tools/install.py ../emscripten_package
185+
npm ci --production --no-optional ../emscripten_package
186+
cd ../emscripten_package
187+
zip -r ../emscripten_package.zip .
188+
189+
- name: Archive emscripten_package.zip
190+
uses: actions/upload-artifact@v3
191+
with:
192+
name: emscripten_package.zip
193+
path: emscripten_package.zip
194+
retention-days: 1
195+
196+
build-wasm-binaries:
197+
if: ${{ inputs.wasm_binaries_build }}
198+
needs: [build-emscripten, build-binaryen, build-llvm-webassembly-arm64]
199+
200+
runs-on: [windows-latest]
201+
202+
steps:
203+
204+
- uses: actions/download-artifact@v3
205+
with:
206+
name: emscripten_package.zip
207+
208+
- uses: actions/download-artifact@v3
209+
with:
210+
name: llvm-arm64.zip
211+
212+
- uses: actions/download-artifact@v3
213+
with:
214+
name: binaryen-arm64.zip
215+
216+
- name: Pack wasm-binaries for Arm64
20217
run: |
21-
set
22218
ls
219+
New-Item -ItemType Directory -Force -Path emsdk/emscripten
220+
Expand-Archive -LiteralPath emscripten_package.zip -DestinationPath emsdk\emscripten
221+
Expand-Archive -LiteralPath llvm-arm64.zip -DestinationPath emsdk
222+
Expand-Archive -LiteralPath binaryen-arm64.zip -DestinationPath emsdk
223+
cd emsdk
224+
Compress-Archive -Path * -DestinationPath wasm-binaries-arm64
225+
226+
- name: Archive wasm-binaries-arm64.zip
227+
uses: actions/upload-artifact@v3
228+
with:
229+
name: wasm-binaries-arm64.zip
230+
path: emsdk/wasm-binaries-arm64.zip
231+
retention-days: 3
232+

0 commit comments

Comments
 (0)