1
0
mirror of https://github.com/dswd/vpncloud.git synced 2025-03-11 03:42:46 +00:00
vpncloud/build.rs

29 lines
1.1 KiB
Rust
Raw Normal View History

2017-07-22 16:49:53 +02:00
// VpnCloud - Peer-to-Peer VPN
2020-05-28 09:03:48 +02:00
// Copyright (C) 2015-2020 Dennis Schwerdel
2017-07-22 16:49:53 +02:00
// This software is licensed under GPL-3 or newer (see LICENSE.md)
2020-01-25 13:54:44 +01:00
use std::{env, fs, path::Path, process::Command};
2015-11-19 16:34:20 +01:00
fn main() {
let out_dir = env::var("OUT_DIR").unwrap();
2020-06-03 17:42:43 +02:00
// Process manpage using asciidoctor command
println!("cargo:rerun-if-changed=vpncloud.adoc");
2020-09-25 00:47:30 +02:00
fs::create_dir_all(&out_dir).unwrap();
2020-06-03 17:42:43 +02:00
fs::copy("vpncloud.adoc", Path::new(&out_dir).join("vpncloud.adoc")).unwrap();
match Command::new("asciidoctor")
.args(&["-b", "manpage", "vpncloud.adoc"])
.current_dir(&Path::new(&out_dir))
.status()
{
2019-02-18 09:56:37 +01:00
Ok(_) => {
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();
2020-01-25 13:54:44 +01:00
}
2019-02-18 09:56:37 +01:00
Err(err) => {
println!("cargo:warning=Error building manpage: {}", err);
2020-06-03 17:42:43 +02:00
println!("cargo:warning=The manpage will not be build. Do you have 'asciidoctor'?");
2019-02-18 09:56:37 +01:00
}
}
2015-11-21 17:06:57 +01:00
}