Skip to content

Commit

Permalink
[LW-12086] Remove dots from directory names under Contents/MacOS
Browse files Browse the repository at this point in the history
  • Loading branch information
michalrus committed Jan 10, 2025
1 parent dcd1dfb commit 234dcc0
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions nix/internal/any-darwin.nix
Original file line number Diff line number Diff line change
Expand Up @@ -196,16 +196,19 @@ in rec {
bash "$tmpdir"/bundle-macos.sh "$tmpdir" "$target"
rm "$tmpdir"/bundle-macos.sh
mv "$tmpdir/bundle" "$(dirname "$target")/$(basename "$target")"-lib
# We can’t have dots in directory names, or they’re interpreted as bundles, and code signing fails:
libDirName="$(basename "$target" | tr . -)-lib"
mv "$tmpdir/bundle" "$(dirname "$target")/$libDirName"
rmdir "$tmpdir"
rm "$target"
mv "$(dirname "$target")/$(basename "$target")-lib/$(basename "$target")" "$target"
mv "$(dirname "$target")/$libDirName/$(basename "$target")" "$target"
otool -L "$target" \
| { grep -E '^\s*@loader_path' || true ; } \
| sed -r 's/^\s*//g ; s/ \(.*//g' \
| while IFS= read -r lib ; do
install_name_tool -change "$lib" "$(sed <<<"$lib" -r 's,@loader_path/,@loader_path/'"$(basename "$target")"'-lib/,g')" "$target"
install_name_tool -change "$lib" "$(sed <<<"$lib" -r 's,@loader_path/,@loader_path/'"$libDirName"'/,g')" "$target"
done
'';

Expand Down

0 comments on commit 234dcc0

Please sign in to comment.