Skip to content

Commit eb3cb9c

Browse files
committed
github: Build macOS and Linux toolchains with a stage1 Clang
1 parent 7dcff8f commit eb3cb9c

File tree

1 file changed

+95
-6
lines changed

1 file changed

+95
-6
lines changed

.github/workflows/build.yml

Lines changed: 95 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -64,13 +64,52 @@ jobs:
6464
parameters.txt
6565
retention-days: 7
6666

67+
linux-stage1:
68+
if: (github.event_name != 'schedule') || (github.repository == 'mstorsjo/llvm-mingw')
69+
needs: [prepare]
70+
runs-on: ubuntu-22.04
71+
steps:
72+
- uses: actions/checkout@v4
73+
- name: Build
74+
env:
75+
LLVM_VERSION: ${{needs.prepare.outputs.LLVM_VERSION}}
76+
TAG: ${{needs.prepare.outputs.TAG}}
77+
SOURCE_DATE_EPOCH: ${{needs.prepare.outputs.COMMIT_DATE_UNIX}}
78+
BUILD_DATE: ${{needs.prepare.outputs.BUILD_DATE}}
79+
run: |
80+
# Skip dynamic library dependencies that might make it harder to
81+
# run the binaries on other distros (and that have little use within
82+
# llvm-mingw).
83+
LLVM_CMAKEFLAGS="-DLLVM_ENABLE_LIBXML2=OFF -DLLDB_ENABLE_PYTHON=OFF" ./build-all.sh $(pwd)/install/llvm --stage1 --llvm-only
84+
.github/workflows/store-version.sh install/llvm/versions.txt
85+
cd install
86+
DISTRO=ubuntu-$(grep DISTRIB_RELEASE /etc/lsb-release | cut -f 2 -d =)-$(uname -m)
87+
NAME=llvm-$TAG-$DISTRO
88+
mv llvm $NAME
89+
tar -Jcf ../$NAME.tar.xz --format=ustar --numeric-owner --owner=0 --group=0 --sort=name --mtime="$BUILD_DATE" $NAME
90+
- uses: actions/upload-artifact@v4
91+
with:
92+
name: linux-llvm-x86_64
93+
path: |
94+
llvm-*.tar.xz
95+
retention-days: 7
96+
6797
# Build a cross compiler for Linux, targeting Windows.
6898
linux:
6999
if: (github.event_name != 'schedule') || (github.repository == 'mstorsjo/llvm-mingw')
70-
needs: [prepare]
100+
needs: [prepare, linux-stage1]
71101
runs-on: ubuntu-22.04
72102
steps:
73103
- uses: actions/checkout@v4
104+
- uses: actions/download-artifact@v4
105+
with:
106+
name: linux-llvm-x86_64
107+
- name: Unpack stage1 Clang
108+
run: |
109+
tar -Jxf llvm-*.tar.xz
110+
rm llvm-*.tar.xz
111+
sudo mv llvm* /opt/llvm
112+
echo /opt/llvm/bin >> $GITHUB_PATH
74113
- name: Build
75114
env:
76115
LLVM_VERSION: ${{needs.prepare.outputs.LLVM_VERSION}}
@@ -82,7 +121,7 @@ jobs:
82121
# Skip dynamic library dependencies that might make it harder to
83122
# run the binaries on other distros (and that have little use within
84123
# llvm-mingw).
85-
LLVM_CMAKEFLAGS="-DLLVM_ENABLE_LIBXML2=OFF -DLLDB_ENABLE_PYTHON=OFF" ./build-all.sh $(pwd)/install/llvm-mingw
124+
LLVM_CMAKEFLAGS="-DLLVM_ENABLE_LIBXML2=OFF -DLLDB_ENABLE_PYTHON=OFF" ./build-all.sh $(pwd)/install/llvm-mingw --with-clang
86125
.github/workflows/store-version.sh install/llvm-mingw/versions.txt
87126
./test-libcxx-module.sh $(pwd)/install/llvm-mingw
88127
./run-tests.sh $(pwd)/install/llvm-mingw
@@ -102,18 +141,27 @@ jobs:
102141
# libraries that were built in the 'linux' step above.
103142
linux-cross-aarch64:
104143
if: (github.event_name != 'schedule') || (github.repository == 'mstorsjo/llvm-mingw')
105-
needs: [linux, prepare]
144+
needs: [linux, linux-stage1, prepare]
106145
runs-on: ubuntu-22.04
107146
steps:
108147
- uses: actions/checkout@v4
148+
- uses: actions/download-artifact@v4
149+
with:
150+
name: linux-llvm-x86_64
151+
- name: Unpack stage1 Clang
152+
run: |
153+
tar -Jxf llvm-*.tar.xz
154+
rm llvm-*.tar.xz
155+
sudo mv llvm* /opt/llvm
156+
echo /opt/llvm/bin >> $GITHUB_PATH
109157
- name: Build
110158
env:
111159
LLVM_VERSION: ${{needs.prepare.outputs.LLVM_VERSION}}
112160
MINGW_W64_VERSION: ${{needs.prepare.outputs.MINGW_W64_VERSION}}
113161
SOURCE_DATE_EPOCH: ${{needs.prepare.outputs.COMMIT_DATE_UNIX}}
114162
run: |
115163
sudo apt-get update && sudo apt-get install g++-aarch64-linux-gnu
116-
./build-all.sh $(pwd)/install/llvm-mingw --no-runtimes --host=aarch64-linux-gnu
164+
./build-all.sh $(pwd)/install/llvm-mingw --no-runtimes --host=aarch64-linux-gnu --with-clang
117165
.github/workflows/store-version.sh install/llvm-mingw/versions.txt
118166
- uses: actions/download-artifact@v4
119167
with:
@@ -183,13 +231,51 @@ jobs:
183231
llvm-mingw-linux.tar.xz
184232
retention-days: 7
185233

