github: Build macOS and Linux toolchains with a stage1 Clang

This commit is contained in:
Martin Storsjö committed 2025-06-25 11:51:07 +03:00
1 parent 7dcff8f89f
commit eb3cb9c31d
1 file changed
+97 -8
+97 -8
View File
@@ -64,13 +64,52 @@ jobs:
parameters.txt parameters.txt
retention-days: 7 retention-days: 7
# Build a cross compiler for Linux, targeting Windows. linux-stage1:
linux:
if: (github.event_name != 'schedule') || (github.repository == 'mstorsjo/llvm-mingw') if: (github.event_name != 'schedule') || (github.repository == 'mstorsjo/llvm-mingw')
needs: [prepare] needs: [prepare]
runs-on: ubuntu-22.04 runs-on: ubuntu-22.04
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- name: Build
env:
LLVM_VERSION: ${{needs.prepare.outputs.LLVM_VERSION}}
TAG: ${{needs.prepare.outputs.TAG}}
SOURCE_DATE_EPOCH: ${{needs.prepare.outputs.COMMIT_DATE_UNIX}}
BUILD_DATE: ${{needs.prepare.outputs.BUILD_DATE}}
run: |
# Skip dynamic library dependencies that might make it harder to
# run the binaries on other distros (and that have little use within
# llvm-mingw).
LLVM_CMAKEFLAGS="-DLLVM_ENABLE_LIBXML2=OFF -DLLDB_ENABLE_PYTHON=OFF" ./build-all.sh $(pwd)/install/llvm --stage1 --llvm-only
.github/workflows/store-version.sh install/llvm/versions.txt
cd install
DISTRO=ubuntu-$(grep DISTRIB_RELEASE /etc/lsb-release | cut -f 2 -d =)-$(uname -m)
NAME=llvm-$TAG-$DISTRO
mv llvm $NAME
tar -Jcf ../$NAME.tar.xz --format=ustar --numeric-owner --owner=0 --group=0 --sort=name --mtime="$BUILD_DATE" $NAME
- uses: actions/upload-artifact@v4
with:
name: linux-llvm-x86_64
path: |
llvm-*.tar.xz
retention-days: 7
# Build a cross compiler for Linux, targeting Windows.
linux:
if: (github.event_name != 'schedule') || (github.repository == 'mstorsjo/llvm-mingw')
needs: [prepare, linux-stage1]
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
name: linux-llvm-x86_64
- name: Unpack stage1 Clang
run: |
tar -Jxf llvm-*.tar.xz
rm llvm-*.tar.xz
sudo mv llvm* /opt/llvm
echo /opt/llvm/bin >> $GITHUB_PATH
- name: Build - name: Build
env: env:
LLVM_VERSION: ${{needs.prepare.outputs.LLVM_VERSION}} LLVM_VERSION: ${{needs.prepare.outputs.LLVM_VERSION}}
@@ -82,7 +121,7 @@ jobs:
# Skip dynamic library dependencies that might make it harder to # Skip dynamic library dependencies that might make it harder to
# run the binaries on other distros (and that have little use within # run the binaries on other distros (and that have little use within
# llvm-mingw). # llvm-mingw).
LLVM_CMAKEFLAGS="-DLLVM_ENABLE_LIBXML2=OFF -DLLDB_ENABLE_PYTHON=OFF" ./build-all.sh $(pwd)/install/llvm-mingw LLVM_CMAKEFLAGS="-DLLVM_ENABLE_LIBXML2=OFF -DLLDB_ENABLE_PYTHON=OFF" ./build-all.sh $(pwd)/install/llvm-mingw --with-clang
.github/workflows/store-version.sh install/llvm-mingw/versions.txt .github/workflows/store-version.sh install/llvm-mingw/versions.txt
./test-libcxx-module.sh $(pwd)/install/llvm-mingw ./test-libcxx-module.sh $(pwd)/install/llvm-mingw
./run-tests.sh $(pwd)/install/llvm-mingw ./run-tests.sh $(pwd)/install/llvm-mingw
@@ -102,10 +141,19 @@ jobs:
# libraries that were built in the 'linux' step above. # libraries that were built in the 'linux' step above.
linux-cross-aarch64: linux-cross-aarch64:
if: (github.event_name != 'schedule') || (github.repository == 'mstorsjo/llvm-mingw') if: (github.event_name != 'schedule') || (github.repository == 'mstorsjo/llvm-mingw')
needs: [linux, prepare] needs: [linux, linux-stage1, prepare]
runs-on: ubuntu-22.04 runs-on: ubuntu-22.04
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
name: linux-llvm-x86_64
- name: Unpack stage1 Clang
run: |
tar -Jxf llvm-*.tar.xz
rm llvm-*.tar.xz
sudo mv llvm* /opt/llvm
echo /opt/llvm/bin >> $GITHUB_PATH
- name: Build - name: Build
env: env:
LLVM_VERSION: ${{needs.prepare.outputs.LLVM_VERSION}} LLVM_VERSION: ${{needs.prepare.outputs.LLVM_VERSION}}
@@ -113,7 +161,7 @@ jobs:
SOURCE_DATE_EPOCH: ${{needs.prepare.outputs.COMMIT_DATE_UNIX}} SOURCE_DATE_EPOCH: ${{needs.prepare.outputs.COMMIT_DATE_UNIX}}
run: | run: |
sudo apt-get update && sudo apt-get install g++-aarch64-linux-gnu sudo apt-get update && sudo apt-get install g++-aarch64-linux-gnu
./build-all.sh $(pwd)/install/llvm-mingw --no-runtimes --host=aarch64-linux-gnu ./build-all.sh $(pwd)/install/llvm-mingw --no-runtimes --host=aarch64-linux-gnu --with-clang
.github/workflows/store-version.sh install/llvm-mingw/versions.txt .github/workflows/store-version.sh install/llvm-mingw/versions.txt
- uses: actions/download-artifact@v4 - uses: actions/download-artifact@v4
with: with:
@@ -183,13 +231,51 @@ jobs:
llvm-mingw-linux.tar.xz llvm-mingw-linux.tar.xz
retention-days: 7 retention-days: 7
# Build a cross compiler for macOS, targeting Windows. macos-stage1:
macos:
if: (github.event_name != 'schedule') || (github.repository == 'mstorsjo/llvm-mingw') if: (github.event_name != 'schedule') || (github.repository == 'mstorsjo/llvm-mingw')
needs: [prepare] needs: [prepare]
runs-on: macos-latest runs-on: macos-latest
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- name: Build
env:
LLVM_VERSION: ${{needs.prepare.outputs.LLVM_VERSION}}
TAG: ${{needs.prepare.outputs.TAG}}
SOURCE_DATE_EPOCH: ${{needs.prepare.outputs.COMMIT_DATE_UNIX}}
BUILD_DATE: ${{needs.prepare.outputs.BUILD_DATE}}
run: |
# Disable zstd and python. Both are available on the runners, but
# installed with homebrew, and only available in the native (arm64)
# form.
LLVM_CMAKEFLAGS="-DLLVM_ENABLE_ZSTD=OFF -DLLDB_ENABLE_PYTHON=OFF" ./build-all.sh $(pwd)/install/llvm --stage1 --llvm-only
.github/workflows/store-version.sh install/llvm/versions.txt
cd install
NAME=llvm-$TAG-macos-$(uname -m)
mv llvm $NAME
gtar -Jcf ../$NAME.tar.xz --format=ustar --numeric-owner --owner=0 --group=0 --sort=name --mtime="$BUILD_DATE" $NAME
- uses: actions/upload-artifact@v4
with:
name: macos-llvm
path: |
llvm-*.tar.xz
retention-days: 7
# Build a cross compiler for macOS, targeting Windows.
macos:
if: (github.event_name != 'schedule') || (github.repository == 'mstorsjo/llvm-mingw')
needs: [prepare, macos-stage1]
runs-on: macos-latest
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
name: macos-llvm
- name: Unpack stage1 Clang
run: |
tar -Jxf llvm-*.tar.xz
rm llvm-*.tar.xz
mv llvm* $HOME/llvm
echo $HOME/llvm/bin >> $GITHUB_PATH
- name: Build - name: Build
env: env:
LLVM_VERSION: ${{needs.prepare.outputs.LLVM_VERSION}} LLVM_VERSION: ${{needs.prepare.outputs.LLVM_VERSION}}
@@ -203,7 +289,8 @@ jobs:
# form. Therefore, autodetection will pick them up, but linking # form. Therefore, autodetection will pick them up, but linking
# universal binaries fails as those libraries are unavailable in the # universal binaries fails as those libraries are unavailable in the
# other (x86_64) architecture form. # other (x86_64) architecture form.
MACOS_REDIST=1 LLVM_CMAKEFLAGS="-DLLVM_ENABLE_ZSTD=OFF -DLLDB_ENABLE_PYTHON=OFF" ./build-all.sh $(pwd)/install/llvm-mingw export SDKROOT=$(xcrun --show-sdk-path)
MACOS_REDIST=1 LLVM_CMAKEFLAGS="-DLLVM_ENABLE_ZSTD=OFF -DLLDB_ENABLE_PYTHON=OFF" ./build-all.sh $(pwd)/install/llvm-mingw --with-clang
.github/workflows/store-version.sh install/llvm-mingw/versions.txt .github/workflows/store-version.sh install/llvm-mingw/versions.txt
./test-libcxx-module.sh $(pwd)/install/llvm-mingw ./test-libcxx-module.sh $(pwd)/install/llvm-mingw
./run-tests.sh $(pwd)/install/llvm-mingw ./run-tests.sh $(pwd)/install/llvm-mingw
@@ -689,6 +776,8 @@ jobs:
run: | run: |
rm -rf linux-asserts* rm -rf linux-asserts*
rm -rf msys2* rm -rf msys2*
rm -rf linux-llvm-*
rm -rf macos-llvm*
mv *-toolchain/*.zip *-toolchain/*.tar.xz . mv *-toolchain/*.zip *-toolchain/*.tar.xz .
- name: Upload binaries - name: Upload binaries
env: env: