Commit Graph
692175 Commits
Author SHA1 Message Date
Randy Eckenrode ca4dd24306 darwin.libiconv: move back to darwin attrset and use mkAppleDerivation 2024-10-10 16:23:05 -04:00
Randy Eckenrode 0335ce09c0 darwin.ICU: convert to upstream build system and use mkAppleDerivation 2024-10-10 16:23:05 -04:00
Randy Eckenrode eed715ac43 darwin.file_cmds: convert to Meson and use mkAppleDerivation 2024-10-10 16:23:05 -04:00
Randy Eckenrode 97454b46d5 darwin.diskdev_cmds: convert to Meson and use mkAppleDerivation 2024-10-10 16:23:05 -04:00
Randy Eckenrode 83807dc4e9 darwin.developer_cmds: convert to Meson and use mkAppleDerivation 2024-10-10 16:23:05 -04:00
Randy Eckenrode b8dbc16f1b darwin.Csu: use mkAppleDerivation 2024-10-10 16:23:05 -04:00
Randy Eckenrode 8574626dbb darwin.copyfile: convert to Meson and use mkAppleDerivation 2024-10-10 16:23:05 -04:00
Randy Eckenrode b878c44404 darwin.bsdmake: add to darwin-aliases.nix
Use portable bmake instead of Apple’s port of BSD Make.
2024-10-10 16:23:04 -04:00
Randy Eckenrode c5c276b6cb darwin.bootstrap_cmds: convert to Meson and use mkAppleDerivation 2024-10-10 16:23:04 -04:00
Randy Eckenrode 94b14746e0 darwin.basic_cmds: convert to Meson and use mkAppleDerivation 2024-10-10 16:23:04 -04:00
Randy Eckenrode 8e7056cc07 darwin.AvailabilityVersions: remove workaround
The patch adding support for `__ENVIRONMENT_OS_VERSION_MIN_REQUIRED__`
to clang has been backported to all versions of clang in nixpkgs (except
for clang 12), allowing this workaround to be dropped.
2024-10-10 16:23:04 -04:00
Randy Eckenrode 129a959fad darwin.AvailabilityVersions: also generate _symbol_aliasing.h 2024-10-10 16:23:04 -04:00
Randy Eckenrode 78076b3c12 darwin.AvailabilityVersions: use mkAppleDerivation 2024-10-10 16:23:04 -04:00
Randy Eckenrode 4624bd7959 darwin.adv_cmds: convert to Meson and use mkAppleDerivation 2024-10-10 16:23:04 -04:00
Randy Eckenrode b7442b9066 darwin.stdenv: provide an SDK when cross-compiling
Static can rely on the standard cross-SDK because it will be a static
SDK when building for static targets.
2024-10-10 16:23:04 -04:00
Randy Eckenrode 9c004ef367 darwin.stdenv: use xarMinimal
Using xarMinimal avoids pulling e2fsprogs and (eventually) macfuse-stubs
into the Darwin stdenv bootstrap.
2024-10-10 16:23:03 -04:00
Randy Eckenrode 76a5ef680e darwin.stdenv: rework for the new SDK
While it would be nice if this could be split, there are too many
changes as part of the cleanup and improvements, including:

- Refactoring all propagated packages into functions that can be used to
  ensure that packages are propagated only at the expected stages;
- Using a sanity-checking merge function to ensure that packages are
  only propagated by one of the above functions;
- Reducing the number of Python builds during the bootstrap to one;
- Removing the extra sysctl stage;
- Using the LLVM bootstrap to build LLVM, clang, libc++, etc;
- Propagating llvmPackages_<version> in the final stdenv, so that
  packages needing that version specifically don’t have to rebuild it;
