summaryrefslogtreecommitdiff
path: root/ext/ffi/build.rs
diff options
context:
space:
mode:
Diffstat (limited to 'ext/ffi/build.rs')
-rw-r--r--ext/ffi/build.rs70
1 files changed, 0 insertions, 70 deletions
diff --git a/ext/ffi/build.rs b/ext/ffi/build.rs
deleted file mode 100644
index 1debd6b9c..000000000
--- a/ext/ffi/build.rs
+++ /dev/null
@@ -1,70 +0,0 @@
-// Copyright 2018-2022 the Deno authors. All rights reserved. MIT license.
-
-#[cfg(not(target_os = "windows"))]
-fn build_tcc() {
- use std::env;
-
- {
- // TODO(@littledivy): Windows support for fast call.
- // let tcc_path = root
- // .parent()
- // .unwrap()
- // .to_path_buf()
- // .parent()
- // .unwrap()
- // .to_path_buf()
- // .join("third_party")
- // .join("prebuilt")
- // .join("win");
- // println!("cargo:rustc-link-search=native={}", tcc_path.display());
- }
- #[cfg(not(target_os = "windows"))]
- {
- use std::path::PathBuf;
- use std::process::exit;
- use std::process::Command;
-
- let root = PathBuf::from(concat!(env!("CARGO_MANIFEST_DIR")));
- let tcc_src = root.join("tinycc");
- dbg!(&tcc_src);
- let out_dir = PathBuf::from(env::var("OUT_DIR").unwrap());
- let mut configure = Command::new(tcc_src.join("configure"));
- configure.current_dir(&out_dir);
- configure.args(&["--enable-static", "--extra-cflags=-fPIC -O3 -g -static"]);
- let status = configure.status().unwrap();
- if !status.success() {
- eprintln!("Fail to configure: {:?}", status);
- exit(1);
- }
-
- let mut make = Command::new("make");
- make.current_dir(&out_dir).arg(format!(
- "-j{}",
- env::var("NUM_JOBS").unwrap_or_else(|_| String::from("1"))
- ));
- make.args(&["libtcc.a"]);
- let status = make.status().unwrap();
-
- if !status.success() {
- eprintln!("Fail to make: {:?}", status);
- exit(1);
- }
- println!("cargo:rustc-link-search=native={}", out_dir.display());
- println!("cargo:rerun-if-changed={}", tcc_src.display());
- }
-}
-
-#[cfg(target_os = "windows")]
-fn main() {}
-
-#[cfg(not(target_os = "windows"))]
-fn main() {
- use std::env;
-
- if let Ok(tcc_path) = env::var("TCC_PATH") {
- println!("cargo:rustc-link-search=native={}", tcc_path);
- } else {
- build_tcc();
- }
- println!("cargo:rustc-link-lib=static=tcc");
-}