Skip to content

Commit 234dcc0

Browse files
committed
[LW-12086] Remove dots from directory names under Contents/MacOS
1 parent dcd1dfb commit 234dcc0

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

nix/internal/any-darwin.nix

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -196,16 +196,19 @@ in rec {
196196
bash "$tmpdir"/bundle-macos.sh "$tmpdir" "$target"
197197
rm "$tmpdir"/bundle-macos.sh
198198
199-
mv "$tmpdir/bundle" "$(dirname "$target")/$(basename "$target")"-lib
199+
# We can’t have dots in directory names, or they’re interpreted as bundles, and code signing fails:
200+
libDirName="$(basename "$target" | tr . -)-lib"
201+
202+
mv "$tmpdir/bundle" "$(dirname "$target")/$libDirName"
200203
rmdir "$tmpdir"
201204
rm "$target"
202-
mv "$(dirname "$target")/$(basename "$target")-lib/$(basename "$target")" "$target"
205+
mv "$(dirname "$target")/$libDirName/$(basename "$target")" "$target"
203206
204207
otool -L "$target" \
205208
| { grep -E '^\s*@loader_path' || true ; } \
206209
| sed -r 's/^\s*//g ; s/ \(.*//g' \
207210
| while IFS= read -r lib ; do
208-
install_name_tool -change "$lib" "$(sed <<<"$lib" -r 's,@loader_path/,@loader_path/'"$(basename "$target")"'-lib/,g')" "$target"
211+
install_name_tool -change "$lib" "$(sed <<<"$lib" -r 's,@loader_path/,@loader_path/'"$libDirName"'/,g')" "$target"
209212
done
210213
'';
211214

0 commit comments

Comments
 (0)