]> git.cameronkatri.com Git - apple_cmds.git/commitdiff
file_cmds: install: Patch strip() to use STRIPBIN env var instead of xcrun
authorCameron Katri <me@cameronkatri.com>
Thu, 13 May 2021 18:20:43 +0000 (14:20 -0400)
committerCameron Katri <me@cameronkatri.com>
Thu, 13 May 2021 18:20:43 +0000 (14:20 -0400)
file_cmds/install/xinstall.c

index 5e6bcecc09a8337fdc9ee5c0df4b81af3d9709db..49934aab74f987474f8116286c6090e801c64ce2 100644 (file)
@@ -721,21 +721,29 @@ void
 strip(to_name)
        char *to_name;
 {
+       const char *stripbin;
+       const char *args[3];
        pid_t pid;
        int error;
        extern char** environ;
-       char *const argv[] = { "xcrun", "strip", "-", to_name, NULL };
+
+       stripbin = getenv("STRIPBIN");
+       if (stripbin == NULL)
+               stripbin = "strip";
+       args[0] = stripbin;
+       args[1] = to_name;
+       args[2] = NULL;
        
-       if (0 == (error = posix_spawnp(&pid, "xcrun", NULL, NULL, argv, environ))) {
+       if (0 == (error = posix_spawnp(&pid, stripbin, NULL, NULL, (char**)args, environ))) {
                int status = 0;
                pid_t child = waitpid(pid, &status, 0);
                if ((child == -1) || status) {
                        unlink(to_name);
-                       errx(EX_SOFTWARE, "child process failed: xcrun strip - %s", to_name);
+                       errx(EX_SOFTWARE, "child process failed: %p", args);
                }
        } else {
                errno = error;
-               err(EX_OSERR, "xcrun strip - %s", to_name);
+               err(EX_OSERR, "%p", args);
        }
 }