Allow to build without manpage

This commit is contained in:
Dennis Schwerdel 2019-02-18 09:56:37 +01:00
parent f3347e0b7a
commit 9cf0079698
2 changed files with 17 additions and 6 deletions

View File

@ -2,6 +2,10 @@
This project follows [semantic versioning](http://semver.org). This project follows [semantic versioning](http://semver.org).
### UNRELEASED
- [changed] Allow to build binary without manpage
### v0.9.1 (2019-02-16) ### v0.9.1 (2019-02-16)
- [fixed] Fixed bug in new hex secret key functionality - [fixed] Fixed bug in new hex secret key functionality

View File

@ -13,13 +13,20 @@ fn main() {
let out_dir = env::var("OUT_DIR").unwrap(); let out_dir = env::var("OUT_DIR").unwrap();
// Compile tun/tap C code // Compile tun/tap C code
println!("rerun-if-changed=src/c/tuntap.c"); println!("cargo:rerun-if-changed=src/c/tuntap.c");
cc::Build::new().file("src/c/tuntap.c").include("src").compile("libtuntap.a"); cc::Build::new().file("src/c/tuntap.c").include("src").compile("libtuntap.a");
// Process manpage using ronn command // Process manpage using ronn command
println!("rerun-if-changed=vpncloud.md"); println!("cargo:rerun-if-changed=vpncloud.md");
fs::copy("vpncloud.md", Path::new(&out_dir).join("vpncloud.1.ronn")).unwrap(); fs::copy("vpncloud.md", Path::new(&out_dir).join("vpncloud.1.ronn")).unwrap();
Command::new("ronn").args(&["-r", "vpncloud.1.ronn"]).current_dir(&Path::new(&out_dir)).status().expect("Failed to process manpage, ronn command missing?"); match Command::new("ronn").args(&["-r", "vpncloud.1.ronn"]).current_dir(&Path::new(&out_dir)).status() {
Ok(_) => {
Command::new("gzip").args(&["vpncloud.1"]).current_dir(&Path::new(&out_dir)).status().unwrap(); Command::new("gzip").args(&["vpncloud.1"]).current_dir(&Path::new(&out_dir)).status().unwrap();
fs::copy(Path::new(&out_dir).join("vpncloud.1.gz"), "target/vpncloud.1.gz").unwrap(); fs::copy(Path::new(&out_dir).join("vpncloud.1.gz"), "target/vpncloud.1.gz").unwrap();
},
Err(err) => {
println!("cargo:warning=Error building manpage: {}", err);
println!("cargo:warning=The manpage will not be build. Do you have 'ronn'?");
}
}
} }