diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 1c70678..375a68b 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -64,13 +64,52 @@ jobs: parameters.txt retention-days: 7 - # Build a cross compiler for Linux, targeting Windows. - linux: + linux-stage1: if: (github.event_name != 'schedule') || (github.repository == 'mstorsjo/llvm-mingw') needs: [prepare] runs-on: ubuntu-22.04 steps: - 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 env: LLVM_VERSION: ${{needs.prepare.outputs.LLVM_VERSION}} @@ -82,7 +121,7 @@ jobs: # 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-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 ./test-libcxx-module.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. linux-cross-aarch64: if: (github.event_name != 'schedule') || (github.repository == 'mstorsjo/llvm-mingw') - needs: [linux, prepare] + needs: [linux, linux-stage1, prepare] 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 env: LLVM_VERSION: ${{needs.prepare.outputs.LLVM_VERSION}} @@ -113,7 +161,7 @@ jobs: SOURCE_DATE_EPOCH: ${{needs.prepare.outputs.COMMIT_DATE_UNIX}} run: | 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 - uses: actions/download-artifact@v4 with: @@ -183,13 +231,51 @@ jobs: llvm-mingw-linux.tar.xz retention-days: 7 - # Build a cross compiler for macOS, targeting Windows. - macos: + macos-stage1: if: (github.event_name != 'schedule') || (github.repository == 'mstorsjo/llvm-mingw') needs: [prepare] runs-on: macos-latest steps: - 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 env: LLVM_VERSION: ${{needs.prepare.outputs.LLVM_VERSION}} @@ -203,7 +289,8 @@ jobs: # form. Therefore, autodetection will pick them up, but linking # universal binaries fails as those libraries are unavailable in the # 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 ./test-libcxx-module.sh $(pwd)/install/llvm-mingw ./run-tests.sh $(pwd)/install/llvm-mingw @@ -689,6 +776,8 @@ jobs: run: | rm -rf linux-asserts* rm -rf msys2* + rm -rf linux-llvm-* + rm -rf macos-llvm* mv *-toolchain/*.zip *-toolchain/*.tar.xz . - name: Upload binaries env: