revive llvm builder utility (#154)

Pre-eliminary support for LLVM releases and resolc binary releases by streamlining the build process for all supported hosts platforms.

- Introduce the revive-llvm-builder crate with the revive-llvm builder utilty.
- Do not rely on the LLVM dependency in $PATH to decouple the system LLVM installation from the LLVM host dependency.
- Fix the emscripten build by decoupling the host and native LLVM dependencies. Thus allowing a single LLVM emscripten release that can be used on any host platform.
- An example Dockerfile building an alpine container with a fully statically linked resolc ELF binary.
- Remove the Debian builder utilities and workflow.
This commit is contained in:
Cyrill Leutwiler
2025-01-13 15:58:27 +01:00
committed by GitHub
parent fde9edab10
commit 7f81f37e0c
65 changed files with 4847 additions and 557 deletions
+3
View File
@@ -12,3 +12,6 @@ anyhow = { workspace = true }
inkwell = { workspace = true, features = ["target-riscv", "no-libffi-linking", "llvm18-0"] }
revive-common = { workspace = true }
[build-dependencies]
revive-build-utils = { workspace = true }
+7 -2
View File
@@ -14,7 +14,7 @@ const EXPORTS_BC: &str = "polkavm_exports.bc";
const EXPORTS_RUST: &str = "polkavm_exports.rs";
fn compile(source_path: &str, bitcode_path: &str) {
let output = Command::new("clang")
let output = Command::new(revive_build_utils::llvm_host_tool("clang"))
.args([
TARGET_FLAG,
"-Xclang",
@@ -37,7 +37,7 @@ fn compile(source_path: &str, bitcode_path: &str) {
source_path,
])
.output()
.expect("should be able to invoke C clang");
.unwrap_or_else(|error| panic!("failed to execute clang: {}", error));
assert!(
output.status.success(),
@@ -59,6 +59,11 @@ fn build_module(source_path: &str, bitcode_path: &str, rust_file: &str) {
}
fn main() {
println!(
"cargo:rerun-if-env-changed={}",
revive_build_utils::REVIVE_LLVM_HOST_PREFIX
);
build_module(IMPORTS_SOUCE, IMPORTS_BC, IMPORTS_RUST);
build_module(EXPORTS_SOUCE, EXPORTS_BC, EXPORTS_RUST);