mirror of
https://github.com/roc-lang/roc.git
synced 2025-10-01 07:41:12 +00:00
better zig hosts
This commit is contained in:
parent
d0686582d0
commit
4c16a46001
1 changed files with 9 additions and 2 deletions
|
@ -49,17 +49,24 @@ pub fn rebuild_host(host_input_path: &Path) {
|
||||||
let host_dest = host_input_path.with_file_name("host.o");
|
let host_dest = host_input_path.with_file_name("host.o");
|
||||||
|
|
||||||
let env_path = env::var("PATH").unwrap_or_else(|_| "".to_string());
|
let env_path = env::var("PATH").unwrap_or_else(|_| "".to_string());
|
||||||
|
let env_home = env::var("HOME").unwrap_or_else(|_| "".to_string());
|
||||||
|
|
||||||
if zig_host_src.exists() {
|
if zig_host_src.exists() {
|
||||||
// Compile host.zig
|
// Compile host.zig
|
||||||
|
let emit_bin = format!("-femit-bin={}", host_dest.to_str().unwrap());
|
||||||
let output = Command::new("zig")
|
let output = Command::new("zig")
|
||||||
.env_clear()
|
.env_clear()
|
||||||
.env("PATH", &env_path)
|
.env("PATH", &env_path)
|
||||||
|
.env("HOME", &env_home)
|
||||||
.args(&[
|
.args(&[
|
||||||
|
"build-lib",
|
||||||
|
zig_host_src.to_str().unwrap(),
|
||||||
|
&emit_bin,
|
||||||
|
// include the zig runtime
|
||||||
|
"-fcompiler-rt",
|
||||||
|
// include libc
|
||||||
"--library",
|
"--library",
|
||||||
"c",
|
"c",
|
||||||
"build-obj",
|
|
||||||
zig_host_src.to_str().unwrap(),
|
|
||||||
])
|
])
|
||||||
.output()
|
.output()
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue