File: build.rs

package info (click to toggle)
rust-rust-apt 0.8.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 620 kB
  • sloc: cpp: 703; makefile: 8
file content (51 lines) | stat: -rw-r--r-- 1,154 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
use std::env;

fn main() {
	let source_files = vec![
		"src/cache.rs",
		"src/progress.rs",
		"src/config.rs",
		"src/util.rs",
		"src/records.rs",
		"src/depcache.rs",
		"src/pkgmanager.rs",
		"src/error.rs",
		"src/acquire.rs",
		"src/iterators/package.rs",
		"src/iterators/version.rs",
		"src/iterators/dependency.rs",
		"src/iterators/provider.rs",
		"src/iterators/files.rs",
	];

	let mut cc_files = vec!["apt-pkg-c/error.cc"];

	cxx_build::bridges(&source_files)
		.files(&cc_files)
		.flag_if_supported("-std=c++17")
		.compile("rust-apt");

	println!("cargo:rustc-link-lib=apt-pkg");
	for file in source_files {
		println!("cargo:rerun-if-changed={file}")
	}

	cc_files.extend_from_slice(&[
		"apt-pkg-c/cache.h",
		"apt-pkg-c/progress.h",
		"apt-pkg-c/configuration.h",
		"apt-pkg-c/util.h",
		"apt-pkg-c/records.h",
		"apt-pkg-c/depcache.h",
		"apt-pkg-c/package.h",
		"apt-pkg-c/pkgmanager.h",
		"apt-pkg-c/error.h",
		"apt-pkg-c/types.h",
		"apt-pkg-c/acquire.h",
	]);

	for file in cc_files {
		println!("cargo:rerun-if-changed={file}")
	}
    println!("dh-cargo:deb-built-using=rust-apt=1={}", env::var("CARGO_MANIFEST_DIR").unwrap());
}