Archived
2
0
This repository has been archived on 2024-01-01. You can view files and clone it, but cannot push or open issues or pull requests.
coreutils/build.rs

51 lines
1.1 KiB
Rust
Raw Normal View History

2022-12-05 07:43:58 -07:00
// Copyright (c) 2022 silt <silt@tebibyte.media>
// SPDX-License-Identifier: AGPL-3.0-or-later
2022-12-05 07:39:57 -07:00
use std::env;
use std::process::{Command, exit};
fn main() -> Result<(), Box<dyn std::error::Error>> {
let out_dir = env::var("OUT_DIR")?;
let mut handler_nasm_true = Command::new("nasm").args([
"-f", "elf",
"src/asm/true.asm",
"-o", &(out_dir.clone() + "/true.o")
]).spawn()?;
let mut handler_nasm_false = Command::new("nasm").args([
"-f", "elf",
"src/asm/false.asm",
"-o", &(out_dir.clone() + "/false.o")
]).spawn()?;
if !handler_nasm_true.wait_with_output()?.stderr.is_empty() {
exit(1);
}
let mut handler_ld_true = Command::new("ld").args([
"-m", "elf_i386",
"src/asm/true.asm",
"-s",
&(out_dir.clone() + "/true.o"),
"-o", &(out_dir.clone() + "/true"),
]).spawn()?;
if !handler_nasm_false.wait_with_output()?.stderr.is_empty() {
exit(1)
}
let mut handler_ld_false = Command::new("ld").args([
"-m", "elf_i386",
"src/asm/false.asm",
"-s",
&(out_dir.clone() + "/false.o"),
"-o", &(out_dir.clone() + "/false"),
]).spawn()?;
2022-12-05 18:01:32 -07:00
handler_ld_true.wait().unwrap();
handler_ld_false.wait().unwrap();
2022-12-05 07:39:57 -07:00
Ok(())
2022-12-05 07:43:58 -07:00
}