bootstrap is not autoconf and rejects the --enable-static/
--disable-shared flags injected by the static stdenv adapter;
set dontAddStaticConfigureFlags to avoid them
FindLibArchive doesn't handle static libarchive correctly,
use pkg-config to find correct entry manually and pass via
NIX_LDFLAGS.
kwsys's DynamicLoader test is inimical to -static so
disable BUILD_TESTING in that case.
Co-authored-by: Luna Nova <git@lunnova.dev>
This policy was introduced in CMake 3.0 (June 2014), and removed
entirely in CMake 4.0. As this causes a world-rebuild we'd probably
leave it alone except that I'm already changing the setup hook.
This was introduced in https://github.com/NixOS/nixpkgs/pull/37015,
before the migration of Apple SDK frameworks to be included by default.
More specifically, it breaks anything looking for `Network.framework`
(such as qtbase 6.10) because it will prefer `libnetwork.tbd` over the
framework.
Fixes#455059.
Supersedes #455458.
This regularly broke things – as can be seen from the number
of packages that were opting out of it – while providing only a
dubious and partial benefit to purity that other build systems did
not “enjoy”.
It has become associated with Darwin, but was actually introduced
in 2007 as part of 67d41efde1,
a work‐in‐progress commit for KDE 4 that introduced the CMake
setup hook. It has haunted us ever since, and will presumably become
even better at doing so now that it is a dead ghost.
Of course, it is possible and even likely that more impure paths will
leak into Darwin builds from third‐party CMake modules included
in packages. However, considering it already disregarded many of the
most common macOS system paths, it will be better overall to address
these in a targeted manner than dealing with the effects of this
brute‐force hook. In the long run, a good sandbox is going to be
the solution for reliable build reproducibility on the platform.
These are almost all dead code – some references to `/bin` and
`/sbin` and some Windows paths notwithstanding – and dropping them
entirely makes the patch shorter and more effective.
It is likely that a lot of this patch is still superfluous; we
don’t really care about the purity of unsandboxed builds on Linux,
for instance, so any code path that is never taken on Darwin could
probably be dropped. But this provides a conservative base to drop the
problematic hook without compromise for CMake‐distributed modules. Of
course, the long‐term solution should be proper sandboxing on macOS.
In some cases these may make the statements more accurate to our
patched version, but in practice they just add lines to the diff and
often make it more confusing or outright wrong instead. I don’t
think we even install the documentation, anyway.
This is a huge amount of diff noise for things that aren’t installed
and that we don’t even run. If anyone wants to try getting the tests
running, they can fix reproducibility problems that may be addressed
by these changes in a more targeted manner.
To be honest, I’m not sure exactly how useful the libc one is or
why it doesn’t need to include the C++ library and the like, but
splitting this up helps with the following work.
Used for determining core count and Apple Silicon stuff.
Also drop unnecessary `@ps@` replacements in `#elif` branches that
aren’t taken, and correct a comment about `ps(1)` being in the Linux
`stdenv`, since… it does not appear to be.
They are not doing anything right now. This is in preparation for their
complete removal from the tree.
Note: several changes that affect the derivation inputs (e.g. removal of
references to stub paths in build instructions) were left out. They will
be cleaned up the next iteration and will require special care.
Note: this PR is a result of a mix of ugly regex (not AST) based
automation and some manual labor. For reference, the regex automation
part was hacked in: https://github.com/booxter/nix-clean-apple_sdk
Signed-off-by: Ihar Hrachyshka <ihar.hrachyshka@gmail.com>