Skip to content

Commit

Permalink
Buld v15.x and cross build riscv64 too
Browse files Browse the repository at this point in the history
  • Loading branch information
ptitSeb committed Sep 8, 2023
1 parent c5458a4 commit b15dc57
Show file tree
Hide file tree
Showing 4 changed files with 57 additions and 7 deletions.
29 changes: 27 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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: ''
Expand All @@ -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

Expand All @@ -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
Expand All @@ -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 }}
Expand All @@ -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: |
Expand Down Expand Up @@ -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:
Expand Down
24 changes: 24 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,30 @@ assets](https://github.com/wasmerio/llvm-custom-builds/releases).
</tr>
</thead>
<tbody>
<tr>
<td rowspan="4">15</td>
<td rowspan="3">amd64</td>
<td>Darwin</td>
<td><a href="https://github.com/wasmerio/llvm-custom-builds/releases/download/15.x/darwin-amd64.tar.gz">download</a></td>
</tr>
<tr>
<td>Linux</td>
<td><a href="https://github.com/wasmerio/llvm-custom-builds/releases/download/15.x/linux-amd64.tar.gz">download</a></td>
</tr>
<tr>
<td>Windows</td>
<td><a href="https://github.com/wasmerio/llvm-custom-builds/releases/download/15.x/windows-amd64.tar.gz">download</a></td>
</tr>
<tr>
<td>aarch64</td>
<td>Linux</td>
<td><a href="https://github.com/wasmerio/llvm-custom-builds/releases/download/15.x/linux-aarch64.tar.gz">download</a></td>
</tr>
<tr>
<td>riscv64</td>
<td>Linux</td>
<td><a href="https://github.com/wasmerio/llvm-custom-builds/releases/download/15.x/linux-riscv64.tar.gz">download</a></td>
</tr>
<tr>
<td rowspan="4">14</td>
<td rowspan="3">amd64</td>
Expand Down
2 changes: 1 addition & 1 deletion build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
9 changes: 5 additions & 4 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ LLVM_CROSS="$3"

if [[ -z "$LLVM_REPO_URL" || -z "$LLVM_VERSION" ]]
then
echo "Usage: $0 <llvm-version> <llvm-repository-url> [aarch64]"
echo "Usage: $0 <llvm-version> <llvm-repository-url> [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
Expand Down Expand Up @@ -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

Expand All @@ -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
Expand All @@ -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/
mv destdir/usr/bin/* destdir/bin/

0 comments on commit b15dc57

Please sign in to comment.