This repository has been archived by the owner on Feb 17, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 37
/
build.rs
61 lines (54 loc) · 1.67 KB
/
build.rs
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
52
53
54
55
56
57
58
59
60
61
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
extern crate pkg_config;
use std::env;
use std::process::Command;
fn main() {
let target = env::var("TARGET").unwrap();
if !target.contains("android") {
// If the system version of fontconfig is at least 2.11.1, use it.
#[allow(clippy::single_match)]
match pkg_config::Config::new()
.atleast_version("2.11.1")
.find("fontconfig")
{
Ok(lib) => {
println!(
"cargo:incdir={}",
lib.include_paths[0]
.clone()
.into_os_string()
.into_string()
.unwrap()
);
return;
}
#[cfg(feature = "force_system_lib")]
Err(error) => {
panic!("{}", error);
}
#[cfg(not(feature = "force_system_lib"))]
_ => (),
}
}
assert!(Command::new("make")
.env("MAKEFLAGS", env::var("CARGO_MAKEFLAGS").unwrap_or_default())
.args(&["-R", "-f", "makefile.cargo"])
.status()
.unwrap()
.success());
println!(
"cargo:rustc-link-search=native={}",
env::var("OUT_DIR").unwrap()
);
println!("cargo:rustc-link-lib=static=fontconfig");
println!(
"cargo:incdir={}",
env::current_dir()
.unwrap()
.into_os_string()
.into_string()
.unwrap()
);
}