From 7872c3b8c68417ce9b11c891bd51f524845d940a Mon Sep 17 00:00:00 2001 From: Sander Date: Thu, 12 Jun 2025 23:05:21 +0200 Subject: [PATCH] pjsip: fix builds failing to patch executables on macos A lot of non-executable files in the build output are marked as executable, including a header file, which causes `install_name_tool` to fail. We now search `/bin` and `/share/**/samples` specifically and check that the file is a Mach-O binary before patching. --- pkgs/by-name/pj/pjsip/package.nix | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/pkgs/by-name/pj/pjsip/package.nix b/pkgs/by-name/pj/pjsip/package.nix index 53219b38c98e..6cd8d59e8669 100644 --- a/pkgs/by-name/pj/pjsip/package.nix +++ b/pkgs/by-name/pj/pjsip/package.nix @@ -109,9 +109,12 @@ stdenv.mkDerivation (finalAttrs: { done # Rewrite library references for all executables. - find "$out" -executable -type f | while read executable; do - install_name_tool "''${change_args[@]}" "$executable" - done + find "$out" -type f -executable -path "*/bin/*" -o -type f -executable -path "*/share/*/samples/*" \ + | while read executable; do + if isMachO "$executable"; then + install_name_tool "''${change_args[@]}" "$executable" + fi + done ''; # We need the libgcc_s.so.1 loadable (for pthread_cancel to work)