- Bootstrapping with the new Darwin SDK; and
- Reducing the overall number of paths build during a bootstrap by ~33%.
2024-10-10 16:23:03 -04:00
Randy Eckenrode 1fd1796e65 zlib: build with the bootstrap stdenv on Darwin
Using the bootstrap stdenv avoids an infinite recursion from xcbuild
depending on zlib depending on xcrun from xcbuild, which is propagated
by the non-bootstrap stdenv.
2024-10-10 16:23:03 -04:00
Randy Eckenrode 75bc428cf2 xcbuild: 0.1.2-pre -> 0.1.1-unstable-2019-11-20
xcbuild is archived and will never be updated, so bump it to the last
commit in the repo.
2024-10-10 16:23:03 -04:00
Randy Eckenrode dd569d8913 xcbuild: avoid xcrun invoking itself via /usr/bin stubs
macOS ships with several stubs in `/usr/bin` that invoke `xcrun` to run
the tools from the active SDK. When `/usr/bin` is in `PATH`, this will
cause `xcrun` from xcbuild to invoke itself over and over. Filtering
`/usr/bin` from `xcrun`’s search path prevents this from happening.
2024-10-10 16:23:03 -04:00
Randy Eckenrode fee84be752 xcbuild: suppress xcbuild passthru warning for now 2024-10-10 16:23:03 -04:00
Randy Eckenrode 49834c3000 xcbuild: suppress warning for now
Enabling this by default requires additional clean that will be done
after the Darwin refactor has been merged.
2024-10-10 16:23:03 -04:00
Randy Eckenrode 118a214ac5 xcbuild: warn when someone tries to override sdkVer
xcbuild determines the SDK dynamically, so overriding the `sdkVer` no
longer works. If packages want to change the SDK, they need to add one
of the SDK packages to their inputs.
2024-10-10 16:23:03 -04:00
Randy Eckenrode 15ac657942 xcbuild: refactor to support the new SDKs
Take advantage of the new Darwin SDKs to dynamically determine SDK
information such as path, version, and binaries (via `xcrun --find`).
This is accomplished by relying on the existance of `DEVELOPER_DIR`,
which the SDK will set up in nixpkgs.
2024-10-10 16:23:02 -04:00
Randy Eckenrode f51c62a7f8 xcbuild: format with nixfmt-rfc-style 2024-10-10 16:23:02 -04:00
Randy Eckenrode 45e65c16d2 xcbuild: move to pkgs/by-name 2024-10-10 16:23:02 -04:00
Randy Eckenrode aef4614421 xar: add xarMinimal
xarMinimal allows e2fsprogs to build fuse2fs again on Darwin.
See https://github.com/NixOS/nixpkgs/pull/339412.
2024-10-10 16:23:02 -04:00
Randy Eckenrode bf45402971 ncurses: build with the bootstrap stdenv on Darwin
Using the bootstrap stdenv avoids an infinite recursion from xcbuild
depending on ncurses depending on xcrun from xcbuild, which is
propagated by the non-bootstrap stdenv.
2024-10-10 16:23:02 -04:00
Randy Eckenrode 34ce30c35a llvmPackages.libllvm: disable tests when built in the Darwin bootstrap
When using the LLVM bootstrap to build LLVM and its libraries,
overriding just LLVM to disable tests during the first build doesn’t
seem to work. This stage name should remain stable, so check for it and
disable tests when building in it.
2024-10-10 16:23:02 -04:00
Randy Eckenrode 18211adceb llvmPackages.libcxx: use a bootstrap stdenv on Darwin
Using a bootstrap stdenv is needed to avoid infinite recursions that
occur due to inputs propagated by SDK that depend on libc++.
2024-10-10 16:23:02 -04:00
Randy Eckenrode 3e5acdacdd llvmPackages.compiler-rt: fix cross-compilation on Darwin
When compiler-rt targets Darwin, it is built with `-target`, which
causes clang to try to invoke `ld` without a target prefix (e.g., it
will try to exec `ld` instead of `x86_64-apple-darwin-ld` on a
cross-build to x86_64-darwin). Specifying `--ld-path` overrides that
behavior, allowing it to find the appropriate cross-linker.
2024-10-10 16:23:02 -04:00
Randy Eckenrode e6a4c83d20 llvmPackages.compiler-rt: fix compiler-rt bootstrap on Darwin
The first build of compiler-rt in the LLVM bootstrap is build without
libc++ being available, which causes support for the `-g` flag to be
detected incorrectly on Darwin. Overriding the check by specifying that
it’s usable allows the first build of compiler-rt to succeed.
2024-10-10 16:23:01 -04:00
Randy Eckenrode 2fd9a1abeb llvmPackages.compiler-rt: drop use of xcbuild
compiler-rt supports specifying the SDK path and version, so do that to
avoid needing to include `xcrun` as a native build input, which
simplifies the bootstrap.
2024-10-10 16:23:01 -04:00
Randy Eckenrode 7647c6834a llvmPackages.compiler-rt: avoid propagating the SDK in static builds 2024-10-10 16:23:01 -04:00
Randy Eckenrode 654e19fb83 llvmPackages.compiler-rt: always build sanitizers on Darwin
Also enable TSAN since the SDK has xpc. There’s no reason to disable it.
2024-10-10 16:23:01 -04:00
Randy Eckenrode d3114e05d7 llvmPackages.compiler-rt: align Darwin bootstrap with other platforms
Instead of using overrides in the stdenv bootstrap, Darwin will be
relying on the LLVM bootstrap to build compiler-rt. The only special
handling it needs is to use a stdenv with a bootstrap SDK instead of the
default one (to avoid infinite recursions).
2024-10-10 16:23:01 -04:00
Randy Eckenrode 4dc3227d4c llvmPackages.clang: use the system libunwind on Darwin
While the Darwin stdenv bootstrap sets up its own clang wrappers and
doesn’t provide these wrappers in the final stdenv, it does use them
indirectly via the LLVM bootstrap to build LLVM and its libraries.

