github: Build the linux full toolchain already in stage1

This makes a cross compiler available before doing the full second
stage.
This commit is contained in:
Martin Storsjö committed 2025-06-25 11:51:07 +03:00
1 parent bc8eea6fc0
commit 05625eaf62
1 file changed
+27 -31
+27 -31
View File
@@ -73,6 +73,7 @@ jobs:
- name: Build - name: Build
env: env:
LLVM_VERSION: ${{needs.prepare.outputs.LLVM_VERSION}} LLVM_VERSION: ${{needs.prepare.outputs.LLVM_VERSION}}
MINGW_W64_VERSION: ${{needs.prepare.outputs.MINGW_W64_VERSION}}
TAG: ${{needs.prepare.outputs.TAG}} TAG: ${{needs.prepare.outputs.TAG}}
SOURCE_DATE_EPOCH: ${{needs.prepare.outputs.COMMIT_DATE_UNIX}} SOURCE_DATE_EPOCH: ${{needs.prepare.outputs.COMMIT_DATE_UNIX}}
BUILD_DATE: ${{needs.prepare.outputs.BUILD_DATE}} BUILD_DATE: ${{needs.prepare.outputs.BUILD_DATE}}
@@ -80,18 +81,20 @@ 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 --stage1 --llvm-only LLVM_CMAKEFLAGS="-DLLVM_ENABLE_LIBXML2=OFF -DLLDB_ENABLE_PYTHON=OFF" ./build-all.sh $(pwd)/install/llvm-mingw --stage1
.github/workflows/store-version.sh install/llvm/versions.txt .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
cd install cd install
DISTRO=ubuntu-$(grep DISTRIB_RELEASE /etc/lsb-release | cut -f 2 -d =)-$(uname -m) DISTRO=ubuntu-$(grep DISTRIB_RELEASE /etc/lsb-release | cut -f 2 -d =)-$(uname -m)
NAME=llvm-$TAG-$DISTRO NAME=llvm-mingw-stage1-$TAG-ucrt-$DISTRO
mv llvm $NAME mv llvm-mingw $NAME
tar -Jcf ../$NAME.tar.xz --format=ustar --numeric-owner --owner=0 --group=0 --sort=name --mtime="$BUILD_DATE" $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 - uses: actions/upload-artifact@v4
with: with:
name: linux-llvm-x86_64 name: linux-stage1-ucrt-x86_64-toolchain
path: | path: |
llvm-*.tar.xz llvm-mingw-*.tar.xz
retention-days: 7 retention-days: 7
# Build a cross compiler for Linux, targeting Windows. # Build a cross compiler for Linux, targeting Windows.
@@ -103,25 +106,26 @@ jobs:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- uses: actions/download-artifact@v4 - uses: actions/download-artifact@v4
with: with:
name: linux-llvm-x86_64 name: linux-stage1-ucrt-x86_64-toolchain
- name: Unpack stage1 Clang - name: Unpack stage1 Clang
run: | run: |
tar -Jxf llvm-*.tar.xz tar -Jxf llvm-mingw-*.tar.xz
rm llvm-*.tar.xz rm llvm-mingw-*.tar.xz
sudo mv llvm* /opt/llvm sudo mv llvm-mingw* /opt/llvm-mingw
echo /opt/llvm/bin >> $GITHUB_PATH echo /opt/llvm-mingw/bin >> $GITHUB_PATH
- name: Build - name: Build
env: env:
LLVM_VERSION: ${{needs.prepare.outputs.LLVM_VERSION}} LLVM_VERSION: ${{needs.prepare.outputs.LLVM_VERSION}}
MINGW_W64_VERSION: ${{needs.prepare.outputs.MINGW_W64_VERSION}}
TAG: ${{needs.prepare.outputs.TAG}} TAG: ${{needs.prepare.outputs.TAG}}
SOURCE_DATE_EPOCH: ${{needs.prepare.outputs.COMMIT_DATE_UNIX}} SOURCE_DATE_EPOCH: ${{needs.prepare.outputs.COMMIT_DATE_UNIX}}
BUILD_DATE: ${{needs.prepare.outputs.BUILD_DATE}} BUILD_DATE: ${{needs.prepare.outputs.BUILD_DATE}}
run: | run: |
mkdir -p install
cp -a /opt/llvm-mingw install
# 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 --with-clang --thinlto LLVM_CMAKEFLAGS="-DLLVM_ENABLE_LIBXML2=OFF -DLLDB_ENABLE_PYTHON=OFF" ./build-all.sh $(pwd)/install/llvm-mingw --with-clang --thinlto --llvm-only
.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
@@ -141,19 +145,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, linux-stage1, prepare] needs: [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 - uses: actions/download-artifact@v4
with: with:
name: linux-llvm-x86_64 name: linux-stage1-ucrt-x86_64-toolchain
- name: Unpack stage1 Clang - name: Unpack stage1 Clang
run: | run: |
tar -Jxf llvm-*.tar.xz tar -Jxf llvm-mingw-*.tar.xz
rm llvm-*.tar.xz rm llvm-mingw-*.tar.xz
sudo mv llvm* /opt/llvm sudo mv llvm-mingw* /opt/llvm-mingw
echo /opt/llvm/bin >> $GITHUB_PATH echo /opt/llvm-mingw/bin >> $GITHUB_PATH
- name: Build - name: Build
env: env:
LLVM_VERSION: ${{needs.prepare.outputs.LLVM_VERSION}} LLVM_VERSION: ${{needs.prepare.outputs.LLVM_VERSION}}
@@ -163,17 +167,9 @@ jobs:
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 --with-clang --thinlto ./build-all.sh $(pwd)/install/llvm-mingw --no-runtimes --host=aarch64-linux-gnu --with-clang --thinlto
.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
with:
name: linux-ucrt-x86_64-toolchain
- name: Unpack native toolchain
run: |
tar -Jxf llvm-mingw-*.tar.xz
rm llvm-mingw-*.tar.xz
mv llvm-mingw* llvm-mingw-native
- name: Assemble the cross-built toolchain - name: Assemble the cross-built toolchain
run: | run: |
./prepare-cross-toolchain-unix.sh $(pwd)/llvm-mingw-native $(pwd)/install/llvm-mingw ./prepare-cross-toolchain-unix.sh /opt/llvm-mingw $(pwd)/install/llvm-mingw
- name: Test using the cross-built assembled toolchain - name: Test using the cross-built assembled toolchain
run: | run: |
sudo apt-get update && sudo apt-get install qemu-user-static libc6-arm64-cross libstdc++6-arm64-cross sudo apt-get update && sudo apt-get install qemu-user-static libc6-arm64-cross libstdc++6-arm64-cross
@@ -367,7 +363,7 @@ jobs:
# architectures). The binaries built here match actual releases quite closely. # architectures). The binaries built here match actual releases quite closely.
linux-cross-windows: linux-cross-windows:
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-stage1, prepare]
runs-on: ubuntu-latest runs-on: ubuntu-latest
strategy: strategy:
fail-fast: false fail-fast: false
@@ -380,7 +376,7 @@ jobs:
steps: steps:
- uses: actions/download-artifact@v4 - uses: actions/download-artifact@v4
with: with:
name: linux-${{matrix.crt}}-x86_64-toolchain name: linux-stage1-${{matrix.crt}}-x86_64-toolchain
- name: Unpack cross toolchain - name: Unpack cross toolchain
run: | run: |
tar -Jxf llvm-mingw-*.tar.xz tar -Jxf llvm-mingw-*.tar.xz
@@ -776,7 +772,7 @@ jobs:
run: | run: |
rm -rf linux-asserts* rm -rf linux-asserts*
rm -rf msys2* rm -rf msys2*
rm -rf linux-llvm-* rm -rf linux-stage1-*
rm -rf macos-llvm* rm -rf macos-llvm*
mv *-toolchain/*.zip *-toolchain/*.tar.xz . mv *-toolchain/*.zip *-toolchain/*.tar.xz .
- name: Upload binaries - name: Upload binaries