-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathbuild.rs
67 lines (62 loc) · 2.34 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
62
63
64
65
66
67
use std::{env, process::Command};
fn main() {
Command::new("glib-compile-resources")
.args(&["src/resources/resources.xml", "--sourcedir=src/resources"])
.status()
.unwrap();
let python_installed = Command::new("sh")
.args(&["-c", "command -v python3"])
.status()
.unwrap()
.success();
let pip_installed = Command::new("sh")
.args(&["-c", "command -v pip3"])
.status()
.unwrap()
.success();
let wget_installed = Command::new("sh")
.args(&["-c", "command -v wget"])
.status()
.unwrap()
.success();
if python_installed && pip_installed && wget_installed {
Command::new("pip3")
.args(&["install", "aiohttp", "toml"])
.status()
.unwrap();
Command::new("wget").arg("https://raw.githubusercontent.com/flatpak/flatpak-builder-tools/master/cargo/flatpak-cargo-generator.py").status().unwrap();
Command::new("python3")
.args(&[
"flatpak-cargo-generator.py",
"Cargo.lock",
"-o",
"src/resources/cargo-sources.json",
])
.status()
.unwrap();
Command::new("rm")
.arg("flatpak-cargo-generator.py")
.status()
.unwrap();
}
if Ok("debug".to_owned()) == env::var("PROFILE") {
Command::new("sh")
.args(&["-c", "mkdir -p $HOME/.local/share/glib-2.0/schemas"])
.status()
.unwrap();
Command::new("sh").args(&["-c", "install -D src/resources/com.github.weclaw1.ImageRoll.gschema.xml $HOME/.local/share/glib-2.0/schemas/"]).status().unwrap();
Command::new("sh")
.args(&[
"-c",
"glib-compile-schemas $HOME/.local/share/glib-2.0/schemas/",
])
.status()
.unwrap();
}
println!("cargo:rerun-if-changed=src/resources/resources.xml");
println!("cargo:rerun-if-changed=src/resources/image-roll.ui");
println!("cargo:rerun-if-changed=src/resources/icons/crop-symbolic.svg");
println!("cargo:rerun-if-changed=src/resources/com.github.weclaw1.ImageRoll.svg");
println!("cargo:rerun-if-changed=src/resources/com.github.weclaw1.ImageRoll.gschema.xml");
println!("cargo:rerun-if-changed=Cargo.lock");
}