234+
macos-stage1:
235+
if: (github.event_name != 'schedule') || (github.repository == 'mstorsjo/llvm-mingw')
236+
needs: [prepare]
237+
runs-on: macos-latest
238+
steps:
239+
- uses: actions/checkout@v4
240+
- name: Build
241+
env:
242+
LLVM_VERSION: ${{needs.prepare.outputs.LLVM_VERSION}}
243+
TAG: ${{needs.prepare.outputs.TAG}}
244+
SOURCE_DATE_EPOCH: ${{needs.prepare.outputs.COMMIT_DATE_UNIX}}
245+
BUILD_DATE: ${{needs.prepare.outputs.BUILD_DATE}}
246+
run: |
247+
# Disable zstd and python. Both are available on the runners, but
248+
# installed with homebrew, and only available in the native (arm64)
249+
# form.
250+
LLVM_CMAKEFLAGS="-DLLVM_ENABLE_ZSTD=OFF -DLLDB_ENABLE_PYTHON=OFF" ./build-all.sh $(pwd)/install/llvm --stage1 --llvm-only
251+
.github/workflows/store-version.sh install/llvm/versions.txt
252+
cd install
253+
NAME=llvm-$TAG-macos-$(uname -m)
254+
mv llvm $NAME
255+
gtar -Jcf ../$NAME.tar.xz --format=ustar --numeric-owner --owner=0 --group=0 --sort=name --mtime="$BUILD_DATE" $NAME
256+
- uses: actions/upload-artifact@v4
257+
with:
258+
name: macos-llvm
259+
path: |
260+
llvm-*.tar.xz
261+
retention-days: 7
262+
186263
# Build a cross compiler for macOS, targeting Windows.
187264
macos:
188265
if: (github.event_name != 'schedule') || (github.repository == 'mstorsjo/llvm-mingw')
189-
needs: [prepare]
266+
needs: [prepare, macos-stage1]
190267
runs-on: macos-latest
191268
steps:
192269
- uses: actions/checkout@v4
270+
- uses: actions/download-artifact@v4
271+
with:
272+
name: macos-llvm
273+
- name: Unpack stage1 Clang
274+
run: |
275+
tar -Jxf llvm-*.tar.xz
276+
rm llvm-*.tar.xz
277+
mv llvm* $HOME/llvm
278+
echo $HOME/llvm/bin >> $GITHUB_PATH
193279
- name: Build
194280
env:
195281
LLVM_VERSION: ${{needs.prepare.outputs.LLVM_VERSION}}
@@ -203,7 +289,8 @@ jobs:
203289
# form. Therefore, autodetection will pick them up, but linking
204290
# universal binaries fails as those libraries are unavailable in the
205291
# other (x86_64) architecture form.
206-
MACOS_REDIST=1 LLVM_CMAKEFLAGS="-DLLVM_ENABLE_ZSTD=OFF -DLLDB_ENABLE_PYTHON=OFF" ./build-all.sh $(pwd)/install/llvm-mingw
292+
export SDKROOT=$(xcrun --show-sdk-path)
293+
MACOS_REDIST=1 LLVM_CMAKEFLAGS="-DLLVM_ENABLE_ZSTD=OFF -DLLDB_ENABLE_PYTHON=OFF" ./build-all.sh $(pwd)/install/llvm-mingw --with-clang
207294
.github/workflows/store-version.sh install/llvm-mingw/versions.txt
208295
./test-libcxx-module.sh $(pwd)/install/llvm-mingw
209296
./run-tests.sh $(pwd)/install/llvm-mingw
@@ -689,6 +776,8 @@ jobs:
689776
run: |
690777
rm -rf linux-asserts*
691778
rm -rf msys2*
779+
rm -rf linux-llvm-*
780+
rm -rf macos-llvm*
692781
mv *-toolchain/*.zip *-toolchain/*.tar.xz .
693782
- name: Upload binaries
694783
env:

0 commit comments

Comments
 (0)