diff options
author | Jeremy Andrews <athenian200@outlook.com> | 2021-11-22 23:52:44 -0600 |
---|---|---|
committer | Jeremy Andrews <athenian200@outlook.com> | 2021-11-22 23:52:44 -0600 |
commit | aad9e8efc5de44949725d37f44ec2d125f33211a (patch) | |
tree | 5a363c6710fc0b3aa7290af76f87aec40529c8da /python | |
parent | baad25e39733dfc3dd310198fdcced00ffbef68b (diff) | |
download | aura-central-aad9e8efc5de44949725d37f44ec2d125f33211a.tar.gz |
Issue %3041 - 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:
http://xref.palemoon.org/goanna-central/source/platform/libs/nspr/src/pr/src/md/unix/Makefile.in%76
http://xref.palemoon.org/goanna-central/source/platform/libs/nss/src/coreconf/UNIX.mk%34
http://xref.palemoon.org/goanna-central/source/palemoon/app/Makefile.in%30
http://xref.palemoon.org/goanna-central/source/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
Diffstat (limited to 'python')
-rw-r--r-- | python/mozbuild/mozpack/files.py | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/python/mozbuild/mozpack/files.py b/python/mozbuild/mozpack/files.py index 64902e195..6848e5ccc 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. |