Debian Codegraph @

build.rs

raw symbols SCIP
1 extern crate pkg_configrust-analyzer cargo libudev-sys 0.1.4 pkg_config/;
2
3 use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::envrust-analyzer cargo std https://github.com/rust-lang/rust/library/std env/;
4 use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::fsrust-analyzer cargo std https://github.com/rust-lang/rust/library/std fs/::Filerust-analyzer cargo std https://github.com/rust-lang/rust/library/std fs/File#;
5 use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::pathrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/::Pathrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/Path#;
6 use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::processrust-analyzer cargo std https://github.com/rust-lang/rust/library/std process/::Commandrust-analyzer cargo std https://github.com/rust-lang/rust/library/std process/Command#;
7
8 use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::preluderust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/prelude/::*;
9
10 fn check_funcrust-analyzer cargo libudev-sys 0.1.4 check_func().(function_name: &str) -> bool {
11 let out_dir = envrust-analyzer cargo std https://github.com/rust-lang/rust/library/std env/::var_osrust-analyzer cargo std https://github.com/rust-lang/rust/library/std env/var_os().("OUT_DIR").unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().();
12 let test_file_name = Pathrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/Path#::newrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/impl#[Path]new().(&out_dir).joinrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/impl#[Path]join().(formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!("check_{}.rs", function_name));
13
14 {
15 let mut test_file = Filerust-analyzer cargo std https://github.com/rust-lang/rust/library/std fs/File#::createrust-analyzer cargo std https://github.com/rust-lang/rust/library/std fs/impl#[File]create().(&test_file_name).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().();
16
17 writelnrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/writeln!!(&mut test_file, "extern \"C\" {{").unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().();
18 writelnrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/writeln!!(&mut test_file, " fn {}();", function_name).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().();
19 writelnrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/writeln!!(&mut test_file, "}}").unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().();
20 writelnrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/writeln!!(&mut test_file, "").unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().();
21 writelnrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/writeln!!(&mut test_file, "fn main() {{").unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().();
22 writelnrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/writeln!!(&mut test_file, " unsafe {{").unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().();
23 writelnrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/writeln!!(&mut test_file, " {}();", function_name).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().();
24 writelnrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/writeln!!(&mut test_file, " }}").unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().();
25 writelnrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/writeln!!(&mut test_file, "}}").unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().();
26 }
27
28 let output = Commandrust-analyzer cargo std https://github.com/rust-lang/rust/library/std process/Command#::newrust-analyzer cargo std https://github.com/rust-lang/rust/library/std process/impl#[Command]new().("rustc").
29 argrust-analyzer cargo std https://github.com/rust-lang/rust/library/std process/impl#[Command]arg().(&test_file_name).
30 argrust-analyzer cargo std https://github.com/rust-lang/rust/library/std process/impl#[Command]arg().("--out-dir").argrust-analyzer cargo std https://github.com/rust-lang/rust/library/std process/impl#[Command]arg().(&out_dir).
31 argrust-analyzer cargo std https://github.com/rust-lang/rust/library/std process/impl#[Command]arg().("-l").argrust-analyzer cargo std https://github.com/rust-lang/rust/library/std process/impl#[Command]arg().("udev").
32 outputrust-analyzer cargo std https://github.com/rust-lang/rust/library/std process/impl#[Command]output().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().();
33
34 output.statusrust-analyzer cargo std https://github.com/rust-lang/rust/library/std process/Output#status..successrust-analyzer cargo std https://github.com/rust-lang/rust/library/std process/impl#[ExitStatus]success().()
35 }
36
37 fn mainrust-analyzer cargo libudev-sys 0.1.4 main().() {
38 pkg_configrust-analyzer cargo pkg-config 0.3.34 crate/::find_libraryrust-analyzer cargo pkg-config 0.3.34 find_library().("libudev").unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().();
39
40 if check_funcrust-analyzer cargo libudev-sys 0.1.4 check_func().("udev_hwdb_new") {
41 printlnrust-analyzer cargo std https://github.com/rust-lang/rust/library/std macros/println!!("cargo:rustc-cfg=hwdb");
42 printlnrust-analyzer cargo std https://github.com/rust-lang/rust/library/std macros/println!!("cargo:hwdb=true");
43 }
44 else {
45 printlnrust-analyzer cargo std https://github.com/rust-lang/rust/library/std macros/println!!("cargo:hwdb=false");
46 }
47 }