Debian Codegraph @

build.rs

raw symbols SCIP
1 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/;
2 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/::PathBufrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/PathBuf#;
3
4 mod buildrust-analyzer cargo dav1d-sys 0.8.3 build/ {
5 use superrust-analyzer cargo dav1d-sys 0.8.3 crate/::*;
6 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#;
7 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#, Stdiorust-analyzer cargo std https://github.com/rust-lang/rust/library/std process/Stdio#};
8
9 const REPOrust-analyzer cargo dav1d-sys 0.8.3 build/REPO.: &str = "https://code.videolan.org/videolan/dav1d.git";
10 const TAGrust-analyzer cargo dav1d-sys 0.8.3 build/TAG.: &str = "1.5.0";
11
12 macro_rules! runnerrust-analyzer cargo dav1d-sys 0.8.3 build/runner! {
13 ($cmd:expr, $($arg:expr),*) => {
14 Command::new($cmd)
15 $(.arg($arg))*
16 .stderr(Stdio::inherit())
17 .stdout(Stdio::inherit())
18 .output()
19 .expect(concat!($cmd, " failed"));
20
21 };
22 }
23
24 pub fn build_from_srcrust-analyzer cargo dav1d-sys 0.8.3 build/build_from_src().(
25 lib: &str,
26 _version: &str,
27 ) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<system_depsrust-analyzer cargo system-deps 7.0.5 crate/::Libraryrust-analyzer cargo system-deps 7.0.5 Library#, system_depsrust-analyzer cargo system-deps 7.0.5 crate/::BuildInternalClosureErrorrust-analyzer cargo system-deps 7.0.5 BuildInternalClosureError#> {
28 let build_dir = "build";
29 let release_dir = "release";
30
31 let source = PathBufrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/PathBuf#::fromrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/impl#[PathBuf][`From<String>`]from().(envrust-analyzer cargo std https://github.com/rust-lang/rust/library/std env/::varrust-analyzer cargo std https://github.com/rust-lang/rust/library/std env/var().("OUT_DIR").unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().()).joinrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/impl#[Path]join().("dav1d");
32 let build_path = source.joinrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/impl#[Path]join().(build_dir);
33 let release_path = source.joinrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/impl#[Path]join().(release_dir);
34
35 if !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().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().(&source.joinrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/impl#[Path]join().(".git")).existsrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/impl#[Path]exists().() {
36 runnerrust-analyzer cargo dav1d-sys 0.8.3 build/runner!!("git", "clone", "--depth", "1", "-b", TAGrust-analyzer cargo dav1d-sys 0.8.3 build/TAG., REPOrust-analyzer cargo dav1d-sys 0.8.3 build/REPO., &source);
37 } else {
38 runnerrust-analyzer cargo dav1d-sys 0.8.3 build/runner!!(
39 "git",
40 "-C",
41 source.to_strrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/impl#[Path]to_str().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().(),
42 "fetch",
43 "--depth",
44 "1",
45 "origin",
46 TAGrust-analyzer cargo dav1d-sys 0.8.3 build/TAG.
47 );
48 runnerrust-analyzer cargo dav1d-sys 0.8.3 build/runner!!(
49 "git",
50 "-C",
51 source.to_strrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/impl#[Path]to_str().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().(),
52 "checkout",
53 "FETCH_HEAD"
54 );
55 }
56
57 runnerrust-analyzer cargo dav1d-sys 0.8.3 build/runner!!(
58 "meson",
59 "setup",
60 "-Ddefault_library=static",
61 "--prefix",
62 release_path.to_strrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/impl#[Path]to_str().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().(),
63 build_path.to_strrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/impl#[Path]to_str().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().(),
64 source.to_strrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/impl#[Path]to_str().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().()
65 );
66 runnerrust-analyzer cargo dav1d-sys 0.8.3 build/runner!!("ninja", "-C", build_path.to_strrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/impl#[Path]to_str().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().());
67 runnerrust-analyzer cargo dav1d-sys 0.8.3 build/runner!!("meson", "install", "-C", build_path.to_strrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/impl#[Path]to_str().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().());
68
69 let pkg_dir = build_path.joinrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/impl#[Path]join().("meson-private");
70 system_depsrust-analyzer cargo system-deps 7.0.5 crate/::Libraryrust-analyzer cargo system-deps 7.0.5 Library#::from_internal_pkg_configrust-analyzer cargo system-deps 7.0.5 impl#[Library]from_internal_pkg_config().(pkg_dir, lib, TAGrust-analyzer cargo dav1d-sys 0.8.3 build/TAG.)
71 }
72 }
73
74 fn mainrust-analyzer cargo dav1d-sys 0.8.3 main().() {
75 if 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/::varrust-analyzer cargo std https://github.com/rust-lang/rust/library/std env/var().("DOCS_RS").is_okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]is_ok().() {
76 return;
77 }
78
79 system_depsrust-analyzer cargo system-deps 7.0.5 crate/::Configrust-analyzer cargo system-deps 7.0.5 Config#::newrust-analyzer cargo system-deps 7.0.5 impl#[Config]new().()
80 .add_build_internalrust-analyzer cargo system-deps 7.0.5 impl#[Config]add_build_internal().("dav1d", buildrust-analyzer cargo dav1d-sys 0.8.3 build/::build_from_srcrust-analyzer cargo dav1d-sys 0.8.3 build/build_from_src().)
81 .proberust-analyzer cargo system-deps 7.0.5 impl#[Config]probe().()
82 .unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().();
83 }