mirror of
https://github.com/roc-lang/roc.git
synced 2024-09-22 08:17:40 +03:00
commit
7c2963d31d
@ -1,5 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
set -euxo pipefail
|
|
||||||
|
|
||||||
zig build-obj src/main.zig -O ReleaseFast -femit-llvm-ir=builtins.ll -femit-bin=builtins.o --strip
|
|
@ -24,9 +24,6 @@ fn main() {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
let big_sur_path = "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/lib";
|
|
||||||
let use_build_script = Path::new(big_sur_path).exists();
|
|
||||||
|
|
||||||
// "." is relative to where "build.rs" is
|
// "." is relative to where "build.rs" is
|
||||||
let build_script_dir_path = fs::canonicalize(Path::new(".")).unwrap();
|
let build_script_dir_path = fs::canonicalize(Path::new(".")).unwrap();
|
||||||
let bitcode_path = build_script_dir_path.join("bitcode");
|
let bitcode_path = build_script_dir_path.join("bitcode");
|
||||||
@ -40,26 +37,18 @@ fn main() {
|
|||||||
let dest_ir_path = bitcode_path.join("builtins-64bit.ll");
|
let dest_ir_path = bitcode_path.join("builtins-64bit.ll");
|
||||||
let dest_ir_64bit = dest_ir_path.to_str().expect("Invalid dest ir path");
|
let dest_ir_64bit = dest_ir_path.to_str().expect("Invalid dest ir path");
|
||||||
|
|
||||||
if use_build_script {
|
println!("Compiling zig object to: {}", src_obj);
|
||||||
println!(
|
run_command(&bitcode_path, "zig", &["build", "object", "-Drelease=true"]);
|
||||||
"Compiling zig object & ir to: {} and {}",
|
|
||||||
src_obj, dest_ir_64bit
|
|
||||||
);
|
|
||||||
run_command_with_no_args(&bitcode_path, "./build.sh");
|
|
||||||
} else {
|
|
||||||
println!("Compiling zig object to: {}", src_obj);
|
|
||||||
run_command(&bitcode_path, "zig", &["build", "object", "-Drelease=true"]);
|
|
||||||
|
|
||||||
println!("Compiling 64-bit ir to: {}", dest_ir_64bit);
|
println!("Compiling 64-bit ir to: {}", dest_ir_64bit);
|
||||||
run_command(&bitcode_path, "zig", &["build", "ir", "-Drelease=true"]);
|
run_command(&bitcode_path, "zig", &["build", "ir", "-Drelease=true"]);
|
||||||
|
|
||||||
println!("Compiling 32-bit ir to: {}", dest_ir_32bit);
|
println!("Compiling 32-bit ir to: {}", dest_ir_32bit);
|
||||||
run_command(
|
run_command(
|
||||||
&bitcode_path,
|
&bitcode_path,
|
||||||
"zig",
|
"zig",
|
||||||
&["build", "ir-32bit", "-Drelease=true"],
|
&["build", "ir-32bit", "-Drelease=true"],
|
||||||
);
|
);
|
||||||
}
|
|
||||||
|
|
||||||
println!("Moving zig object to: {}", dest_obj);
|
println!("Moving zig object to: {}", dest_obj);
|
||||||
|
|
||||||
@ -119,25 +108,6 @@ where
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn run_command_with_no_args<P: AsRef<Path>>(path: P, command_str: &str) {
|
|
||||||
let output_result = Command::new(OsStr::new(&command_str))
|
|
||||||
.current_dir(path)
|
|
||||||
.output();
|
|
||||||
match output_result {
|
|
||||||
Ok(output) => match output.status.success() {
|
|
||||||
true => (),
|
|
||||||
false => {
|
|
||||||
let error_str = match str::from_utf8(&output.stderr) {
|
|
||||||
Ok(stderr) => stderr.to_string(),
|
|
||||||
Err(_) => format!("Failed to run \"{}\"", command_str),
|
|
||||||
};
|
|
||||||
panic!("{} failed: {}", command_str, error_str);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
Err(reason) => panic!("{} failed: {}", command_str, reason),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fn get_zig_files(dir: &Path, cb: &dyn Fn(&Path)) -> io::Result<()> {
|
fn get_zig_files(dir: &Path, cb: &dyn Fn(&Path)) -> io::Result<()> {
|
||||||
if dir.is_dir() {
|
if dir.is_dir() {
|
||||||
for entry in fs::read_dir(dir)? {
|
for entry in fs::read_dir(dir)? {
|
||||||
|
Loading…
Reference in New Issue
Block a user