Skip to content

Commit

Permalink
WIP: LLVM release workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
mutantcornholio committed Jan 28, 2025
1 parent 888723e commit 8ea8493
Show file tree
Hide file tree
Showing 2 changed files with 161 additions and 7 deletions.
148 changes: 148 additions & 0 deletions .github/workflows/release-llvm.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,148 @@
name: Release LLVM
on:
workflow_dispatch:
inputs:
version:
description: "version to use in tag name; without the leading 'v', or prefix"
required: false
push:
branches: ["yuri/release-llvm"]

env:
CARGO_TERM_COLOR: always

jobs:
build-macos-gnu:
runs-on: macos-latest
steps:
- uses: actions/checkout@v4

- name: install macos deps
run: |
brew install ninja
- name: versions
run: |
rustup show
cargo --version
cmake --version
echo "bash:" && bash --version
echo "ninja:" && ninja --version
echo "clang:" && clang --version
- name: Build LLVM
run: |
make install-llvm
- uses: actions/upload-artifact@v4
with:
name: llvm-macos
path: target-llvm/gnu/target-final
if-no-files-found: error
compression-level: 9

build-linux-all:
runs-on: parity-large
steps:
- uses: actions/checkout@v4

- name: install linux deps
run: |
sudo apt-get update && sudo apt-get install -y cmake ninja-build curl git libssl-dev pkg-config clang lld
- name: Install Rust stable toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
components: rust-src
target: wasm32-unknown-emscripten

- name: versions
run: |
rustup show
cargo --version
cmake --version
echo "bash:" && bash --version
echo "ninja:" && ninja --version
echo "clang:" && clang --version
- name: Build host LLVM
run: |
make install-llvm
- name: Build emscripten LLVM
run: |
revive-llvm --target-env emscripten clone
source emsdk/emsdk_env.sh
revive-llvm --target-env emscripten build --llvm-projects lld
- uses: actions/upload-artifact@v4
with:
name: llvm-linux
path: target-llvm/gnu/target-final
if-no-files-found: error
compression-level: 9

- uses: actions/upload-artifact@v4
with:
name: llvm-emscripten
path: target-llvm/emscripten/target-final
if-no-files-found: error
compression-level: 9

build-windows-gnu:
# runs-on: windows-latest
runs-on: lorwyn
env:
MSYSTEM: "MINGW"
steps:
- uses: actions/checkout@v4

- name: install win deps
run: |
choco install ninja
- name: Setup msys2
id: msys2
uses: msys2/setup-msys2@v2
with:
path-type: inherit
install: >-
base-devel
mingw-w64-x86_64-clang
mingw-w64-x86_64-lld
mingw-w64-x86_64-rust
mingw-w64-x86_64-cmake
mingw-w64-x86_64-gcc
mingw-w64-x86_64-gcc-libs
mingw-w64-x86_64-python
mingw-w64-clang-x86_64-riscv64-unknown-elf-toolchain
- name: Prepare env
shell: "msys2 {0}"
run: |
echo "/c/Users/runneradmin/.cargo/bin" >> "${GITHUB_PATH}"
- name: versions
shell: "msys2 {0}"
run: |
rustup show
cargo --version
cmake --version
ninja --version
- name: Build LLVM
shell: "msys2 {0}"
env:
VERBOSE: 1
LIBSTDCPP_SOURCE_PATH: "${{ steps.msys2.outputs.msys2-location }}/mingw64/lib/libstdc++.a"
run: |
make install-llvm
- uses: actions/upload-artifact@v4
with:
name: llvm-windows
path: target-llvm/gnu/target-final
if-no-files-found: error
compression-level: 9
20 changes: 13 additions & 7 deletions crates/llvm-builder/src/builtins.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,26 +42,32 @@ fn cmake_dynamic_args(
crate::LLVMPath::llvm_target_final()?
};

let bin_suffix = if cfg!(target_os = "windows") {
".exe"
} else {
""
};

let mut clang_path = llvm_target_host.to_path_buf();
clang_path.push("bin/clang");
clang_path.push(format!("bin/clang{}", bin_suffix));

let mut clangxx_path = llvm_target_host.to_path_buf();
clangxx_path.push("bin/clang++");
clangxx_path.push(format!("bin/clang++{}", bin_suffix));

let mut llvm_config_path = llvm_target_host.to_path_buf();
llvm_config_path.push("bin/llvm-config");
llvm_config_path.push(format!("bin/llvm-config++{}", bin_suffix));

let mut ar_path = llvm_target_host.to_path_buf();
ar_path.push("bin/llvm-ar");
ar_path.push(format!("bin/llvm-ar{}", bin_suffix));

let mut nm_path = llvm_target_host.to_path_buf();
nm_path.push("bin/llvm-nm");
nm_path.push(format!("bin/llvm-nm{}", bin_suffix));

let mut ranlib_path = llvm_target_host.to_path_buf();
ranlib_path.push("bin/llvm-ranlib");
ranlib_path.push(format!("bin/llvm-ranlib{}", bin_suffix));

let mut linker_path = llvm_target_host.to_path_buf();
linker_path.push("bin/ld.lld");
linker_path.push(format!("bin/ld.lld{}", bin_suffix));

Ok([
format!(
Expand Down

0 comments on commit 8ea8493

Please sign in to comment.