]>
git.proxmox.com Git - cargo.git/blob - build.rs
1 use flate2
::{Compression, GzBuilder}
;
11 let out_path
= Path
::new(&std
::env
::var("OUT_DIR").unwrap()).join("man.tgz");
12 let dst
= fs
::File
::create(out_path
).unwrap();
13 let encoder
= GzBuilder
::new()
15 .write(dst
, Compression
::best());
16 let mut ar
= tar
::Builder
::new(encoder
);
17 ar
.mode(tar
::HeaderMode
::Deterministic
);
19 let mut add_files
= |dir
, extension
| {
20 let mut files
= fs
::read_dir(dir
)
22 .map(|e
| e
.unwrap().path())
26 if path
.extension() != Some(extension
) {
29 println
!("cargo:rerun-if-changed={}", path
.display());
30 ar
.append_path_with_name(&path
, path
.file_name().unwrap())
35 add_files(Path
::new("src/etc/man"), OsStr
::new("1"));
36 add_files(Path
::new("src/doc/man/generated_txt"), OsStr
::new("txt"));
37 let encoder
= ar
.into_inner().unwrap();
38 encoder
.finish().unwrap();