Bug 1584812 - PR_GetLibraryFilePathname is returning absolute paths in MacOS Catalina. r=IanN a=IanN
authorFrank-Rainer Grahl <frgrahl@gmx.net>
Tue, 01 Oct 2019 16:59:20 +0200
changeset 32319 2de29b2f2c3ed933481691812f51df071a78d512
parent 32318 1562bf096151922a86b717c6883c3ab7fa2efee6
child 32320 8643534c597195f0b45b4d94d4ceb695e804eece
push id220
push userfrgrahl@gmx.net
push dateTue, 01 Oct 2019 15:01:16 +0000
treeherdercomm-esr60@e71c6693877f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersIanN, IanN
bugs1584812, 1562684
Bug 1584812 - PR_GetLibraryFilePathname is returning absolute paths in MacOS Catalina. r=IanN a=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
@@ -135,14 +135,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