summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeremy Andrews <athenian200@outlook.com>2021-11-22 23:52:44 -0600
committerMoonchild <moonchild@palemoon.org>2022-04-06 00:04:36 +0200
commite6c662b5c67830c09df604aff125f7cf5bea3014 (patch)
tree3e9d328ad9d29dbc57ba2e07137e06136dee33c9
parent6abe7e7914006e6477f41c4d3f418ffd9da2c281 (diff)
downloaduxp-e6c662b5c67830c09df604aff125f7cf5bea3014.tar.gz
Issue # 1824 - Restore NSDISTMODE, and have SunOS use it by default.
To make a long story short, there's an old flag called NSDISTMODE that was never added to old-configure so it could be passed down through the build system to all the places it needs to go nowadays if used in your .mozconfig, but which still sort of works when set as an environment variable. If you leave it unset, it uses relative symlinks. However, it has two other modes. One of them is "copy" and the other is "absolute_symlink." Copy simply copies the files into the directory, and absolute_symlink attempts to use absolute symlinks instead of relative ones. I've been wondering for a while now if there was a way to make the shared library files in `dist/bin` that we use `./mach run` against *not* be relative symlinks, and this seems to be that elusive technique. It seems to be a part of the institutional memory that was all but lost shortly after Netscape went under. You mostly see a few references to it in NSS, NSPR, and the Makefiles in the `config` directory. And also there is one reference in a Makefile in the application directory, which seems to explains why application executables themselves usually aren't symlinks: /platform/libs/nspr/src/pr/src/md/unix/Makefile.in#76 /platform/libs/nss/src/coreconf/UNIX.mk#34 /palemoon/app/Makefile.in#30 /platform/config/config.mk#396 My patch essentially revives NSDISTMODE and makes it work as intended again, more or less. Some parts of the work are loosely inspired by this bug that was never finished upstream, showing that Mozilla only rediscovered it earlier this year while trying to disable symlinks in dist/bin for WSL, as far as I can tell. https://bugzilla.mozilla.org/show_bug.cgi?id=1699855
-rw-r--r--old-configure.in19
-rw-r--r--python/mozbuild/mozpack/files.py8
2 files changed, 19 insertions, 8 deletions
diff --git a/old-configure.in b/old-configure.in
index faed99df57..0d617a2236 100644
--- a/old-configure.in
+++ b/old-configure.in
@@ -1063,12 +1063,20 @@ case "$target" in
fi
;;
-i*86-*-solaris*)
- MOZ_FIX_LINK_PATHS="-L${DIST}/bin -R'\$\$ORIGIN':/usr/gcc/7/lib"
- ;;
+*-solaris*)
+dnl Set NSDISTMODE to copy mode on SunOS automatically. The dynamic linker
+dnl uses the real path of a symlink after resolving it, which breaks the
+dnl default mode that relies on relative symlinks being handled a certain way.
+
+ if test -z "$NSDISTMODE"; then
+ NSDISTMODE=copy
+ fi
-x86_64-*-solaris*)
- MOZ_FIX_LINK_PATHS="-L${DIST}/bin -R'\$\$ORIGIN':/usr/gcc/7/lib/amd64"
+ if test "$CPU_ARCH" = "x86"; then
+ MOZ_FIX_LINK_PATHS="-L${DIST}/bin -R'\$\$ORIGIN':/usr/gcc/7/lib"
+ elif test "$CPU_ARCH" = "x86_64"; then
+ MOZ_FIX_LINK_PATHS="-L${DIST}/bin -R'\$\$ORIGIN':/usr/gcc/7/lib/amd64"
+ fi
;;
esac
@@ -4621,6 +4629,7 @@ AC_SUBST(INCREMENTAL_LINKER)
AC_SUBST(MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS)
AC_SUBST(MOZ_FIX_LINK_PATHS)
+AC_SUBST(NSDISTMODE)
AC_SUBST(MOZ_POST_PROGRAM_COMMAND)
AC_SUBST(MOZ_LINKER_EXTRACT)
diff --git a/python/mozbuild/mozpack/files.py b/python/mozbuild/mozpack/files.py
index 64902e195c..6848e5ccc0 100644
--- a/python/mozbuild/mozpack/files.py
+++ b/python/mozbuild/mozpack/files.py
@@ -300,15 +300,17 @@ class AbsoluteSymlinkFile(File):
def copy(self, dest, skip_if_older=True):
assert isinstance(dest, basestring)
+ from buildconfig import substs
# The logic in this function is complicated by the fact that symlinks
- # aren't universally supported. So, where symlinks aren't supported, we
+ # aren't universally supported, and are explicitly disabled when
+ # NSDISTMODE is set to copy. So, where symlinks aren't supported, we
# fall back to file copying. Keep in mind that symlink support is
# per-filesystem, not per-OS.
# Handle the simple case where symlinks are definitely not supported by
- # falling back to file copy.
- if not hasattr(os, 'symlink'):
+ # falling back to file copy.
+ if not hasattr(os, 'symlink') or substs.get('NSDISTMODE') == 'copy':
return File.copy(self, dest, skip_if_older=skip_if_older)
# Always verify the symlink target path exists.