xtask: make C components optional
This commit is contained in:
parent
bcaa09cc5d
commit
dea1b3ecf2
2
.gitignore
vendored
2
.gitignore
vendored
@ -1,3 +1,3 @@
|
||||
/target
|
||||
/toolchain
|
||||
/xtask.user.toml
|
||||
/xtask.toml
|
||||
|
@ -212,15 +212,20 @@ pub fn build_c(env: &BuildEnv, install: &mut Vec<(PathBuf, PathBuf)>) -> Result<
|
||||
let libm = build_openlibm(env, &llvm)?;
|
||||
install_openlibm(env, &libm)?;
|
||||
|
||||
toolchain_c::install_llvm_cxx_runtime(env, &llvm)?;
|
||||
if env.config.components(env).libcxx {
|
||||
toolchain_c::install_llvm_cxx_runtime(env, &llvm)?;
|
||||
}
|
||||
|
||||
build_test_c_program(env, &llvm, install)?;
|
||||
build_test_cpp_program(env, &llvm, install)?;
|
||||
|
||||
install.push((
|
||||
env.llvm_sysroot.join("lib/libc++.so"),
|
||||
"lib/libc++.so".into(),
|
||||
));
|
||||
if env.config.components(env).libcxx {
|
||||
build_test_cpp_program(env, &llvm, install)?;
|
||||
|
||||
install.push((
|
||||
env.llvm_sysroot.join("lib/libc++.so"),
|
||||
"lib/libc++.so".into(),
|
||||
));
|
||||
}
|
||||
install.push((ygglibc.shared_lib_file, "lib/libygglibc.so".into()));
|
||||
install.push((libm.shared_lib_file, "lib/libopenlibm.so.4".into()));
|
||||
|
||||
|
@ -72,8 +72,10 @@ fn build_userspace(
|
||||
log::info!("Building userspace");
|
||||
CargoBuilder::Userspace(env).build(env.workspace_root.join("userspace"))?;
|
||||
CargoBuilder::Userspace(env).build(env.workspace_root.join("userspace/dynload-program"))?;
|
||||
// TODO other architectures
|
||||
c::build_c(env, extra)?;
|
||||
|
||||
if env.config.components(env).libc || env.config.components(env).libcxx {
|
||||
c::build_c(env, extra)?;
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
@ -143,6 +143,16 @@ impl BuildEnv {
|
||||
}
|
||||
}
|
||||
|
||||
impl XTaskConfig {
|
||||
pub fn components(&self, env: &BuildEnv) -> &BuildComponents {
|
||||
match env.arch {
|
||||
Arch::aarch64 => &self.target.aarch64.components,
|
||||
Arch::x86_64 => &self.target.x86_64.components,
|
||||
Arch::i686 => &self.target.i686.components,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl Profile {
|
||||
pub fn dir(&self) -> &str {
|
||||
match self {
|
||||
|
@ -92,7 +92,17 @@ fn run(args: Args) -> Result<(), Error> {
|
||||
} else {
|
||||
Profile::Debug
|
||||
};
|
||||
let config = if let Some(path) = &args.config_path {
|
||||
|
||||
let default_config = workspace_root.join("xtask.toml");
|
||||
let config_path = args.config_path.as_ref().or_else(|| {
|
||||
if default_config.exists() {
|
||||
Some(&default_config)
|
||||
} else {
|
||||
None
|
||||
}
|
||||
});
|
||||
|
||||
let config = if let Some(path) = config_path {
|
||||
toml::from_str(&fs::read_to_string(path)?)
|
||||
.map_err(|e| Error::TomlParseError(path.to_owned(), e))?
|
||||
} else {
|
||||
|
Loading…
x
Reference in New Issue
Block a user