Build LLVM toolchain #73
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build LLVM toolchain | |
on: | |
workflow_dispatch: | |
inputs: | |
llvm_tag: | |
required: true | |
jobs: | |
build_linux: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
cpu: ["x86_64", "aarch64"] | |
steps: | |
- name: Install dependencies | |
run: sudo apt update && sudo apt install -yqq python3 git ninja-build cmake zstd | |
- name: Install ARM toolchain | |
run: sudo apt install -yqq gcc-arm-linux-gnueabi g++-arm-linux-gnueabi binutils-arm-linux-gnueabi | |
- name: Install AArch64 toolchain | |
run: sudo apt install -yqq gcc-aarch64-linux-gnu g++-aarch64-linux-gnu binutils-aarch64-linux-gnu | |
- name: Install RISC-V toolchain | |
run: sudo apt install -yqq gcc-riscv64-linux-gnu g++-riscv64-linux-gnu binutils-riscv64-linux-gnu | |
- name: Setup mold | |
uses: rui314/setup-mold@v1 | |
with: | |
mold-version: 2.4.0 | |
make-default: false | |
- name: Checkout LLVM | |
uses: actions/checkout@v4 | |
with: | |
repository: "llvm/llvm-project" | |
ref: ${{ inputs.llvm_tag }} | |
path: llvm | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
with: | |
path: toolchain | |
- name: Build and install | |
env: | |
CXXFLAGS: -w | |
CFLAGS: -w | |
run: | | |
mkdir build && mkdir install | |
python3 ./toolchain/scripts/configure_llvm.py --target_cpu="${{matrix.cpu}}-unknown-linux-gnu" --build_dir=$PWD/build | |
cd build | |
DESTDIR=$PWD/../install/${{inputs.llvm_tag}}-linux-${{matrix.cpu}}-clang-tidy ninja install-clangtidy-distribution-stripped | |
DESTDIR=$PWD/../install/${{inputs.llvm_tag}}-linux-${{matrix.cpu}}-clang-doc ninja install-clangdoc-distribution-stripped | |
DESTDIR=$PWD/../install/${{inputs.llvm_tag}}-linux-${{matrix.cpu}}-clang-format ninja install-clangformat-distribution-stripped | |
DESTDIR=$PWD/../install/${{inputs.llvm_tag}}-linux-${{matrix.cpu}}-clangd ninja install-clangdtool-distribution-stripped | |
DESTDIR=$PWD/../install/${{inputs.llvm_tag}}-linux-${{matrix.cpu}}-bolt ninja install-bolttool-distribution-stripped | |
DESTDIR=$PWD/../install/${{inputs.llvm_tag}}-linux-${{matrix.cpu}}-lld ninja install-lldtool-distribution-stripped | |
DESTDIR=$PWD/../install/${{inputs.llvm_tag}}-linux-${{matrix.cpu}}-libcpp ninja install-stdlib-distribution-stripped | |
DESTDIR=$PWD/../install/${{inputs.llvm_tag}}-linux-${{matrix.cpu}} ninja install-toolchain-distribution-stripped | |
../toolchain/scripts/flatten_usr_dirs.sh $PWD/../install/${{inputs.llvm_tag}}-linux-${{matrix.cpu}}-clang-tidy | |
../toolchain/scripts/flatten_usr_dirs.sh $PWD/../install/${{inputs.llvm_tag}}-linux-${{matrix.cpu}}-clang-doc | |
../toolchain/scripts/flatten_usr_dirs.sh $PWD/../install/${{inputs.llvm_tag}}-linux-${{matrix.cpu}}-clang-format | |
../toolchain/scripts/flatten_usr_dirs.sh $PWD/../install/${{inputs.llvm_tag}}-linux-${{matrix.cpu}}-clangd | |
../toolchain/scripts/flatten_usr_dirs.sh $PWD/../install/${{inputs.llvm_tag}}-linux-${{matrix.cpu}}-bolt | |
../toolchain/scripts/flatten_usr_dirs.sh $PWD/../install/${{inputs.llvm_tag}}-linux-${{matrix.cpu}}-lld | |
../toolchain/scripts/flatten_usr_dirs.sh $PWD/../install/${{inputs.llvm_tag}}-linux-${{matrix.cpu}}-libcpp | |
../toolchain/scripts/flatten_usr_dirs.sh $PWD/../install/${{inputs.llvm_tag}}-linux-${{matrix.cpu}} | |
ninja llvm-dwp | |
DESTDIR=$PWD/install/${{inputs.llvm_tag}}-linux-${{matrix.cpu}} ninja install-pstl | |
cp ./bin/llvm-dwp ../install/${{inputs.llvm_tag}}-linux-${{matrix.cpu}}/bin/ | |
cd ../install | |
tar --zstd -cf ${{ inputs.llvm_tag }}-linux-${{matrix.cpu}}.tar.zst ${{ inputs.llvm_tag }}-linux-${{matrix.cpu}} | |
tar --zstd -cf ${{ inputs.llvm_tag }}-linux-${{matrix.cpu}}-clang-tidy.tar.zst ${{ inputs.llvm_tag }}-linux-${{matrix.cpu}}-clang-tidy | |
tar --zstd -cf ${{ inputs.llvm_tag }}-linux-${{matrix.cpu}}-clang-doc.tar.zst ${{ inputs.llvm_tag }}-linux-${{matrix.cpu}}-clang-doc | |
tar --zstd -cf ${{ inputs.llvm_tag }}-linux-${{matrix.cpu}}-clang-format.tar.zst ${{ inputs.llvm_tag }}-linux-${{matrix.cpu}}-clang-format | |
tar --zstd -cf ${{ inputs.llvm_tag }}-linux-${{matrix.cpu}}-clangd.tar.zst ${{ inputs.llvm_tag }}-linux-${{matrix.cpu}}-clangd | |
tar --zstd -cf ${{ inputs.llvm_tag }}-linux-${{matrix.cpu}}-bolt.tar.zst ${{ inputs.llvm_tag }}-linux-${{matrix.cpu}}-bolt | |
tar --zstd -cf ${{ inputs.llvm_tag }}-linux-${{matrix.cpu}}-lld.tar.zst ${{ inputs.llvm_tag }}-linux-${{matrix.cpu}}-lld | |
tar --zstd -cf ${{ inputs.llvm_tag }}-linux-${{matrix.cpu}}-libcpp.tar.zst ${{ inputs.llvm_tag }}-linux-${{matrix.cpu}}-libcpp | |
- name: Upload artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
path: install/${{ inputs.llvm_tag }}-linux-${{matrix.cpu}}*.tar.zst | |
name: linux-${{matrix.cpu}}-toolchain | |
build_macos: | |
runs-on: macos-13 | |
strategy: | |
matrix: | |
cpu: ["x86_64", "aarch64"] | |
steps: | |
- name: Install dependencies | |
run: brew install ninja zstd gnu-tar | |
- name: Checkout LLVM | |
uses: actions/checkout@v4 | |
with: | |
repository: "llvm/llvm-project" | |
ref: ${{ inputs.llvm_tag }} | |
path: llvm | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
with: | |
path: toolchain | |
- name: Build and install | |
env: | |
CXXFLAGS: -w | |
CFLAGS: -w | |
run: | | |
sudo xcode-select -s /Applications/Xcode_15.1.app | |
mkdir build && mkdir install | |
python3 ./toolchain/scripts/configure_llvm.py --target_cpu="${{matrix.cpu}}-apple-darwin" --build_dir=$PWD/build | |
cd build | |
DESTDIR=$PWD/../install/${{inputs.llvm_tag}}-macos-${{matrix.cpu}}-clang-tidy ninja install-clangtidy-distribution-stripped | |
DESTDIR=$PWD/../install/${{inputs.llvm_tag}}-macos-${{matrix.cpu}}-clang-doc ninja install-clangdoc-distribution-stripped | |
DESTDIR=$PWD/../install/${{inputs.llvm_tag}}-macos-${{matrix.cpu}}-clang-format ninja install-clangformat-distribution-stripped | |
DESTDIR=$PWD/../install/${{inputs.llvm_tag}}-macos-${{matrix.cpu}}-clangd ninja install-clangdtool-distribution-stripped | |
DESTDIR=$PWD/../install/${{inputs.llvm_tag}}-macos-${{matrix.cpu}}-bolt ninja install-bolttool-distribution-stripped | |
DESTDIR=$PWD/../install/${{inputs.llvm_tag}}-macos-${{matrix.cpu}}-lld ninja install-lldtool-distribution-stripped | |
DESTDIR=$PWD/../install/${{inputs.llvm_tag}}-macos-${{matrix.cpu}}-libcpp ninja install-stdlib-distribution-stripped | |
DESTDIR=$PWD/../install/${{inputs.llvm_tag}}-macos-${{matrix.cpu}} ninja install-toolchain-distribution-stripped | |
../toolchain/scripts/flatten_usr_dirs.sh $PWD/../install/${{inputs.llvm_tag}}-macos-${{matrix.cpu}}-clang-tidy | |
../toolchain/scripts/flatten_usr_dirs.sh $PWD/../install/${{inputs.llvm_tag}}-macos-${{matrix.cpu}}-clang-doc | |
../toolchain/scripts/flatten_usr_dirs.sh $PWD/../install/${{inputs.llvm_tag}}-macos-${{matrix.cpu}}-clang-format | |
../toolchain/scripts/flatten_usr_dirs.sh $PWD/../install/${{inputs.llvm_tag}}-macos-${{matrix.cpu}}-clangd | |
../toolchain/scripts/flatten_usr_dirs.sh $PWD/../install/${{inputs.llvm_tag}}-macos-${{matrix.cpu}}-bolt | |
../toolchain/scripts/flatten_usr_dirs.sh $PWD/../install/${{inputs.llvm_tag}}-macos-${{matrix.cpu}}-lld | |
../toolchain/scripts/flatten_usr_dirs.sh $PWD/../install/${{inputs.llvm_tag}}-macos-${{matrix.cpu}}-libcpp | |
../toolchain/scripts/flatten_usr_dirs.sh $PWD/../install/${{inputs.llvm_tag}}-macos-${{matrix.cpu}} | |
ninja llvm-dwp | |
DESTDIR=$PWD/../install/${{inputs.llvm_tag}}-macos-${{matrix.cpu}} ninja install-pstl | |
cp ./bin/llvm-dwp ../install/${{inputs.llvm_tag}}-macos-${{matrix.cpu}}/bin/ | |
cd ../install | |
tar --zstd -cf ${{ inputs.llvm_tag }}-macos-${{matrix.cpu}}.tar.zst ${{ inputs.llvm_tag }}-macos-${{matrix.cpu}} | |
tar --zstd -cf ${{ inputs.llvm_tag }}-macos-${{matrix.cpu}}-clang-tidy.tar.zst ${{ inputs.llvm_tag }}-macos-${{matrix.cpu}}-clang-tidy | |
tar --zstd -cf ${{ inputs.llvm_tag }}-macos-${{matrix.cpu}}-clang-doc.tar.zst ${{ inputs.llvm_tag }}-macos-${{matrix.cpu}}-clang-doc | |
tar --zstd -cf ${{ inputs.llvm_tag }}-macos-${{matrix.cpu}}-clang-format.tar.zst ${{ inputs.llvm_tag }}-macos-${{matrix.cpu}}-clang-format | |
tar --zstd -cf ${{ inputs.llvm_tag }}-macos-${{matrix.cpu}}-clangd.tar.zst ${{ inputs.llvm_tag }}-macos-${{matrix.cpu}}-clangd | |
tar --zstd -cf ${{ inputs.llvm_tag }}-macos-${{matrix.cpu}}-bolt.tar.zst ${{ inputs.llvm_tag }}-macos-${{matrix.cpu}}-bolt | |
tar --zstd -cf ${{ inputs.llvm_tag }}-macos-${{matrix.cpu}}-lld.tar.zst ${{ inputs.llvm_tag }}-macos-${{matrix.cpu}}-lld | |
tar --zstd -cf ${{ inputs.llvm_tag }}-macos-${{matrix.cpu}}-libcpp.tar.zst ${{ inputs.llvm_tag }}-macos-${{matrix.cpu}}-libcpp | |
- name: Upload artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
path: install/${{ inputs.llvm_tag }}-macos-${{matrix.cpu}}*.tar.zst | |
name: macos-${{matrix.cpu}}-toolchain | |
publish_release: | |
needs: ["build_linux", "build_macos"] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Download artifacts | |
uses: actions/download-artifact@v3 | |
- name: Collect sha256 checksums | |
run: | | |
touch RELASE.txt | |
sha256sum linux-x86_64-toolchain/${{ inputs.llvm_tag }}-linux-x86_64.tar.zst >> RELEASE.txt | |
sha256sum linux-x86_64-toolchain/${{ inputs.llvm_tag }}-linux-x86_64-clang-tidy.tar.zst >> RELEASE.txt | |
sha256sum linux-x86_64-toolchain/${{ inputs.llvm_tag }}-linux-x86_64-clang-doc.tar.zst >> RELEASE.txt | |
sha256sum linux-x86_64-toolchain/${{ inputs.llvm_tag }}-linux-x86_64-clang-format.tar.zst >> RELEASE.txt | |
sha256sum linux-x86_64-toolchain/${{ inputs.llvm_tag }}-linux-x86_64-clangd.tar.zst >> RELEASE.txt | |
sha256sum linux-x86_64-toolchain/${{ inputs.llvm_tag }}-linux-x86_64-bolt.tar.zst >> RELEASE.txt | |
sha256sum linux-x86_64-toolchain/${{ inputs.llvm_tag }}-linux-x86_64-lld.tar.zst >> RELEASE.txt | |
sha256sum linux-x86_64-toolchain/${{ inputs.llvm_tag }}-linux-x86_64-libcpp.tar.zst >> RELEASE.txt | |
sha256sum linux-aarch64-toolchain/${{ inputs.llvm_tag }}-linux-aarch64.tar.zst >> RELEASE.txt | |
sha256sum linux-aarch64-toolchain/${{ inputs.llvm_tag }}-linux-aarch64-clang-tidy.tar.zst >> RELEASE.txt | |
sha256sum linux-aarch64-toolchain/${{ inputs.llvm_tag }}-linux-aarch64-clang-doc.tar.zst >> RELEASE.txt | |
sha256sum linux-aarch64-toolchain/${{ inputs.llvm_tag }}-linux-aarch64-clang-format.tar.zst >> RELEASE.txt | |
sha256sum linux-aarch64-toolchain/${{ inputs.llvm_tag }}-linux-aarch64-clangd.tar.zst >> RELEASE.txt | |
sha256sum linux-aarch64-toolchain/${{ inputs.llvm_tag }}-linux-aarch64-bolt.tar.zst >> RELEASE.txt | |
sha256sum linux-aarch64-toolchain/${{ inputs.llvm_tag }}-linux-aarch64-lld.tar.zst >> RELEASE.txt | |
sha256sum linux-aarch64-toolchain/${{ inputs.llvm_tag }}-linux-aarch64-libcpp.tar.zst >> RELEASE.txt | |
# sha256sum linux-riscv64-toolchain/${{ inputs.llvm_tag }}-linux-riscv64.tar.zst >> RELEASE.txt | |
# sha256sum linux-riscv64-toolchain/${{ inputs.llvm_tag }}-linux-riscv64-clang-tidy.tar.zst >> RELEASE.txt | |
# sha256sum linux-riscv64-toolchain/${{ inputs.llvm_tag }}-linux-riscv64-clang-doc.tar.zst >> RELEASE.txt | |
# sha256sum linux-riscv64-toolchain/${{ inputs.llvm_tag }}-linux-riscv64-clang-format.tar.zst >> RELEASE.txt | |
# sha256sum linux-riscv64-toolchain/${{ inputs.llvm_tag }}-linux-riscv64-clangd.tar.zst >> RELEASE.txt | |
# sha256sum linux-riscv64-toolchain/${{ inputs.llvm_tag }}-linux-riscv64-bolt.tar.zst >> RELEASE.txt | |
# sha256sum linux-riscv64-toolchain/${{ inputs.llvm_tag }}-linux-riscv64-lld.tar.zst >> RELEASE.txt | |
# sha256sum linux-riscv64-toolchain/${{ inputs.llvm_tag }}-linux-riscv64-libcpp.tar.zst >> RELEASE.txt | |
sha256sum macos-x86_64-toolchain/${{ inputs.llvm_tag }}-macos-x86_64.tar.zst >> RELEASE.txt | |
sha256sum macos-x86_64-toolchain/${{ inputs.llvm_tag }}-macos-x86_64-clang-tidy.tar.zst >> RELEASE.txt | |
sha256sum macos-x86_64-toolchain/${{ inputs.llvm_tag }}-macos-x86_64-clang-doc.tar.zst >> RELEASE.txt | |
sha256sum macos-x86_64-toolchain/${{ inputs.llvm_tag }}-macos-x86_64-clang-format.tar.zst >> RELEASE.txt | |
sha256sum macos-x86_64-toolchain/${{ inputs.llvm_tag }}-macos-x86_64-clangd.tar.zst >> RELEASE.txt | |
sha256sum macos-x86_64-toolchain/${{ inputs.llvm_tag }}-macos-x86_64-bolt.tar.zst >> RELEASE.txt | |
sha256sum macos-x86_64-toolchain/${{ inputs.llvm_tag }}-macos-x86_64-lld.tar.zst >> RELEASE.txt | |
sha256sum macos-x86_64-toolchain/${{ inputs.llvm_tag }}-macos-x86_64-libcpp.tar.zst >> RELEASE.txt | |
sha256sum macos-aarch64-toolchain/${{ inputs.llvm_tag }}-macos-aarch64.tar.zst >> RELEASE.txt | |
sha256sum macos-aarch64-toolchain/${{ inputs.llvm_tag }}-macos-aarch64-clang-tidy.tar.zst >> RELEASE.txt | |
sha256sum macos-aarch64-toolchain/${{ inputs.llvm_tag }}-macos-aarch64-clang-doc.tar.zst >> RELEASE.txt | |
sha256sum macos-aarch64-toolchain/${{ inputs.llvm_tag }}-macos-aarch64-clang-format.tar.zst >> RELEASE.txt | |
sha256sum macos-aarch64-toolchain/${{ inputs.llvm_tag }}-macos-aarch64-clangd.tar.zst >> RELEASE.txt | |
sha256sum macos-aarch64-toolchain/${{ inputs.llvm_tag }}-macos-aarch64-bolt.tar.zst >> RELEASE.txt | |
sha256sum macos-aarch64-toolchain/${{ inputs.llvm_tag }}-macos-aarch64-lld.tar.zst >> RELEASE.txt | |
sha256sum macos-aarch64-toolchain/${{ inputs.llvm_tag }}-macos-aarch64-libcpp.tar.zst >> RELEASE.txt | |
- name: Create release | |
uses: softprops/action-gh-release@v1 | |
with: | |
token: ${{ secrets.RELEASE_TOKEN }} | |
body_path: RELEASE.txt | |
tag_name: ${{ inputs.llvm_tag }}-${{ github.sha }} | |
name: LLVM Toolchain ${{ inputs.llvm_tag }} | |
prerelease: true | |
files: | | |
linux-x86_64-toolchain/${{ inputs.llvm_tag }}-linux-x86_64.tar.zst | |
linux-x86_64-toolchain/${{ inputs.llvm_tag }}-linux-x86_64-clang-tidy.tar.zst | |
linux-x86_64-toolchain/${{ inputs.llvm_tag }}-linux-x86_64-clang-doc.tar.zst | |
linux-x86_64-toolchain/${{ inputs.llvm_tag }}-linux-x86_64-clang-format.tar.zst | |
linux-x86_64-toolchain/${{ inputs.llvm_tag }}-linux-x86_64-clangd.tar.zst | |
linux-x86_64-toolchain/${{ inputs.llvm_tag }}-linux-x86_64-bolt.tar.zst | |
linux-x86_64-toolchain/${{ inputs.llvm_tag }}-linux-x86_64-lld.tar.zst | |
linux-x86_64-toolchain/${{ inputs.llvm_tag }}-linux-x86_64-libcpp.tar.zst | |
linux-aarch64-toolchain/${{ inputs.llvm_tag }}-linux-aarch64.tar.zst | |
linux-aarch64-toolchain/${{ inputs.llvm_tag }}-linux-aarch64-clang-tidy.tar.zst | |
linux-aarch64-toolchain/${{ inputs.llvm_tag }}-linux-aarch64-clang-doc.tar.zst | |
linux-aarch64-toolchain/${{ inputs.llvm_tag }}-linux-aarch64-clang-format.tar.zst | |
linux-aarch64-toolchain/${{ inputs.llvm_tag }}-linux-aarch64-clangd.tar.zst | |
linux-aarch64-toolchain/${{ inputs.llvm_tag }}-linux-aarch64-bolt.tar.zst | |
linux-aarch64-toolchain/${{ inputs.llvm_tag }}-linux-aarch64-lld.tar.zst | |
linux-aarch64-toolchain/${{ inputs.llvm_tag }}-linux-aarch64-libcpp.tar.zst | |
macos-x86_64-toolchain/${{ inputs.llvm_tag }}-macos-x86_64.tar.zst | |
macos-x86_64-toolchain/${{ inputs.llvm_tag }}-macos-x86_64-clang-tidy.tar.zst | |
macos-x86_64-toolchain/${{ inputs.llvm_tag }}-macos-x86_64-clang-doc.tar.zst | |
macos-x86_64-toolchain/${{ inputs.llvm_tag }}-macos-x86_64-clang-format.tar.zst | |
macos-x86_64-toolchain/${{ inputs.llvm_tag }}-macos-x86_64-clangd.tar.zst | |
macos-x86_64-toolchain/${{ inputs.llvm_tag }}-macos-x86_64-bolt.tar.zst | |
macos-x86_64-toolchain/${{ inputs.llvm_tag }}-macos-x86_64-lld.tar.zst | |
macos-x86_64-toolchain/${{ inputs.llvm_tag }}-macos-x86_64-libcpp.tar.zst | |
macos-aarch64-toolchain/${{ inputs.llvm_tag }}-macos-aarch64.tar.zst | |
macos-aarch64-toolchain/${{ inputs.llvm_tag }}-macos-aarch64-clang-tidy.tar.zst | |
macos-aarch64-toolchain/${{ inputs.llvm_tag }}-macos-aarch64-clang-doc.tar.zst | |
macos-aarch64-toolchain/${{ inputs.llvm_tag }}-macos-aarch64-clang-format.tar.zst | |
macos-aarch64-toolchain/${{ inputs.llvm_tag }}-macos-aarch64-clangd.tar.zst | |
macos-aarch64-toolchain/${{ inputs.llvm_tag }}-macos-aarch64-bolt.tar.zst | |
macos-aarch64-toolchain/${{ inputs.llvm_tag }}-macos-aarch64-lld.tar.zst | |
macos-aarch64-toolchain/${{ inputs.llvm_tag }}-macos-aarch64-libcpp.tar.zst |