Without this change, all Darwin platforms mangle to the same suffix
salt. That is normally not an issue because build = host should mean a
non-cross build, but it causes issues on Darwin with static builds
because `DEVELOPER_DIR_FOR_BUILD` and `DEVELOPER_DIR` will refer to
different SDKs but mangle to the same `DEVELOPER_DIR` with suffix salt.
The fix is to mangle static builds differently from non-static ones on
Darwin, which allows building for a static Darwin target on a
same-architecture Darwin host. This fix is applied only to Dariwn
because the issue does not appear to affect other platforms.
It is unusual to invoke a wrapped compiler without setting
`DEVELOPER_DIR`, but it can happen when a user adds a compiler to their
installed packages or when a package intentionally invokes the compiler
without an environment (such as the GHC binary packages).
Some compilers may know to check these paths when `SDKROOT` is set, but
it’s not assumed they do. `SDKROOT` is instead derived from the
`DEVELOPER_DIR`, and `NIX_CFLAGS_COMPILE` is set up with the sysroot and
necessary framework and include search paths.
The location of `libSystem.tbd` depends on the SDK, making it
effectively dynamic. It must be located relative to the `SDKROOT`
instead of to `clang.libc`.
- Removes the non-slim build instructions, massively simplifying
everything in the package.
- Removes unecessary patches.
- Inherits functions from lib instead of repeating lib.* everywhere.
Signed-off-by: Fernando Rodrigues <alpha@sigmasquadron.net>
As the builder is generic, more people may be using it, so we should try
to keep this value as close to the upstream source of truth as possible.
Signed-off-by: Fernando Rodrigues <alpha@sigmasquadron.net>
This is some thing introduced in 2017 to work around a problem that
no longer seems to exist. Nothing uses it except its own test, which
these days passes even with the standard `clangStdenv`.
This adds convenience writers for self-contained Nim programs.
Those are compiled into very small binaries.
Test with: `nix build .#pkgs.tests.writers.{bin,simple,wrapping}.nim`