From b15dc57144d1deef86329d7e03c9792f5dad6d15 Mon Sep 17 00:00:00 2001 From: ptitSeb Date: Fri, 8 Sep 2023 14:11:08 +0200 Subject: [PATCH] Buld v15.x and cross build riscv64 too --- .github/workflows/ci.yml | 29 +++++++++++++++++++++++++++-- README.md | 24 ++++++++++++++++++++++++ build.ps1 | 2 +- build.sh | 9 +++++---- 4 files changed, 57 insertions(+), 7 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8d69bc0..a35098b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -15,6 +15,9 @@ jobs: - id: 'linux-aarch64' os: "ubuntu-latest" # os: ['self-hosted', 'linux', 'ARM64'] + - id: 'linux-riscv64' + os: "ubuntu-latest" + # os: ['self-hosted', 'linux', 'RISCV64'] - id: 'darwin-amd64' os: 'macos-latest' tar_extra_args: '' @@ -27,7 +30,7 @@ jobs: # adds an additional copy per link, but it reliably works and # the additional size is not too large on Windows. tar_extra_args: '--dereference' - llvm_version: ['14.x'] + llvm_version: ['15.x'] llvm_repo_url: ['https://github.com/llvm/llvm-project.git'] fail-fast: true @@ -49,6 +52,12 @@ jobs: run: | sudo apt-get install gcc-12-aarch64-linux-gnu g++-12-aarch64-linux-gnu gcc-12-multilib binutils-aarch64-linux-gnu libgcc-12-dev-arm64-cross libstdc++6-arm64-cross -y + - name: Install cross-compilatio tools + if: matrix.target.id == 'linux-riscv64' + shell: bash + run: | + sudo apt-get install gcc-12-riscv64-linux-gnu g++-12-riscv64-linux-gnu gcc-12-multilib binutils-riscv64-linux-gnu libgcc-12-dev-riscv64-cross libstdc++6-riscv64-cross -y + - name: Install `ninja` on macOS if: startsWith(matrix.target.id, 'darwin-') shell: bash @@ -63,7 +72,7 @@ jobs: # choco install ninja - name: Build - if: matrix.target.id != 'windows-amd64' && matrix.target.id != 'linux-aarch64' + if: matrix.target.id != 'windows-amd64' && matrix.target.id != 'linux-aarch64' && matrix.target.id != 'linux-riscv64' shell: bash run: | ./build.sh ${{ matrix.llvm_version }} ${{ matrix.llvm_repo_url }} @@ -74,6 +83,12 @@ jobs: run: | ./build.sh ${{ matrix.llvm_version }} ${{ matrix.llvm_repo_url }} aarch64 + - name: Build (linux-aarch64) + if: matrix.target.id == 'linux-riscv64' + shell: bash + run: | + ./build.sh ${{ matrix.llvm_version }} ${{ matrix.llvm_repo_url }} riscv64 + - name: Build (Windows) if: matrix.target.id == 'windows-amd64' shell: | @@ -157,6 +172,16 @@ jobs: asset_name: linux-aarch64.tar.xz asset_content_type: application/gzip + - name: Upload Release Asset Linux (RISCV64) + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ steps.create_release.outputs.upload_url }} + asset_path: artifacts/linux-riscv64-${{matrix.llvm_version}}/llvm.tar.xz + asset_name: linux-riscv64.tar.xz + asset_content_type: application/gzip + - name: Upload Release Asset Darwin uses: actions/upload-release-asset@v1 env: diff --git a/README.md b/README.md index beaf6b1..d44f3e0 100644 --- a/README.md +++ b/README.md @@ -48,6 +48,30 @@ assets](https://github.com/wasmerio/llvm-custom-builds/releases). + + 15 + amd64 + Darwin + download + + + Linux + download + + + Windows + download + + + aarch64 + Linux + download + + + riscv64 + Linux + download + 14 amd64 diff --git a/build.ps1 b/build.ps1 index 8525838..4a326e3 100755 --- a/build.ps1 +++ b/build.ps1 @@ -53,7 +53,7 @@ cmake ` -DLLVM_INCLUDE_TOOLS=ON ` -DLLVM_INCLUDE_UTILS=OFF ` -DLLVM_OPTIMIZED_TABLEGEN=ON ` - -DLLVM_TARGETS_TO_BUILD="X86;AArch64;RISCV" ` + -DLLVM_TARGETS_TO_BUILD="X86;AArch64;RISCV;WebAssembly" ` $CROSS_COMPILE ` $CMAKE_ARGUMENTS ` ../llvm diff --git a/build.sh b/build.sh index eb876a5..97e70fc 100755 --- a/build.sh +++ b/build.sh @@ -10,12 +10,12 @@ LLVM_CROSS="$3" if [[ -z "$LLVM_REPO_URL" || -z "$LLVM_VERSION" ]] then - echo "Usage: $0 [aarch64]" + echo "Usage: $0 [aarch64/riscv64]" echo echo "# Arguments" echo " llvm-version The name of a LLVM release branch without the 'release/' prefix" echo " llvm-repository-url The URL used to clone LLVM sources (default: https://github.com/llvm/llvm-project.git)" - echo " aarch64 To cross-compile an aarch64 version of LLVM" + echo " aarch64 / riscv64 To cross-compile an aarch64/riscv64 version of LLVM" exit 1 fi @@ -53,6 +53,7 @@ CROSS_COMPILE="" case "${LLVM_CROSS}" in aarch64*) CROSS_COMPILE="-DLLVM_HOST_TRIPLE=aarch64-linux-gnu" ;; + riscv64*) CROSS_COMPILE="-DLLVM_HOST_TRIPLE=riscv64-linux-gnu" ;; *) ;; esac @@ -71,7 +72,7 @@ cmake \ -DLLVM_INCLUDE_TOOLS=ON \ -DLLVM_INCLUDE_UTILS=OFF \ -DLLVM_OPTIMIZED_TABLEGEN=ON \ - -DLLVM_TARGETS_TO_BUILD="X86;AArch64;RISCV" \ + -DLLVM_TARGETS_TO_BUILD="X86;AArch64;RISCV;WebAssembly" \ "${CROSS_COMPILE}" \ "${CMAKE_ARGUMENTS}" \ ../llvm @@ -81,4 +82,4 @@ cmake --build . --config MinSizeRel DESTDIR=destdir cmake --install . --strip --config MinSizeRel # move usr/bin/* to bin/ or llvm-config will be broken -mv destdir/usr/bin/* destdir/bin/ \ No newline at end of file +mv destdir/usr/bin/* destdir/bin/