Refactor(build.rs): extract common code between branches (#1950)
This commit is contained in:
parent
44a37da680
commit
fbd0d497d4
@ -146,7 +146,6 @@ pub fn build(
|
||||
.arg("distclean")
|
||||
.status(),
|
||||
);*/
|
||||
if is_usermode && !custom_qemu_no_configure {
|
||||
let mut cmd = Command::new("./configure");
|
||||
cmd.current_dir(&qemu_path)
|
||||
//.arg("--as-static-lib")
|
||||
@ -162,35 +161,19 @@ pub fn build(
|
||||
qemu_path.join("linker_interceptor++.py").display()
|
||||
))
|
||||
.arg("--as-shared-lib")
|
||||
.arg(&format!("--target-list={cpu_target}-{target_suffix}"))
|
||||
.args([
|
||||
.arg(&format!("--target-list={cpu_target}-{target_suffix}"));
|
||||
if cfg!(feature = "debug_assertions") {
|
||||
cmd.arg("--enable-debug");
|
||||
}
|
||||
if is_usermode && !custom_qemu_no_configure {
|
||||
cmd.args([
|
||||
"--disable-bsd-user",
|
||||
"--disable-fdt",
|
||||
"--disable-system",
|
||||
"--disable-capstone",
|
||||
]);
|
||||
if cfg!(feature = "debug_assertions") {
|
||||
cmd.arg("--enable-debug");
|
||||
}
|
||||
cmd.status().expect("Configure failed");
|
||||
} else if !custom_qemu_no_configure {
|
||||
let mut cmd = Command::new("./configure");
|
||||
cmd.current_dir(&qemu_path)
|
||||
//.arg("--as-static-lib")
|
||||
.env("__LIBAFL_QEMU_BUILD_OUT", build_dir.join("linkinfo.json"))
|
||||
.env("__LIBAFL_QEMU_BUILD_CC", cc_compiler.path())
|
||||
.env("__LIBAFL_QEMU_BUILD_CXX", cpp_compiler.path())
|
||||
.arg(&format!(
|
||||
"--cc={}",
|
||||
qemu_path.join("linker_interceptor.py").display()
|
||||
))
|
||||
.arg(&format!(
|
||||
"--cxx={}",
|
||||
qemu_path.join("linker_interceptor++.py").display()
|
||||
))
|
||||
.arg("--as-shared-lib")
|
||||
.arg(&format!("--target-list={cpu_target}-{target_suffix}"))
|
||||
.arg(if cfg!(feature = "slirp") {
|
||||
cmd.arg(if cfg!(feature = "slirp") {
|
||||
"--enable-slirp"
|
||||
} else {
|
||||
"--disable-slirp"
|
||||
@ -304,11 +287,9 @@ pub fn build(
|
||||
.arg("--disable-xkbcommon")
|
||||
.arg("--disable-zstd")
|
||||
.arg("--disable-tests");
|
||||
if cfg!(feature = "debug_assertions") {
|
||||
cmd.arg("--enable-debug");
|
||||
}
|
||||
|
||||
cmd.status().expect("Configure failed");
|
||||
}
|
||||
if let Some(j) = jobs {
|
||||
Command::new("make")
|
||||
.current_dir(&build_dir)
|
||||
|
Loading…
x
Reference in New Issue
Block a user