gettext-rs / gettext-rs

GNU Gettext FFI binding for Rust
55 stars 29 forks source link

tar is using non standard flags (patch) #116

Open Zectbumo opened 11 months ago

Zectbumo commented 11 months ago

https://github.com/Koka/gettext-rs/blob/0cce4fbda352d9fa45e9bd115c463171f5c69db6/gettext-sys/build.rs#L186

I'm having trouble installing because there is: no J no --strip-components on OpenBSD 7.4

Would you use xzcat gettext-0.21.tar.xz | tar xf - instead?

I tried to make the changes but I don't know rust and got stuck. sorry. Error: no field `stdout` on type `Result<Child, std::io::Error>`

diff --git a/gettext-sys/build.rs b/gettext-sys/build.rs
index 60c30d0..4a894d7 100644
--- a/gettext-sys/build.rs
+++ b/gettext-sys/build.rs
@@ -6,7 +6,7 @@ use std::ffi::OsString;
 use std::fs;
 use std::io::ErrorKind;
 use std::path::{Path, PathBuf};
-use std::process::Command;
+use std::process::{Command, Stdio};
 use temp_dir::TempDir;

 fn env(name: &str) -> Option<String> {
@@ -181,12 +181,16 @@ fn main() {
         cflags.push("-DLIBXML_STATIC");
     }

-    let mut cmd = Command::new("tar");
-    cmd.current_dir(&build_dir.join("gettext"))
-        .arg("xJf")
+    let mut xzcat = Command::new("xzcat")
+        .current_dir(&build_dir.join("gettext"))
         .arg(&src.join("gettext-0.21.tar.xz"))
-        .arg("--strip-components")
-        .arg("1");
+        .stdout(Stdio::piped())
+        .spawn();
+    let mut cmd = Command::new("tar")
+        .current_dir(&build_dir.join("gettext"))
+        .arg("xf")
+        .arg("-")
+        .stdin(xzcat.stdout);
     if host.contains("windows") {
         // tar confuses local path with a remote resource because of ':'
         cmd.arg("--force-local");
@@ -199,7 +203,7 @@ fn main() {
         .env("LD", &which("ld").unwrap())
         .env("VERBOSE", "1")
         .current_dir(&build_dir.join("build"))
-        .arg(&posix_path(&build_dir.join("gettext").join("configure")));
+        .arg(&posix_path(&build_dir.join("gettext").join("gettext-0.21").join("configure")));

     cmd.arg("--without-emacs");
     cmd.arg("--disable-java");
Minoru commented 4 months ago

Thanks! Windows also has problems with tar, so we'll ship an unpacked tarball instead. I hope to push it out next week.

Zectbumo commented 3 weeks ago

I think this is an easy fix. Can this changed?