mirror of
https://github.com/pezkuwichain/revive.git
synced 2026-06-14 18:01:05 +00:00
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:
@@ -0,0 +1,119 @@
|
||||
//! The revive LLVM builder arguments.
|
||||
|
||||
use clap::Parser;
|
||||
use revive_llvm_builder::ccache_variant::CcacheVariant;
|
||||
|
||||
/// The revive LLVM builder arguments.
|
||||
#[derive(Debug, Parser)]
|
||||
#[command(version, about)]
|
||||
pub struct Arguments {
|
||||
/// Target environment to build LLVM (gnu, musl, emscripten).
|
||||
#[arg(long, default_value_t = revive_llvm_builder::target_env::TargetEnv::GNU)]
|
||||
pub target_env: revive_llvm_builder::target_env::TargetEnv,
|
||||
|
||||
#[command(subcommand)]
|
||||
pub subcommand: Subcommand,
|
||||
}
|
||||
|
||||
/// The revive LLVM builder arguments.
|
||||
#[derive(Debug, clap::Subcommand)]
|
||||
pub enum Subcommand {
|
||||
/// Clone the branch specified in `LLVM.lock`.
|
||||
Clone {
|
||||
/// Clone with full commits history.
|
||||
#[arg(long)]
|
||||
deep: bool,
|
||||
},
|
||||
|
||||
/// Build the LLVM framework.
|
||||
Build {
|
||||
/// LLVM build type (`Debug`, `Release`, `RelWithDebInfo`, or `MinSizeRel`).
|
||||
#[arg(long, default_value_t = revive_llvm_builder::BuildType::Release)]
|
||||
build_type: revive_llvm_builder::BuildType,
|
||||
|
||||
/// Additional targets to build LLVM with.
|
||||
#[arg(long)]
|
||||
targets: Vec<String>,
|
||||
|
||||
/// LLVM projects to build LLVM with.
|
||||
#[arg(
|
||||
long,
|
||||
default_values_t = vec![
|
||||
revive_llvm_builder::llvm_project::LLVMProject::CLANG,
|
||||
revive_llvm_builder::llvm_project::LLVMProject::LLD
|
||||
]
|
||||
)]
|
||||
llvm_projects: Vec<revive_llvm_builder::llvm_project::LLVMProject>,
|
||||
|
||||
/// Whether to build LLVM with run-time type information (RTTI) enabled.
|
||||
#[arg(long)]
|
||||
enable_rtti: bool,
|
||||
|
||||
/// The default target to build LLVM with.
|
||||
#[arg(long)]
|
||||
default_target: Option<revive_llvm_builder::target_triple::TargetTriple>,
|
||||
|
||||
/// Whether to build the LLVM tests.
|
||||
#[arg(long)]
|
||||
enable_tests: bool,
|
||||
|
||||
/// Whether to build LLVM for source-based code coverage.
|
||||
#[arg(long)]
|
||||
enable_coverage: bool,
|
||||
|
||||
/// Extra arguments to pass to CMake.
|
||||
/// A leading backslash will be unescaped.
|
||||
#[arg(long)]
|
||||
extra_args: Vec<String>,
|
||||
|
||||
/// Whether to use compiler cache (ccache) to speed-up builds.
|
||||
#[arg(long)]
|
||||
ccache_variant: Option<CcacheVariant>,
|
||||
|
||||
/// Whether to build with assertions enabled or not.
|
||||
#[arg(long, default_value_t = true)]
|
||||
enable_assertions: bool,
|
||||
|
||||
/// Build LLVM with sanitizer enabled (`Address`, `Memory`, `MemoryWithOrigins`, `Undefined`, `Thread`, `DataFlow`, or `Address;Undefined`).
|
||||
#[arg(long)]
|
||||
sanitizer: Option<revive_llvm_builder::sanitizer::Sanitizer>,
|
||||
|
||||
/// Whether to run LLVM unit tests under valgrind or not.
|
||||
#[arg(long)]
|
||||
enable_valgrind: bool,
|
||||
},
|
||||
|
||||
/// Checkout the branch specified in `LLVM.lock`.
|
||||
Checkout {
|
||||
/// Remove all artifacts preventing the checkout (removes all local changes!).
|
||||
#[arg(long)]
|
||||
force: bool,
|
||||
},
|
||||
|
||||
/// Clean the build artifacts.
|
||||
Clean,
|
||||
|
||||
/// Build the LLVM compiler-rt builtins for the PolkaVM target.
|
||||
Builtins {
|
||||
/// LLVM build type (`Debug`, `Release`, `RelWithDebInfo`, or `MinSizeRel`).
|
||||
#[arg(long, default_value_t = revive_llvm_builder::BuildType::Release)]
|
||||
build_type: revive_llvm_builder::BuildType,
|
||||
|
||||
/// The default target to build LLVM with.
|
||||
#[arg(long)]
|
||||
default_target: Option<revive_llvm_builder::target_triple::TargetTriple>,
|
||||
|
||||
/// Extra arguments to pass to CMake.
|
||||
/// A leading backslash will be unescaped.
|
||||
#[arg(long)]
|
||||
extra_args: Vec<String>,
|
||||
|
||||
/// Whether to use compiler cache (ccache) to speed-up builds.
|
||||
#[arg(long)]
|
||||
ccache_variant: Option<CcacheVariant>,
|
||||
|
||||
/// Build LLVM with sanitizer enabled (`Address`, `Memory`, `MemoryWithOrigins`, `Undefined`, `Thread`, `DataFlow`, or `Address;Undefined`).
|
||||
#[arg(long)]
|
||||
sanitizer: Option<revive_llvm_builder::sanitizer::Sanitizer>,
|
||||
},
|
||||
}
|
||||
Reference in New Issue
Block a user