Bug 1584812 - PR_GetLibraryFilePathname is returning absolute paths in MacOS Catalina. r=IanN
authorFrank-Rainer Grahl <frgrahl@gmx.net>
Tue, 01 Oct 2019 16:39:56 +0200
changeset 37038 665db3e150aef5f1b29f1a4b10dce4dbe84ca533
parent 37037 8cb2fc11db8b1bd4796f8e5ae1c623c07e29179b
child 37039 57752d5ccb8168d9e4eae4cf723df07ffbbc8f91
push id395
push userclokep@gmail.com
push dateMon, 02 Dec 2019 19:38:57 +0000
reviewersIanN
bugs1584812, 1562684
Bug 1584812 - PR_GetLibraryFilePathname is returning absolute paths in MacOS Catalina. r=IanN Instead of using symlinks, copy .dylib files to the ${OBJDIR}/dist/Nightly{Debug}.app/Contents/MacOS dir for local builds. Port of Bug 1562684.
suite/app/Makefile.in
suite/app/macbuild/Contents/MacOS-files-copy.in
suite/app/macbuild/Contents/MacOS-files.in
--- a/suite/app/Makefile.in
+++ b/suite/app/Makefile.in
@@ -131,14 +131,17 @@ tools:: $(DIST)/bin/$(MOZ_APP_NAME)
 	mkdir -p '$(dist_dest)/Contents/MacOS'
 	rsync -a --exclude "*.in" $(srcdir)/macbuild/Contents '$(dist_dest)' --exclude English.lproj
 	mkdir -p '$(dist_dest)/$(LPROJ)'
 	rsync -a --exclude "*.in" $(srcdir)/macbuild/Contents/Resources/English.lproj/ '$(dist_dest)/$(LPROJ)'
 	sed -e 's/\@MOZ_APP_NAME\@/$(MOZ_APP_NAME)/' -e 's/\@MAC_APP_NAME\@/$(MAC_APP_NAME)/' -e 's/\@MOZ_APP_DISPLAYNAME\@/$(MOZ_APP_DISPLAYNAME)/' -e 's/\@MOZ_APP_VERSION\@/$(MOZ_APP_VERSION)/' -e 's/\@MOZ_MACBUNDLE_ID\@/$(MOZ_MACBUNDLE_ID)/' -e 's|\@MOZ_DEVELOPER_REPO_PATH\@|$(topsrcdir)|' -e 's|\@MOZ_DEVELOPER_OBJ_PATH\@|$(topobjdir)|' $(srcdir)/macbuild/Contents/Info.plist.in > '$(dist_dest)/Contents/Info.plist'
 	sed  -e "s/\@MAC_APP_NAME\@/$(MAC_APP_NAME)/" $(srcdir)/macbuild/Contents/Resources/English.lproj/InfoPlist.strings.in | iconv -f UTF-8 -t UTF-16 > '$(dist_dest)/$(LPROJ)/InfoPlist.strings'
 	rsync -a --exclude-from='$(srcdir)/macbuild/Contents/MacOS-files.in' $(DIST)/bin/ '$(dist_dest)/Contents/Resources'
 	rsync -a --include-from='$(srcdir)/macbuild/Contents/MacOS-files.in' --exclude '*' $(DIST)/bin/ '$(dist_dest)/Contents/MacOS'
+	# MacOS-files-copy.in is a list of files that should be copies rather
+	# than symlinks and placed in .app/Contents/MacOS.
+	rsync -aL --include-from='$(srcdir)/macbuild/Contents/MacOS-files-copy.in' --exclude '*' $(DIST)/bin/ '$(dist_dest)/Contents/MacOS'
 	rm -f '$(dist_dest)/Contents/MacOS/$(MOZ_APP_NAME)'
 	rsync -aL $(DIST)/bin/$(MOZ_APP_NAME) '$(dist_dest)/Contents/MacOS'
 	cp -RL $(topsrcdir)/$(MOZ_BRANDING_DIRECTORY)/seamonkey.icns '$(dist_dest)/Contents/Resources/seamonkey.icns'
 	cp -RL $(topsrcdir)/$(MOZ_BRANDING_DIRECTORY)/document.icns '$(dist_dest)/Contents/Resources/document.icns'
 	printf APPLMOZZ > '$(dist_dest)/Contents/PkgInfo'
 endif
new file mode 100644
--- /dev/null
+++ b/suite/app/macbuild/Contents/MacOS-files-copy.in
@@ -0,0 +1,11 @@
+# Specifies files that should be copied (via deep copy, resolving symlinks)
+# from dist/bin to the .app/Contents/MacOS directory. Linking is preferred to
+# reduce disk I/O during builds, so just include dylibs which need to be in the
+# same directory as returned by dladddr(3).
+#
+# Some of these dylibs load other dylibs which are assumed to be siblings in
+# the same directory obtained from dladdr(3). With macOS 10.15, dladdr returns
+# absolute resolved paths which breaks this assumption if symlinks are used
+# because the symlink targets are in different directories. Hence the need for
+# them to be copied to the same directory.
+/*.dylib
--- a/suite/app/macbuild/Contents/MacOS-files.in
+++ b/suite/app/macbuild/Contents/MacOS-files.in
@@ -1,9 +1,8 @@
 /*.app/***
-/*.dylib
 /certutil
 /seamonkey-bin
 /pingsender
 /pk12util
 /ssltunnel
 /xpcshell
 /XUL