freebsd-ports/graphics/oxipng/files/patch-man
2024-11-30 00:47:38 +01:00

98 lines
2.3 KiB
Text

Revert https://github.com/shssoichiro/oxipng/commit/c81a863e69c8
--- Cargo.lock.orig 1970-01-01 00:00:01 UTC
+++ Cargo.lock
@@ -149,6 +149,16 @@ checksum = "afb84c814227b90d6895e01398aee0d8033c00e746
checksum = "afb84c814227b90d6895e01398aee0d8033c00e7466aca416fb6a8e0eb19d8a7"
[[package]]
+name = "clap_mangen"
+version = "0.2.24"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "fbae9cbfdc5d4fa8711c09bd7b83f644cb48281ac35bf97af3e47b0675864bdf"
+dependencies = [
+ "clap",
+ "roff",
+]
+
+[[package]]
name = "colorchoice"
version = "1.0.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -402,6 +412,7 @@ dependencies = [
dependencies = [
"bitvec",
"clap",
+ "clap_mangen",
"crossbeam-channel",
"env_logger",
"filetime",
@@ -472,6 +483,12 @@ dependencies = [
dependencies = [
"bytemuck",
]
+
+[[package]]
+name = "roff"
+version = "0.2.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "88f8660c1ff60292143c98d08fc6e2f654d722db50410e3f3797d40baaf9d8f3"
[[package]]
name = "rustc-hash"
--- Cargo.toml.orig 1970-01-01 00:00:01 UTC
+++ Cargo.toml
@@ -146,6 +146,10 @@ default-features = false
optional = true
default-features = false
+[build-dependencies]
+clap = "4.5.21"
+clap_mangen = "0.2.24"
+
[features]
binary = [
"dep:clap",
--- build.rs.orig 2024-11-29 23:41:27 UTC
+++ build.rs
@@ -0,0 +1,40 @@
+use std::{
+ env,
+ fs::File,
+ io::{BufWriter, Error},
+ path::Path,
+};
+
+use clap_mangen::Man;
+
+include!("src/cli.rs");
+
+fn build_manpages(outdir: &Path) -> Result<(), Error> {
+ let app = build_command();
+
+ let file = Path::new(&outdir).join("oxipng.1");
+ let mut file = BufWriter::new(File::create(file)?);
+
+ Man::new(app).render(&mut file)?;
+
+ Ok(())
+}
+
+fn main() -> Result<(), Error> {
+ println!("cargo:rerun-if-changed=src/cli.rs");
+ println!("cargo:rerun-if-changed=src/display_chunks.rs");
+
+ // Create `target/<debug|release>/assets/` folder.
+ let outdir = match env::var_os("OUT_DIR") {
+ None => return Ok(()),
+ Some(outdir) => outdir,
+ };
+ let out_path = PathBuf::from(outdir);
+ let mut path = out_path.ancestors().nth(3).unwrap().to_owned();
+ path.push("assets");
+ std::fs::create_dir_all(&path).unwrap();
+
+ build_manpages(&path)?;
+
+ Ok(())
+}