Skip to content

Commit ac40163

Browse files
committed
Apply the same fallback to codesign_allocate
1 parent 162908a commit ac40163

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

haskell/private/cc_wrapper.py.tpl

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -934,13 +934,15 @@ def darwin_rewrite_load_commands(rewrites, output):
934934
# Fall back to /usr/bin/codesign if the `CODESIGN` executable is not available
935935
# (this might happen when using a default cc toolchain from a nix shell on Darwin instead
936936
# of using a nixpkgs_cc_configure'd toolchain).
937+
# Do the same for codesign_allocate.
937938
codesign = CODESIGN if os.access(CODESIGN, os.X_OK) else "/usr/bin/codesign"
939+
codesign_allocate = CODESIGN_ALLOCATE if os.access(CODESIGN_ALLOCATE, os.X_OK) else "/usr/bin/codesign_allocate"
938940
# This is necessary on MacOS Monterey on M1.
939941
# The moving back and forth is necessary because the OS caches the signature.
940942
# See this note from nixpkgs for reference:
941943
# https://github.com/NixOS/nixpkgs/blob/5855ff74f511423e3e2646248598b3ffff229223/pkgs/os-specific/darwin/signing-utils/utils.sh#L1-L6
942944
os.rename(output, f"{output}.resign")
943-
subprocess.check_call([codesign] + ["-f", "-s", "-"] + [f"{output}.resign"], env = {'CODESIGN_ALLOCATE': CODESIGN_ALLOCATE})
945+
subprocess.check_call([codesign] + ["-f", "-s", "-"] + [f"{output}.resign"], env = {'CODESIGN_ALLOCATE': codesign_allocate})
944946
os.rename(f"{output}.resign", output)
945947

946948

0 commit comments

Comments
 (0)