forked from hermit-os/loader
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.rs
More file actions
27 lines (23 loc) · 692 Bytes
/
build.rs
File metadata and controls
27 lines (23 loc) · 692 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
extern crate target_build_utils;
use std::env;
use std::path::Path;
use std::process::Command;
use target_build_utils::TargetInfo;
fn main() {
let target = TargetInfo::new().expect("Could not get target info");
let out_dir = env::var("OUT_DIR").unwrap();
if target.target_arch() == "x86_64" {
Command::new("nasm")
.args(&["src/arch/x86_64/entry.asm", "-felf64", "-o"])
.arg(&format!("{}/entry.o", out_dir))
.status()
.unwrap();
Command::new("ar")
.args(&["crus", "libentry.a", "entry.o"])
.current_dir(&Path::new(&out_dir))
.status()
.unwrap();
println!("cargo:rustc-link-search=native={}", out_dir);
println!("cargo:rustc-link-lib=static=entry");
}
}