Note on using the system libunwind: It is possible to build and use the
LLVM libunwind on Darwin, but using the system by default one ensures
everything is using the same unwinder.
2024-10-10 16:23:01 -04:00
Randy Eckenrode 25c6fe1dc3 llvmPackages.clang: backport __ENVIRONMENT_OS_VERSION_MIN_REQUIRED__
Newer SDKs use this on Darwin. Without it, using the 14.4 and 15.0 SDKs
won’t work with clang 16.
2024-10-10 16:23:01 -04:00
Randy Eckenrode 5a60ff8315 libxml2: build with the bootstrap stdenv on Darwin
Using the bootstrap stdenv avoids an infinite recursion from xcbuild
depending on libxml2 depending on xcrun from xcbuild, which is
propagated by the non-bootstrap stdenv.
2024-10-10 16:23:01 -04:00
Randy Eckenrode 1ebcfd5758 libuv: Use darwin.libutil on Darwin
The Darwin SDK used to provide `libutil.tbd`, but it has been replaced
by `libutil.dylib` in the darwin.libutil package.
2024-10-10 16:23:00 -04:00
Randy Eckenrode f1480a23ec libpng: build with the bootstrap stdenv on Darwin
Using the bootstrap stdenv avoids an infinite recursion from xcbuild
depending on libpng depending on xcrun from xcbuild, which is propagated
by the non-bootstrap stdenv.
2024-10-10 16:23:00 -04:00
Randy Eckenrode a79ed0daec gnutar: make sure libiconv is linked
gnutar’s `configure` detects libiconv but fails to link it on Darwin.
2024-10-10 16:23:00 -04:00
Randy Eckenrode 472d10b75b cmake: do in fact use the Darwin SDK in the setup hook 2024-10-10 16:23:00 -04:00
Randy Eckenrode 54d591b2b4 cmake: undo /var/empty workaround for Darwin SDK paths
With this workaround enabled, CMake looks for SDK headers and libraries
in `${SDKROOT}/var/empty`, which ensures it will not find them.
Disabling the workaround in just this case allows CMake’s SDK support to
work with the SDKs in nixpkgs while still not including other, impure
paths in its search paths.
2024-10-10 16:23:00 -04:00
Randy Eckenrode a556a81f12 atf: build with the bootstrap stdenv on Darwin 2024-10-10 16:23:00 -04:00
Randy Eckenrode 826edbf719 {bintools,cc}-wrapper: fix static builds on Darwin
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.
2024-10-10 16:23:00 -04:00
Randy Eckenrode 51755b0c00 {bintools,cc}-wrapper: use a fallback SDK when DEVELOPER_DIR is not set
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).
2024-10-10 16:22:59 -04:00
Randy Eckenrode 97d75cb619 {bintools,cc}-wrapper: set up Darwin SDK paths
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.
2024-10-10 16:22:59 -04:00
Randy Eckenrode c218ce1e4d darwin: replace framework chooser with stubs 2024-10-10 16:22:59 -04:00
Randy Eckenrode 9ecb69c827 darwin.apple_sdk: drop gen-frameworks.py (replaced by new SDK pattern) 2024-10-10 16:22:59 -04:00