Skip to content

Commit c882ffe

Browse files
committed
osx: Strip signature from copied libraries
When copying a library we use `install_name_tool` to change the shared library search path so that they will find the versions within the .app bundle. However, since this changes the file, it breaks any code signing signature. We must generate a new ad-hoc signature, particularly since recent versions of macOS have turned on more strict checking for code signing signatures.
1 parent 7e4b0e8 commit c882ffe

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

pkg/osx/cp-with-libs

+5-1
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,6 @@ install_with_deps() {
6868
# Copy libraries that this file depends on:
6969

7070
otool -L "$src_file" | tail -n +2 | sed 's/^.//; s/ (.*//' | while read; do
71-
7271
# Don't copy system libraries
7372

7473
if is_sys_lib "$REPLY"; then
@@ -95,6 +94,11 @@ install_with_deps() {
9594
if is_dylib "$dest_file"; then
9695
install_name_tool -id "@executable_path/$bin_name" "$dest_file"
9796
fi
97+
98+
# The install_name_tool calls above break signatures. Recent versions
99+
# of macOS make signatures mandatory, even if just ad-hoc ones.
100+
codesign --remove-signature "$dest_file"
101+
codesign --force -s - "$dest_file" # ad-hoc signature
98102
}
99103

100104
# Install the file, and recursively install any libraries:

0 commit comments

Comments
 (0)