42
42
latest-factors : |
43
43
msvc Optimized-Debug
44
44
gcc UBSan Coverage
45
- clang UBSan ASan
45
+ clang UBSan ASan MSan
46
46
apple-clang UBSan ASan
47
47
factors : ' '
48
48
runs-on : |
@@ -66,21 +66,27 @@ jobs:
66
66
clang: git build-essential pkg-config python3 curl openjdk-11-jdk pkg-config libncurses-dev libxml2-utils libxml2-dev g++-14=14.2.0-4ubuntu2~24.04
67
67
msvc: ''
68
68
extra-values : |
69
- llvm-hash: a1b6e7ff393533a5c4f3bdfd4efe5da106e2de2b
69
+ use-libcxx: {{#if (and (ieq compiler 'clang') (or ubsan asan msan)) }}true{{else}}false{{/if}}
70
+ llvm-path: /usr/local/llvm
71
+ libcxx-runtimes: libcxx;libcxxabi{{#if (ieq compiler 'apple-clang')}};compiler-rt{{/if}}
72
+ llvm-hash: 3f797a8342c3dbe4a260b26f948d8776ff490431
70
73
llvm-build-preset-prefix: {{#if optimized-debug}}debwithopt{{else}}{{{lowercase build-type}}}{{/if}}
71
74
llvm-build-preset-os: {{#if (ieq os 'windows') }}win{{else}}unix{{/if}}
72
- llvm-sanitizer: {{#if (eq compiler 'gcc')}}{{else if ubsan}}-UBSan {{else if asan}}-ASan {{else if msan}}-MSan{{/if}}
75
+ llvm-sanitizer: {{#if (eq compiler 'gcc')}}{{else if ubsan}}-UBSan2 {{else if asan}}-ASan2 {{else if msan}}-MSan{{/if}}
73
76
llvm-build-preset: {{{ llvm-build-preset-prefix }}}-{{{ llvm-build-preset-os }}}
74
77
llvm-compiler-version: {{#if (or (contains version '*') (contains version '^'))}}{{else}}-{{{ version }}}{{/if}}
75
78
llvm-archive-basename: llvm-{{{ lowercase os }}}-{{{ compiler }}}{{{ llvm-compiler-version }}}-{{{ llvm-build-preset-prefix }}}{{{ llvm-sanitizer }}}-{{{ substr llvm-hash 0 7 }}}
76
- llvm-root: ../third-party/llvm-project/install
77
79
llvm-archive-extension: {{#if (ieq os 'windows') }}7z{{else}}tar.bz2{{/if}}
78
80
llvm-archive-filename: {{{ llvm-archive-basename }}}.{{{ llvm-archive-extension }}}
79
81
llvm-sanitizer-config: {{#if (and (ne compiler 'clang') (ne compiler 'apple-clang'))}}{{else if ubsan}}Undefined{{else if asan}}Address{{else if msan}}MemoryWithOrigins{{/if}}
80
- mrdocs-flags: {{#if (and (eq compiler 'gcc') (not asan)) }}-static{{/if}}{{#if (and (eq compiler 'clang') msan) }}-fsanitize-memory-track-origins{{/if}}
81
- mrdocs-ccflags: {{{ ccflags }}} {{{ mrdocs-flags }}}
82
- mrdocs-cxxflags: {{{ cxxflags }}} {{{ mrdocs-flags }}}
83
- mrdocs-linkflags: {{#if asan }}-fsanitize=address{{/if}}
82
+ llvm-enable-assertions: {{#if (ieq use-libcxx 'true')}}ON{{else}}OFF{{/if}}
83
+ common-flags: -gz=zstd {{#if msan }}-fsanitize-memory-track-origins {{/if}}
84
+ common-ccflags: {{{ ccflags }}} {{{ common-flags }}}
85
+ common-cxxflags: {{{ cxxflags }}} {{#if (ieq use-libcxx 'true') }}-nostdinc++ -isystem{{{ libcxx-path }}}/include/c++/v1{{/if}}
86
+ common-ldflags: {{{ ldflags }}} {{#if (ieq use-libcxx 'true') }}-nostdlib++ -L{{{ libcxx-path }}}/lib -lc++abi -lc++ -Wl,-rpath,{{{ libcxx-path }}}/lib {{/if}}{{#if ubsan }}-fsanitize=undefined {{/if}}{{#if asan }}-fsanitize=address {{/if}}{{#if msan }}-fsanitize=memory {{/if}}
87
+ mrdocs-flags: {{#if (and (eq compiler 'gcc') (not asan)) }}-static{{/if}}
88
+ mrdocs-ccflags: {{{ common-ccflags }}} {{{ mrdocs-flags }}}
89
+ mrdocs-cxxflags: {{{ common-cxxflags }}} {{{ mrdocs-flags }}}
84
90
mrdocs-package-generators: {{#if (ieq os 'windows') }}7Z ZIP WIX{{else}}TGZ TXZ{{/if}}
85
91
mrdocs-release-package-artifact: release-packages-{{{ lowercase os }}}
86
92
output-file : matrix.json
@@ -198,18 +204,15 @@ jobs:
198
204
with :
199
205
apt-get : ${{ matrix.install }}
200
206
201
- - name : Resolve LLVM Root
202
- id : resolve-llvm-root
207
+ - name : Install LLVM packages
208
+ if : matrix.use-libcxx == 'true' && matrix.compiler == 'clang'
209
+ env :
210
+ DEBIAN_FRONTEND : ' noninteractive'
211
+ TZ : ' Etc/UTC'
203
212
run : |
204
- set -x
205
- cd ..
206
- llvm_root=$(pwd)/third-party/llvm-project/install
207
- if [[ ${{ runner.os }} == 'Windows' ]]; then
208
- llvm_root=$(echo "$llvm_root" | sed 's/\\/\//g')
209
- llvm_root=$(echo $llvm_root | sed 's|^/d/|D:/|')
210
- echo "$llvm_root"
211
- fi
212
- echo -E "llvm-root=$llvm_root" >> $GITHUB_OUTPUT
213
+ echo "deb http://apt.llvm.org/noble/ llvm-toolchain-noble-21 main" >> /etc/apt/sources.list
214
+ apt-get update
215
+ apt-get install -y libclang-21-dev
213
216
214
217
- name : Resolve Third-Party Directory
215
218
id : resolve-third-party-dir
@@ -228,7 +231,7 @@ jobs:
228
231
id : llvm-cache
229
232
uses : actions/cache@v4
230
233
with :
231
- path : ${{ steps.resolve- llvm-root.outputs.llvm-root }}
234
+ path : ${{ matrix. llvm-path }}
232
235
key : ${{ matrix.llvm-archive-basename }}
233
236
234
237
- name : Download LLVM Binaries
@@ -261,6 +264,42 @@ jobs:
261
264
echo "found=$found" >> $GITHUB_OUTPUT
262
265
fi
263
266
267
+ - name : Install libc++
268
+ id : install_libcxx
269
+ uses :
alandefreitas/cpp-actions/[email protected]
270
+ if : steps.llvm-cache.outputs.cache-hit != 'true' && steps.llvm-download.outputs.found != 'true'
271
+ with :
272
+ cmake-version : ' >=3.26'
273
+ source-dir : ../third-party/llvm-project/runtimes
274
+ git-repository : https://github.com/llvm/llvm-project.git
275
+ git-tag : ${{ matrix.llvm-hash }}
276
+ download-dir : ../third-party/llvm-project
277
+ build-dir : ${sourceDir}/build
278
+ build-type : ${{ matrix.build-type }}
279
+ extra-args : |
280
+ -D LLVM_USE_SANITIZER=${{ matrix.llvm-sanitizer-config }}
281
+ -D LLVM_OPTIMIZED_TABLEGEN=ON
282
+ -D LLVM_ENABLE_LIBCXX=OFF
283
+ -D LLVM_ENABLE_PROJECT=""
284
+ -D LLVM_ENABLE_RUNTIMES="${{ matrix.libcxx-runtimes }}"
285
+ -D LLVM_ENABLE_PIC=ON
286
+ -D LIBCXXABI_USE_LLVM_UNWINDER=OFF
287
+
288
+ cc : ${{ steps.setup-cpp.outputs.cc }}
289
+ cxx : ${{ steps.setup-cpp.outputs.cxx }}
290
+ ccflags : -gz=zstd
291
+ cxxflags : -gz=zstd
292
+ generator : Ninja
293
+ install : true
294
+ install-prefix : ${{ matrix.llvm-path }}
295
+ run-tests : false
296
+ trace-commands : true
297
+
298
+ - name : Remove libcxx build-dir
299
+ if : steps.install_libcxx.outcome == 'success'
300
+ run : |
301
+ rm -r ../third-party/llvm-project/runtimes/build
302
+
264
303
- name : Install LLVM
265
304
id : install_llvm
266
305
uses :
alandefreitas/cpp-actions/[email protected]
@@ -274,26 +313,34 @@ jobs:
274
313
patches : |
275
314
./third-party/llvm/CMakePresets.json
276
315
./third-party/llvm/CMakeUserPresets.json
277
- build-dir : ${sourceDir}/llvm/ build
316
+ build-dir : ${sourceDir}/build
278
317
preset : ${{ matrix.llvm-build-preset }}
279
318
build-type : ${{ matrix.build-type }}
280
- # The LLVM_USE_SANITIZER option doesn't support GCC.
281
319
extra-args : |
282
- -DLLVM_USE_SANITIZER=${{ matrix.llvm-sanitizer-config }}
320
+ -D LLVM_ENABLE_ASSERTIONS=${{ matrix.llvm-enable-assertions }}
321
+ -D LLVM_USE_SANITIZER="${{ matrix.llvm-sanitizer-config }}"
322
+ -D LLVM_OPTIMIZED_TABLEGEN=ON
323
+ -D LLVM_COMPILER_CHECKED=ON
324
+ -D LLVM_BUILD_TOOLS=OFF
325
+ -D LLVM_INCLUDE_TOOLS=OFF
326
+ -D CLANG_BUILD_TOOLS=OFF
327
+ -D LLVM_ENABLE_RUNTIMES=""
328
+ -D CMAKE_C_FLAGS="${{ matrix.common-ccflags }}"
329
+ -D CMAKE_CXX_FLAGS="${{ matrix.common-cxxflags }}"
330
+ -D CMAKE_SHARED_LINKER_FLAGS="${{ matrix.common-ldflags }}"
331
+ -D CMAKE_EXE_LINKER_FLAGS="${{ matrix.common-ldflags }}"
283
332
cc : ${{ steps.setup-cpp.outputs.cc }}
284
333
cxx : ${{ steps.setup-cpp.outputs.cxx }}
285
- ccflags : -gz=zstd
286
- cxxflags : -gz=zstd
287
334
generator : Ninja
288
335
install : true
289
- install-prefix : ${sourceDir}/../install
336
+ install-prefix : ${{ matrix.llvm-path }}
290
337
run-tests : false
291
338
trace-commands : true
292
339
293
340
- name : Remove LLVM build-dir
294
341
if : steps.install_llvm.outcome == 'success'
295
342
run : |
296
- rm -r ../third-party/llvm-project/llvm/llvm/build
343
+ rm -r ../third-party/llvm-project
297
344
298
345
- name : Install Duktape
299
346
uses :
alandefreitas/cpp-actions/[email protected]
@@ -306,8 +353,8 @@ jobs:
306
353
build-dir : ${sourceDir}/build
307
354
cc : ${{ steps.setup-cpp.outputs.cc }}
308
355
cxx : ${{ steps.setup-cpp.outputs.cxx }}
309
- ccflags : ${{ matrix.ccflags }}
310
- cxxflags : ${{ matrix.cxxflags }}
356
+ ccflags : ${{ matrix.common- ccflags }}
357
+ cxxflags : ${{ matrix.common- cxxflags }}
311
358
build-type : ${{ matrix.build-type }}
312
359
shared : false
313
360
install : true
@@ -325,11 +372,12 @@ jobs:
325
372
build-dir : ${sourceDir}/build
326
373
cc : ${{ steps.setup-cpp.outputs.cc }}
327
374
cxx : ${{ steps.setup-cpp.outputs.cxx }}
328
- ccflags : ${{ matrix.ccflags }}
329
- cxxflags : ${{ matrix.cxxflags }}
375
+ ccflags : ${{ matrix.common- ccflags }}
376
+ cxxflags : ${{ matrix.common- cxxflags }}
330
377
build-type : Release
331
378
shared : false
332
379
extra-args : |
380
+ -D CMAKE_SHARED_LINKER_FLAGS="${{ matrix.common-ldflags }}"
333
381
-D LIBXML2_WITH_PROGRAMS=ON
334
382
-D LIBXML2_WITH_FTP=OFF
335
383
-D LIBXML2_WITH_HTTP=OFF
@@ -388,11 +436,11 @@ jobs:
388
436
install-prefix : .local
389
437
extra-args : |
390
438
-D MRDOCS_BUILD_DOCS=OFF
391
- -D CMAKE_EXE_LINKER_FLAGS=${{ matrix.mrdocs-linkflags }}
392
- -D LLVM_ROOT=${{ steps.resolve-third-party-dir.outputs.third-party-dir }}/llvm-project/install
393
- -D Clang_ROOT=${{ steps.resolve-third-party-dir.outputs.third-party-dir }}/llvm-project/install
394
- -D duktape_ROOT=${{ steps.resolve-third-party-dir.outputs.third-party-dir }}/duktape/install
395
- -D Duktape_ROOT=${{ steps.resolve-third-party-dir.outputs.third-party-dir }}/duktape/install
439
+ -D CMAKE_EXE_LINKER_FLAGS=" ${{ matrix.common-ldflags }}"
440
+ -D LLVM_ROOT=" ${{ matrix.llvm-path }}"
441
+ -D Clang_ROOT=" ${{ matrix.llvm-path }}"
442
+ -D duktape_ROOT=" ${{ steps.resolve-third-party-dir.outputs.third-party-dir }}/duktape/install"
443
+ -D Duktape_ROOT=" ${{ steps.resolve-third-party-dir.outputs.third-party-dir }}/duktape/install"
396
444
${{ runner.os == 'Windows' && '-D libxml2_ROOT=../third-party/libxml2/install' || '' }}
397
445
${{ runner.os == 'Windows' && '-D LibXml2_ROOT=../third-party/libxml2/install' || '' }}
398
446
export-compile-commands : true
@@ -882,25 +930,12 @@ jobs:
882
930
fi
883
931
echo "exists=$exists" >> $GITHUB_OUTPUT
884
932
885
- - name : Resolve LLVM Root
886
- id : resolve-llvm-root
887
- run : |
888
- set -x
889
- cd ..
890
- llvm_root=$(pwd)/third-party/llvm-project/install
891
- if [[ ${{ runner.os }} == 'Windows' ]]; then
892
- llvm_root=$(echo "$llvm_root" | sed 's/\\/\//g')
893
- llvm_root=$(echo $llvm_root | sed 's|^/d/|D:/|')
894
- echo "$llvm_root"
895
- fi
896
- echo -E "llvm-root=$llvm_root" >> $GITHUB_OUTPUT
897
-
898
933
- name : LLVM Binaries
899
934
id : llvm-cache
900
935
if : steps.website-releases.outputs.exists != 'true'
901
936
uses : actions/cache@v4
902
937
with :
903
- path : ${{ steps.resolve- llvm-root.outputs.llvm-root }}
938
+ path : ${{ matrix. llvm-path }}
904
939
key : ${{ matrix.llvm-archive-basename }}
905
940
906
941
- name : Compress LLVM
0 commit comments