Source reconstructed at patch state 0 of 1 — not the installed (fully patched) source.
1 Debian patch touch this file
| 1 |
use std::path::Path; |
| 2 |
use std::{env, fs}; |
| 3 |
|
| 4 |
fn main() { |
| 5 |
if env::var_os("DISABLED_TS_BUILD").is_some() { |
| 6 |
return; |
| 7 |
} |
| 8 |
let mut config = cc::Build::new(); |
| 9 |
|
| 10 |
let manifest_path = Path::new(env!("CARGO_MANIFEST_DIR")); |
| 11 |
let include_path = manifest_path.join("vendor/include"); |
| 12 |
let src_path = manifest_path.join("vendor/src"); |
| 13 |
for entry in fs::read_dir(&src_path).unwrap() { |
| 14 |
let entry = entry.unwrap(); |
| 15 |
let path = src_path.join(entry.file_name()); |
| 16 |
println!("cargo:rerun-if-changed={}", path.to_str().unwrap()); |
| 17 |
} |
| 18 |
|
| 19 |
config |
| 20 |
.flag_if_supported("-std=c11") |
| 21 |
.flag_if_supported("-fvisibility=hidden") |
| 22 |
.flag_if_supported("-Wshadow") |
| 23 |
.flag_if_supported("-Wno-unused-parameter") |
| 24 |
.flag_if_supported("-Wno-incompatible-pointer-types") |
| 25 |
.include(&src_path) |
| 26 |
.include(&include_path) |
| 27 |
.define("_POSIX_C_SOURCE", "200112L") |
| 28 |
.define("_DEFAULT_SOURCE", None) |
| 29 |
.warnings(false) |
| 30 |
.file(src_path.join("lib.c")) |
| 31 |
.compile("tree-sitter"); |
| 32 |
} |