Skip to content

Commit e6095c0

Browse files
author
Marek Suchánek
committed
Generate the man page in the standardized directory
1 parent e50541d commit e6095c0

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

build.rs

+4-1
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,16 @@ mod cmd_line;
1414
use cmd_line::Cli;
1515

1616
fn main() -> std::io::Result<()> {
17+
let out_dir =
18+
std::path::PathBuf::from(std::env::var_os("OUT_DIR").ok_or(std::io::ErrorKind::NotFound)?);
19+
1720
let cmd: clap::Command = Cli::command();
1821

1922
let man = clap_mangen::Man::new(cmd);
2023
let mut buffer: Vec<u8> = Default::default();
2124
man.render(&mut buffer)?;
2225

23-
std::fs::write("newdoc.1", buffer)?;
26+
std::fs::write(out_dir.join("newdoc.1"), buffer)?;
2427

2528
Ok(())
2629
}

newdoc.spec

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ install -m 0755 target/release/%{name} %{buildroot}%{_bindir}/%{name}
4141
# An alternative way to install the binary using cargo.
4242
# cargo install --path . --root %{buildroot}/usr
4343
# Compress the man page
44-
gzip %{name}.1
44+
gzip -c target/release/build/%{name}-*/out/%{name}.1 > %{name}.1.gz
4545
# Install the man page into the chroot environment.
4646
install -m 0644 %{name}.1.gz %{buildroot}%{_mandir}/man1/%{name}.1.gz
4747

0 commit comments

Comments
 (0)