From 22369efb1ca9f2df5d56097588cfc12a2d2f715f Mon Sep 17 00:00:00 2001 From: Randy Eckenrode Date: Sat, 10 Aug 2024 23:12:20 -0400 Subject: [PATCH 001/157] maintainers/team-list.nix: add reckenrode to darwin --- maintainers/team-list.nix | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/maintainers/team-list.nix b/maintainers/team-list.nix index 546c944e0c53f..5f095fdbce996 100644 --- a/maintainers/team-list.nix +++ b/maintainers/team-list.nix @@ -194,7 +194,10 @@ with lib.maintainers; }; darwin = { - members = [ toonn ]; + members = [ + reckenrode + toonn + ]; githubTeams = [ "darwin-maintainers" ]; scope = "Maintain Darwin compatibility of packages and Darwin-only packages."; shortName = "Darwin"; From 08ad88285dd5f058d8ddc606150f753be7f9f493 Mon Sep 17 00:00:00 2001 From: Randy Eckenrode Date: Wed, 21 Aug 2024 07:50:34 -0400 Subject: [PATCH 002/157] darwin: add bootstrapStdenv Packages propagated by the SDK need to use a stdenv that does not propagate anything. Otherwise, an infinite recursion will result when building those packages. For consistency, all source releases should use the bootstrapStdenv. --- pkgs/top-level/darwin-packages.nix | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/pkgs/top-level/darwin-packages.nix b/pkgs/top-level/darwin-packages.nix index f0bdad863e901..30d5ef83061a7 100644 --- a/pkgs/top-level/darwin-packages.nix +++ b/pkgs/top-level/darwin-packages.nix @@ -20,6 +20,18 @@ let }; aliases = self: super: lib.optionalAttrs config.allowAliases (import ../top-level/darwin-aliases.nix lib self super pkgs); + + mkBootstrapStdenv = + stdenv: + stdenv.override (old: { + extraBuildInputs = map ( + pkg: + if lib.isDerivation pkg && lib.getName pkg == "apple-sdk" then + pkg.override { enableBootstrap = true; } + else + pkg + ) (old.extraBuildInputs or [ ]); + }); in makeScopeWithSplicing' { @@ -133,6 +145,9 @@ impure-cmds // appleSourcePackages // chooseLibs // { bintools = self.binutils-unwrapped; }; + # Removes propagated packages from the stdenv, so those packages can be built without depending upon themselves. + bootstrapStdenv = mkBootstrapStdenv pkgs.stdenv; + # TODO(@connorbaker): See https://github.com/NixOS/nixpkgs/issues/229389. cf-private = self.apple_sdk.frameworks.CoreFoundation; From 40d415f4df5548679dcb47331c83a2d4e7741ae8 Mon Sep 17 00:00:00 2001 From: Randy Eckenrode Date: Sun, 22 Sep 2024 23:20:16 -0400 Subject: [PATCH 003/157] darwin: add darwinMinVersionHook Adding the hook allows the deployment target to be changed without having to mess with the stdenv. The can also be propagated, which is useful for libraries that have a minimum deployment target higher than the default in nixpkgs. In that case, they can propagate the hook to ensure library users are not targeting an unsupported version. --- .../darwin-min-version-hook/setup-hook.sh | 26 +++++++++++++++++++ pkgs/top-level/all-packages.nix | 12 +++++++++ 2 files changed, 38 insertions(+) create mode 100644 pkgs/os-specific/darwin/darwin-min-version-hook/setup-hook.sh diff --git a/pkgs/os-specific/darwin/darwin-min-version-hook/setup-hook.sh b/pkgs/os-specific/darwin/darwin-min-version-hook/setup-hook.sh new file mode 100644 index 0000000000000..17a42eb02ef4c --- /dev/null +++ b/pkgs/os-specific/darwin/darwin-min-version-hook/setup-hook.sh @@ -0,0 +1,26 @@ +local role_post +getHostRole + +# Compare the requested deployment target to the existing one. The deployment target has to be a version number, +# and this hook tries to do the right thing with deployment targets set outside of it, so it has to parse +# the version numbers for the comparison manually. + +local darwinMinVersion=@deploymentTarget@ +local darwinMinVersionVar=@darwinMinVersionVariable@${role_post} + +local currentDeploymentTargetArr +IFS=. read -a currentDeploymentTargetArr <<< "${!darwinMinVersionVar-0.0.0}" + +local darwinMinVersionArr +IFS=. read -a darwinMinVersionArr <<< "$darwinMinVersion" + +local currentDeploymentTarget +currentDeploymentTarget=$(printf "%02d%02d%02d" "${currentDeploymentTargetArr[0]-0}" "${currentDeploymentTargetArr[1]-0}" "${currentDeploymentTargetArr[2]-0}") + +darwinMinVersion=$(printf "%02d%02d%02d" "${darwinMinVersionArr[0]-0}" "${darwinMinVersionArr[1]-0}" "${darwinMinVersionArr[2]-0}") + +if [ "$darwinMinVersion" -gt "$currentDeploymentTarget" ]; then + export "$darwinMinVersionVar"=@deploymentTarget@ +fi + +unset -v role_post currentDeploymentTarget currentDeploymentTargetArr darwinMinVersion darwinMinVersionArr darwinMinVersionVar diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index b6744b93ea24d..fd4ca3df70c78 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -23740,6 +23740,18 @@ with pkgs; plumed = callPackage ../development/libraries/science/chemistry/plumed { }; + ### DEVELOPMENT / LIBRARIES / DARWIN SDKS + + darwinMinVersionHook = + deploymentTarget: + makeSetupHook { + name = "darwin-deployment-target-hook-${deploymentTarget}"; + substitutions = { + darwinMinVersionVariable = lib.escapeShellArg stdenv.hostPlatform.darwinMinVersionVariable; + deploymentTarget = lib.escapeShellArg deploymentTarget; + }; + } ../os-specific/darwin/darwin-min-version-hook/setup-hook.sh; + ### DEVELOPMENT / LIBRARIES / AGDA agdaPackages = callPackage ./agda-packages.nix { From 5721c4fa47f6aa99c039bbceab40392d5110794e Mon Sep 17 00:00:00 2001 From: Randy Eckenrode Date: Mon, 30 Sep 2024 09:12:53 -0400 Subject: [PATCH 004/157] darwin: add libSystem The new Darwin SDK pattern relies on an effectively empty, stub libc implementation. The actual libSystem to be linked is located dynamically based on the active SDK for the target. Independent build, host, and target SDKs are all supported by Darwin. The stub libSystem contains empty `include` and `lib` folders to avoid warnings from wrappers that add those paths unconditionally, which can turn into errors when a package is building with warnings-as-errors. While it would be nice if a fallback libc could be provided, SDK headers are not compatible between framework versions. Providing a fallback risks mixing headers from different frameworks, which can result in hard to diagnose errors involving semicolons or other punctuation. --- pkgs/os-specific/darwin/libSystem/default.nix | 13 +++++++++++++ pkgs/top-level/darwin-packages.nix | 2 ++ 2 files changed, 15 insertions(+) create mode 100644 pkgs/os-specific/darwin/libSystem/default.nix diff --git a/pkgs/os-specific/darwin/libSystem/default.nix b/pkgs/os-specific/darwin/libSystem/default.nix new file mode 100644 index 0000000000000..1dea8e846fdf0 --- /dev/null +++ b/pkgs/os-specific/darwin/libSystem/default.nix @@ -0,0 +1,13 @@ +{ stdenvNoCC }: + +# Darwin dynamically determines the `libSystem` to use based on the SDK found at `DEVELOPER_DIR`. +# By default, this will be `apple-sdk` or one of the versioned variants. +stdenvNoCC.mkDerivation { + pname = "libSystem"; + version = "B"; + + # Silence linker warnings due a missing `lib` (which is added by cc-wrapper). + buildCommand = '' + mkdir -p "$out/include" "$out/lib" + ''; +} diff --git a/pkgs/top-level/darwin-packages.nix b/pkgs/top-level/darwin-packages.nix index 30d5ef83061a7..0d3cf4033efa5 100644 --- a/pkgs/top-level/darwin-packages.nix +++ b/pkgs/top-level/darwin-packages.nix @@ -148,6 +148,8 @@ impure-cmds // appleSourcePackages // chooseLibs // { # Removes propagated packages from the stdenv, so those packages can be built without depending upon themselves. bootstrapStdenv = mkBootstrapStdenv pkgs.stdenv; + libSystem = callPackage ../os-specific/darwin/libSystem { }; + # TODO(@connorbaker): See https://github.com/NixOS/nixpkgs/issues/229389. cf-private = self.apple_sdk.frameworks.CoreFoundation; From 121149836ef2c33bb62abd323eb95780ac7d59a2 Mon Sep 17 00:00:00 2001 From: Randy Eckenrode Date: Mon, 2 Sep 2024 19:27:03 -0400 Subject: [PATCH 005/157] darwin: add xcodeProjectCheckHook This hook is used by source releases that build with Meson to assert that the Xcode project has not changed since the previous release. This is meant to be a check to force those updating source release packages to make sure they have incorporated any changes that were made to the Xcode project into the Meson build. --- .../xcode-project-check-hook/setup-hook.sh | 55 +++++++++++++++++++ pkgs/top-level/darwin-packages.nix | 5 ++ 2 files changed, 60 insertions(+) create mode 100644 pkgs/os-specific/darwin/xcode-project-check-hook/setup-hook.sh diff --git a/pkgs/os-specific/darwin/xcode-project-check-hook/setup-hook.sh b/pkgs/os-specific/darwin/xcode-project-check-hook/setup-hook.sh new file mode 100644 index 0000000000000..a39c50adbeae1 --- /dev/null +++ b/pkgs/os-specific/darwin/xcode-project-check-hook/setup-hook.sh @@ -0,0 +1,55 @@ +# Verify that the Xcode project has not changed unexpectedly. This is only useful for source releases that are +# being built with other build systems (e.g., Meson) instead of xcbuild. + +verifyXcodeProjectHash() { + printHashInstructions() { + echo '1. Set xcodeHash to an empty string: `xcodeHash = "";`' + echo '2. Build the derivation and wait for it to fail with a hash mismatch' + echo '3. Copy the "got: sha256-..." value back into the xcodeHash field' + echo ' You should have: xcodeHash = "sha256-XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX=";' + } + + if [ -z "${xcodeHash-}" ]; then + echo "error: xcodeHash missing" + echo + echo "To fix the issue:" + printHashInstructions + exit 1 + fi + + if [ -z "${xcodeProject-}" ]; then + echo "error: xcodeProject missing" + echo + echo "To fix the issue: Set xcodeProject to the name of the project" + exit 1 + fi + + local xcodeHashArr + readarray -t -d - xcodeHashArr < <(printf "$xcodeHash") + + local hashType=${xcodeHashArr[0]} + local expectedHash=${xcodeHashArr[1]} + + if [ -z "$hashType" ] || [ -z "$expectedHash" ]; then + echo "error: xcodeHash is in invalid format" + echo + echo "To fix the issue:" + printHashInstructions + exit 1 + fi + + local hash + hash=$(openssl "$hashType" -binary "$sourceRoot/$xcodeProject/project.pbxproj" | base64) + + if [ "$hash" != "$expectedHash" ]; then + echo "error: hash mismatch in $xcodeProject/project.pbxproj" + echo " specified: $xcodeHash" + echo " got: $hashType-$hash" + echo + echo 'Upstream Xcode project has changed. Update `meson.build` with any changes, then update `xcodeHash`.' + printHashInstructions + exit 1 + fi +} + +postUnpackHooks+=(verifyXcodeProjectHash) diff --git a/pkgs/top-level/darwin-packages.nix b/pkgs/top-level/darwin-packages.nix index 0d3cf4033efa5..c47cc3e565e79 100644 --- a/pkgs/top-level/darwin-packages.nix +++ b/pkgs/top-level/darwin-packages.nix @@ -242,6 +242,11 @@ impure-cmds // appleSourcePackages // chooseLibs // { setupHook = null; }); + xcodeProjectCheckHook = pkgs.makeSetupHook { + name = "xcode-project-check-hook"; + propagatedBuildInputs = [ pkgs.pkgsBuildHost.openssl ]; + } ../os-specific/darwin/xcode-project-check-hook/setup-hook.sh; + # Formerly the CF attribute. Use this is you need the open source release. swift-corelibs-foundation = callPackage ../os-specific/darwin/swift-corelibs/corefoundation.nix { }; From 8f8e240965a71cea585b60a7f09281737d6849cf Mon Sep 17 00:00:00 2001 From: Randy Eckenrode Date: Mon, 2 Sep 2024 19:27:03 -0400 Subject: [PATCH 006/157] darwin.apple-source-releases: add mkAppleDerivation This is a replacement for the family of `appleDerivation` functions currently used. It is patterned after the `mkDerivation` used in the BSD package sets. It also provides additional support for using Meson to build source releases. --- .../darwin/apple-source-releases/default.nix | 15 +++- .../developer-tools-11.3.1.nix | 2 +- .../apple-source-releases/macos-11.0.1.nix | 2 +- .../mkAppleDerivation.nix | 89 +++++++++++++++++++ .../apple-source-releases/versions.json | 2 + 5 files changed, 105 insertions(+), 5 deletions(-) create mode 100644 pkgs/os-specific/darwin/apple-source-releases/mkAppleDerivation.nix create mode 100644 pkgs/os-specific/darwin/apple-source-releases/versions.json diff --git a/pkgs/os-specific/darwin/apple-source-releases/default.nix b/pkgs/os-specific/darwin/apple-source-releases/default.nix index 491f2b6675d5a..bb85028f14237 100644 --- a/pkgs/os-specific/darwin/apple-source-releases/default.nix +++ b/pkgs/os-specific/darwin/apple-source-releases/default.nix @@ -228,15 +228,18 @@ in self: let - macosPackages_11_0_1 = import ./macos-11.0.1.nix { inherit applePackage'; }; - developerToolsPackages_11_3_1 = import ./developer-tools-11.3.1.nix { inherit applePackage'; }; + macosPackages_11_0_1 = import ./macos-11.0.1.nix { inherit applePackage' callPackage; }; + developerToolsPackages_11_3_1 = import ./developer-tools-11.3.1.nix { inherit applePackage' callPackage; }; applePackage' = namePath: version: sdkName: sha256: let pname = builtins.head (lib.splitString "/" namePath); appleDerivation' = stdenv: appleDerivation'' stdenv pname version sdkName sha256; appleDerivation = appleDerivation' stdenv; - callPackage = self.newScope { inherit appleDerivation' appleDerivation; python3 = pkgs.buildPackages.python3Minimal; }; + callPackage = self.newScope { + inherit appleDerivation' appleDerivation mkAppleDerivation; + python3 = pkgs.buildPackages.python3Minimal; + }; in callPackage (./. + "/${namePath}"); applePackage = namePath: sdkName: sha256: let @@ -244,6 +247,12 @@ let version = versions.${sdkName}.${pname}; in applePackage' namePath version sdkName sha256; + callPackage = self.newScope { inherit mkAppleDerivation; }; + + mkAppleDerivation = pkgs.callPackage ./mkAppleDerivation.nix { + inherit (pkgs.darwin) bootstrapStdenv xcodeProjectCheckHook; + }; + # Only used for bootstrapping. It’s convenient because it was the last version to come with a real makefile. adv_cmds-boot = applePackage "adv_cmds/boot.nix" "osx-10.5.8" "sha256-/OJLNpATyS31W5nWfJgSVO5itp8j55TRwG57/QLT5Fg=" {}; diff --git a/pkgs/os-specific/darwin/apple-source-releases/developer-tools-11.3.1.nix b/pkgs/os-specific/darwin/apple-source-releases/developer-tools-11.3.1.nix index 7eeafec346551..88e91ae1250da 100644 --- a/pkgs/os-specific/darwin/apple-source-releases/developer-tools-11.3.1.nix +++ b/pkgs/os-specific/darwin/apple-source-releases/developer-tools-11.3.1.nix @@ -1,6 +1,6 @@ # Generated using: ./generate-sdk-packages.sh developer-tools 11.3.1 -{ applePackage' }: +{ applePackage', callPackage }: { bootstrap_cmds = applePackage' "bootstrap_cmds" "116" "developer-tools-11.3.1" "06nw99ajkd264vdi6n2zv252ppxp3wx3120hqf3jqdh6c1wavy0b" {}; diff --git a/pkgs/os-specific/darwin/apple-source-releases/macos-11.0.1.nix b/pkgs/os-specific/darwin/apple-source-releases/macos-11.0.1.nix index 2de90a0236761..4b82b4410fa78 100644 --- a/pkgs/os-specific/darwin/apple-source-releases/macos-11.0.1.nix +++ b/pkgs/os-specific/darwin/apple-source-releases/macos-11.0.1.nix @@ -1,6 +1,6 @@ # Generated using: ./generate-sdk-packages.sh macos 11.0.1 -{ applePackage' }: +{ applePackage', callPackage }: { CommonCrypto = applePackage' "CommonCrypto" "60178.40.2" "macos-11.0.1" "129gsxhhcxqycg0zjrdrz2ay4dv2ih1ckafqh33qrc499z8dam2p" {}; diff --git a/pkgs/os-specific/darwin/apple-source-releases/mkAppleDerivation.nix b/pkgs/os-specific/darwin/apple-source-releases/mkAppleDerivation.nix new file mode 100644 index 0000000000000..a200a11799b37 --- /dev/null +++ b/pkgs/os-specific/darwin/apple-source-releases/mkAppleDerivation.nix @@ -0,0 +1,89 @@ +let + versions = builtins.fromJSON (builtins.readFile ./versions.json); +in + +{ + lib, + bootstrapStdenv, + fetchFromGitHub, + meson, + ninja, + stdenv, + stdenvNoCC, + xcodeProjectCheckHook, +}: + +let + hasBasenamePrefix = prefix: file: lib.hasPrefix prefix (baseNameOf file); +in +lib.makeOverridable ( + attrs: + let + attrs' = if lib.isFunction attrs then attrs else _: attrs; + attrsFixed = lib.fix attrs'; + stdenv' = + if attrsFixed.noCC or false then + stdenvNoCC + else if attrsFixed.noBootstrap or false then + stdenv + else + bootstrapStdenv; + in + stdenv'.mkDerivation ( + lib.extends ( + self: super: + assert super ? releaseName; + let + inherit (super) releaseName; + info = versions.${releaseName}; + files = lib.filesystem.listFilesRecursive (lib.path.append ./. releaseName); + mesonFiles = lib.filter (hasBasenamePrefix "meson") files; + in + # You have to have at least `meson.build.in` when using xcodeHash to trigger the Meson + # build support in `mkAppleDerivation`. + assert super ? xcodeHash -> lib.length mesonFiles > 0; + { + pname = super.pname or releaseName; + inherit (info) version; + + src = super.src or fetchFromGitHub { + owner = "apple-oss-distributions"; + repo = releaseName; + rev = info.rev or "${releaseName}-${info.version}"; + inherit (info) hash; + }; + + strictDeps = true; + __structuredAttrs = true; + + meta = { + homepage = "https://opensource.apple.com/releases/"; + license = lib.licenses.apple-psl20; + maintainers = lib.teams.darwin.members; + platforms = lib.platforms.darwin; + } // super.meta or { }; + } + // lib.optionalAttrs (super ? xcodeHash) { + postUnpack = + super.postUnpack or "" + + lib.concatMapStrings ( + file: + if baseNameOf file == "meson.build.in" then + "substitute ${lib.escapeShellArg "${file}"} \"$sourceRoot/meson.build\" --subst-var version\n" + else + "cp ${lib.escapeShellArg "${file}"} \"$sourceRoot/\"${lib.escapeShellArg (baseNameOf file)}\n" + ) mesonFiles; + + xcodeProject = super.xcodeProject or "${releaseName}.xcodeproj"; + + nativeBuildInputs = super.nativeBuildInputs or [ ] ++ [ + meson + ninja + xcodeProjectCheckHook + ]; + + mesonBuildType = "release"; + } + ) attrs' + ) +) diff --git a/pkgs/os-specific/darwin/apple-source-releases/versions.json b/pkgs/os-specific/darwin/apple-source-releases/versions.json new file mode 100644 index 0000000000000..2c63c0851048d --- /dev/null +++ b/pkgs/os-specific/darwin/apple-source-releases/versions.json @@ -0,0 +1,2 @@ +{ +} From 6a54c7f6c92da33bbf330624313551f4a8b3c503 Mon Sep 17 00:00:00 2001 From: Randy Eckenrode Date: Sun, 22 Sep 2024 18:16:01 -0400 Subject: [PATCH 007/157] darwin.apple-source-releases: add update-source-releases.sh Add a new update script that locks the source releases to the indicated macOS version per the version pins in following repo: https://github.com/apple-oss-distributions/distribution-macOS --- .../update-source-releases.sh | 79 +++++++++++++++++++ 1 file changed, 79 insertions(+) create mode 100755 pkgs/os-specific/darwin/apple-source-releases/update-source-releases.sh diff --git a/pkgs/os-specific/darwin/apple-source-releases/update-source-releases.sh b/pkgs/os-specific/darwin/apple-source-releases/update-source-releases.sh new file mode 100755 index 0000000000000..36d82700a4c9f --- /dev/null +++ b/pkgs/os-specific/darwin/apple-source-releases/update-source-releases.sh @@ -0,0 +1,79 @@ +#!/usr/bin/env nix-shell +#!nix-shell -i bash -p coreutils curl git gnutar jq moreutils nix + +set -eu -o pipefail + +if [ ! -v 1 ]; then + echo "usage: lock-sdk-deps.sh " >&2 + echo " Decimal-separated version number." >&2 + echo " Must correspond to a tag in https://github.com/apple-oss-distributions/distribution-macOS" >&2 + exit 1 +fi + +pkgdir=$(dirname "$(realpath "$0")") + +lockfile=$pkgdir/versions.json +if [ -e "$lockfile" ]; then + echo '{}' > "$lockfile" +fi + +workdir=$(mktemp -d) +trap 'rm -rf -- "$workdir"' EXIT + +sdkVersion=$1; shift +tag="macos-${sdkVersion//.}" + +declare -A ignoredPackages=( + [libsbuf]=1 + [mkAppleDerivation]=1 + [update-source-releases.sh]=1 + [versions.json]=1 +) + +readarray -t packages < <( + for file in "$pkgdir"/*; do + pkg=$(basename "$file" ".nix") + test ! "${ignoredPackages[$pkg]-}" && echo "$pkg" + done +) + +echo "Locking versions for macOS $sdkVersion using tag '$tag'..." + +pushd "$workdir" > /dev/null + +git clone --branch "$tag" https://github.com/apple-oss-distributions/distribution-macOS.git &> /dev/null +cd distribution-macOS + +for package in "${packages[@]}"; do + # If the tag exists in `release.json`, use that as an optimization to avoid downloading unnecessarily from Github. + packageTag=$(jq -r --arg package "$package" '.projects[] | select(.project == $package) | .tag' release.json) + packageCommit=$(git ls-tree -d HEAD "$package" | awk '{print $3}') + + if [ ! -d "$package" ]; then + packageCommit=HEAD + fi + + # However, sometimes it doesn’t exist. In that case, fall back to cloning the repo and check manually + # which tag corresponds to the commit from the submodule. + if [ -z "$packageTag" ]; then + git clone --no-checkout "https://github.com/apple-oss-distributions/$package.git" ../source &> /dev/null + pushd ../source > /dev/null + packageTag=$(git tag --points-at "$packageCommit") + popd > /dev/null + rm -rf ../source + fi + + packageVersion=${packageTag##"$package"-} + + curl -OL "https://github.com/apple-oss-distributions/$package/archive/$packageTag.tar.gz" &> /dev/null + tar axf "$packageTag.tar.gz" + + packageHash=$(nix --extra-experimental-features nix-command hash path "$package-$packageTag") + + pkgsjson="{\"$package\": {\"version\": \"$packageVersion\", \"hash\": \"$packageHash\"}}" + + echo " - Locking $package to version $packageVersion with hash '$packageHash'" + jq --argjson pkg "$pkgsjson" -S '. * $pkg' "$lockfile" | sponge "$lockfile" +done + +popd > /dev/null From 639108ea70bc0541440bc14c375def19b592a48b Mon Sep 17 00:00:00 2001 From: Randy Eckenrode Date: Sat, 21 Sep 2024 09:34:47 -0400 Subject: [PATCH 008/157] darwin.libsbuf: init at 14.1 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit libsbuf is required by some of the source release updates that will be done. Unfortunately, it is only available on macOS 14 and newer, and there is no source release available currently. This is a port of libsbuf from FreeBSD, which appears to be the origin of the header provided in the 14.x SDK. It provides the same ABI as the system dylib and same API as the the SDK header while being available on all supported deployment targets in nixpkgs. Note: This package is not based on libsbuf from the FreeBSD package set in nixpkgs because: it doesn’t build on Darwin, and using it would pull many FreeBSD packages into the Darwin bootstrap, which is undesirable. --- .../darwin/apple-source-releases/default.nix | 2 + .../libsbuf/meson.build.in | 17 +++ .../apple-source-releases/libsbuf/package.nix | 85 +++++++++++ .../patches/0001-darwin-compatibility.patch | 137 ++++++++++++++++++ 4 files changed, 241 insertions(+) create mode 100644 pkgs/os-specific/darwin/apple-source-releases/libsbuf/meson.build.in create mode 100644 pkgs/os-specific/darwin/apple-source-releases/libsbuf/package.nix create mode 100644 pkgs/os-specific/darwin/apple-source-releases/libsbuf/patches/0001-darwin-compatibility.patch diff --git a/pkgs/os-specific/darwin/apple-source-releases/default.nix b/pkgs/os-specific/darwin/apple-source-releases/default.nix index bb85028f14237..192dcd8301a30 100644 --- a/pkgs/os-specific/darwin/apple-source-releases/default.nix +++ b/pkgs/os-specific/darwin/apple-source-releases/default.nix @@ -341,4 +341,6 @@ developerToolsPackages_11_3_1 // macosPackages_11_0_1 // { # TODO(matthewbauer): # To be removed, once I figure out how to build a newer Security version. Security = applePackage "Security/boot.nix" "osx-10.9.5" "sha256-7qr0IamjCXCobIJ6V9KtvbMBkJDfRCy4C5eqpHJlQLI=" {}; + + libsbuf = callPackage ./libsbuf/package.nix { }; } diff --git a/pkgs/os-specific/darwin/apple-source-releases/libsbuf/meson.build.in b/pkgs/os-specific/darwin/apple-source-releases/libsbuf/meson.build.in new file mode 100644 index 0000000000000..f6b69a368f307 --- /dev/null +++ b/pkgs/os-specific/darwin/apple-source-releases/libsbuf/meson.build.in @@ -0,0 +1,17 @@ +# Project settings +project('libsbuf', 'c', version : '@version@') + + +# Libraries +library( + 'sbuf', + darwin_versions : '1', + install : true, + sources : [ + 'subr_prf.c', + 'subr_sbuf.c', + ], + soversion : '6', +) +install_headers('usbuf.h') +install_man('sbuf.9') diff --git a/pkgs/os-specific/darwin/apple-source-releases/libsbuf/package.nix b/pkgs/os-specific/darwin/apple-source-releases/libsbuf/package.nix new file mode 100644 index 0000000000000..57467f6577555 --- /dev/null +++ b/pkgs/os-specific/darwin/apple-source-releases/libsbuf/package.nix @@ -0,0 +1,85 @@ +{ + lib, + bootstrapStdenv, + fetchurl, + meson, + ninja, + stdenv, +}: + +# Apple ships libsbuf with macOS 14 but does not provide any source releases. +# Fortunately, it’s a single file library that can be made to build on Darwin using the source from FreeBSD. +bootstrapStdenv.mkDerivation (finalAttrs: { + pname = "libsbuf"; + version = "14.1.0"; + + outputs = [ + "out" + "dev" + "man" + ]; + + srcs = [ + (fetchurl { + name = "subr_sbuf.c"; + url = "https://cgit.freebsd.org/src/plain/sys/kern/subr_sbuf.c?h=release/${finalAttrs.version}"; + hash = "sha256-+wIcXz2wuYzOXmbxjDYBh7lIpoVtw+SW/l7oMXFJUcc="; + }) + (fetchurl { + name = "subr_prf.c"; + url = "https://cgit.freebsd.org/src/plain/sys/kern/subr_prf.c?h=release/${finalAttrs.version}"; + hash = "sha256-Sd+kJ7/RwwndK1N6YvqQqPTQRA0ajPAT0yk0rOPRpW8="; + }) + (fetchurl { + name = "usbuf.h"; + url = "https://cgit.freebsd.org/src/plain/sys/sys/sbuf.h?h=release/${finalAttrs.version}"; + hash = "sha256-CCwh9kI/X1u16hHWiiBipvBzDKvo2S2OFtI4Jo6HF0E="; + }) + (fetchurl { + name = "sbuf.9"; + url = "https://cgit.freebsd.org/src/plain/share/man/man9/sbuf.9?h=release/${finalAttrs.version}"; + hash = "sha256-43uUIGvYX0NvikcGTTJHrokHvubQ89ztLv/BK3MP0YY="; + }) + ]; + + sourceRoot = "source"; + + unpackPhase = '' + runHook preUnpack + + mkdir "$sourceRoot" + for src in "''${srcs[@]}"; do + destFilename=$(basename "$src") + cp "$src" "$sourceRoot/''${src#*-}" + done + + runHook postUnpack + ''; + + patches = [ + # Fix up sources to build on Darwin and follow the same ABI used by Apple. + ./patches/0001-darwin-compatibility.patch + ]; + + postPatch = lib.optionalString stdenv.hostPlatform.isDarwin '' + substitute '${./meson.build.in}' "meson.build" --subst-var version + ''; + + strictDeps = true; + + nativeBuildInputs = [ + meson + ninja + ]; + + __structuredAttrs = true; + + meta = { + description = "Safely compose and manipulate strings in C"; + homepage = "https://www.freebsd.org"; + license = [ + lib.licenses.bsd2 + lib.licenses.bsd3 + ]; + }; +}) diff --git a/pkgs/os-specific/darwin/apple-source-releases/libsbuf/patches/0001-darwin-compatibility.patch b/pkgs/os-specific/darwin/apple-source-releases/libsbuf/patches/0001-darwin-compatibility.patch new file mode 100644 index 0000000000000..e12f3e12db805 --- /dev/null +++ b/pkgs/os-specific/darwin/apple-source-releases/libsbuf/patches/0001-darwin-compatibility.patch @@ -0,0 +1,137 @@ +diff '--color=auto' -ur a/subr_prf.c b/subr_prf.c +--- a/subr_prf.c 2024-09-04 20:07:10.149623000 -0400 ++++ b/subr_prf.c 2024-09-04 20:14:10.265336775 -0400 +@@ -64,8 +64,8 @@ + #else /* !_KERNEL */ + #include + #endif +-#include +-#include ++#include ++#include + + #ifdef DDB + #include +diff '--color=auto' -ur a/subr_sbuf.c b/subr_sbuf.c +--- a/subr_sbuf.c 2024-09-04 20:07:10.149810000 -0400 ++++ b/subr_sbuf.c 2024-09-04 20:22:20.289037135 -0400 +@@ -50,7 +50,7 @@ + #include + #endif /* _KERNEL */ + +-#include ++#include + + #ifdef _KERNEL + static MALLOC_DEFINE(M_SBUF, "sbuf", "string buffers"); +@@ -96,6 +96,18 @@ + #define SBUF_MAXEXTENDINCR 4096 + #endif + ++/* Per https://cgit.freebsd.org/src/commit/?id=8fa6abb6f4f64f4f23e2920e2aea7996566851a4 */ ++#define roundup2 __builtin_align_up ++/* From https://cgit.freebsd.org/src/tree/sys/sys/cdefs.h?id=8fa6abb6f4f64f4f23e2920e2aea7996566851a4 */ ++#define __predict_false(exp) __builtin_expect((exp),0) ++ ++/* These symbols are exported even though the functions aren’t defined in the public header. ++ Redefine them for consistency. */ ++#define sbuf_count_drain usbuf_count_drain ++#define sbuf_drain usbuf_drain ++#define sbuf_nl_terminate usbuf_nl_terminate ++#define sbuf_put_bytes usbuf_put_bytes ++ + /* + * Debugging support + */ +diff '--color=auto' -ur a/usbuf.h b/usbuf.h +--- a/usbuf.h 2024-09-04 20:07:10.150177000 -0400 ++++ b/usbuf.h 2024-09-04 20:13:26.469610458 -0400 +@@ -33,6 +33,50 @@ + + #include + ++#include ++ ++#define sbuf_new usbuf_new ++#define sbuf_clear usbuf_clear ++#define sbuf_setpos usbuf_setpos ++#define sbuf_bcat usbuf_bcat ++#define sbuf_bcpy usbuf_bcpy ++#define sbuf_cat usbuf_cat ++#define sbuf_cpy usbuf_cpy ++#define sbuf_printf usbuf_printf ++#define sbuf_vprintf usbuf_vprintf ++#define sbuf_putc usbuf_putc ++#define sbuf_set_drain usbuf_set_drain ++#define sbuf_trim usbuf_trim ++#define sbuf_error usbuf_error ++#define sbuf_finish usbuf_finish ++#define sbuf_data usbuf_data ++#define sbuf_len usbuf_len ++#define sbuf_done usbuf_done ++#define sbuf_delete usbuf_delete ++#define sbuf_clear_flags usbuf_clear_flags ++#define sbuf_get_flags usbuf_get_flags ++#define sbuf_set_flags usbuf_set_flags ++#define sbuf_start_section usbuf_start_section ++#define sbuf_end_section usbuf_end_section ++#define sbuf_hexdump usbuf_hexdump ++#define sbuf_putbuf usbuf_putbuf ++#define sbuf_printf_drain usbuf_printf_drain ++ ++#define SBUF_FIXEDLEN USBUF_FIXEDLEN ++#define SBUF_AUTOEXTEND USBUF_AUTOEXTEND ++#define SBUF_INCLUDENUL USBUF_INCLUDENUL ++#define SBUF_DRAINTOEOR USBUF_DRAINTOEOR ++#define SBUF_NOWAIT USBUF_NOWAIT ++#define SBUF_USRFLAGMSK USBUF_USRFLAGMSK ++#define SBUF_DYNAMIC USBUF_DYNAMIC ++#define SBUF_FINISHED USBUF_FINISHED ++#define SBUF_DYNSTRUCT USBUF_DYNSTRUCT ++#define SBUF_INSECTION USBUF_INSECTION ++#define SBUF_DRAINATEOL USBUF_DRAINATEOL ++ ++#define sbuf usbuf ++#define sbuf_drain_func usbuf_drain_func ++ + struct sbuf; + typedef int (sbuf_drain_func)(void *, const char *, int); + +@@ -46,17 +90,17 @@ + int s_error; /* current error code */ + ssize_t s_size; /* size of storage buffer */ + ssize_t s_len; /* current length of string */ +-#define SBUF_FIXEDLEN 0x00000000 /* fixed length buffer (default) */ +-#define SBUF_AUTOEXTEND 0x00000001 /* automatically extend buffer */ +-#define SBUF_INCLUDENUL 0x00000002 /* nulterm byte is counted in len */ +-#define SBUF_DRAINTOEOR 0x00000004 /* use section 0 as drain EOR marker */ +-#define SBUF_NOWAIT 0x00000008 /* Extend with non-blocking malloc */ +-#define SBUF_USRFLAGMSK 0x0000ffff /* mask of flags the user may specify */ +-#define SBUF_DYNAMIC 0x00010000 /* s_buf must be freed */ +-#define SBUF_FINISHED 0x00020000 /* set by sbuf_finish() */ +-#define SBUF_DYNSTRUCT 0x00080000 /* sbuf must be freed */ +-#define SBUF_INSECTION 0x00100000 /* set by sbuf_start_section() */ +-#define SBUF_DRAINATEOL 0x00200000 /* drained contents ended in \n */ ++#define USBUF_FIXEDLEN 0x00000000 /* fixed length buffer (default) */ ++#define USBUF_AUTOEXTEND 0x00000001 /* automatically extend buffer */ ++#define USBUF_INCLUDENUL 0x00000002 /* nulterm byte is counted in len */ ++#define USBUF_DRAINTOEOR 0x00000004 /* use section 0 as drain EOR marker */ ++#define USBUF_NOWAIT 0x00000008 /* Extend with non-blocking malloc */ ++#define USBUF_USRFLAGMSK 0x0000ffff /* mask of flags the user may specify */ ++#define USBUF_DYNAMIC 0x00010000 /* s_buf must be freed */ ++#define USBUF_FINISHED 0x00020000 /* set by sbuf_finish() */ ++#define USBUF_DYNSTRUCT 0x00080000 /* sbuf must be freed */ ++#define USBUF_INSECTION 0x00100000 /* set by sbuf_start_section() */ ++#define USBUF_DRAINATEOL 0x00200000 /* drained contents ended in \n */ + int s_flags; /* flags */ + ssize_t s_sect_len; /* current length of section */ + ssize_t s_rec_off; /* current record start offset */ +@@ -88,7 +132,7 @@ + int sbuf_cpy(struct sbuf *, const char *); + int sbuf_printf(struct sbuf *, const char *, ...) + __printflike(2, 3); +-int sbuf_vprintf(struct sbuf *, const char *, __va_list) ++int sbuf_vprintf(struct sbuf *, const char *, va_list) + __printflike(2, 0); + int sbuf_nl_terminate(struct sbuf *); + int sbuf_putc(struct sbuf *, int); From 556790248f75fbd60ba60bb55418a830b2f98945 Mon Sep 17 00:00:00 2001 From: Randy Eckenrode Date: Fri, 20 Sep 2024 20:41:00 -0400 Subject: [PATCH 009/157] apple-sdk: init at 10.12.2 and 11.3 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This is a new packaging of the Darwin SDK. Instead of splitting libraries and frameworks into separate packages, it provides a single package for the whole SDK. # Features - Vendored files are removed from the SDK. There are 50+ different packages that are vendored by upstream (depending on the version); - Components that are built in nixpkgs (either from upstream or from the source releases) are also removed. If they need to be included by default, they are propagated; - A single SDK pattern is used to package all SDKs, and scripts are provided to aid updating the SDK version and its source release versions. This makes adding new SDKs much easier; - SDK overrides are handled by adding the SDK version you require. If multiple SDKs are present, only the newest is used. It is possible to have different SDKs for each of build, host, and target platforms; - Private headers are no longer provided by default unless you use the SDK’s `privateFrameworksHook` to add them. It does the right thing when multiple SDKs are in your inputs; - Source releases for the SDK version are available via a passthru `sourceRelease` function. This is mostly useful for getting private headers for building source releases in the darwin attrset; and - The same versions of propagated components are used on both platforms (e.g., the same libresult, libiconv, etc). See `pkgs/by-name/ap/apple-sdk/README.md` for details on how the SDK derivation is structured and how to update it. --- pkgs/by-name/ap/apple-sdk/README.md | 0 .../common/add-core-symbolication.nix | 51 ++ .../apple-sdk/common/derivation-options.nix | 17 + .../by-name/ap/apple-sdk/common/fetch-sdk.nix | 42 ++ .../common/passthru-private-frameworks.nix | 9 + .../common/passthru-source-release-files.nix | 37 ++ pkgs/by-name/ap/apple-sdk/common/plists.nix | 307 ++++++++++ .../ap/apple-sdk/common/process-stubs.nix | 46 ++ .../ap/apple-sdk/common/propagate-inputs.nix | 71 +++ .../ap/apple-sdk/common/propagate-xcrun.nix | 50 ++ .../common/remove-disallowed-packages.nix | 35 ++ .../ap/apple-sdk/common/rewrite-sdk-paths.nix | 18 + .../common/run-build-phase-hooks.nix | 9 + .../metadata/apple-oss-lockfile.json | 358 +++++++++++ .../metadata/disallowed-packages.json | 554 ++++++++++++++++++ .../ap/apple-sdk/metadata/versions.json | 12 + pkgs/by-name/ap/apple-sdk/package.nix | 120 ++++ ...initions-needed-to-build-zlog-in-sys.patch | 48 ++ .../0002-Add-CF_EXPORT-To-const-symbols.patch | 45 ++ .../scripts/get-sdks-from-catalog.sh | 41 ++ .../ap/apple-sdk/scripts/lock-sdk-deps.sh | 69 +++ .../apple-sdk/scripts/regenerate-lockfile.sh | 62 ++ .../setup-hooks/add-private-frameworks.sh | 6 + .../ap/apple-sdk/setup-hooks/role.bash | 71 +++ .../ap/apple-sdk/setup-hooks/sdk-hook.sh | 17 + pkgs/top-level/all-packages.nix | 3 + 26 files changed, 2098 insertions(+) create mode 100644 pkgs/by-name/ap/apple-sdk/README.md create mode 100644 pkgs/by-name/ap/apple-sdk/common/add-core-symbolication.nix create mode 100644 pkgs/by-name/ap/apple-sdk/common/derivation-options.nix create mode 100644 pkgs/by-name/ap/apple-sdk/common/fetch-sdk.nix create mode 100644 pkgs/by-name/ap/apple-sdk/common/passthru-private-frameworks.nix create mode 100644 pkgs/by-name/ap/apple-sdk/common/passthru-source-release-files.nix create mode 100644 pkgs/by-name/ap/apple-sdk/common/plists.nix create mode 100644 pkgs/by-name/ap/apple-sdk/common/process-stubs.nix create mode 100644 pkgs/by-name/ap/apple-sdk/common/propagate-inputs.nix create mode 100644 pkgs/by-name/ap/apple-sdk/common/propagate-xcrun.nix create mode 100644 pkgs/by-name/ap/apple-sdk/common/remove-disallowed-packages.nix create mode 100644 pkgs/by-name/ap/apple-sdk/common/rewrite-sdk-paths.nix create mode 100644 pkgs/by-name/ap/apple-sdk/common/run-build-phase-hooks.nix create mode 100644 pkgs/by-name/ap/apple-sdk/metadata/apple-oss-lockfile.json create mode 100644 pkgs/by-name/ap/apple-sdk/metadata/disallowed-packages.json create mode 100644 pkgs/by-name/ap/apple-sdk/metadata/versions.json create mode 100644 pkgs/by-name/ap/apple-sdk/package.nix create mode 100644 pkgs/by-name/ap/apple-sdk/patches/0001-Add-function-definitions-needed-to-build-zlog-in-sys.patch create mode 100644 pkgs/by-name/ap/apple-sdk/patches/0002-Add-CF_EXPORT-To-const-symbols.patch create mode 100755 pkgs/by-name/ap/apple-sdk/scripts/get-sdks-from-catalog.sh create mode 100755 pkgs/by-name/ap/apple-sdk/scripts/lock-sdk-deps.sh create mode 100755 pkgs/by-name/ap/apple-sdk/scripts/regenerate-lockfile.sh create mode 100644 pkgs/by-name/ap/apple-sdk/setup-hooks/add-private-frameworks.sh create mode 100644 pkgs/by-name/ap/apple-sdk/setup-hooks/role.bash create mode 100644 pkgs/by-name/ap/apple-sdk/setup-hooks/sdk-hook.sh diff --git a/pkgs/by-name/ap/apple-sdk/README.md b/pkgs/by-name/ap/apple-sdk/README.md new file mode 100644 index 0000000000000..e69de29bb2d1d diff --git a/pkgs/by-name/ap/apple-sdk/common/add-core-symbolication.nix b/pkgs/by-name/ap/apple-sdk/common/add-core-symbolication.nix new file mode 100644 index 0000000000000..7bb655a1863b7 --- /dev/null +++ b/pkgs/by-name/ap/apple-sdk/common/add-core-symbolication.nix @@ -0,0 +1,51 @@ +{ + lib, + fetchFromGitHub, + stdenvNoCC, +}: + +let + CoreSymbolication = stdenvNoCC.mkDerivation (finalAttrs: { + pname = "CoreSymbolication"; + version = "0-unstable-2018-06-17"; + + src = fetchFromGitHub { + repo = "CoreSymbolication"; + owner = "matthewbauer"; + rev = "24c87c23664b3ee05dc7a5a87d647ae476a680e4"; + hash = "sha256-PzvLq94eNhP0+rLwGMKcMzxuD6MlrNI7iT/eV0obtSE="; + }; + + patches = [ + # Add missing symbol definitions needed to build `zlog` in system_cmds. + # https://github.com/matthewbauer/CoreSymbolication/pull/2 + ../patches/0001-Add-function-definitions-needed-to-build-zlog-in-sys.patch + ../patches/0002-Add-CF_EXPORT-To-const-symbols.patch + ]; + + dontBuild = true; + + installPhase = '' + mkdir -p "$out/include" + cp *.h "$out/include" + ''; + + meta = { + description = "Reverse engineered headers for Apple's CoreSymbolication framework"; + homepage = "https://github.com/matthewbauer/CoreSymbolication"; + license = lib.licenses.mit; + maintainers = lib.teams.darwin.members; + platforms = lib.platforms.darwin; + }; + }); +in +self: super: { + buildPhase = + super.buildPhase or "" + + '' + mkdir -p System/Library/PrivateFrameworks/CoreSymbolication.framework/Versions/A/Headers + ln -s A System/Library/PrivateFrameworks/CoreSymbolication.framework/Versions/Current + ln -s Versions/Current/Headers System/Library/PrivateFrameworks/CoreSymbolication.framework/Headers + cp '${CoreSymbolication}/include/'*.h System/Library/PrivateFrameworks/CoreSymbolication.framework/Versions/A/Headers + ''; +} diff --git a/pkgs/by-name/ap/apple-sdk/common/derivation-options.nix b/pkgs/by-name/ap/apple-sdk/common/derivation-options.nix new file mode 100644 index 0000000000000..361e8df0f8d16 --- /dev/null +++ b/pkgs/by-name/ap/apple-sdk/common/derivation-options.nix @@ -0,0 +1,17 @@ +{ lib, config }: + +self: super: { + preBuild = + super.preBuild or "" + + '' + platformPath=$out/Platforms/MacOSX.platform + sdkpath=$platformPath/Developer/SDKs + ''; + + preInstall = + super.preInstall or "" + + '' + platformPath=$out/Platforms/MacOSX.platform + sdkpath=$platformPath/Developer/SDKs + ''; +} diff --git a/pkgs/by-name/ap/apple-sdk/common/fetch-sdk.nix b/pkgs/by-name/ap/apple-sdk/common/fetch-sdk.nix new file mode 100644 index 0000000000000..d96c27509ddac --- /dev/null +++ b/pkgs/by-name/ap/apple-sdk/common/fetch-sdk.nix @@ -0,0 +1,42 @@ +{ + lib, + fetchurl, + cpio, + pbzx, +}: + +{ + url, + version, + hash, +}: + +fetchurl { + pname = "macOS-SDK"; + inherit version url hash; + + recursiveHash = true; + + nativeBuildInputs = [ + cpio + pbzx + ]; + + postFetch = '' + renamed=$(mktemp -d)/sdk.xar + mv "$downloadedFile" "$renamed" + pbzx "$renamed" | cpio -idm + + # SDKs are inconsistent about whether MacOSX.sdk or MacOSX.sdk is a symlink. + src=Library/Developer/CommandLineTools/SDKs/MacOSX${lib.versions.majorMinor version}.sdk + if [ ! -d $src ]; then + src=Library/Developer/CommandLineTools/SDKs/MacOSX.sdk + fi + + # Remove unwanted binaries, man pages, and folders from the SDK. + rm -rf $src/usr/bin $src/usr/share $src/System/Library/Perl + + mkdir -p "$out" + cp -rd $src/* "$out" + ''; +} diff --git a/pkgs/by-name/ap/apple-sdk/common/passthru-private-frameworks.nix b/pkgs/by-name/ap/apple-sdk/common/passthru-private-frameworks.nix new file mode 100644 index 0000000000000..7d3897dc1dcc4 --- /dev/null +++ b/pkgs/by-name/ap/apple-sdk/common/passthru-private-frameworks.nix @@ -0,0 +1,9 @@ +{ makeSetupHook, sdkVersion }: + +self: super: { + passthru = super.passthru or { } // { + privateFrameworksHook = makeSetupHook { + name = "apple-sdk-private-frameworks-hook"; + } ../setup-hooks/add-private-frameworks.sh; + }; +} diff --git a/pkgs/by-name/ap/apple-sdk/common/passthru-source-release-files.nix b/pkgs/by-name/ap/apple-sdk/common/passthru-source-release-files.nix new file mode 100644 index 0000000000000..cf23ea7214bcf --- /dev/null +++ b/pkgs/by-name/ap/apple-sdk/common/passthru-source-release-files.nix @@ -0,0 +1,37 @@ +let + lockfile = builtins.fromJSON (builtins.readFile ../metadata/apple-oss-lockfile.json); +in + +{ + lib, + fetchFromGitHub, + stdenvNoCC, + sdkVersion, +}: + +let + sdkinfo = lockfile.${sdkVersion}; +in +self: super: { + passthru = super.passthru or { } // { + # Returns the raw source from apple-oss-distributions repo. + # This is mostly useful for copying private headers needed to build other source releases. + # + # Note: The source releases are mostly not used to build the SDK. Unless they can be used to build binaries, + # they’re not used. + sourceRelease = + name: + let + lockinfo = sdkinfo.${name}; + in + fetchFromGitHub { + owner = "apple-oss-distributions"; + repo = name; + rev = lockinfo.rev or "${name}-${lockinfo.version}"; + inherit (lockinfo) hash; + } + // { + inherit (lockinfo) version; + }; + }; +} diff --git a/pkgs/by-name/ap/apple-sdk/common/plists.nix b/pkgs/by-name/ap/apple-sdk/common/plists.nix new file mode 100644 index 0000000000000..581635694a769 --- /dev/null +++ b/pkgs/by-name/ap/apple-sdk/common/plists.nix @@ -0,0 +1,307 @@ +{ + lib, + stdenvNoCC, + xcodePlatform, +}: + +let + inherit (lib.generators) toPlist; + + Info = { + CFBundleIdentifier = "com.apple.platform.${lib.toLower xcodePlatform}"; + Type = "Platform"; + Name = lib.toLower xcodePlatform; + }; + + # These files are all based off of Xcode spec files found in + # /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/Library/Xcode/PrivatePlugIns/IDEOSXSupportCore.ideplugin/Contents/Resources. + + # Based off of the "MacOSX Architectures.xcspec" file. All i386 stuff + # is removed because NixPkgs only supports darwin-x86_64 and darwin-arm64. + Architectures = [ + { + Identifier = "Standard"; + Type = "Architecture"; + Name = "Standard Architectures (Apple Silicon, 64-bit Intel)"; + RealArchitectures = [ + "arm64" + "x86_64" + ]; + ArchitectureSetting = "ARCHS_STANDARD"; + } + { + Identifier = "Universal"; + Type = "Architecture"; + Name = "Universal (Apple Silicon, 64-bit Intel)"; + RealArchitectures = [ + "arm64" + "x86_64" + ]; + ArchitectureSetting = "ARCHS_STANDARD_32_64_BIT"; + } + { + Identifier = "Native"; + Type = "Architecture"; + Name = "Native Architecture of Build Machine"; + ArchitectureSetting = "NATIVE_ARCH_ACTUAL"; + } + { + Identifier = "Standard64bit"; + Type = "Architecture"; + Name = "Apple Silicon, 64-bit Intel"; + RealArchitectures = [ + "arm64" + "x86_64" + ]; + ArchitectureSetting = "ARCHS_STANDARD_64_BIT"; + } + { + Identifier = stdenvNoCC.hostPlatform.darwinArch; + Type = "Architecture"; + Name = "Apple Silicon or Intel 64-bit"; + } + { + Identifier = "Standard_Including_64_bit"; + Type = "Architecture"; + Name = "Standard Architectures (including 64-bit)"; + RealArchitectures = [ + "arm64" + "x86_64" + ]; + ArchitectureSetting = "ARCHS_STANDARD_INCLUDING_64_BIT"; + } + ]; + + # Based off of the "MacOSX Package Types.xcspec" file. Only keep the + # bare minimum needed. + PackageTypes = [ + { + Identifier = "com.apple.package-type.mach-o-executable"; + Type = "PackageType"; + Name = "Mach-O Executable"; + DefaultBuildSettings = { + EXECUTABLE_NAME = "$(EXECUTABLE_PREFIX)$(PRODUCT_NAME)$(EXECUTABLE_VARIANT_SUFFIX)$(EXECUTABLE_SUFFIX)"; + EXECUTABLE_PATH = "$(EXECUTABLE_NAME)"; + }; + ProductReference = { + FileType = "compiled.mach-o.executable"; + Name = "$(EXECUTABLE_NAME)"; + }; + } + { + Identifier = "com.apple.package-type.mach-o-objfile"; + Type = "PackageType"; + Name = "Mach-O Object File"; + DefaultBuildSettings = { + EXECUTABLE_NAME = "$(EXECUTABLE_PREFIX)$(PRODUCT_NAME)$(EXECUTABLE_VARIANT_SUFFIX)$(EXECUTABLE_SUFFIX)"; + EXECUTABLE_PATH = "$(EXECUTABLE_NAME)"; + }; + ProductReference = { + FileType = "compiled.mach-o.objfile"; + Name = "$(EXECUTABLE_NAME)"; + }; + } + { + Identifier = "com.apple.package-type.mach-o-dylib"; + Type = "PackageType"; + Name = "Mach-O Dynamic Library"; + DefaultBuildSettings = { + EXECUTABLE_NAME = "$(EXECUTABLE_PREFIX)$(PRODUCT_NAME)$(EXECUTABLE_VARIANT_SUFFIX)$(EXECUTABLE_SUFFIX)"; + EXECUTABLE_PATH = "$(EXECUTABLE_NAME)"; + }; + ProductReference = { + FileType = "compiled.mach-o.dylib"; + Name = "$(EXECUTABLE_NAME)"; + }; + } + { + Identifier = "com.apple.package-type.static-library"; + Type = "PackageType"; + Name = "Mach-O Static Library"; + DefaultBuildSettings = { + EXECUTABLE_PREFIX = "lib"; + EXECUTABLE_SUFFIX = ".a"; + EXECUTABLE_NAME = "$(EXECUTABLE_PREFIX)$(PRODUCT_NAME)$(EXECUTABLE_VARIANT_SUFFIX)$(EXECUTABLE_SUFFIX)"; + EXECUTABLE_PATH = "$(EXECUTABLE_NAME)"; + }; + ProductReference = { + FileType = "archive.ar"; + Name = "$(EXECUTABLE_NAME)"; + IsLaunchable = "NO"; + }; + } + { + Identifier = "com.apple.package-type.wrapper"; + Type = "PackageType"; + Name = "Wrapper"; + DefaultBuildSettings = { + WRAPPER_SUFFIX = ".bundle"; + WRAPPER_NAME = "$(WRAPPER_PREFIX)$(PRODUCT_NAME)$(WRAPPER_SUFFIX)"; + CONTENTS_FOLDER_PATH = "$(WRAPPER_NAME)/Contents"; + EXECUTABLE_NAME = "$(EXECUTABLE_PREFIX)$(PRODUCT_NAME)$(EXECUTABLE_VARIANT_SUFFIX)$(EXECUTABLE_SUFFIX)"; + EXECUTABLE_FOLDER_PATH = "$(CONTENTS_FOLDER_PATH)/MacOS"; + EXECUTABLE_PATH = "$(EXECUTABLE_FOLDER_PATH)/$(EXECUTABLE_NAME)"; + INFOPLIST_PATH = "$(CONTENTS_FOLDER_PATH)/Info.plist"; + INFOSTRINGS_PATH = "$(LOCALIZED_RESOURCES_FOLDER_PATH)/InfoPlist.strings"; + PKGINFO_PATH = "$(CONTENTS_FOLDER_PATH)/PkgInfo"; + PBDEVELOPMENTPLIST_PATH = "$(CONTENTS_FOLDER_PATH)/pbdevelopment.plist"; + VERSIONPLIST_PATH = "$(CONTENTS_FOLDER_PATH)/version.plist"; + PUBLIC_HEADERS_FOLDER_PATH = "$(CONTENTS_FOLDER_PATH)/Headers"; + PRIVATE_HEADERS_FOLDER_PATH = "$(CONTENTS_FOLDER_PATH)/PrivateHeaders"; + EXECUTABLES_FOLDER_PATH = "$(CONTENTS_FOLDER_PATH)/Executables"; + FRAMEWORKS_FOLDER_PATH = "$(CONTENTS_FOLDER_PATH)/Frameworks"; + SHARED_FRAMEWORKS_FOLDER_PATH = "$(CONTENTS_FOLDER_PATH)/SharedFrameworks"; + SHARED_SUPPORT_FOLDER_PATH = "$(CONTENTS_FOLDER_PATH)/SharedSupport"; + UNLOCALIZED_RESOURCES_FOLDER_PATH = "$(CONTENTS_FOLDER_PATH)/Resources"; + LOCALIZED_RESOURCES_FOLDER_PATH = "$(UNLOCALIZED_RESOURCES_FOLDER_PATH)/$(DEVELOPMENT_LANGUAGE).lproj"; + DOCUMENTATION_FOLDER_PATH = "$(LOCALIZED_RESOURCES_FOLDER_PATH)/Documentation"; + PLUGINS_FOLDER_PATH = "$(CONTENTS_FOLDER_PATH)/PlugIns"; + SCRIPTS_FOLDER_PATH = "$(UNLOCALIZED_RESOURCES_FOLDER_PATH)/Scripts"; + }; + ProductReference = { + FileType = "wrapper.cfbundle"; + Name = "$(WRAPPER_NAME)"; + IsLaunchable = "NO"; + }; + } + { + Identifier = "com.apple.package-type.wrapper.application"; + Type = "PackageType"; + BasedOn = "com.apple.package-type.wrapper"; + Name = "Application Wrapper"; + DefaultBuildSettings = { + GENERATE_PKGINFO_FILE = "YES"; + }; + ProductReference = { + FileType = "wrapper.application"; + Name = "$(WRAPPER_NAME)"; + IsLaunchable = "YES"; + }; + } + ]; + + # Based off of the "MacOSX Product Types.xcspec" file. All + # bundles/wrapper are removed, because we prefer dynamic products in + # NixPkgs. + ProductTypes = [ + { + Identifier = "com.apple.product-type.tool"; + Type = "ProductType"; + Name = "Command-line Tool"; + PackageTypes = [ "com.apple.package-type.mach-o-executable" ]; + } + { + Identifier = "com.apple.product-type.objfile"; + Type = "ProductType"; + Name = "Object File"; + PackageTypes = [ "com.apple.package-type.mach-o-objfile" ]; + } + { + Identifier = "com.apple.product-type.library.dynamic"; + Type = "ProductType"; + Name = "Dynamic Library"; + PackageTypes = [ "com.apple.package-type.mach-o-dylib" ]; + DefaultBuildProperties = { + FULL_PRODUCT_NAME = "$(EXECUTABLE_NAME)"; + MACH_O_TYPE = "mh_dylib"; + REZ_EXECUTABLE = "YES"; + EXECUTABLE_SUFFIX = ".$(EXECUTABLE_EXTENSION)"; + EXECUTABLE_EXTENSION = "dylib"; + DYLIB_COMPATIBILITY_VERSION = "1"; + DYLIB_CURRENT_VERSION = "1"; + FRAMEWORK_FLAG_PREFIX = "-framework"; + LIBRARY_FLAG_PREFIX = "-l"; + LIBRARY_FLAG_NOSPACE = "YES"; + STRIP_STYLE = "debugging"; + GCC_INLINES_ARE_PRIVATE_EXTERN = "YES"; + CODE_SIGNING_ALLOWED = "YES"; + CODE_SIGNING_REQUIRED = "NO"; + }; + } + { + Identifier = "com.apple.product-type.library.static"; + Type = "ProductType"; + Name = "Static Library"; + PackageTypes = [ "com.apple.package-type.static-library" ]; + DefaultBuildProperties = { + FULL_PRODUCT_NAME = "$(EXECUTABLE_NAME)"; + MACH_O_TYPE = "staticlib"; + REZ_EXECUTABLE = "YES"; + EXECUTABLE_PREFIX = "lib"; + EXECUTABLE_SUFFIX = ".$(EXECUTABLE_EXTENSION)"; + EXECUTABLE_EXTENSION = "a"; + FRAMEWORK_FLAG_PREFIX = "-framework"; + LIBRARY_FLAG_PREFIX = "-l"; + LIBRARY_FLAG_NOSPACE = "YES"; + STRIP_STYLE = "debugging"; + SEPARATE_STRIP = "YES"; + CLANG_ENABLE_MODULE_DEBUGGING = "NO"; + }; + } + { + Type = "ProductType"; + Identifier = "com.apple.product-type.bundle"; + Name = "Bundle"; + DefaultBuildProperties = { + FULL_PRODUCT_NAME = "$(WRAPPER_NAME)"; + MACH_O_TYPE = "mh_bundle"; + WRAPPER_PREFIX = ""; + WRAPPER_SUFFIX = ".$(WRAPPER_EXTENSION)"; + WRAPPER_EXTENSION = "bundle"; + WRAPPER_NAME = "$(WRAPPER_PREFIX)$(PRODUCT_NAME)$(WRAPPER_SUFFIX)"; + FRAMEWORK_FLAG_PREFIX = "-framework"; + LIBRARY_FLAG_PREFIX = "-l"; + LIBRARY_FLAG_NOSPACE = "YES"; + STRIP_STYLE = "non-global"; + }; + PackageTypes = [ "com.apple.package-type.wrapper" ]; + IsWrapper = "YES"; + HasInfoPlist = "YES"; + HasInfoPlistStrings = "YES"; + } + { + Identifier = "com.apple.product-type.application"; + Type = "ProductType"; + BasedOn = "com.apple.product-type.bundle"; + Name = "Application"; + DefaultBuildProperties = { + MACH_O_TYPE = "mh_execute"; + WRAPPER_SUFFIX = ".$(WRAPPER_EXTENSION)"; + WRAPPER_EXTENSION = "app"; + }; + PackageTypes = [ "com.apple.package-type.wrapper.application" ]; + } + { + Type = "ProductType"; + Identifier = "com.apple.product-type.framework"; + Name = "Bundle"; + DefaultBuildProperties = { + FULL_PRODUCT_NAME = "$(WRAPPER_NAME)"; + MACH_O_TYPE = "mh_bundle"; + WRAPPER_PREFIX = ""; + WRAPPER_SUFFIX = ".$(WRAPPER_EXTENSION)"; + WRAPPER_EXTENSION = "bundle"; + WRAPPER_NAME = "$(WRAPPER_PREFIX)$(PRODUCT_NAME)$(WRAPPER_SUFFIX)"; + FRAMEWORK_FLAG_PREFIX = "-framework"; + LIBRARY_FLAG_PREFIX = "-l"; + LIBRARY_FLAG_NOSPACE = "YES"; + STRIP_STYLE = "non-global"; + }; + PackageTypes = [ "com.apple.package-type.wrapper" ]; + IsWrapper = "YES"; + HasInfoPlist = "YES"; + HasInfoPlistStrings = "YES"; + } + ]; + + ToolchainInfo = { + Identifier = "com.apple.dt.toolchain.XcodeDefault"; + }; +in +{ + "Info.plist" = builtins.toFile "Info.plist" (toPlist { } Info); + "ToolchainInfo.plist" = builtins.toFile "ToolchainInfo.plist" (toPlist { } ToolchainInfo); + "Architectures.xcspec" = builtins.toFile "Architectures.xcspec" (toPlist { } Architectures); + "PackageTypes.xcspec" = builtins.toFile "PackageTypes.xcspec" (toPlist { } PackageTypes); + "ProductTypes.xcspec" = builtins.toFile "ProductTypes.xcspec" (toPlist { } ProductTypes); +} diff --git a/pkgs/by-name/ap/apple-sdk/common/process-stubs.nix b/pkgs/by-name/ap/apple-sdk/common/process-stubs.nix new file mode 100644 index 0000000000000..840415d2e3b1e --- /dev/null +++ b/pkgs/by-name/ap/apple-sdk/common/process-stubs.nix @@ -0,0 +1,46 @@ +let + removedDylibs = [ + # corecrypto is available under a very restrictive license (effectively: non-free, can’t use). + # Without the headers and not being able to use corecrypto due to its license, it’s not very useful. + # Stubs are included in the SDK for all dylibs, including corecrypto. They should be removed. + "/usr/lib/system/libcorecrypto.dylib" + ]; +in + +{ + lib, + jq, + libtapi, +}: + +self: super: { + nativeBuildInputs = super.nativeBuildInputs or [ ] ++ [ + jq + libtapi + ]; + + buildPhase = + super.buildPhase or "" + + '' + echo "Removing the following dylibs from the libSystem reexported libraries list: ${lib.escapeShellArg (lib.concatStringsSep ", " removedDylibs)}" + for libSystem in libSystem.B.tbd libSystem.B_asan.tbd; do + test ! -e usr/lib/$libSystem && continue # TODO: remove once the minimum SDK is 10.14 or newer. + tapi stubify --filetype=tbd-v5 usr/lib/$libSystem -o usr/lib/$libSystem # tbd-v5 is a JSON-based format. + jq --argjson libs ${lib.escapeShellArg (builtins.toJSON removedDylibs)} ' + if .libraries then + .libraries[] |= select(.install_names[] | any([.] | inside($libs)) | not) + else + . + end + | .main_library.reexported_libraries[].names[] |= select([.] | inside($libs) | not) + ' usr/lib/$libSystem > usr/lib/$libSystem~ + mv usr/lib/$libSystem~ usr/lib/$libSystem + done + + # Rewrite the text-based stubs to v4 using `tapi`. This ensures a consistent format between SDK versions. + # tbd-v4 also drops certain elements that are no longer necessary (such as GUID lists). + find . -name '*.tbd' -type f \ + -exec echo "Converting {} to tbd-v4" \; \ + -exec tapi stubify --filetype=tbd-v4 {} -o {} \; + ''; +} diff --git a/pkgs/by-name/ap/apple-sdk/common/propagate-inputs.nix b/pkgs/by-name/ap/apple-sdk/common/propagate-inputs.nix new file mode 100644 index 0000000000000..f4d80eed0b498 --- /dev/null +++ b/pkgs/by-name/ap/apple-sdk/common/propagate-inputs.nix @@ -0,0 +1,71 @@ +{ + lib, + cups, + darwin, + db, + libiconv, + ncurses, + stdenv, + stdenvNoCC, + xcbuild, +}: + +let + # CUPS has too many dependencies to build as part of the Darwin bootstrap. It’s also typically taken as an explicit + # dependency by other packages, so building only the headers (to satisfy other SDK headers) should be okay. + cupsHeaders = darwin.bootstrapStdenv.mkDerivation { + pname = "${lib.getName cups}-headers"; + version = lib.getVersion cups; + + inherit (cups) src; + + patches = cups.patches or [ ]; + + strictDeps = true; + + dontBuild = true; + + buildInputs = [ darwin.libresolv ]; # The `configure` script requires libresolv headers. + + # CUPS’s configure script fails to find `ar` when cross-compiling. + configureFlags = [ "ac_cv_path_AR=${stdenv.cc.targetPrefix}ar" ]; + + installTargets = [ "install-headers" ]; + + __structuredAttrs = true; + + meta = { + inherit (cups.meta) + homepage + description + license + maintainers + platforms + ; + }; + }; +in +self: super: { + # These packages are propagated only because other platforms include them in their libc (or otherwise by default). + # Reducing the number of special cases required to support Darwin makes supporting it easier for package authors. + propagatedBuildInputs = + super.propagatedBuildInputs or [ ] + ++ [ + libiconv + darwin.libresolv + darwin.libsbuf + # Required by some SDK headers + cupsHeaders + ] + # x86_64-darwin links the object files from Csu when targeting very old releases + ++ lib.optionals stdenvNoCC.hostPlatform.isx86_64 [ darwin.Csu ]; + + # The Darwin module for Swift requires certain headers to be included in the SDK (and not just be propagated). + buildPhase = + super.buildPhase or "" + + '' + for header in '${lib.getDev libiconv}/include/'* '${lib.getDev ncurses}/include/'*; do + ln -s "$header" "usr/include/$(basename "$header")" + done + ''; +} diff --git a/pkgs/by-name/ap/apple-sdk/common/propagate-xcrun.nix b/pkgs/by-name/ap/apple-sdk/common/propagate-xcrun.nix new file mode 100644 index 0000000000000..441b36698688e --- /dev/null +++ b/pkgs/by-name/ap/apple-sdk/common/propagate-xcrun.nix @@ -0,0 +1,50 @@ +{ + lib, + pkgsBuildHost, + stdenv, + stdenvNoCC, +}: + +let + plists = import ./plists.nix { + inherit lib stdenvNoCC; + xcodePlatform = if stdenvNoCC.hostPlatform.isMacOS then "MacOSX" else "iPhoneOS"; + }; + inherit (pkgsBuildHost) darwin cctools xcbuild; +in +self: super: { + propagatedNativeBuildInputs = super.propagatedNativeBuildInputs or [ ] ++ [ xcbuild.xcrun ]; + + postInstall = + super.postInstall or "" + + '' + specspath=$out/Library/Xcode/Specifications + toolchainsPath=$out/Toolchains/XcodeDefault.xctoolchain + mkdir -p "$specspath" "$toolchainsPath" + + # xcbuild expects to find things relative to the plist locations. If these are linked instead of copied, + # it won’t find any platforms or SDKs. + cp '${plists."Info.plist"}' "$platformPath/Info.plist" + cp '${plists."ToolchainInfo.plist"}' "$toolchainsPath/ToolchainInfo.plist" + + for spec in '${xcbuild}/Library/Xcode/Specifications/'*; do + ln -s "$spec" "$specspath/$(basename "$spec")" + done + cp '${plists."Architectures.xcspec"}' "$specspath/Architectures.xcspec" + cp '${plists."PackageTypes.xcspec"}' "$specspath/PackageTypes.xcspec" + cp '${plists."ProductTypes.xcspec"}' "$specspath/ProductTypes.xcspec" + + mkdir -p "$out/usr/bin" + ln -s '${xcbuild.xcrun}/bin/xcrun' "$out/usr/bin/xcrun" + + # Include `libtool` in the toolchain, so `xcrun -find libtool` can find it without requiring `cctools.libtool` + # as a `nativeBuildInput`. + mkdir -p "$toolchainsPath/usr/bin" + ln -s '${cctools.libtool}/bin/${stdenv.cc.targetPrefix}libtool' "$toolchainsPath/usr/bin/libtool" + + # Include additional binutils required by some packages (such as Chromium). + for tool in lipo nm otool size strip; do + ln -s '${darwin.binutils-unwrapped}/bin/${stdenv.cc.targetPrefix}'$tool "$toolchainsPath/usr/bin/$tool" + done + ''; +} diff --git a/pkgs/by-name/ap/apple-sdk/common/remove-disallowed-packages.nix b/pkgs/by-name/ap/apple-sdk/common/remove-disallowed-packages.nix new file mode 100644 index 0000000000000..c771b2ccb9f59 --- /dev/null +++ b/pkgs/by-name/ap/apple-sdk/common/remove-disallowed-packages.nix @@ -0,0 +1,35 @@ +let + # This can be made unconditional once jq is available in the bootstrap tools. If corecrypto is not removed from + # the umbrella framework, linking will fail in stage 1 because it can’t find the tbd. + disallowedPackages' = builtins.fromJSON (builtins.readFile ../metadata/disallowed-packages.json); +in + +{ + lib, + jq, + stdenv, +}: + +let + disallowedPackages = + if jq == null then + lib.filter (p: p.package != "corecrypto") disallowedPackages' + else + disallowedPackages'; +in +self: super: { + # Remove headers and stubs for packages that are available in nixpkgs. + buildPhase = + super.buildPhase or "" + + '' + ${lib.concatMapStringsSep "\n" ( + pkg: + lib.concatLines ( + [ ''echo "Removing headers and libraries from ${pkg.package}"'' ] + ++ (map (header: "rm -rf -- usr/include/${header}") pkg.headers or [ ]) + ++ (map (framework: "rm -rf -- System/Library/Frameworks/${framework}") pkg.frameworks or [ ]) + ++ (map (library: "rm -rf -- usr/lib/${library}") pkg.libraries or [ ]) + ) + ) disallowedPackages} + ''; +} diff --git a/pkgs/by-name/ap/apple-sdk/common/rewrite-sdk-paths.nix b/pkgs/by-name/ap/apple-sdk/common/rewrite-sdk-paths.nix new file mode 100644 index 0000000000000..0eca6b8836b38 --- /dev/null +++ b/pkgs/by-name/ap/apple-sdk/common/rewrite-sdk-paths.nix @@ -0,0 +1,18 @@ +{ lib, sdkVersion }: + +let + name = "MacOSX${lib.versions.majorMinor sdkVersion}.sdk"; +in +self: super: { + # Rewrite the stubs to point to dylibs in the SDK instead of at system locations. This is needed for umbrella + # frameworks in older SDKs, which don’t also embed their stubs. + buildPhase = + super.buildPhase or "" + + '' + echo "Rewriting stubs to reference the SDK location in the store" + find . -name '*.tbd' -type f -exec sed -E \ + -e "/^install-name/n; s|( \\|'\\|\"\\|\\[)/usr/|\1$sdkpath/${name}/usr/|g" \ + -e "/^install-name/n; s|( \\|'\\|\"\\|\\[)/System/|\1$sdkpath/${name}/System/|g" \ + -i {} \; + ''; +} diff --git a/pkgs/by-name/ap/apple-sdk/common/run-build-phase-hooks.nix b/pkgs/by-name/ap/apple-sdk/common/run-build-phase-hooks.nix new file mode 100644 index 0000000000000..9ab00665675db --- /dev/null +++ b/pkgs/by-name/ap/apple-sdk/common/run-build-phase-hooks.nix @@ -0,0 +1,9 @@ +{ }: + +self: super: { + buildPhase = '' + runHook preBuild + ${super.buildPhase or ""} + runHook postBuild + ''; +} diff --git a/pkgs/by-name/ap/apple-sdk/metadata/apple-oss-lockfile.json b/pkgs/by-name/ap/apple-sdk/metadata/apple-oss-lockfile.json new file mode 100644 index 0000000000000..9340931ca473b --- /dev/null +++ b/pkgs/by-name/ap/apple-sdk/metadata/apple-oss-lockfile.json @@ -0,0 +1,358 @@ +{ + "10.12.2": { + "CarbonHeaders": { + "hash": "sha256-nIPXnLr21yVnpBhx9K5q3l/nPARA6JL/dED08MeyhP8=", + "version": "18.1" + }, + "CommonCrypto": { + "hash": "sha256-1mCJjZLBMIftcsKC7Ihhzi6LRS3u7kJzh9/dy6MY1Hg=", + "version": "60092.30.2" + }, + "IOAudioFamily": { + "hash": "sha256-5t3D44H/h0cUZqAjMi56BTbJD4o+R0xVdHJ1sZLYgNM=", + "version": "205.11" + }, + "IOBDStorageFamily": { + "hash": "sha256-4NpWcqfkp3UxhKKAwomDK3zxQ9DagyYFUVoUcrHo1Rg=", + "version": "18" + }, + "IOCDStorageFamily": { + "hash": "sha256-XOwdBFunLbwyasnTKQC6MRlXxGns07JvcAQc6AQ1Zt4=", + "version": "56" + }, + "IODVDStorageFamily": { + "hash": "sha256-bbGzqJnenEL9hRyKMBif/381/ETO+yNYHhlnXXWLne0=", + "version": "41.1" + }, + "IOFWDVComponents": { + "hash": "sha256-WkfkWnzRupEh20U7vjsTta89clhus6GTkOpXQWXw/bM=", + "version": "208" + }, + "IOFireWireAVC": { + "hash": "sha256-rhZdjNoZ3OuHVLClhe9tMQU6qJs3IOHEqJ5TaNRJRnM=", + "version": "424" + }, + "IOFireWireFamily": { + "hash": "sha256-adOI5uhd6QL4zpo4MK4ttmS1lcKseqmr68C1D/juGo0=", + "version": "465" + }, + "IOFireWireSBP2": { + "hash": "sha256-5UWldDuSyAnRYjgIKllY4VNbxtAUawrlRS46+8FnbPs=", + "version": "427" + }, + "IOFireWireSerialBusProtocolTransport": { + "hash": "sha256-a/xnnR2dUSWVMyTlkxJPa7cWk20RHl0Zh2Ot2pSEkF0=", + "version": "252" + }, + "IOGraphics": { + "hash": "sha256-63XDVmEHu+KUdr06S7+RPi1BgLcAl4GZZRy+K96CvA0=", + "version": "513.1" + }, + "IOHIDFamily": { + "hash": "sha256-BUDj89w4DrnsIxJZNIx3ZJ85c22HMchIVhJI7xREWTM=", + "version": "870.31.1" + }, + "IOKitUser": { + "hash": "sha256-XJnOp5AtStXUim19GLev8MSM8iS5U8rRSnm7cNp/B80=", + "version": "1324.30.13" + }, + "IONetworkingFamily": { + "hash": "sha256-dL1wSu72uzAAoMdgSjitXgHviioVIGdkDXqwY6HT5/g=", + "version": "116.1.1" + }, + "IOSerialFamily": { + "hash": "sha256-ZcZ5F+a4u2AHThO5WyLn3/o42DR+YDBZKTy4P2EhHhk=", + "version": "91" + }, + "IOStorageFamily": { + "hash": "sha256-IjsG/lgdtW04WH/5rb1QAT563Oy4O5fUrTGuA1kBrkY=", + "version": "210.30.1" + }, + "IOUSBFamily": { + "hash": "sha256-Z0E3TfKP49toYo1Fo9kElRap8CZ+mVDHy5RIexgJTpA=", + "version": "630.4.5" + }, + "Libc": { + "hash": "sha256-wyt5CJnNzk0MPC6pg2JAdiwIPxWFJsO9Yqa83vY+hLc=", + "version": "1158.30.7" + }, + "Libinfo": { + "hash": "sha256-3Mu9lOkaQx5gmNPXzr67FnZvKWmQhryIPsN6k95TU18=", + "version": "503.30.1" + }, + "Libm": { + "hash": "sha256-p4BndAag9d0XSMYWQ+c4myGv5qXbKx5E1VghudSbpTk=", + "version": "2026" + }, + "Libnotify": { + "hash": "sha256-msGtbR53SHXjYN8i74gmkYWGkmqg+TcRO7TY/23XSFQ=", + "version": "165.20.1" + }, + "Librpcsvc": { + "hash": "sha256-8e8E9TkRTAep3/miyqhF/mSkNdlym12W+AVhXF94+Bg=", + "version": "26" + }, + "Libsystem": { + "hash": "sha256-FwI2aD3wSwES/sKkr014BdFLfsKeEefgS0Pne1FGOp0=", + "version": "1238" + }, + "OpenDirectory": { + "hash": "sha256-6fSl8PasCZSBfe0ftaePcBuSEO3syb6kK+mfDI6iR7A=", + "version": "146" + }, + "Security": { + "hash": "sha256-Ya+ZO3bHNhQ+vZZx/lE7x+uMROHYWYKvm2ZZ1vClu3Q=", + "version": "57740.31.2" + }, + "architecture": { + "hash": "sha256-gHUfKWc1uahI/IATafY1ppPAWnYUghOEXWK2lknAfrQ=", + "version": "268" + }, + "configd": { + "hash": "sha256-i1UjnU7xBh7jCrGZxWMGrldzDrk2dDvjpthp/kq9OKo=", + "version": "888.30.2" + }, + "copyfile": { + "hash": "sha256-pth+37uTfuFY94HuA4b/5GleDjidAuXVsBEQBUa3xCE=", + "version": "138" + }, + "dtrace": { + "hash": "sha256-dK0N3l02241A5S1uvxZhqArHrTxd5Sd4JoAl6RBa8/8=", + "version": "209.20.4" + }, + "dyld": { + "hash": "sha256-wyVsmqYgKLdMKZsLOHzOLag+mBnH0kNS6XAv4zuNTT4=", + "version": "421.2" + }, + "eap8021x": { + "hash": "sha256-XSbzuNXyDJAADcnZed4Akmg1SK8P1IGrZitmhV3wzlo=", + "version": "246.30.1" + }, + "hfs": { + "hash": "sha256-7ByUP59FXmmrxC5yJYUQxrkgt/vY7vZMl5JPQ0HfoS8=", + "version": "366.30.3" + }, + "launchd": { + "hash": "sha256-8mW9bnuHmRXCx9py8Wy28C5b2QPICW0rlAps5njYa00=", + "version": "842.1.4" + }, + "libclosure": { + "hash": "sha256-hfXKQDRdgEDVyT+3v/EuQZyXNd0abD2tICYdQNfhtwY=", + "version": "67" + }, + "libdispatch": { + "hash": "sha256-tj4+6V4FL/XVON13UH71schElTm4/IKtPJH/yoUgRY0=", + "version": "703.30.5" + }, + "libmalloc": { + "hash": "sha256-q9zcUy8YTsRds6RYJMIUIY/MULQ19uKiNduMXP3D7hA=", + "version": "116.30.3" + }, + "libplatform": { + "hash": "sha256-k9Pd+TJCrNS7K100og+6bLAZjV/0VUTy8SIOsc+SE6Q=", + "version": "126.1.2" + }, + "libpthread": { + "hash": "sha256-FJaJO4lXIMAIwEmVF6mHE4ZZZoPI8ZIVuMKLojEsESE=", + "version": "218.30.1" + }, + "mDNSResponder": { + "hash": "sha256-LYDkkmgyfWKK6AMINXyrXo5kw7+lxUcz+4Ckq9175vA=", + "version": "765.30.11" + }, + "objc4": { + "hash": "sha256-WfhJo+/KPGr3/OuV5Kg2no48UR7VVVarh9TB3VFSCQ4=", + "version": "706" + }, + "ppp": { + "hash": "sha256-eW62wL8C1GZ2+5aN0dTPsdoEu6FWf+6XEYv8OiEeMfY=", + "version": "838" + }, + "removefile": { + "hash": "sha256-EJYU6eHggyRsezClEWkGJmgePIdtyF4rpFD4kSK5Czw=", + "version": "45" + }, + "xnu": { + "hash": "sha256-pkELzbsWPtm9H31LaRkaVjkQpPDxG9E93TNS+K9nqhE=", + "version": "3789.31.2" + } + }, + "11.3": { + "CarbonHeaders": { + "hash": "sha256-nIPXnLr21yVnpBhx9K5q3l/nPARA6JL/dED08MeyhP8=", + "version": "18.1" + }, + "CommonCrypto": { + "hash": "sha256-92v9tuNLqvalwYV4AqQllA8yN9fqGjSpc4MNAmFPrbk=", + "version": "60178.100.1" + }, + "IOAudioFamily": { + "hash": "sha256-dSSbt9ZoL/Tq2xXwvvXsDmD3Xru7igzdK1MxGL1K+Aw=", + "version": "300.6.1" + }, + "IOBDStorageFamily": { + "hash": "sha256-UgLMsQBe1QLzlbScmPmASBN7VH4YBmNOUX2CEDezjmE=", + "version": "20.100.1" + }, + "IOCDStorageFamily": { + "hash": "sha256-w0YhZ38RBfnxSc74Q8r5UdK+WiWOSAX46r5hahHLnSg=", + "version": "59" + }, + "IODVDStorageFamily": { + "hash": "sha256-1Sa8aZBGNtqJBNHva+YXxET6Wcdm2PgVrTzYT/8qrN4=", + "version": "43" + }, + "IOFWDVComponents": { + "hash": "sha256-WkfkWnzRupEh20U7vjsTta89clhus6GTkOpXQWXw/bM=", + "version": "208" + }, + "IOFireWireAVC": { + "hash": "sha256-7H3WcZC/HuS9xsTNDWRqt+1JzUNK4ndvd4u2ru0GGRE=", + "version": "428" + }, + "IOFireWireFamily": { + "hash": "sha256-2xppN8RJ9cxrHWjPQ4bUIjtupPbzfmrm3rXnT/9QVfc=", + "version": "483" + }, + "IOFireWireSBP2": { + "hash": "sha256-kfhmZy8veqI3/XHDtOTKmKj6P7s+j0B+BiAbcjhGq0M=", + "version": "442" + }, + "IOFireWireSerialBusProtocolTransport": { + "hash": "sha256-WDq2Ak72Jw6gYNIKgZkiexA6LzccrPn1kpSbW5U50ek=", + "version": "257.40.1" + }, + "IOGraphics": { + "hash": "sha256-kEP4RWIZwu3ZPIq9IAPUKM0gIXHr8xD50SnGNFCQRcI=", + "version": "585.1" + }, + "IOHIDFamily": { + "hash": "sha256-QASfvttke+AUx55In4DD4vsQGzC3nbe+MugQQ4ddXGU=", + "version": "1633.100.36" + }, + "IOKitUser": { + "hash": "sha256-NQCRrufElx00B7CqqslBi5BTxf5Zs4lcMcJig4Eab0k=", + "version": "1845.100.19" + }, + "IONetworkingFamily": { + "hash": "sha256-HqTKzrX75mMFYYbxNKwPdXmI7h7t/QWuO3W1Qo//zIo=", + "version": "151.40.1" + }, + "IOSerialFamily": { + "hash": "sha256-wVS4QTx6MBOS0VrwyCZ3s5Usezwaf8rWzmNnfdDTXTU=", + "version": "93" + }, + "IOStorageFamily": { + "hash": "sha256-dy6CYz/z6SwPw0YfC6GLZO2u62Xy8otMDUNrZ5JhTDY=", + "version": "260.100.1" + }, + "IOUSBFamily": { + "hash": "sha256-Z0E3TfKP49toYo1Fo9kElRap8CZ+mVDHy5RIexgJTpA=", + "version": "630.4.5" + }, + "Libc": { + "hash": "sha256-v01g/EtMW/STZQ1neKDMyUGL7sgaCzlwXN0VDaj/Mf0=", + "version": "1439.100.3" + }, + "Libinfo": { + "hash": "sha256-T7KO6zfswjyTIKSdZJCbvfsdqQfPMLj5nheX9iSIl9o=", + "version": "542.40.3" + }, + "Libm": { + "hash": "sha256-p4BndAag9d0XSMYWQ+c4myGv5qXbKx5E1VghudSbpTk=", + "version": "2026" + }, + "Libnotify": { + "hash": "sha256-vcDjdwB5OiTEUdl8ISezzpoHeFttkdvkulY/YbUOZjk=", + "version": "279.40.4" + }, + "Librpcsvc": { + "hash": "sha256-8e8E9TkRTAep3/miyqhF/mSkNdlym12W+AVhXF94+Bg=", + "version": "26" + }, + "Libsystem": { + "hash": "sha256-24T9aD4W71prcpr3MnnaU3pfxIzIwkOz39OyhCwPO/E=", + "version": "1292.100.5" + }, + "OpenDirectory": { + "hash": "sha256-6fSl8PasCZSBfe0ftaePcBuSEO3syb6kK+mfDI6iR7A=", + "version": "146" + }, + "Security": { + "hash": "sha256-o5MyyqDpERvNPvbEfXNgqMIq0YpQV0+ju72C9g/9OdI=", + "version": "59754.100.106" + }, + "architecture": { + "hash": "sha256-pIX9pEXE1Xjll9qwiWrMRwqw6G4g0isto/ALHsmkUSc=", + "version": "279" + }, + "configd": { + "hash": "sha256-WEorIW5Vl8E9/aB0RBTY2bhkfVOF3tckjNztGDOOueA=", + "version": "1109.101.1" + }, + "copyfile": { + "hash": "sha256-3BHFM67dvwUpinzF0pSX3QiUbIsqtLo77WzB3tMbTW4=", + "version": "173.40.2" + }, + "dtrace": { + "hash": "sha256-FfyaYjEMDeL9wGdUyZ4eJdkbkp/WpdTGyBvaorwKSi8=", + "version": "370.40.1" + }, + "dyld": { + "hash": "sha256-dtDTh6YqubBI4Z+QeytwGgUmU6tutvonIWHqzw6zuxo=", + "version": "851.27" + }, + "eap8021x": { + "hash": "sha256-Ap7qumn/oKYe424n2NW6QkuivgDyLoJgDfl30Q5O7Jo=", + "version": "304.100.1" + }, + "hfs": { + "hash": "sha256-MSnc1pB8DcB+mn308snTD1uRQ7Ro4aWyFuLdWjHtAG4=", + "version": "556.100.11" + }, + "launchd": { + "hash": "sha256-8mW9bnuHmRXCx9py8Wy28C5b2QPICW0rlAps5njYa00=", + "version": "842.1.4" + }, + "libclosure": { + "hash": "sha256-UgmMnDUosaC2yI7IyQ7mkNwZ6/oft77ay+SmGSoycIw=", + "version": "79" + }, + "libdispatch": { + "hash": "sha256-K8QL9NfjGsj8c0jbocKegmKBqydimpKu8yRXnQQqdH8=", + "version": "1271.100.5" + }, + "libmalloc": { + "hash": "sha256-k3dJk7S0Lom3B28vRI9QxIuo0AOkd9OHzWO7MandfUw=", + "version": "317.100.9" + }, + "libplatform": { + "hash": "sha256-BSIGgKj5B6Dr0KQiIl2LSA3+ZEhzk/snQeCauErcq6k=", + "version": "254.80.2" + }, + "libpthread": { + "hash": "sha256-cGaDXLTztUYppbMvv41qj5RqONXfhfdHpt9dqY6+5Lc=", + "version": "454.100.8" + }, + "mDNSResponder": { + "hash": "sha256-eqcv174vIwWYXrIhzph+KO1zG8TdK5jRFVgsaAlV9es=", + "version": "1310.100.10" + }, + "objc4": { + "hash": "sha256-rqOPyN9S4KbMhCCVvtyEmGxTWzy+tsh0kfu3k47szXo=", + "version": "818.2" + }, + "ppp": { + "hash": "sha256-pSOlu/yXQhopCHDLnmhUnQeU89MkXhkQB0ZrN9r3qyk=", + "version": "877.40.2" + }, + "removefile": { + "hash": "sha256-B79A9AQ1/cB+zlmVKWcEXVOJHW6rOrX40S/hrMuWqXU=", + "version": "49.101.1" + }, + "xnu": { + "hash": "sha256-M1XWippH55VUJu4aosRFX8j9aOm/PONYVjPZOPufD80=", + "version": "7195.101.1" + } + } +} diff --git a/pkgs/by-name/ap/apple-sdk/metadata/disallowed-packages.json b/pkgs/by-name/ap/apple-sdk/metadata/disallowed-packages.json new file mode 100644 index 0000000000000..4c225b9af1d2f --- /dev/null +++ b/pkgs/by-name/ap/apple-sdk/metadata/disallowed-packages.json @@ -0,0 +1,554 @@ +[ + { + "package": "apache", + "headers": [ + "apache2" + ] + }, + { + "package": "apr", + "headers": [ + "apr-1" + ], + "libraries": [ + "libapr-1.*", + "libaprutil-1.*" + ] + }, + { + "package": "boringssl", + "libraries": [ + "libboringssl.*" + ] + }, + { + "package": "bzip2", + "headers": [ + "bzlib.h" + ], + "libraries": [ + "libbz2.*" + ] + }, + { + "package": "corecrypto", + "libraries": [ + "system/libcorecrypto*" + ] + }, + { + "package": "Csu", + "libraries": [ + "*.o" + ] + }, + { + "package": "cups", + "headers": [ + "cups" + ], + "libraries": [ + "libcups*" + ] + }, + { + "package": "curl", + "headers": [ + "curl" + ], + "libraries": [ + "libcurl.*" + ] + }, + { + "package": "cyrus_sasl", + "headers": [ + "sasl" + ], + "libraries": [ + "libsasl*" + ] + }, + { + "package": "dtrace", + "headers": [ + "dtrace.h" + ], + "libraries": [ + "*dtrace*" + ] + }, + { + "package": "editline", + "headers": [ + "editline.h", + "editline" + ], + "libraries": [ + "libedit.*", + "libeditline.*" + ] + }, + { + "package": "html-tidy", + "headers": [ + "tidy*" + ], + "libraries": [ + "libtidy.*" + ] + }, + { + "package": "hunspell", + "headers": [ + "hunspell" + ], + "libraries": [ + "libhunspell*" + ] + }, + { + "package": "icu", + "headers": [ + "unicode" + ], + "libraries": [ + "libicucore.*" + ] + }, + { + "package": "libarchive", + "headers": [ + "archive.h", + "archive_entry.h" + ], + "libraries": [ + "libarchive.*" + ] + }, + { + "package": "libc++", + "headers": [ + "c++", + "cxxabi.h", + "__cxxabi_config.h" + ], + "libraries": [ + "libc++*" + ] + }, + { + "package": "ld64", + "libraries": [ + "libcodedirectory.*", + "libcodedirectory_static.*" + ] + }, + { + "package": "expat", + "headers": [ + "expat.h", + "expat_config.h", + "expat_external.h" + ], + "libraries": [ + "libexpat.*" + ] + }, + { + "package": "libffi", + "headers": [ + "ffi*" + ], + "libraries": [ + "libffi*" + ] + }, + { + "package": "libgcc", + "libraries": [ + "libgcc*" + ] + }, + { + "package": "libiconv", + "headers": [ + "iconv.h", + "libcharset.h", + "localcharset.h" + ], + "libraries": [ + "libcharset.*", + "libiconv.*", + "i18n" + ] + }, + { + "package": "libiodbc", + "libraries": [ + "libiodbc*" + ] + }, + { + "package": "libkrb4", + "libraries": [ + "libkrb4.*" + ] + }, + { + "package": "libkrb5", + "headers": [ + "com_err.h", + "gssapi", + "gssapi.h", + "gssrpc", + "kadm5", + "kdb.h", + "krad.h", + "krb5", + "krb5.h", + "profile.h", + "verto-module.h", + "verto.h" + ], + "libraries": [ + "krb5", + "libcom_err.*", + "libgssapi_krb5.*", + "libgssrpc.*", + "libk5crypto.*", + "libkadm5clnt.*", + "libkadm5clnt_mit.*", + "libkadm5srv.*", + "libkadm5srv_mit.*", + "libkdb5.*", + "libkrad.*", + "libkrb5*", + "libkrb5support.*", + "libverto.*" + ] + }, + { + "package": "libpcap", + "headers": [ + "pcap*" + ], + "libraries": [ + "libpcap.*" + ] + }, + { + "package": "libresolv", + "headers": [ + "arpa/nameser.h", + "arpa/nameser_compat.h", + "dns.h", + "dns_util.h", + "nameser.h", + "resolv.h" + ], + "libraries": [ + "libresolv.*" + ] + }, + { + "package": "libstdc++", + "libraries": [ + "libstdc++.*" + ] + }, + { + "package": "libsbuf", + "headers": [ + "usbuf.h" + ], + "libraries": [ + "libsbuf.*" + ] + }, + { + "package": "libtermcap", + "headers": [ + "termcap.h" + ], + "libraries": [ + "libtermcap.*" + ] + }, + { + "package": "libutil", + "headers": [ + "libutil.h" + ], + "libraries": [ + "libutil.*", + "libutil1.*" + ] + }, + { + "package": "libxml2", + "headers": [ + "libxml", + "libxml2" + ], + "libraries": [ + "libxml2.*" + ] + }, + { + "package": "libxo", + "headers": [ + "libxo" + ], + "libraries": [ + "libxo.*" + ] + }, + { + "package": "libxslt", + "headers": [ + "libexslt", + "libxslt" + ], + "libraries": [ + "libexslt.*", + "libxslt.*" + ] + }, + { + "package": "liby", + "libraries": [ + "liby.a" + ] + }, + { + "package": "marisa-trie", + "libraries": [ + "libmarisa.*" + ] + }, + { + "package": "ncurses", + "headers": [ + "curses*", + "cursslk.h", + "eti.h", + "etip.h", + "form.h", + "menu.h", + "nc_tparm.h", + "ncurses*", + "panel.h", + "term.h", + "term_entry.h", + "termcap.h", + "tic.h", + "unctrl.h" + ], + "libraries": [ + "libcurses.*", + "libform.*", + "libformw.*", + "libmenu.*", + "libmenuw.*", + "libncurses.*", + "libncursesw.*", + "libpanel.*", + "libpanelw.*", + "libtinfo.*" + ] + }, + { + "package": "net-snmp", + "headers": [ + "net-snmp" + ], + "libraries": [ + "libnetsnmp*" + ] + }, + { + "package": "nghttp", + "libraries": [ + "lib*nghttp2.*" + ] + }, + { + "package": "openblas", + "headers": [ + "cblas.h", + "f77blas.h", + "lapack.h", + "lapacke.h", + "lapacke_config.h", + "lapacke_mangling.h", + "lapacke_utils.h", + "openblas_config.h" + ], + "libraries": [ + "libblas.*", + "libcblas.*", + "libclapack.*", + "libf77lapack.*", + "liblapack.*", + "liblapacke.*", + "libopenblas.*", + "libopenblas.*", + "libopenblasp*" + ] + }, + { + "package": "openldap", + "headers": [ + "lber.h", + "lber_types.h", + "ldap.h", + "ldap_cdefs.h", + "ldap_features.h", + "ldap_schema.h", + "ldap_utf8.h", + "ldif.h", + "openldap.h", + "slapi-plugin.h" + ], + "libraries": [ + "liblber.*", + "liblber_r.*", + "libldap.*", + "libldap_r.*" + ] + }, + { + "package": "openpam", + "headers": [ + "security" + ], + "libraries": [ + "libpam.*", + "pam_*" + ] + }, + { + "package": "pcre", + "headers": [ + "pcre.h", + "pcreposix.h" + ], + "libraries": [ + "libpcre.*", + "libpcre2*", + "libpcreposix.*" + ] + }, + { + "package": "php", + "headers": [ + "php" + ], + "libraries": [ + "php" + ] + }, + { + "package": "postgresql", + "libraries": [ + "libecpg*", + "libpg*", + "libpq*" + ] + }, + { + "package": "python", + "headers": [ + "python*" + ], + "frameworks": [ + "Python.framework" + ], + "libraries": [ + "libpython*", + "python*" + ] + }, + { + "package": "readline", + "headers": [ + "readline" + ], + "libraries": [ + "libhistory.*", + "libreadline.*" + ] + }, + { + "package": "ruby", + "frameworks": [ + "Ruby.framework" + ], + "libraries": [ + "libruby.*", + "ruby" + ] + }, + { + "package": "sqlite3", + "headers": [ + "sqlite3.h", + "sqlite3ext.h" + ], + "libraries": [ + "libsqlite3.*" + ] + }, + { + "package": "swift", + "libraries": [ + "swift/shims" + ] + }, + { + "package": "tcl", + "headers": [ + "tcl*", + "tk*" + ], + "frameworks": [ + "Tcl.framework", + "Tk.framework" + ], + "libraries": [ + "libtcl*", + "libtk*", + "tclConfig.sh", + "tkConfig.sh" + ] + }, + { + "package": "xar", + "headers": [ + "xar" + ], + "libraries": [ + "libxar.*" + ] + }, + { + "package": "xz", + "headers": [ + "lzma*" + ], + "libraries": [ + "liblzma.*" + ] + }, + { + "package": "zlib", + "headers": [ + "zconf.h", + "zlib.h" + ], + "libraries": [ + "libz.*" + ] + } +] diff --git a/pkgs/by-name/ap/apple-sdk/metadata/versions.json b/pkgs/by-name/ap/apple-sdk/metadata/versions.json new file mode 100644 index 0000000000000..3b7f086c55441 --- /dev/null +++ b/pkgs/by-name/ap/apple-sdk/metadata/versions.json @@ -0,0 +1,12 @@ +{ + "10.12": { + "url": "http://swcdn.apple.com/content/downloads/22/62/041-88607/wg8avdk0jo75k9a13gentz9stwqgrqmcv6/CLTools_SDK_OSX1012.pkg", + "version": "10.12.2", + "hash": "sha256-Jf2WIB9bY/rPwe0AOW3YWJY/6EqVe41yhezdTGOO3M8=" + }, + "11": { + "url": "https://swcdn.apple.com/content/downloads/02/62/071-54303-A_EU2CL1YVT7/943i95dpeyi2ghlnj2mgyq3t202t5gf18b/CLTools_macOSNMOS_SDK.pkg", + "version": "11.3", + "hash": "sha256-/go8utcx3jprf6c8V/DUbXwsmNYSFchOAai1OaJs3Bg=" + } +} diff --git a/pkgs/by-name/ap/apple-sdk/package.nix b/pkgs/by-name/ap/apple-sdk/package.nix new file mode 100644 index 0000000000000..2fb57182001c3 --- /dev/null +++ b/pkgs/by-name/ap/apple-sdk/package.nix @@ -0,0 +1,120 @@ +let + sdkVersions = builtins.fromJSON (builtins.readFile ./metadata/versions.json); +in + +{ + lib, + stdenv, + stdenvNoCC, + substitute, + + # Specifies the major version used for the SDK. Uses `hostPlatform.darwinSdkVersion` by default. + darwinSdkMajorVersion ? ( + if lib.versionOlder stdenv.hostPlatform.darwinSdkVersion "11" then + lib.versions.majorMinor stdenv.hostPlatform.darwinSdkVersion + else + lib.versions.major stdenv.hostPlatform.darwinSdkVersion + ), + # Enabling bootstrap disables propagation. Defaults to `false` (meaning to propagate certain packages and `xcrun`) + # except in stage0 of the Darwin stdenv bootstrap. + enableBootstrap ? stdenv.name == "bootstrap-stage0-stdenv-darwin", + + # Required by various phases + callPackage, + jq, +}: + +let + sdkInfo = + sdkVersions.${darwinSdkMajorVersion} + or (lib.throw "Unsupported SDK major version: ${darwinSdkMajorVersion}"); + sdkVersion = sdkInfo.version; + + fetchSDK = callPackage ./common/fetch-sdk.nix { }; + + phases = lib.composeManyExtensions ( + [ + (callPackage ./common/add-core-symbolication.nix { }) + (callPackage ./common/derivation-options.nix { }) + (callPackage ./common/passthru-private-frameworks.nix { inherit sdkVersion; }) + (callPackage ./common/passthru-source-release-files.nix { inherit sdkVersion; }) + (callPackage ./common/remove-disallowed-packages.nix { }) + ] + # Only process stubs and convert them to tbd-v4 if jq is available. This can be made unconditional once + # the bootstrap tools have jq and libtapi. + ++ lib.optional (jq != null) (callPackage ./common/process-stubs.nix { }) + # Avoid infinite recursions by not propagating certain packages, so they can themselves build with the SDK. + ++ lib.optionals (!enableBootstrap) [ + (callPackage ./common/propagate-inputs.nix { }) + (callPackage ./common/propagate-xcrun.nix { }) + ] + ++ [ + # These have to happen last. + (callPackage ./common/rewrite-sdk-paths.nix { inherit sdkVersion; }) + (callPackage ./common/run-build-phase-hooks.nix { }) + ] + ); +in +stdenvNoCC.mkDerivation ( + lib.extends phases (finalAttrs: { + pname = "apple-sdk"; + inherit (sdkInfo) version; + + src = fetchSDK sdkInfo; + + dontConfigure = true; + + strictDeps = true; + + setupHooks = [ + # `role.bash` is copied from `../build-support/setup-hooks/role.bash` due to the requirements not to reference + # paths outside the package when it is in `by-name`. It needs to be kept in sync, but it fortunately does not + # change often. Once `build-support` is available as a package (or some other mechanism), it should be changed + # to whatever that replacement is. + ./setup-hooks/role.bash + (substitute { + src = ./setup-hooks/sdk-hook.sh; + substitutions = [ + "--subst-var-by" + "sdkVersion" + (lib.escapeShellArgs (lib.splitVersion sdkVersion)) + ]; + }) + ]; + + installPhase = + let + sdkName = "MacOSX${lib.versions.majorMinor sdkVersion}.sdk"; + sdkMajor = lib.versions.major sdkVersion; + in + '' + runHook preInstall + + mkdir -p "$sdkpath" + + cp -rd . "$sdkpath/${sdkName}" + ${lib.optionalString (lib.versionAtLeast finalAttrs.version "11.0") '' + ln -s "${sdkName}" "$sdkpath/MacOSX${sdkMajor}.sdk" + ''} + ln -s "${sdkName}" "$sdkpath/MacOSX.sdk" + + runHook postInstall + ''; + + passthru = { + sdkroot = finalAttrs.finalPackage + "/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk"; + }; + + __structuredAttrs = true; + + meta = { + description = "Frameworks and libraries required for building packages on Darwin"; + homepage = "https://developer.apple.com"; + maintainers = lib.teams.darwin.members; + platforms = lib.platforms.darwin; + badPlatforms = + lib.optionals (lib.versionAtLeast sdkVersion "10.15") [ lib.systems.inspect.patterns.is32bit ] + ++ lib.optionals (lib.versionOlder sdkVersion "11.0") [ lib.systems.inspect.patterns.isAarch ]; + }; + }) +) diff --git a/pkgs/by-name/ap/apple-sdk/patches/0001-Add-function-definitions-needed-to-build-zlog-in-sys.patch b/pkgs/by-name/ap/apple-sdk/patches/0001-Add-function-definitions-needed-to-build-zlog-in-sys.patch new file mode 100644 index 0000000000000..681970cb2f71a --- /dev/null +++ b/pkgs/by-name/ap/apple-sdk/patches/0001-Add-function-definitions-needed-to-build-zlog-in-sys.patch @@ -0,0 +1,48 @@ +From 6531da946949a94643e6d8424236174ae64fe0ca Mon Sep 17 00:00:00 2001 +From: Randy Eckenrode +Date: Sat, 30 Sep 2023 18:02:39 -0400 +Subject: [PATCH 1/2] Add function definitions needed to build zlog in + system_cmds + +--- + CoreSymbolication.h | 10 +++++++--- + 1 file changed, 7 insertions(+), 3 deletions(-) + +diff --git a/CoreSymbolication.h b/CoreSymbolication.h +index a413860..f3cf63f 100644 +--- a/CoreSymbolication.h ++++ b/CoreSymbolication.h +@@ -324,7 +324,9 @@ CSSymbolOwnerEditRelocations + CSSymbolOwnerForeachRegion + CSSymbolOwnerForeachRegionWithName + CSSymbolOwnerForeachSection +-CSSymbolOwnerForeachSegment ++*/ ++void CSSymbolOwnerForeachSegment(CSSymbolOwnerRef owner, void (^block)(CSSegmentRef)); ++/* + CSSymbolOwnerForeachSourceInfo + CSSymbolOwnerForeachSymbol + */ +@@ -333,7 +335,9 @@ void CSSymbolOwnerForeachSymbolWithName(CSSymbolOwnerRef owner, const char *sna + /* + CSSymbolOwnerGetArchitecture + CSSymbolOwnerGetBaseAddress +-CSSymbolOwnerGetCFUUIDBytes ++*/ ++const CFUUIDBytes* CSSymbolOwnerGetCFUUIDBytes(CSSymbolOwnerRef owner); ++/* + CSSymbolOwnerGetCompatibilityVersion + CSSymbolOwnerGetCurrentVersion + CSSymbolOwnerGetDataFlags +@@ -390,7 +394,7 @@ CSSymbolOwnerSetLoadTimestamp + CSSymbolOwnerSetPath + CSSymbolOwnerSetRelocationCount + */ +-CSSymbolOwnerSetTransientUserData(CSSymbolOwnerRef owner, uint32_t gen); ++void CSSymbolOwnerSetTransientUserData(CSSymbolOwnerRef owner, uint32_t gen); + /* + CSSymbolOwnerSetUnloadTimestamp + */ +-- +2.44.1 + diff --git a/pkgs/by-name/ap/apple-sdk/patches/0002-Add-CF_EXPORT-To-const-symbols.patch b/pkgs/by-name/ap/apple-sdk/patches/0002-Add-CF_EXPORT-To-const-symbols.patch new file mode 100644 index 0000000000000..01f934be6ef4f --- /dev/null +++ b/pkgs/by-name/ap/apple-sdk/patches/0002-Add-CF_EXPORT-To-const-symbols.patch @@ -0,0 +1,45 @@ +From ae7ac6a7043dbae8e63d6ce5e63dfaf02b5977fe Mon Sep 17 00:00:00 2001 +From: Randy Eckenrode +Date: Sat, 30 Sep 2023 18:37:18 -0400 +Subject: [PATCH 2/2] Add CF_EXPORT To const symbols + +--- + CoreSymbolication.h | 15 ++++++++------- + 1 file changed, 8 insertions(+), 7 deletions(-) + +diff --git a/CoreSymbolication.h b/CoreSymbolication.h +index f3cf63f..4124a54 100644 +--- a/CoreSymbolication.h ++++ b/CoreSymbolication.h +@@ -49,6 +49,7 @@ + + + #include ++#include + #include + + +@@ -139,13 +140,13 @@ typedef void (^CSSegmentIterator)(CSSegmentRef segment); + * External symbols + */ + +-const char* kCSRegionMachHeaderName; +-const CSDictionaryKeyCallBacks kCSTypeDictionaryKeyCallBacks; +-const CSDictionaryValueCallBacks kCSTypeDictionaryValueCallBacks; +-const CSDictionaryKeyCallBacks kCSTypeDictionaryWeakKeyCallBacks; +-const CSDictionaryValueCallBacks kCSTypeDictionaryWeakValueCallBacks; +-const CSSetCallBacks kCSTypeSetCallBacks; +-const CSSetCallBacks kCSTypeSetWeakCallBacks; ++CF_EXPORT const char* kCSRegionMachHeaderName; ++CF_EXPORT const CSDictionaryKeyCallBacks kCSTypeDictionaryKeyCallBacks; ++CF_EXPORT const CSDictionaryValueCallBacks kCSTypeDictionaryValueCallBacks; ++CF_EXPORT const CSDictionaryKeyCallBacks kCSTypeDictionaryWeakKeyCallBacks; ++CF_EXPORT const CSDictionaryValueCallBacks kCSTypeDictionaryWeakValueCallBacks; ++CF_EXPORT const CSSetCallBacks kCSTypeSetCallBacks; ++CF_EXPORT const CSSetCallBacks kCSTypeSetWeakCallBacks; + + + /* +-- +2.44.1 + diff --git a/pkgs/by-name/ap/apple-sdk/scripts/get-sdks-from-catalog.sh b/pkgs/by-name/ap/apple-sdk/scripts/get-sdks-from-catalog.sh new file mode 100755 index 0000000000000..1293fab11cc92 --- /dev/null +++ b/pkgs/by-name/ap/apple-sdk/scripts/get-sdks-from-catalog.sh @@ -0,0 +1,41 @@ +#!/usr/bin/env nix-shell +#!nix-shell -i bash -p coreutils curl file gzip jq xcbuild yq + +set -eu -o pipefail + +catalog=${1-} + +if [ -z "$catalog" ]; then + echo "usage: get-sdks-from-catalog.sh " + echo " Apple software update catalog (may be gzipped)" >&2 + exit 1 +fi + +scratch=$(mktemp) +trap 'rm -f -- "$scratch"' EXIT + +if [[ "$(file "$catalog")" =~ gzip ]]; then + gzcat "$catalog" > "$scratch" +else + cp --reflink=auto "$catalog" "$scratch" +fi + +# Grab all SDK packages from the catalog +filter='.Products[].Packages[] | select(.URL | test(".*CLTools_macOSNMOS_SDK.pkg")) | "\(.URL)|\(.MetadataURL)"' + +declare -A package_list +for package in $(plutil -convert json -o - "$scratch" | jq -r "$filter"); do + package_list[${package%%|*}]=${package#*|} +done + +truncate --size 0 "$scratch" +for pkg in "${!package_list[@]}"; do + ver=$(curl --silent "${package_list[$pkg]}" | xq -r '."pkg-info"."@version"') + echo "{\"url\": \"$pkg\", \"version\": \"$(cut -d. -f1-3 <<< "$ver")\", \"long_version\": \"$ver\"}" >> "$scratch" +done + +jq -r --slurp ' + group_by(.version | split(".")[0]) + | map(max_by(.version)) + | sort_by(.version)[] + | "Package URL: \(.url)\n Xcode Ver: \(.version) (\(.long_version))\n"' "$scratch" diff --git a/pkgs/by-name/ap/apple-sdk/scripts/lock-sdk-deps.sh b/pkgs/by-name/ap/apple-sdk/scripts/lock-sdk-deps.sh new file mode 100755 index 0000000000000..ce2c1f1aeb534 --- /dev/null +++ b/pkgs/by-name/ap/apple-sdk/scripts/lock-sdk-deps.sh @@ -0,0 +1,69 @@ +#!/usr/bin/env nix-shell +#!nix-shell -i bash -p coreutils curl git gnutar jq moreutils nix + +set -eu -o pipefail + +if [ ! -v 2 ]; then + echo "usage: lock-sdk-deps.sh " >&2 + echo " Decimal-separated version number." >&2 + echo " Must correspond to a tag in https://github.com/apple-oss-distributions/distribution-macOS" >&2 + echo " List of packages from the distributions-macOS repository." >&2 + echo " Packages not in the repository at the tag for will be ignored." + exit 1 +fi + +pkgdir=$(dirname "$(dirname "$(realpath "$0")")") + +lockfile=$pkgdir/metadata/apple-oss-lockfile.json +if [ ! -e "$lockfile" ]; then + touch "$lockfile" +fi + +workdir=$(mktemp -d) +trap 'rm -rf -- "$workdir"' EXIT + +sdkVersion=$1; shift +tag="macos-${sdkVersion//.}" + +declare -a packages=("$@") + +echo "Locking versions for macOS $sdkVersion using tag '$tag'..." + +pushd "$workdir" > /dev/null + +git clone --branch "$tag" https://github.com/apple-oss-distributions/distribution-macOS.git &> /dev/null +cd distribution-macOS + +for package in "${packages[@]}"; do + # If the tag exists in `release.json`, use that as an optimization to avoid downloading unnecessarily from Github. + packageTag=$(jq -r --arg package "$package" '.projects[] | select(.project == $package) | .tag' release.json) + packageCommit=$(git ls-tree -d HEAD "$package" | awk '{print $3}') + + if [ ! -d "$package" ]; then + packageCommit=HEAD + fi + + # However, sometimes it doesn’t exist. In that case, fall back to cloning the repo and check manually + # which tag corresponds to the commit from the submodule. + if [ -z "$packageTag" ]; then + git clone --no-checkout "https://github.com/apple-oss-distributions/$package.git" ../source &> /dev/null + pushd ../source > /dev/null + packageTag=$(git tag --points-at "$packageCommit") + popd > /dev/null + rm -rf ../source + fi + + packageVersion=${packageTag##"$package"-} + + curl -OL "https://github.com/apple-oss-distributions/$package/archive/$packageTag.tar.gz" &> /dev/null + tar axf "$packageTag.tar.gz" + + packageHash=$(nix --extra-experimental-features nix-command hash path "$package-$packageTag") + + pkgsjson="{\"$package\": {\"version\": \"$packageVersion\", \"hash\": \"$packageHash\"}}" + + echo " - Locking $package to version $packageVersion with hash '$packageHash'" + jq --argjson pkg "$pkgsjson" -S '. * $pkg' "$lockfile" | sponge "$lockfile" +done + +popd > /dev/null diff --git a/pkgs/by-name/ap/apple-sdk/scripts/regenerate-lockfile.sh b/pkgs/by-name/ap/apple-sdk/scripts/regenerate-lockfile.sh new file mode 100755 index 0000000000000..3922916e6135d --- /dev/null +++ b/pkgs/by-name/ap/apple-sdk/scripts/regenerate-lockfile.sh @@ -0,0 +1,62 @@ +#!/usr/bin/env nix-shell +#!nix-shell -i bash -p coreutils jq + +set -eu -o pipefail + +pkgdir=$(dirname "$(dirname "$(realpath "$0")")") + +echo '{}' > "$pkgdir/metadata/apple-oss-lockfile.json" + +declare -a versions +readarray -t versions < <(jq -r '.[].version' "$pkgdir/metadata/versions.json") + +declare -a packages=( + CarbonHeaders + CommonCrypto + IOAudioFamily + IOFireWireFamily + IOFWDVComponents + IOFireWireAVC + IOFireWireSBP2 + IOFireWireSerialBusProtocolTransport + IOGraphics + IOHIDFamily + IONetworkingFamily + IOSerialFamily + IOStorageFamily + IOBDStorageFamily + IOCDStorageFamily + IODVDStorageFamily + IOUSBFamily + IOKitUser + Libc + Libinfo + Libm + Libnotify + Librpcsvc + Libsystem + OpenDirectory + Security + architecture + configd + copyfile + dtrace + dyld + eap8021x + hfs + launchd + libclosure + libdispatch + libmalloc + libplatform + libpthread + mDNSResponder + objc4 + ppp + removefile + xnu +) + +for version in "${versions[@]}"; do + "$pkgdir/scripts/lock-sdk-deps.sh" "$version" "${packages[@]}" +done diff --git a/pkgs/by-name/ap/apple-sdk/setup-hooks/add-private-frameworks.sh b/pkgs/by-name/ap/apple-sdk/setup-hooks/add-private-frameworks.sh new file mode 100644 index 0000000000000..d5c48e3dd8799 --- /dev/null +++ b/pkgs/by-name/ap/apple-sdk/setup-hooks/add-private-frameworks.sh @@ -0,0 +1,6 @@ +function enablePrivateFrameworks() { + export NIX_CFLAGS_COMPILE+=" -iframework $DEVELOPER_DIR/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/PrivateFrameworks" + export NIX_LDFLAGS+=" -F$DEVELOPER_DIR/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/PrivateFrameworks" +} + +preConfigureHooks+=(enablePrivateFrameworks) diff --git a/pkgs/by-name/ap/apple-sdk/setup-hooks/role.bash b/pkgs/by-name/ap/apple-sdk/setup-hooks/role.bash new file mode 100644 index 0000000000000..bfd6b61f0aed6 --- /dev/null +++ b/pkgs/by-name/ap/apple-sdk/setup-hooks/role.bash @@ -0,0 +1,71 @@ +# Since the same derivation can be depended on in multiple ways, we need to +# accumulate *each* role (i.e. host and target platforms relative the depending +# derivation) in which the derivation is used. +# +# The role is intended to be used as part of other variables names like +# - $NIX_SOMETHING${role_post} + +function getRole() { + case $1 in + -1) + role_post='_FOR_BUILD' + ;; + 0) + role_post='' + ;; + 1) + role_post='_FOR_TARGET' + ;; + *) + echo "@name@: used as improper sort of dependency" >&2 + return 1 + ;; + esac +} + +# `hostOffset` describes how the host platform of the package is slid relative +# to the depending package. `targetOffset` likewise describes the target +# platform of the package. Both are brought into scope of the setup hook defined +# for dependency whose setup hook is being processed relative to the package +# being built. + +function getHostRole() { + getRole "$hostOffset" +} +function getTargetRole() { + getRole "$targetOffset" +} + +# `depHostOffset` describes how the host platform of the dependencies are slid +# relative to the depending package. `depTargetOffset` likewise describes the +# target platform of dependenices. Both are brought into scope of the +# environment hook defined for the dependency being applied relative to the +# package being built. + +function getHostRoleEnvHook() { + getRole "$depHostOffset" +} +function getTargetRoleEnvHook() { + getRole "$depTargetOffset" +} + +# This variant is intended specifically for code-producing tool wrapper scripts +# `NIX_@wrapperName@_TARGET_*_@suffixSalt@` tracks this (needs to be an exported +# env var so can't use fancier data structures). +function getTargetRoleWrapper() { + case $targetOffset in + -1) + export NIX_@wrapperName@_TARGET_BUILD_@suffixSalt@=1 + ;; + 0) + export NIX_@wrapperName@_TARGET_HOST_@suffixSalt@=1 + ;; + 1) + export NIX_@wrapperName@_TARGET_TARGET_@suffixSalt@=1 + ;; + *) + echo "@name@: used as improper sort of dependency" >&2 + return 1 + ;; + esac +} diff --git a/pkgs/by-name/ap/apple-sdk/setup-hooks/sdk-hook.sh b/pkgs/by-name/ap/apple-sdk/setup-hooks/sdk-hook.sh new file mode 100644 index 0000000000000..62fa8b339a711 --- /dev/null +++ b/pkgs/by-name/ap/apple-sdk/setup-hooks/sdk-hook.sh @@ -0,0 +1,17 @@ +local role_post +getHostRole + +local sdkVersionVar=NIX_APPLE_SDK_VERSION${role_post} +local developerDirVar=DEVELOPER_DIR${role_post} + +local sdkVersionArr=(@sdkVersion@) +local sdkVersion +sdkVersion=$(printf "%02d%02d%02d" "${sdkVersionArr[0]-0}" "${sdkVersionArr[1]-0}" "${sdkVersionArr[2]-0}") + +if [ "$sdkVersion" -gt "${!sdkVersionVar-000000}" ]; then + export "$developerDirVar"='@out@' + export "$sdkVersionVar"="$sdkVersion" + export "SDKROOT${role_post}"="${!developerDirVar}/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk" +fi + +unset -v role_post developerDirVar sdkVersion sdkVersionArr sdkVersionVar diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index fd4ca3df70c78..c520299026aea 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -23742,6 +23742,9 @@ with pkgs; ### DEVELOPMENT / LIBRARIES / DARWIN SDKS + apple-sdk_10_12 = callPackage ../by-name/ap/apple-sdk/package.nix { darwinSdkMajorVersion = "10.12"; }; + apple-sdk_11 = callPackage ../by-name/ap/apple-sdk/package.nix { darwinSdkMajorVersion = "11"; }; + darwinMinVersionHook = deploymentTarget: makeSetupHook { From 3fb982d0e2aab9b17591099caf53331e535295a3 Mon Sep 17 00:00:00 2001 From: Randy Eckenrode Date: Fri, 20 Sep 2024 20:41:00 -0400 Subject: [PATCH 010/157] apple-sdk_10_13: init at 10.13.2 --- .../metadata/apple-oss-lockfile.json | 178 ++++++++++++++++++ .../metadata/disallowed-packages.json | 9 - .../ap/apple-sdk/metadata/versions.json | 5 + pkgs/top-level/all-packages.nix | 1 + 4 files changed, 184 insertions(+), 9 deletions(-) diff --git a/pkgs/by-name/ap/apple-sdk/metadata/apple-oss-lockfile.json b/pkgs/by-name/ap/apple-sdk/metadata/apple-oss-lockfile.json index 9340931ca473b..ef113d3ca7c46 100644 --- a/pkgs/by-name/ap/apple-sdk/metadata/apple-oss-lockfile.json +++ b/pkgs/by-name/ap/apple-sdk/metadata/apple-oss-lockfile.json @@ -177,6 +177,184 @@ "version": "3789.31.2" } }, + "10.13.2": { + "CarbonHeaders": { + "hash": "sha256-nIPXnLr21yVnpBhx9K5q3l/nPARA6JL/dED08MeyhP8=", + "version": "18.1" + }, + "CommonCrypto": { + "hash": "sha256-3vx4HPlHP8PNi1GodeRh2iOEhyRBct3vX0Guc8060+I=", + "version": "60118.30.2" + }, + "IOAudioFamily": { + "hash": "sha256-UG09Dc+up5cJKDHPpCmo11IsBchqZ72hVBPx8y+1klw=", + "version": "206.5" + }, + "IOBDStorageFamily": { + "hash": "sha256-aaS5jWPRX4be8d3Rigq+kXzi9Zwbr8dHcNgcIz0n66o=", + "version": "19" + }, + "IOCDStorageFamily": { + "hash": "sha256-U6v+Gj+IumU8Aha5+uf3yOU0Z4KMuBh7aXnJqiZ/abY=", + "version": "58" + }, + "IODVDStorageFamily": { + "hash": "sha256-JLp4xN0Rdb2VpuXtVTODYNqQthDEZk+g/lvHRwJHQB4=", + "version": "42" + }, + "IOFWDVComponents": { + "hash": "sha256-WkfkWnzRupEh20U7vjsTta89clhus6GTkOpXQWXw/bM=", + "version": "208" + }, + "IOFireWireAVC": { + "hash": "sha256-4JS+oezknezxud2E2ojYdSx7A8Z9Q4rddetAoUMU1es=", + "version": "425" + }, + "IOFireWireFamily": { + "hash": "sha256-+FPlhMN2h1iCg1GAqH8+MwHG3GIs4DvvE3QGABX+3Rg=", + "version": "468" + }, + "IOFireWireSBP2": { + "hash": "sha256-5UWldDuSyAnRYjgIKllY4VNbxtAUawrlRS46+8FnbPs=", + "version": "427" + }, + "IOFireWireSerialBusProtocolTransport": { + "hash": "sha256-a/xnnR2dUSWVMyTlkxJPa7cWk20RHl0Zh2Ot2pSEkF0=", + "version": "252" + }, + "IOGraphics": { + "hash": "sha256-E0wDkVmSeEcyO6L6OeWEQuZ0Ggh7MUkfqeQ9uLUEK/g=", + "version": "517.22" + }, + "IOHIDFamily": { + "hash": "sha256-9FhH53LyP1Yv2/afmr/lpNhl/GNFb/Yg+VpG5Ycg300=", + "version": "1035.30.15" + }, + "IOKitUser": { + "hash": "sha256-LebulFJ4KJ5Vbcjj6SC70cmed/0vhCVYo5qDxCw85SE=", + "version": "1445.31.1" + }, + "IONetworkingFamily": { + "hash": "sha256-gXGFCSn6JnHOVaRKhGXFYdvJBo/AGBMDrUdIcw/CwqI=", + "version": "124.30.1" + }, + "IOSerialFamily": { + "hash": "sha256-wVS4QTx6MBOS0VrwyCZ3s5Usezwaf8rWzmNnfdDTXTU=", + "version": "93" + }, + "IOStorageFamily": { + "hash": "sha256-Jo+0XlNi82KGksyrvUGyVPfmPMlTrDmZ75DT2lH66TY=", + "version": "218.30.1" + }, + "IOUSBFamily": { + "hash": "sha256-Z0E3TfKP49toYo1Fo9kElRap8CZ+mVDHy5RIexgJTpA=", + "version": "630.4.5" + }, + "Libc": { + "hash": "sha256-js2xU5dMF5j209F9Cufuq5WzqcyNusbJDyuPpMgYEZU=", + "version": "1244.30.3" + }, + "Libinfo": { + "hash": "sha256-pVVLb8eOuLVc4HHGcgpl7dqT+Tg2xqKQIQroyLj5OEg=", + "version": "517.30.1" + }, + "Libm": { + "hash": "sha256-p4BndAag9d0XSMYWQ+c4myGv5qXbKx5E1VghudSbpTk=", + "version": "2026" + }, + "Libnotify": { + "hash": "sha256-nsWWqelTEP4nPJI3vG897zpSOxYOgpm8TUVJ04MrWU4=", + "version": "172" + }, + "Librpcsvc": { + "hash": "sha256-8e8E9TkRTAep3/miyqhF/mSkNdlym12W+AVhXF94+Bg=", + "version": "26" + }, + "Libsystem": { + "hash": "sha256-+VFJoiqEtXUcP8ERUxtrKwTWZmgdppr+0oPUxSgIF+c=", + "version": "1252" + }, + "OpenDirectory": { + "hash": "sha256-6fSl8PasCZSBfe0ftaePcBuSEO3syb6kK+mfDI6iR7A=", + "version": "146" + }, + "Security": { + "hash": "sha256-W3bSTDCjj2ftq0wbDp+Z8QfD6TpF4p0fLrVjx2AmvfY=", + "version": "58286.31.2" + }, + "architecture": { + "hash": "sha256-gHUfKWc1uahI/IATafY1ppPAWnYUghOEXWK2lknAfrQ=", + "version": "268" + }, + "configd": { + "hash": "sha256-1YGIbAES4OONFtC2xxXWbM7Htlz2kKtFUULWqBB6fz0=", + "version": "963.30.1" + }, + "copyfile": { + "hash": "sha256-CYTZwieSu1Fm9TLaaevfxDngAPRkEfewY+TgJrREed8=", + "version": "146.30.2" + }, + "dtrace": { + "hash": "sha256-sgLSbCp9tYZ7ws2jgxB3NaAk+ijsIbmybsi0gkbZjFQ=", + "version": "262" + }, + "dyld": { + "hash": "sha256-b1hM+iQl7ihRjHRL4Rcg5AHv5HSyKErVkTb+5KFF2P4=", + "version": "519.2.2" + }, + "eap8021x": { + "hash": "sha256-KZsnzH5JiLfzY3zjMAlJRPCGY5EioW6aDJnMAemZJUY=", + "version": "264.30.3" + }, + "hfs": { + "hash": "sha256-Ine8EFpW1kuNDn/r66abGyvYm+NSGI5TV3v/OlgyIME=", + "version": "407.30.1" + }, + "launchd": { + "hash": "sha256-8mW9bnuHmRXCx9py8Wy28C5b2QPICW0rlAps5njYa00=", + "version": "842.1.4" + }, + "libclosure": { + "hash": "sha256-hfXKQDRdgEDVyT+3v/EuQZyXNd0abD2tICYdQNfhtwY=", + "version": "67" + }, + "libdispatch": { + "hash": "sha256-rvsvtv9VncLxQHoURBBczrTaSgbw5827Qf2TxAPopqA=", + "version": "913.30.4" + }, + "libmalloc": { + "hash": "sha256-VM5jHQYqDkoGmrQ2UugTu+XOLjd1YPqdfddzQkKfhiY=", + "version": "140.1.1" + }, + "libplatform": { + "hash": "sha256-zQ3MYqQoMCsfgG6frwnG3LfKWwauTzgwhoADXVUiGR0=", + "version": "161.20.1" + }, + "libpthread": { + "hash": "sha256-6NLKbnBXikSfqz0ZWF6MOIq/bQK/CmfQNvkNXCU6lcw=", + "version": "301.30.1" + }, + "mDNSResponder": { + "hash": "sha256-anzilyXeGh8LL3cYvuLRdqGzhHUvSp9eILJWAltL18M=", + "version": "878.30.4" + }, + "objc4": { + "hash": "sha256-+4o+EzD0YQhgfTg/W9SbVDol7wWUIFxVAVTGg4OVfHQ=", + "version": "723" + }, + "ppp": { + "hash": "sha256-eUIFlYHsAPRrBS0TpTP1/TacaK8h/5QM2Xl1T46MdWc=", + "version": "847" + }, + "removefile": { + "hash": "sha256-EJYU6eHggyRsezClEWkGJmgePIdtyF4rpFD4kSK5Czw=", + "version": "45" + }, + "xnu": { + "hash": "sha256-x2k0KyNk4mIodXfYDHjaCKR1CsiE3HYBNN6p5SfGIMU=", + "version": "4570.31.3" + } + }, "11.3": { "CarbonHeaders": { "hash": "sha256-nIPXnLr21yVnpBhx9K5q3l/nPARA6JL/dED08MeyhP8=", diff --git a/pkgs/by-name/ap/apple-sdk/metadata/disallowed-packages.json b/pkgs/by-name/ap/apple-sdk/metadata/disallowed-packages.json index 4c225b9af1d2f..2b31160e00738 100644 --- a/pkgs/by-name/ap/apple-sdk/metadata/disallowed-packages.json +++ b/pkgs/by-name/ap/apple-sdk/metadata/disallowed-packages.json @@ -69,15 +69,6 @@ "libsasl*" ] }, - { - "package": "dtrace", - "headers": [ - "dtrace.h" - ], - "libraries": [ - "*dtrace*" - ] - }, { "package": "editline", "headers": [ diff --git a/pkgs/by-name/ap/apple-sdk/metadata/versions.json b/pkgs/by-name/ap/apple-sdk/metadata/versions.json index 3b7f086c55441..b983562017c27 100644 --- a/pkgs/by-name/ap/apple-sdk/metadata/versions.json +++ b/pkgs/by-name/ap/apple-sdk/metadata/versions.json @@ -4,6 +4,11 @@ "version": "10.12.2", "hash": "sha256-Jf2WIB9bY/rPwe0AOW3YWJY/6EqVe41yhezdTGOO3M8=" }, + "10.13": { + "url": "http://swcdn.apple.com/content/downloads/33/36/041-90419-A_7JJ4H9ZHO2/xs88ob5wjz6riz7g6764twblnvksusg4ps/CLTools_SDK_macOS1013.pkg", + "version": "10.13.2", + "hash": "sha256-8nd55fiJLfRWABAbMaHXjp6i20RqupmKedwmhb3S0/A=" + }, "11": { "url": "https://swcdn.apple.com/content/downloads/02/62/071-54303-A_EU2CL1YVT7/943i95dpeyi2ghlnj2mgyq3t202t5gf18b/CLTools_macOSNMOS_SDK.pkg", "version": "11.3", diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index c520299026aea..5581a3f97c1d2 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -23743,6 +23743,7 @@ with pkgs; ### DEVELOPMENT / LIBRARIES / DARWIN SDKS apple-sdk_10_12 = callPackage ../by-name/ap/apple-sdk/package.nix { darwinSdkMajorVersion = "10.12"; }; + apple-sdk_10_13 = callPackage ../by-name/ap/apple-sdk/package.nix { darwinSdkMajorVersion = "10.13"; }; apple-sdk_11 = callPackage ../by-name/ap/apple-sdk/package.nix { darwinSdkMajorVersion = "11"; }; darwinMinVersionHook = From a447cba849ac70a51e636ea7fb0d3585c6730a6d Mon Sep 17 00:00:00 2001 From: Randy Eckenrode Date: Fri, 20 Sep 2024 20:41:00 -0400 Subject: [PATCH 011/157] apple-sdk_10_14: init at 10.14.6 --- .../metadata/apple-oss-lockfile.json | 178 ++++++++++++++++++ .../ap/apple-sdk/metadata/versions.json | 5 + pkgs/top-level/all-packages.nix | 1 + 3 files changed, 184 insertions(+) diff --git a/pkgs/by-name/ap/apple-sdk/metadata/apple-oss-lockfile.json b/pkgs/by-name/ap/apple-sdk/metadata/apple-oss-lockfile.json index ef113d3ca7c46..7b159fa9cd979 100644 --- a/pkgs/by-name/ap/apple-sdk/metadata/apple-oss-lockfile.json +++ b/pkgs/by-name/ap/apple-sdk/metadata/apple-oss-lockfile.json @@ -355,6 +355,184 @@ "version": "4570.31.3" } }, + "10.14.6": { + "CarbonHeaders": { + "hash": "sha256-nIPXnLr21yVnpBhx9K5q3l/nPARA6JL/dED08MeyhP8=", + "version": "18.1" + }, + "CommonCrypto": { + "hash": "sha256-hqsLaS7LEPu8t/bNuV4VUUbMteCetf3/o8e2X0iQvOo=", + "version": "60118.250.2" + }, + "IOAudioFamily": { + "hash": "sha256-UG09Dc+up5cJKDHPpCmo11IsBchqZ72hVBPx8y+1klw=", + "version": "206.5" + }, + "IOBDStorageFamily": { + "hash": "sha256-aaS5jWPRX4be8d3Rigq+kXzi9Zwbr8dHcNgcIz0n66o=", + "version": "19" + }, + "IOCDStorageFamily": { + "hash": "sha256-U6v+Gj+IumU8Aha5+uf3yOU0Z4KMuBh7aXnJqiZ/abY=", + "version": "58" + }, + "IODVDStorageFamily": { + "hash": "sha256-JLp4xN0Rdb2VpuXtVTODYNqQthDEZk+g/lvHRwJHQB4=", + "version": "42" + }, + "IOFWDVComponents": { + "hash": "sha256-WkfkWnzRupEh20U7vjsTta89clhus6GTkOpXQWXw/bM=", + "version": "208" + }, + "IOFireWireAVC": { + "hash": "sha256-EXGpObJVC0b9X3xxEXJScDlM6xygmK3MoCbng21XCmg=", + "version": "426" + }, + "IOFireWireFamily": { + "hash": "sha256-a8zEWhwQTzgGKg75RBmDXb1pgJr602IxnPBTFkKEqSM=", + "version": "473" + }, + "IOFireWireSBP2": { + "hash": "sha256-lpYBTL9TzreyxJn4J3vfuXoWMH/4y8FnNKk5YiuDgHI=", + "version": "433" + }, + "IOFireWireSerialBusProtocolTransport": { + "hash": "sha256-4Y+5+5cJtolSrM3AUnnhSBS3RrKXbg9Kh1ynmllOA2E=", + "version": "252.250.2" + }, + "IOGraphics": { + "hash": "sha256-QFT+h0gtc7SUf0HNciknG0aMOQXnsWCR25C04dgK1/A=", + "version": "530.66" + }, + "IOHIDFamily": { + "hash": "sha256-DpYcxGLvk10iz5TG2SO8R+5obEJv+zLK56RzA/pH0KA=", + "version": "1090.270.6" + }, + "IOKitUser": { + "hash": "sha256-QH2m6BCYtO2JDksH0TebrEldjjZdC4U9otVu/uUoyWY=", + "version": "1483.260.4" + }, + "IONetworkingFamily": { + "hash": "sha256-M01+Bhf7CTJMA7StjSRFW6ffq7Qf/IOh7aM+JI3ONe8=", + "version": "129.200.1" + }, + "IOSerialFamily": { + "hash": "sha256-wVS4QTx6MBOS0VrwyCZ3s5Usezwaf8rWzmNnfdDTXTU=", + "version": "93" + }, + "IOStorageFamily": { + "hash": "sha256-X6s/IyApMQ7zo1wO7IpIk1e94tSsmvvT+fZHThMWv5Y=", + "version": "218.260.1" + }, + "IOUSBFamily": { + "hash": "sha256-Z0E3TfKP49toYo1Fo9kElRap8CZ+mVDHy5RIexgJTpA=", + "version": "630.4.5" + }, + "Libc": { + "hash": "sha256-mhhs8U/oZku9o2kqzLW4K8Xv9QbnKNBbBr+Q6NqC1vQ=", + "version": "1272.250.1" + }, + "Libinfo": { + "hash": "sha256-DUbyWZI+n3WvftlI7aj60CoEHb9y18H1+FYiYQroVEE=", + "version": "517.200.9" + }, + "Libm": { + "hash": "sha256-p4BndAag9d0XSMYWQ+c4myGv5qXbKx5E1VghudSbpTk=", + "version": "2026" + }, + "Libnotify": { + "hash": "sha256-q0ns85I9Zwo5bZPN5JqjrJofY8/XLl+mbsRhyF1kx+o=", + "version": "172.200.21" + }, + "Librpcsvc": { + "hash": "sha256-8e8E9TkRTAep3/miyqhF/mSkNdlym12W+AVhXF94+Bg=", + "version": "26" + }, + "Libsystem": { + "hash": "sha256-Lo4S7fsepuYlRtXGcVvNTAlx/soabjvKEUuiO09htNs=", + "version": "1252.250.1" + }, + "OpenDirectory": { + "hash": "sha256-6fSl8PasCZSBfe0ftaePcBuSEO3syb6kK+mfDI6iR7A=", + "version": "146" + }, + "Security": { + "hash": "sha256-uqSRU4Ft7+zMQ59FBS+Mu2JcWdbbuWP9/dFfo+Vkr5s=", + "version": "58286.270.3.0.1" + }, + "architecture": { + "hash": "sha256-WGUNtFSBu9AuefHVEO3uB/JpKEGAgGFX/zRaaW4eYbI=", + "version": "272.230.1" + }, + "configd": { + "hash": "sha256-Pg58INpZfdKXn1EPut2Kzghfjwxaz1Ex+u5KACA2O7g=", + "version": "963.270.3" + }, + "copyfile": { + "hash": "sha256-gbxGQ8Wjt20++Bf+BkZT/R5dpsCnRo8+qUcerv5m7V8=", + "version": "146.250.1" + }, + "dtrace": { + "hash": "sha256-ZbAaH2wmYlgLKtq0bpDoEInZiHMe5Bx84iUQC67ia0E=", + "version": "284.250.4" + }, + "dyld": { + "hash": "sha256-5wtx+4pSAcNEwcE024XwIRorS3ZW/qmvfkY7UGe75ho=", + "version": "655.1.1" + }, + "eap8021x": { + "hash": "sha256-9j+6Hw7w9wdLZxjdRwTACws2obg2/VCgl9ed4+Y4pPg=", + "version": "264.250.6" + }, + "hfs": { + "hash": "sha256-/yf6z0VJkw2pPnVst2qgnSZfO6x9ot/cWT7Aewo3IZ4=", + "version": "407.200.4" + }, + "launchd": { + "hash": "sha256-8mW9bnuHmRXCx9py8Wy28C5b2QPICW0rlAps5njYa00=", + "version": "842.1.4" + }, + "libclosure": { + "hash": "sha256-NHK+yc7M/wc6Sbk24LDejNjBrbcWIg9zrYHlnPXC/Yc=", + "version": "73" + }, + "libdispatch": { + "hash": "sha256-b0WqX3qX/qhUi2l63BrNvaVq167SuIgYGPid92MJ32U=", + "version": "1008.270.1" + }, + "libmalloc": { + "hash": "sha256-1ZvO0LGV4AkDSdtwqfPFgCUbpAVzfKS0msa58tL2WLA=", + "version": "166.251.2" + }, + "libplatform": { + "hash": "sha256-xQqCf+/DpHu/JMbmOpy6jl3np0H7/m1NKWZ21YWaerE=", + "version": "177.270.1" + }, + "libpthread": { + "hash": "sha256-+AuYgLTM5RO3+MbxeE86rPh9WbiTiAl2gHZOAaQRkec=", + "version": "330.250.2" + }, + "mDNSResponder": { + "hash": "sha256-SlrC3LIOndY1DVJ26bnuYQwpLhkV1PHAMJeaE3bMDI4=", + "version": "878.270.2" + }, + "objc4": { + "hash": "sha256-rzDiOE//rUnRyCHM/XUQs9IImKGIFN/0D0IZ7SeGp2s=", + "version": "756.2" + }, + "ppp": { + "hash": "sha256-a0zTwevtC+AAyLV/0+rX9VN5BXc2vaZGArz83VZtiWs=", + "version": "847.200.5" + }, + "removefile": { + "hash": "sha256-23+ivRTPKId9Is5NAwYmVgN7TX2+7v9NONs9u7DrGH4=", + "version": "45.200.2" + }, + "xnu": { + "hash": "sha256-ZRgj214Mmvvcji4OdzRjK/7Xtpz7r69SFmzSvtZNhNU=", + "version": "4903.270.47" + } + }, "11.3": { "CarbonHeaders": { "hash": "sha256-nIPXnLr21yVnpBhx9K5q3l/nPARA6JL/dED08MeyhP8=", diff --git a/pkgs/by-name/ap/apple-sdk/metadata/versions.json b/pkgs/by-name/ap/apple-sdk/metadata/versions.json index b983562017c27..a84862aeaab02 100644 --- a/pkgs/by-name/ap/apple-sdk/metadata/versions.json +++ b/pkgs/by-name/ap/apple-sdk/metadata/versions.json @@ -9,6 +9,11 @@ "version": "10.13.2", "hash": "sha256-8nd55fiJLfRWABAbMaHXjp6i20RqupmKedwmhb3S0/A=" }, + "10.14": { + "url": "http://swcdn.apple.com/content/downloads/41/57/061-26573-A_JMOA8GZGDR/lj8yrtu8dgs40fw9k8f5fkoviwkp0og6vs/CLTools_SDK_macOS1014.pkg", + "version": "10.14.6", + "hash": "sha256-NMNkycIl3AVZCw0ZpHNkaeYVS9LAZVSddHw5loL9dhk=" + }, "11": { "url": "https://swcdn.apple.com/content/downloads/02/62/071-54303-A_EU2CL1YVT7/943i95dpeyi2ghlnj2mgyq3t202t5gf18b/CLTools_macOSNMOS_SDK.pkg", "version": "11.3", diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 5581a3f97c1d2..87b8d6f66d1c8 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -23744,6 +23744,7 @@ with pkgs; apple-sdk_10_12 = callPackage ../by-name/ap/apple-sdk/package.nix { darwinSdkMajorVersion = "10.12"; }; apple-sdk_10_13 = callPackage ../by-name/ap/apple-sdk/package.nix { darwinSdkMajorVersion = "10.13"; }; + apple-sdk_10_14 = callPackage ../by-name/ap/apple-sdk/package.nix { darwinSdkMajorVersion = "10.14"; }; apple-sdk_11 = callPackage ../by-name/ap/apple-sdk/package.nix { darwinSdkMajorVersion = "11"; }; darwinMinVersionHook = From d10c85b19b251fd6405618ad4e4b45266fa9efc3 Mon Sep 17 00:00:00 2001 From: Randy Eckenrode Date: Fri, 20 Sep 2024 20:41:00 -0400 Subject: [PATCH 012/157] apple-sdk_10_15: init at 10.15.6 --- .../metadata/apple-oss-lockfile.json | 178 ++++++++++++++++++ .../ap/apple-sdk/metadata/versions.json | 5 + pkgs/top-level/all-packages.nix | 1 + 3 files changed, 184 insertions(+) diff --git a/pkgs/by-name/ap/apple-sdk/metadata/apple-oss-lockfile.json b/pkgs/by-name/ap/apple-sdk/metadata/apple-oss-lockfile.json index 7b159fa9cd979..628dc09b3dec2 100644 --- a/pkgs/by-name/ap/apple-sdk/metadata/apple-oss-lockfile.json +++ b/pkgs/by-name/ap/apple-sdk/metadata/apple-oss-lockfile.json @@ -533,6 +533,184 @@ "version": "4903.270.47" } }, + "10.15.6": { + "CarbonHeaders": { + "hash": "sha256-nIPXnLr21yVnpBhx9K5q3l/nPARA6JL/dED08MeyhP8=", + "version": "18.1" + }, + "CommonCrypto": { + "hash": "sha256-HKSRtTnJ6dH5j6Y+PRDQUcPyjwR70PEbRQu3hTM4G0A=", + "version": "60165.120.1" + }, + "IOAudioFamily": { + "hash": "sha256-5lcK8nyjayLBw9j4PPVs8TWwOWcpggKkSXefVGl2rfA=", + "version": "300.2" + }, + "IOBDStorageFamily": { + "hash": "sha256-aaS5jWPRX4be8d3Rigq+kXzi9Zwbr8dHcNgcIz0n66o=", + "version": "19" + }, + "IOCDStorageFamily": { + "hash": "sha256-U6v+Gj+IumU8Aha5+uf3yOU0Z4KMuBh7aXnJqiZ/abY=", + "version": "58" + }, + "IODVDStorageFamily": { + "hash": "sha256-JLp4xN0Rdb2VpuXtVTODYNqQthDEZk+g/lvHRwJHQB4=", + "version": "42" + }, + "IOFWDVComponents": { + "hash": "sha256-WkfkWnzRupEh20U7vjsTta89clhus6GTkOpXQWXw/bM=", + "version": "208" + }, + "IOFireWireAVC": { + "hash": "sha256-7H3WcZC/HuS9xsTNDWRqt+1JzUNK4ndvd4u2ru0GGRE=", + "version": "428" + }, + "IOFireWireFamily": { + "hash": "sha256-hLtd3d5qOsYdnGpMaTSipu9bOIYEHz2rKzNAoJai4dI=", + "version": "475" + }, + "IOFireWireSBP2": { + "hash": "sha256-pHY6okHHotfFjdNsLwRjQX7dWGolBelpD7MEDz4lafY=", + "version": "434" + }, + "IOFireWireSerialBusProtocolTransport": { + "hash": "sha256-Jb70fanuJTNV4IVoKMtMA66oVDR0I/h3JSIymhlKTQU=", + "version": "257" + }, + "IOGraphics": { + "hash": "sha256-sKnJ0MOhT+dFfmMD2gqYmySufh0I9vBI/swjqoCbSHc=", + "version": "576.1" + }, + "IOHIDFamily": { + "hash": "sha256-esiEGEiggFMR7rha6+dYaqiwGM+TlZtLBe8LF/PF0D8=", + "version": "1446.140.2" + }, + "IOKitUser": { + "hash": "sha256-rB5zfJwoBPMpqW5PDM6ppWW07Y2AGS3f0UzXdfPGYYE=", + "version": "1726.140.1" + }, + "IONetworkingFamily": { + "hash": "sha256-T+aDA++nubTHdPpfdAEm6077eJuzsQXHUDEbdlthVBQ=", + "version": "139.140.2" + }, + "IOSerialFamily": { + "hash": "sha256-wVS4QTx6MBOS0VrwyCZ3s5Usezwaf8rWzmNnfdDTXTU=", + "version": "93" + }, + "IOStorageFamily": { + "hash": "sha256-vyIN7oru2PN7C4a6RBJomlYs4NaYzmCTBEuWiSXG41M=", + "version": "238.120.1" + }, + "IOUSBFamily": { + "hash": "sha256-Z0E3TfKP49toYo1Fo9kElRap8CZ+mVDHy5RIexgJTpA=", + "version": "630.4.5" + }, + "Libc": { + "hash": "sha256-FAifkHs2Kls2ym9/M56o4u2UZfdTKCnqxRbTXOIHyz8=", + "version": "1353.100.2" + }, + "Libinfo": { + "hash": "sha256-syTH8dhWkSPgqRG7p528L7Xx1+ymmqHrCyhUykGhK9s=", + "version": "538" + }, + "Libm": { + "hash": "sha256-p4BndAag9d0XSMYWQ+c4myGv5qXbKx5E1VghudSbpTk=", + "version": "2026" + }, + "Libnotify": { + "hash": "sha256-7o4GNZde3MkCks2NJdNIXvvtMAOqGEA05M7S8o7j0XQ=", + "version": "241.100.2" + }, + "Librpcsvc": { + "hash": "sha256-8e8E9TkRTAep3/miyqhF/mSkNdlym12W+AVhXF94+Bg=", + "version": "26" + }, + "Libsystem": { + "hash": "sha256-RNkaoaRl6akbrgjagLd+ncZ2EAdjegIdy7Z/MINoTpc=", + "version": "1281.100.1" + }, + "OpenDirectory": { + "hash": "sha256-6fSl8PasCZSBfe0ftaePcBuSEO3syb6kK+mfDI6iR7A=", + "version": "146" + }, + "Security": { + "hash": "sha256-dlNTEVkgTl3po7ty2wjatGTANBwegpZxBX1ByneqKRU=", + "version": "59306.140.5" + }, + "architecture": { + "hash": "sha256-pIX9pEXE1Xjll9qwiWrMRwqw6G4g0isto/ALHsmkUSc=", + "version": "279" + }, + "configd": { + "hash": "sha256-nKFDfyH1gQtFyda6HBq3E7Tp5EI4O5n/9GYQEFhMIdE=", + "version": "1061.141.1" + }, + "copyfile": { + "hash": "sha256-nEfD/KUk7e32tw9buQYrsy/BAdAfgE9IObdV4nCm37M=", + "version": "166.40.1" + }, + "dtrace": { + "hash": "sha256-dgJ7om5efUQyc9tP6cBeSpahORqV5bzEDcxcVu4TaDg=", + "version": "338.100.1" + }, + "dyld": { + "hash": "sha256-YkFazM/cviJMwPVXHXP2irfgHtOueI2RNrMedWvkH0A=", + "version": "750.6" + }, + "eap8021x": { + "hash": "sha256-/FsmD4mk/kwsocK8x8Gsk3yOBW3pZLcGHxnNcogqjhY=", + "version": "292.40.2" + }, + "hfs": { + "hash": "sha256-vNo2Wd0n6tjG+xtA3OrwB/TOXvLxaLehEY/l9ZBS5Sw=", + "version": "522.100.5" + }, + "launchd": { + "hash": "sha256-8mW9bnuHmRXCx9py8Wy28C5b2QPICW0rlAps5njYa00=", + "version": "842.1.4" + }, + "libclosure": { + "hash": "sha256-A3QTD6bqUy8ahH/XlMuidYNvT92ufeVpwPsZh4ZzQdk=", + "version": "74" + }, + "libdispatch": { + "hash": "sha256-gd56s0C2dKbZoaGNXt3LBfXaEl5A744djFq3G9uoWws=", + "version": "1173.100.2" + }, + "libmalloc": { + "hash": "sha256-1VhkXY8m6vVQ4aaxICtHVQtXDHNV2CsY9UUst0AioMY=", + "version": "283.100.6" + }, + "libplatform": { + "hash": "sha256-Z4Lj9efT1bt6HMAMQvgMc33QdYzrBvieBjmw4W6H9YI=", + "version": "220.100.1" + }, + "libpthread": { + "hash": "sha256-ZHxqq1qVRXPL0psAX+5bcuA5D/FjJnIcm+ctTkTGBJA=", + "version": "416.100.3" + }, + "mDNSResponder": { + "hash": "sha256-CV3GBeO4Ly8/PbZ7Fq55diRzB00VsB2uTvjGo/tqf10=", + "version": "1096.100.3" + }, + "objc4": { + "hash": "sha256-AJwPTnjJMBbSFDppvKyx92RdfmbmwQOvPnU0E0mU+jU=", + "version": "787.1" + }, + "ppp": { + "hash": "sha256-DNmDigQqDKR1ghcn6GaKeDldp6thH2C6+uZKjC3EfkU=", + "version": "862.140.2" + }, + "removefile": { + "hash": "sha256-bkxiq7OEFtEFPwSBi4OxmpRyKWYgeMhnokFfS7RPUnU=", + "version": "48" + }, + "xnu": { + "hash": "sha256-Y/DTtpnT8JQZO5Ijr+tW0IrIOuECcJ+ZvFLCgwrFt2M=", + "version": "6153.141.1" + } + }, "11.3": { "CarbonHeaders": { "hash": "sha256-nIPXnLr21yVnpBhx9K5q3l/nPARA6JL/dED08MeyhP8=", diff --git a/pkgs/by-name/ap/apple-sdk/metadata/versions.json b/pkgs/by-name/ap/apple-sdk/metadata/versions.json index a84862aeaab02..2a3565afe7745 100644 --- a/pkgs/by-name/ap/apple-sdk/metadata/versions.json +++ b/pkgs/by-name/ap/apple-sdk/metadata/versions.json @@ -14,6 +14,11 @@ "version": "10.14.6", "hash": "sha256-NMNkycIl3AVZCw0ZpHNkaeYVS9LAZVSddHw5loL9dhk=" }, + "10.15": { + "url": "https://swcdn.apple.com/content/downloads/50/51/071-29699-A_YC8SX0OHH3/7479xojqghsvgtnt3dxjpnxuz9sjpmbmds/CLTools_macOSLMOS_SDK.pkg", + "version": "10.15.6", + "hash": "sha256-mPJQC+v4yNiOCKLQfhidB2WH2MMclSCP1odvOoGdVPw=" + }, "11": { "url": "https://swcdn.apple.com/content/downloads/02/62/071-54303-A_EU2CL1YVT7/943i95dpeyi2ghlnj2mgyq3t202t5gf18b/CLTools_macOSNMOS_SDK.pkg", "version": "11.3", diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 87b8d6f66d1c8..12a2d549a3f87 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -23745,6 +23745,7 @@ with pkgs; apple-sdk_10_12 = callPackage ../by-name/ap/apple-sdk/package.nix { darwinSdkMajorVersion = "10.12"; }; apple-sdk_10_13 = callPackage ../by-name/ap/apple-sdk/package.nix { darwinSdkMajorVersion = "10.13"; }; apple-sdk_10_14 = callPackage ../by-name/ap/apple-sdk/package.nix { darwinSdkMajorVersion = "10.14"; }; + apple-sdk_10_15 = callPackage ../by-name/ap/apple-sdk/package.nix { darwinSdkMajorVersion = "10.15"; }; apple-sdk_11 = callPackage ../by-name/ap/apple-sdk/package.nix { darwinSdkMajorVersion = "11"; }; darwinMinVersionHook = From 689e8980bc987d54fd441338aeda1649a20a4506 Mon Sep 17 00:00:00 2001 From: Randy Eckenrode Date: Fri, 20 Sep 2024 20:41:00 -0400 Subject: [PATCH 013/157] apple-sdk_12: init at 12.3 --- .../metadata/apple-oss-lockfile.json | 178 ++++++++++++++++++ .../ap/apple-sdk/metadata/versions.json | 5 + pkgs/top-level/all-packages.nix | 1 + 3 files changed, 184 insertions(+) diff --git a/pkgs/by-name/ap/apple-sdk/metadata/apple-oss-lockfile.json b/pkgs/by-name/ap/apple-sdk/metadata/apple-oss-lockfile.json index 628dc09b3dec2..1e4abc9c93790 100644 --- a/pkgs/by-name/ap/apple-sdk/metadata/apple-oss-lockfile.json +++ b/pkgs/by-name/ap/apple-sdk/metadata/apple-oss-lockfile.json @@ -888,5 +888,183 @@ "hash": "sha256-M1XWippH55VUJu4aosRFX8j9aOm/PONYVjPZOPufD80=", "version": "7195.101.1" } + }, + "12.3": { + "CarbonHeaders": { + "hash": "sha256-nIPXnLr21yVnpBhx9K5q3l/nPARA6JL/dED08MeyhP8=", + "version": "18.1" + }, + "CommonCrypto": { + "hash": "sha256-HTGBUE6vHjS80CFTiIQ8F17m8Yd2ZRHccvFu2CA2P9U=", + "version": "60191.100.1" + }, + "IOAudioFamily": { + "hash": "sha256-CuBFZeX2JTKIab2xpp+Yvn66bCl4+aKOv9TvzJef20c=", + "version": "340.2" + }, + "IOBDStorageFamily": { + "hash": "sha256-UgLMsQBe1QLzlbScmPmASBN7VH4YBmNOUX2CEDezjmE=", + "version": "22" + }, + "IOCDStorageFamily": { + "hash": "sha256-p/2qM5zjXFDRb/DISpEHxQEdvmuLlRGt/Ygc71Yu2rI=", + "version": "61" + }, + "IODVDStorageFamily": { + "hash": "sha256-1Sa8aZBGNtqJBNHva+YXxET6Wcdm2PgVrTzYT/8qrN4=", + "version": "43" + }, + "IOFWDVComponents": { + "hash": "sha256-WkfkWnzRupEh20U7vjsTta89clhus6GTkOpXQWXw/bM=", + "version": "208" + }, + "IOFireWireAVC": { + "hash": "sha256-ruAomp5Lv7zuPu9vHsNKoPtDvD1AIrRARsPMpcx/fh0=", + "version": "430" + }, + "IOFireWireFamily": { + "hash": "sha256-W0KOF4hkA7kFOnL1ThAeFU/YlhFVqoqk9uzGjcBppX8=", + "version": "487" + }, + "IOFireWireSBP2": { + "hash": "sha256-bItnRQIaGUxMyiU0q+4N8e5+jYiDEOUPmsrKhBFXvok=", + "version": "445" + }, + "IOFireWireSerialBusProtocolTransport": { + "hash": "sha256-P7egeaD9SSa+YyrIRzM44gILKbIL7vezXK3M6q3MBOI=", + "version": "260" + }, + "IOGraphics": { + "hash": "sha256-lzxBrPLlF01+2jFKRJtSnwpf0r05C0H3tM7Q0N1RUPA=", + "version": "594" + }, + "IOHIDFamily": { + "hash": "sha256-EQQHAS8WKUoTxZscixylc2ZMoD4UYBlHRUj2O7Ikgac=", + "version": "1787.100.13" + }, + "IOKitUser": { + "hash": "sha256-Cdfa/YXM0W4O15femcU0G1Xcpbm+iADWIBWIdzoeuTE=", + "version": "1955.100.5" + }, + "IONetworkingFamily": { + "hash": "sha256-odUZJQq8lb3UYk7F8dBi1Hds00M+kwdlyGwZkVkSwTg=", + "version": "160.100.2" + }, + "IOSerialFamily": { + "hash": "sha256-wVS4QTx6MBOS0VrwyCZ3s5Usezwaf8rWzmNnfdDTXTU=", + "version": "93" + }, + "IOStorageFamily": { + "hash": "sha256-2b32qe1z7Z+Od1dVlAGdM142DdF8cBaRC+ElysSuAQ4=", + "version": "290.100.6" + }, + "IOUSBFamily": { + "hash": "sha256-Z0E3TfKP49toYo1Fo9kElRap8CZ+mVDHy5RIexgJTpA=", + "version": "630.4.5" + }, + "Libc": { + "hash": "sha256-obalDxsbE+7gm7YwznUbfxL7MCriamQFP3DrXleNwU4=", + "version": "1507.100.9" + }, + "Libinfo": { + "hash": "sha256-OjnnSHEcifcWarVyXiHvYg/9jbCQy5/lzaq6fJRriy0=", + "version": "554" + }, + "Libm": { + "hash": "sha256-p4BndAag9d0XSMYWQ+c4myGv5qXbKx5E1VghudSbpTk=", + "version": "2026" + }, + "Libnotify": { + "hash": "sha256-JXG0kHEdoIs6krVZ4+KsRVES4AuNjnQi8qF+XKSp5jE=", + "version": "301" + }, + "Librpcsvc": { + "hash": "sha256-8e8E9TkRTAep3/miyqhF/mSkNdlym12W+AVhXF94+Bg=", + "version": "26" + }, + "Libsystem": { + "hash": "sha256-mPPAxo67wWLtemO+PuKg1Ui0zKEfjnYVj/qX1/0kNBs=", + "version": "1311.100.3" + }, + "OpenDirectory": { + "hash": "sha256-6fSl8PasCZSBfe0ftaePcBuSEO3syb6kK+mfDI6iR7A=", + "version": "146" + }, + "Security": { + "hash": "sha256-cIqfXcfQOZonxaKndH80xC5YmmveHw+TxHOxqvc9u8I=", + "version": "60158.100.133" + }, + "architecture": { + "hash": "sha256-PRNUrhzSOrwmxSPkKmV0LV7yEIik65sdkfKdBqcwFhU=", + "version": "280.100.2" + }, + "configd": { + "hash": "sha256-X34mjXdil4HeBLyqY4tyBWdmpjsOFTJDdDE81UQf708=", + "version": "1163.100.19.0.2" + }, + "copyfile": { + "hash": "sha256-3/zI3j/m9b13hebjCsOLry3Mf8ADdWJgrtQOdD0huG0=", + "version": "180.100.3" + }, + "dtrace": { + "hash": "sha256-q8H6slCN4RwJ5TxC5s3og6cIbjALySP5ODfVw6a/a+M=", + "version": "375" + }, + "dyld": { + "hash": "sha256-v1kk/Z3eI2sufNm2rx3FRbA/f9BeKJ3t9i9W7tTksXg=", + "version": "955" + }, + "eap8021x": { + "hash": "sha256-SayP1d2KWoRShykBA/NrQCuRnPoxlTiaLwifoqm0Gkg=", + "version": "315.100.2" + }, + "hfs": { + "hash": "sha256-q1yOIei98oudGAoBMNPRTV5EOYpXFL7iYmlCYsKsG0o=", + "version": "583.100.10" + }, + "launchd": { + "hash": "sha256-8mW9bnuHmRXCx9py8Wy28C5b2QPICW0rlAps5njYa00=", + "version": "842.1.4" + }, + "libclosure": { + "hash": "sha256-Ez75a0m+fJas7mGqFeDjjpc7sFDnyirRbtLMTYQDVxw=", + "version": "79.1" + }, + "libdispatch": { + "hash": "sha256-/VbSUtnWyToWOUyAAg/3wImbJ2w5k1tbJkt827x2lIE=", + "version": "1325.100.36" + }, + "libmalloc": { + "hash": "sha256-tyYce5nk0N923MbzoGzkGqunoKwArbTiZl8PCppYpso=", + "version": "374.100.5" + }, + "libplatform": { + "hash": "sha256-JUD2NdS310OhZ0F8gnOvoD8AgEtWRtPahKDw5iE2QJU=", + "version": "273.100.5" + }, + "libpthread": { + "hash": "sha256-al8QumtH7/D04oJ4LUSYW+6OdX0Ko3S3rwYU53n9/54=", + "version": "486.100.11" + }, + "mDNSResponder": { + "hash": "sha256-hsV0VYTPoO5YpaxrUXpXFy97LxlERzrQT0FRfCMOwic=", + "version": "1557.101.2" + }, + "objc4": { + "hash": "sha256-MKXnfZL46VtmAQMolqd7ATF9fYjCNstapGQfcH4uVwo=", + "version": "841.13" + }, + "ppp": { + "hash": "sha256-YyCE19T3rcM1G5jdXuYXuBXblJgR/nelvjpq+9maMhw=", + "version": "884" + }, + "removefile": { + "hash": "sha256-xF1VtTUhoiGsFQsvuFnFYemwiCdsKeriFJv51vRLqmw=", + "version": "60" + }, + "xnu": { + "hash": "sha256-bfFmDfRBSvoWMdQYVstsJRbcq+15lDjVFqk+0XYWpy8=", + "version": "8020.101.4" + } } } diff --git a/pkgs/by-name/ap/apple-sdk/metadata/versions.json b/pkgs/by-name/ap/apple-sdk/metadata/versions.json index 2a3565afe7745..24e4f93a89088 100644 --- a/pkgs/by-name/ap/apple-sdk/metadata/versions.json +++ b/pkgs/by-name/ap/apple-sdk/metadata/versions.json @@ -23,5 +23,10 @@ "url": "https://swcdn.apple.com/content/downloads/02/62/071-54303-A_EU2CL1YVT7/943i95dpeyi2ghlnj2mgyq3t202t5gf18b/CLTools_macOSNMOS_SDK.pkg", "version": "11.3", "hash": "sha256-/go8utcx3jprf6c8V/DUbXwsmNYSFchOAai1OaJs3Bg=" + }, + "12": { + "url": "https://swcdn.apple.com/content/downloads/24/42/002-83793-A_74JRE8GVAT/rlnkct919wgc5c0pjq986z5bb9h62uvni2/CLTools_macOSNMOS_SDK.pkg", + "version": "12.3", + "hash": "sha256-qG21ssNUmkqxPLTXALGP2N/RBHu8NMlI1dWvGlV+Wm8=" } } diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 12a2d549a3f87..39a83bc47eeb9 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -23747,6 +23747,7 @@ with pkgs; apple-sdk_10_14 = callPackage ../by-name/ap/apple-sdk/package.nix { darwinSdkMajorVersion = "10.14"; }; apple-sdk_10_15 = callPackage ../by-name/ap/apple-sdk/package.nix { darwinSdkMajorVersion = "10.15"; }; apple-sdk_11 = callPackage ../by-name/ap/apple-sdk/package.nix { darwinSdkMajorVersion = "11"; }; + apple-sdk_12 = callPackage ../by-name/ap/apple-sdk/package.nix { darwinSdkMajorVersion = "12"; }; darwinMinVersionHook = deploymentTarget: From 4283b8f00a2d4cb6cd36a77017f78c8bb8b2e056 Mon Sep 17 00:00:00 2001 From: Randy Eckenrode Date: Fri, 20 Sep 2024 20:41:00 -0400 Subject: [PATCH 014/157] apple-sdk_13: init at 13.3 --- .../metadata/apple-oss-lockfile.json | 178 ++++++++++++++++++ .../ap/apple-sdk/metadata/versions.json | 5 + pkgs/top-level/all-packages.nix | 1 + 3 files changed, 184 insertions(+) diff --git a/pkgs/by-name/ap/apple-sdk/metadata/apple-oss-lockfile.json b/pkgs/by-name/ap/apple-sdk/metadata/apple-oss-lockfile.json index 1e4abc9c93790..b25ff2b05b9df 100644 --- a/pkgs/by-name/ap/apple-sdk/metadata/apple-oss-lockfile.json +++ b/pkgs/by-name/ap/apple-sdk/metadata/apple-oss-lockfile.json @@ -1066,5 +1066,183 @@ "hash": "sha256-bfFmDfRBSvoWMdQYVstsJRbcq+15lDjVFqk+0XYWpy8=", "version": "8020.101.4" } + }, + "13.3": { + "CarbonHeaders": { + "hash": "sha256-nIPXnLr21yVnpBhx9K5q3l/nPARA6JL/dED08MeyhP8=", + "version": "18.1" + }, + "CommonCrypto": { + "hash": "sha256-tftAQbs5xIOc5VZLVAKXAUvle9WO/i33/pQ3D64l/yI=", + "version": "600016.100.4" + }, + "IOAudioFamily": { + "hash": "sha256-CuBFZeX2JTKIab2xpp+Yvn66bCl4+aKOv9TvzJef20c=", + "version": "440.2" + }, + "IOBDStorageFamily": { + "hash": "sha256-UgLMsQBe1QLzlbScmPmASBN7VH4YBmNOUX2CEDezjmE=", + "version": "22" + }, + "IOCDStorageFamily": { + "hash": "sha256-p/2qM5zjXFDRb/DISpEHxQEdvmuLlRGt/Ygc71Yu2rI=", + "version": "61" + }, + "IODVDStorageFamily": { + "hash": "sha256-1Sa8aZBGNtqJBNHva+YXxET6Wcdm2PgVrTzYT/8qrN4=", + "version": "43" + }, + "IOFWDVComponents": { + "hash": "sha256-WkfkWnzRupEh20U7vjsTta89clhus6GTkOpXQWXw/bM=", + "version": "208" + }, + "IOFireWireAVC": { + "hash": "sha256-IUytBKhhCgg0vtI+7q8d5kxpOUgO3tQD7TMy++jrorc=", + "version": "431" + }, + "IOFireWireFamily": { + "hash": "sha256-W0KOF4hkA7kFOnL1ThAeFU/YlhFVqoqk9uzGjcBppX8=", + "version": "487" + }, + "IOFireWireSBP2": { + "hash": "sha256-bItnRQIaGUxMyiU0q+4N8e5+jYiDEOUPmsrKhBFXvok=", + "version": "445" + }, + "IOFireWireSerialBusProtocolTransport": { + "hash": "sha256-P7egeaD9SSa+YyrIRzM44gILKbIL7vezXK3M6q3MBOI=", + "version": "260" + }, + "IOGraphics": { + "hash": "sha256-KubCz8DNwf1WuF7LrtARM2VJugFDP0wfHoUhnIz/faQ=", + "version": "596.1" + }, + "IOHIDFamily": { + "hash": "sha256-7UFMBdF5k9aVFVuoL2riozzKmn8uOt87Aitt8j6XkN8=", + "version": "1915.100.21" + }, + "IOKitUser": { + "hash": "sha256-hgFRHPAuoqSf6aRUBUyfU2y2+dBUA34DKwLHLwhPNms=", + "version": "2022.100.19" + }, + "IONetworkingFamily": { + "hash": "sha256-SwZvXLSB9cMHssZU4dCogGVoV64qYdGN1CGYV3FZ6tk=", + "version": "170" + }, + "IOSerialFamily": { + "hash": "sha256-wVS4QTx6MBOS0VrwyCZ3s5Usezwaf8rWzmNnfdDTXTU=", + "version": "93" + }, + "IOStorageFamily": { + "hash": "sha256-g4oCrxM5VtHm8h1M+zM81Ar1LsaaiJZLej5fT8EHPG4=", + "version": "302.100.1" + }, + "IOUSBFamily": { + "hash": "sha256-Z0E3TfKP49toYo1Fo9kElRap8CZ+mVDHy5RIexgJTpA=", + "version": "630.4.5" + }, + "Libc": { + "hash": "sha256-dqbdWtBuaRq3IHnSUPH2aj8h/X4zCwUNSOeSdwfKvN8=", + "version": "1534.100.14" + }, + "Libinfo": { + "hash": "sha256-iUyndeUXx7FFZ/jgJ6jRwda3IChOaMs4dZW/ISuAJ1E=", + "version": "564.101.1" + }, + "Libm": { + "hash": "sha256-p4BndAag9d0XSMYWQ+c4myGv5qXbKx5E1VghudSbpTk=", + "version": "2026" + }, + "Libnotify": { + "hash": "sha256-7AwTfogvCUMdoabxf413ENWXtFTOM6AUldccoPQ89sU=", + "version": "312" + }, + "Librpcsvc": { + "hash": "sha256-UWYdCQ9QsBqwM01bWr+igINAHSdSluB/FrOclC5AjTI=", + "version": "31" + }, + "Libsystem": { + "hash": "sha256-IIksf0yCg3GdME3HofYzD1MRC+ofsPhHcxddmNd7V2M=", + "version": "1319.100.3" + }, + "OpenDirectory": { + "hash": "sha256-6fSl8PasCZSBfe0ftaePcBuSEO3syb6kK+mfDI6iR7A=", + "version": "146" + }, + "Security": { + "hash": "sha256-lPq58QIx+H9DouTXAUJSMf1X7dj9V6xu3c8VWr2R1IY=", + "version": "60420.101.4" + }, + "architecture": { + "hash": "sha256-PRNUrhzSOrwmxSPkKmV0LV7yEIik65sdkfKdBqcwFhU=", + "version": "282" + }, + "configd": { + "hash": "sha256-M/fRAnUw2wObhCQp9a6zQbCGhACCQHpju4/1+KGlkjg=", + "version": "1241.100.11" + }, + "copyfile": { + "hash": "sha256-te3WcQudrXPqnTM1s/AtsTdu7VIXf5dIASy+IGnIxv0=", + "version": "191.100.3" + }, + "dtrace": { + "hash": "sha256-7jAG66hG9qmqpRbECazMD1Pyi53CWTOGNnZca1NpcxE=", + "version": "397" + }, + "dyld": { + "hash": "sha256-OkDOTV86EB44LxsqwTD4ZncMcr7iqSHXxw+6U+AP7oU=", + "version": "1066.8" + }, + "eap8021x": { + "hash": "sha256-FMG+IGVPpcwrRe2/OKpFycrY/EFPZkge2vX61NgorGg=", + "version": "336.100.6" + }, + "hfs": { + "hash": "sha256-Au5VDrYRBerI1I6rjC0lVDwB5IBwGARrAdcTI4M+Fx0=", + "version": "627.100.6" + }, + "launchd": { + "hash": "sha256-8mW9bnuHmRXCx9py8Wy28C5b2QPICW0rlAps5njYa00=", + "version": "842.1.4" + }, + "libclosure": { + "hash": "sha256-V1tpp/XG6baETunJt029rI6wp6moYSnFprt+bNGaQ40=", + "version": "87" + }, + "libdispatch": { + "hash": "sha256-d1VObN11bNdtNJlZQqp2y8yP4lit5Wbj+4/aN3StsPc=", + "version": "1415.100.11" + }, + "libmalloc": { + "hash": "sha256-jcR1AO/chcZzfAvELkC+U3q9tzxqPdwgLcHrnkQmN4M=", + "version": "425.100.7" + }, + "libplatform": { + "hash": "sha256-+BB23YGGT0hA326Dh+3k2UvAqBdEJ84A6yGA/ccrihg=", + "version": "292.100.1" + }, + "libpthread": { + "hash": "sha256-/l17vMWhfAs0YhIHi+l84vGVxpGFOzocvxxii7B+WUk=", + "version": "514.100.2" + }, + "mDNSResponder": { + "hash": "sha256-M4yfQsdlKwes5M2QOEEfjv7ldSVZw7oGXLISaDcObjs=", + "version": "1807.101.2" + }, + "objc4": { + "hash": "sha256-qOV9YfP59WP8Izp+IvM/aiYTW8fCoq21uxU64OcIHk8=", + "version": "876" + }, + "ppp": { + "hash": "sha256-Sg5c5qOSk5TaS4pgXZ+eAy/iuGBa1oFML0dkj463DcE=", + "version": "1010" + }, + "removefile": { + "hash": "sha256-oQorWHlJ0ctekCTUsLXHko8k1aCKBJ00A2FHkRd4B3E=", + "version": "68" + }, + "xnu": { + "hash": "sha256-w9/lDZ/E54YzYQkOWptNpX5GomgI/fvZLAy7NY3O+IQ=", + "version": "8796.101.5" + } } } diff --git a/pkgs/by-name/ap/apple-sdk/metadata/versions.json b/pkgs/by-name/ap/apple-sdk/metadata/versions.json index 24e4f93a89088..ec81bc0f1024e 100644 --- a/pkgs/by-name/ap/apple-sdk/metadata/versions.json +++ b/pkgs/by-name/ap/apple-sdk/metadata/versions.json @@ -28,5 +28,10 @@ "url": "https://swcdn.apple.com/content/downloads/24/42/002-83793-A_74JRE8GVAT/rlnkct919wgc5c0pjq986z5bb9h62uvni2/CLTools_macOSNMOS_SDK.pkg", "version": "12.3", "hash": "sha256-qG21ssNUmkqxPLTXALGP2N/RBHu8NMlI1dWvGlV+Wm8=" + }, + "13": { + "url": "https://swcdn.apple.com/content/downloads/15/62/032-84673-A_7A1TG1RF8Z/xpc8q44ggn2pkn82iwr0fi1zeb9cxi8ath/CLTools_macOSNMOS_SDK.pkg", + "version": "13.3", + "hash": "sha256-zZ4pbgoXunLGwdYDemxOfyH4CE5WGfMy2s5jN+0q4B4=" } } diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 39a83bc47eeb9..5075d18eb6939 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -23748,6 +23748,7 @@ with pkgs; apple-sdk_10_15 = callPackage ../by-name/ap/apple-sdk/package.nix { darwinSdkMajorVersion = "10.15"; }; apple-sdk_11 = callPackage ../by-name/ap/apple-sdk/package.nix { darwinSdkMajorVersion = "11"; }; apple-sdk_12 = callPackage ../by-name/ap/apple-sdk/package.nix { darwinSdkMajorVersion = "12"; }; + apple-sdk_13 = callPackage ../by-name/ap/apple-sdk/package.nix { darwinSdkMajorVersion = "13"; }; darwinMinVersionHook = deploymentTarget: From 8fae28553af6e18d7e15fff32f3981e6affa5bff Mon Sep 17 00:00:00 2001 From: Randy Eckenrode Date: Fri, 20 Sep 2024 20:41:00 -0400 Subject: [PATCH 015/157] apple-sdk_14: init at 14.4 --- .../metadata/apple-oss-lockfile.json | 178 ++++++++++++++++++ .../ap/apple-sdk/metadata/versions.json | 5 + pkgs/top-level/all-packages.nix | 1 + 3 files changed, 184 insertions(+) diff --git a/pkgs/by-name/ap/apple-sdk/metadata/apple-oss-lockfile.json b/pkgs/by-name/ap/apple-sdk/metadata/apple-oss-lockfile.json index b25ff2b05b9df..62cf862049dcb 100644 --- a/pkgs/by-name/ap/apple-sdk/metadata/apple-oss-lockfile.json +++ b/pkgs/by-name/ap/apple-sdk/metadata/apple-oss-lockfile.json @@ -1244,5 +1244,183 @@ "hash": "sha256-w9/lDZ/E54YzYQkOWptNpX5GomgI/fvZLAy7NY3O+IQ=", "version": "8796.101.5" } + }, + "14.4": { + "CarbonHeaders": { + "hash": "sha256-nIPXnLr21yVnpBhx9K5q3l/nPARA6JL/dED08MeyhP8=", + "version": "18.1" + }, + "CommonCrypto": { + "hash": "sha256-/VoOR9wJuKnmGE1CWGGXxX8SpmALHnEooNTa3QM+ITc=", + "version": "600028.100.1" + }, + "IOAudioFamily": { + "hash": "sha256-VSk3jvsITJugtL67Qt0m4qJ879i7Fj6B/NGBFVCwpiU=", + "version": "540.3" + }, + "IOBDStorageFamily": { + "hash": "sha256-UgLMsQBe1QLzlbScmPmASBN7VH4YBmNOUX2CEDezjmE=", + "version": "22" + }, + "IOCDStorageFamily": { + "hash": "sha256-p/2qM5zjXFDRb/DISpEHxQEdvmuLlRGt/Ygc71Yu2rI=", + "version": "61" + }, + "IODVDStorageFamily": { + "hash": "sha256-1Sa8aZBGNtqJBNHva+YXxET6Wcdm2PgVrTzYT/8qrN4=", + "version": "45" + }, + "IOFWDVComponents": { + "hash": "sha256-WkfkWnzRupEh20U7vjsTta89clhus6GTkOpXQWXw/bM=", + "version": "208" + }, + "IOFireWireAVC": { + "hash": "sha256-IUytBKhhCgg0vtI+7q8d5kxpOUgO3tQD7TMy++jrorc=", + "version": "431" + }, + "IOFireWireFamily": { + "hash": "sha256-W0KOF4hkA7kFOnL1ThAeFU/YlhFVqoqk9uzGjcBppX8=", + "version": "487" + }, + "IOFireWireSBP2": { + "hash": "sha256-bItnRQIaGUxMyiU0q+4N8e5+jYiDEOUPmsrKhBFXvok=", + "version": "445" + }, + "IOFireWireSerialBusProtocolTransport": { + "hash": "sha256-P7egeaD9SSa+YyrIRzM44gILKbIL7vezXK3M6q3MBOI=", + "version": "260" + }, + "IOGraphics": { + "hash": "sha256-Ag37fd3tZJLXLVq1yzHOCWGOYYfwwTkC8hnvNaTEaWg=", + "version": "598" + }, + "IOHIDFamily": { + "hash": "sha256-fmYTJsquAOBwzsgRmqPyjSJJi1hGcfnMmqLIcTe8W1s=", + "version": "2031.100.16" + }, + "IOKitUser": { + "hash": "sha256-1bqRiLvyr2GQfbWwhXHXXIOtIka9YDw5GbKV6bd2k4k=", + "version": "100076.101.1" + }, + "IONetworkingFamily": { + "hash": "sha256-J3cLeWKrQ8ypIaqgwRH9eU5JbjEDBVoezj3a2Lvwu5k=", + "version": "177" + }, + "IOSerialFamily": { + "hash": "sha256-wVS4QTx6MBOS0VrwyCZ3s5Usezwaf8rWzmNnfdDTXTU=", + "version": "93" + }, + "IOStorageFamily": { + "hash": "sha256-cllpJX11c3CX8zEYdOT2TC63sx7NUAHh33yRHhrG2Ro=", + "version": "315" + }, + "IOUSBFamily": { + "hash": "sha256-Z0E3TfKP49toYo1Fo9kElRap8CZ+mVDHy5RIexgJTpA=", + "version": "630.4.5" + }, + "Libc": { + "hash": "sha256-fxBM4KbPwQNVEJl7PCKP+1nUk9Oce/O2+0lVBxyngew=", + "version": "1592.100.35" + }, + "Libinfo": { + "hash": "sha256-zZr6Mmou8Q+G6/wS+k0k7R+XirB94TNCUGS5dhi96ZE=", + "version": "583.0.1" + }, + "Libm": { + "hash": "sha256-p4BndAag9d0XSMYWQ+c4myGv5qXbKx5E1VghudSbpTk=", + "version": "2026" + }, + "Libnotify": { + "hash": "sha256-7X+6S3C7ZOTXJUeDXOOg5EmoZyLZvtE06x3Is0TGgSU=", + "version": "317.100.2" + }, + "Librpcsvc": { + "hash": "sha256-UWYdCQ9QsBqwM01bWr+igINAHSdSluB/FrOclC5AjTI=", + "version": "31" + }, + "Libsystem": { + "hash": "sha256-HsItciWrwyXujQ2hwqzv0JKOkkuynXYIqejLAEPJbMc=", + "version": "1345.100.2" + }, + "OpenDirectory": { + "hash": "sha256-6fSl8PasCZSBfe0ftaePcBuSEO3syb6kK+mfDI6iR7A=", + "version": "146" + }, + "Security": { + "hash": "sha256-NgTGbaw5JkpboDQpt1fSgUr9NYGS+bIOrEMQX7mLAME=", + "version": "61123.100.169" + }, + "architecture": { + "hash": "sha256-PRNUrhzSOrwmxSPkKmV0LV7yEIik65sdkfKdBqcwFhU=", + "version": "282" + }, + "configd": { + "hash": "sha256-+3xesYxqfsNjWCW3T87OA7+Z1hBqmGEh/I8kP8Ajbso=", + "version": "1300.100.9" + }, + "copyfile": { + "hash": "sha256-rSCTgzdHr7QmnPk9rJ9P4fOAolnEQv8PHfgAY+qA0s4=", + "version": "196.100.4" + }, + "dtrace": { + "hash": "sha256-04Q35rCKnM5Csv5poFJKpK0VplWq4hvy251/Cb2Kl80=", + "version": "401.100.3" + }, + "dyld": { + "hash": "sha256-6P/Da6xP19vmaCROoYv9pl7DaW3/U+qZBJT8PD33bn0=", + "version": "1160.6" + }, + "eap8021x": { + "hash": "sha256-Ky6KSlJhyX1NRufGhVBcp+ZFmqYrAxwC/5QvJhC2PhU=", + "version": "354.100.3" + }, + "hfs": { + "hash": "sha256-+YUVOttZU7C8I14CC6t3ZH2KxAjjTA2nB0y5bPgLxZM=", + "version": "650.0.2" + }, + "launchd": { + "hash": "sha256-8mW9bnuHmRXCx9py8Wy28C5b2QPICW0rlAps5njYa00=", + "version": "842.1.4" + }, + "libclosure": { + "hash": "sha256-M/jnIHzKYvdFCO0tJ1JXiD/UcZtJhLIoulaCQQUbn30=", + "version": "90" + }, + "libdispatch": { + "hash": "sha256-igqIA5DMVHjG30WMHZZpYY7LRM9hZyMWItD+UxeTehY=", + "version": "1477.100.9" + }, + "libmalloc": { + "hash": "sha256-Sh4/z7lGWRMldOPURkP5vLOAb5Ou6AUsVJEWz9wk9hI=", + "version": "521.100.59" + }, + "libplatform": { + "hash": "sha256-gojt3sWOr7XO2yYI/B1CmNLTPFieSfoNtlOgQahOCok=", + "version": "316.100.10" + }, + "libpthread": { + "hash": "sha256-phjfN8+IU8ibPsflR6LktnSi3giy89ghI+cFyrhiQNo=", + "version": "519.101.1" + }, + "mDNSResponder": { + "hash": "sha256-0ECbWeMnIRTsi03BeBEe5boyR/84JJPbxzPQze8hHSA=", + "version": "2200.100.94.0.2" + }, + "objc4": { + "hash": "sha256-eUVSpbyTEOMEdHoxSv6lZIZwB+cW/YWIaTZTcHgGOjo=", + "version": "912.3" + }, + "ppp": { + "hash": "sha256-8+QUA79sHf85yvGSPE9qCmGsrZDT3NZnbgZVroJw/Hg=", + "version": "1016" + }, + "removefile": { + "hash": "sha256-L6I0u8S3h3uV1veKA5HvkSebbBCd78ymlf//KWbebZo=", + "version": "70.100.4" + }, + "xnu": { + "hash": "sha256-j5Ep1RX5DTJqTGszrF4d/JtzUqZ6nA6XoExqcIQ0RVQ=", + "version": "10063.101.15" + } } } diff --git a/pkgs/by-name/ap/apple-sdk/metadata/versions.json b/pkgs/by-name/ap/apple-sdk/metadata/versions.json index ec81bc0f1024e..39d0f1cf16a24 100644 --- a/pkgs/by-name/ap/apple-sdk/metadata/versions.json +++ b/pkgs/by-name/ap/apple-sdk/metadata/versions.json @@ -33,5 +33,10 @@ "url": "https://swcdn.apple.com/content/downloads/15/62/032-84673-A_7A1TG1RF8Z/xpc8q44ggn2pkn82iwr0fi1zeb9cxi8ath/CLTools_macOSNMOS_SDK.pkg", "version": "13.3", "hash": "sha256-zZ4pbgoXunLGwdYDemxOfyH4CE5WGfMy2s5jN+0q4B4=" + }, + "14": { + "url": "https://swcdn.apple.com/content/downloads/14/48/052-59890-A_I0F5YGAY0Y/p9n40hio7892gou31o1v031ng6fnm9sb3c/CLTools_macOSNMOS_SDK.pkg", + "version": "14.4", + "hash": "sha256-QozDiwY0Czc0g45vPD7G4v4Ra+3DujCJbSads3fJjjM=" } } diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 5075d18eb6939..01461c7dcbabc 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -23749,6 +23749,7 @@ with pkgs; apple-sdk_11 = callPackage ../by-name/ap/apple-sdk/package.nix { darwinSdkMajorVersion = "11"; }; apple-sdk_12 = callPackage ../by-name/ap/apple-sdk/package.nix { darwinSdkMajorVersion = "12"; }; apple-sdk_13 = callPackage ../by-name/ap/apple-sdk/package.nix { darwinSdkMajorVersion = "13"; }; + apple-sdk_14 = callPackage ../by-name/ap/apple-sdk/package.nix { darwinSdkMajorVersion = "14"; }; darwinMinVersionHook = deploymentTarget: From d1c25395231689272144d9903d18a42f7ed6564f Mon Sep 17 00:00:00 2001 From: Randy Eckenrode Date: Sun, 29 Sep 2024 18:25:05 -0400 Subject: [PATCH 016/157] darwin: add mkStub for deprecating frameworks --- pkgs/os-specific/darwin/apple-sdk/mk-stub.nix | 14 ++++++++++++++ pkgs/top-level/darwin-packages.nix | 2 ++ 2 files changed, 16 insertions(+) create mode 100644 pkgs/os-specific/darwin/apple-sdk/mk-stub.nix diff --git a/pkgs/os-specific/darwin/apple-sdk/mk-stub.nix b/pkgs/os-specific/darwin/apple-sdk/mk-stub.nix new file mode 100644 index 0000000000000..0a0b258998e33 --- /dev/null +++ b/pkgs/os-specific/darwin/apple-sdk/mk-stub.nix @@ -0,0 +1,14 @@ +{ stdenvNoCC }: + +version: pname: +stdenvNoCC.mkDerivation { + inherit pname version; + + buildCommand = '' + mkdir -p "$out" + echo "Individual frameworks have been deprecated. See the stdenv documentation for how to use `apple-sdk`" \ + > "$out/README" + ''; + + passthru.isDarwinCompatStub = true; +} diff --git a/pkgs/top-level/darwin-packages.nix b/pkgs/top-level/darwin-packages.nix index c47cc3e565e79..b5fb2e0566b84 100644 --- a/pkgs/top-level/darwin-packages.nix +++ b/pkgs/top-level/darwin-packages.nix @@ -32,6 +32,8 @@ let pkg ) (old.extraBuildInputs or [ ]); }); + + mkStub = pkgs.callPackage ../os-specific/darwin/apple-sdk/mk-stub.nix { }; in makeScopeWithSplicing' { From 17aeace4d9a6632fcf0092ff95d7fcb9ab1b1507 Mon Sep 17 00:00:00 2001 From: Randy Eckenrode Date: Sat, 21 Sep 2024 10:06:58 -0400 Subject: [PATCH 017/157] darwin: prepare for adding stub packages --- pkgs/top-level/darwin-packages.nix | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pkgs/top-level/darwin-packages.nix b/pkgs/top-level/darwin-packages.nix index b5fb2e0566b84..97a3036062e94 100644 --- a/pkgs/top-level/darwin-packages.nix +++ b/pkgs/top-level/darwin-packages.nix @@ -93,9 +93,12 @@ makeScopeWithSplicing' { else appleSourcePackages ) Security; }; + + stubs = lib.genAttrs [ + ] (mkStub apple_sdk.version); in -impure-cmds // appleSourcePackages // chooseLibs // { +impure-cmds // appleSourcePackages // chooseLibs // stubs // { inherit apple_sdk apple_sdk_10_12 apple_sdk_11_0 apple_sdk_12_3; From fcd9dc8ac61c2c11be5b9b0b9fa730b9827a14af Mon Sep 17 00:00:00 2001 From: Randy Eckenrode Date: Wed, 25 Sep 2024 22:19:41 -0400 Subject: [PATCH 018/157] darwin.apple_sdk_11_0: convert frameworks and libs to stubs --- .../darwin/apple-sdk-11.0/apple_sdk.nix | 268 ----------- .../darwin/apple-sdk-11.0/cf-setup-hook.sh | 6 - .../darwin/apple-sdk-11.0/default.nix | 437 ++++++++++++------ .../darwin/apple-sdk-11.0/frameworks.nix | 196 -------- .../darwin/apple-sdk-11.0/libSystem.nix | 88 ---- .../darwin/apple-sdk-11.0/libcharset.nix | 16 - .../darwin/apple-sdk-11.0/libcompression.nix | 20 - .../darwin/apple-sdk-11.0/libnetwork.nix | 20 - .../darwin/apple-sdk-11.0/libobjc.nix | 24 - .../darwin/apple-sdk-11.0/libpm.nix | 23 - .../darwin/apple-sdk-11.0/libunwind.nix | 24 - .../apple-sdk-11.0/private-frameworks.nix | 32 -- pkgs/top-level/darwin-packages.nix | 10 +- 13 files changed, 295 insertions(+), 869 deletions(-) delete mode 100644 pkgs/os-specific/darwin/apple-sdk-11.0/apple_sdk.nix delete mode 100644 pkgs/os-specific/darwin/apple-sdk-11.0/cf-setup-hook.sh delete mode 100644 pkgs/os-specific/darwin/apple-sdk-11.0/frameworks.nix delete mode 100644 pkgs/os-specific/darwin/apple-sdk-11.0/libSystem.nix delete mode 100644 pkgs/os-specific/darwin/apple-sdk-11.0/libcharset.nix delete mode 100644 pkgs/os-specific/darwin/apple-sdk-11.0/libcompression.nix delete mode 100644 pkgs/os-specific/darwin/apple-sdk-11.0/libnetwork.nix delete mode 100644 pkgs/os-specific/darwin/apple-sdk-11.0/libobjc.nix delete mode 100644 pkgs/os-specific/darwin/apple-sdk-11.0/libpm.nix delete mode 100644 pkgs/os-specific/darwin/apple-sdk-11.0/libunwind.nix delete mode 100644 pkgs/os-specific/darwin/apple-sdk-11.0/private-frameworks.nix diff --git a/pkgs/os-specific/darwin/apple-sdk-11.0/apple_sdk.nix b/pkgs/os-specific/darwin/apple-sdk-11.0/apple_sdk.nix deleted file mode 100644 index fdc3bd45e55ee..0000000000000 --- a/pkgs/os-specific/darwin/apple-sdk-11.0/apple_sdk.nix +++ /dev/null @@ -1,268 +0,0 @@ -{ lib, stdenvNoCC, buildPackages, fetchurl, xar, cpio, pkgs, python3, pbzx, MacOSX-SDK }: - -# TODO: reorganize to make this just frameworks, and move libs to default.nix - -let - stdenv = stdenvNoCC; - - standardFrameworkPath = name: private: - "/System/Library/${lib.optionalString private "Private"}Frameworks/${name}.framework"; - - mkDepsRewrites = deps: - let - mergeRewrites = x: y: { - prefix = lib.mergeAttrs (x.prefix or {}) (y.prefix or {}); - const = lib.mergeAttrs (x.const or {}) (y.const or {}); - }; - - rewriteArgs = { prefix ? {}, const ? {} }: lib.concatLists ( - (lib.mapAttrsToList (from: to: [ "-p" "${from}:${to}" ]) prefix) ++ - (lib.mapAttrsToList (from: to: [ "-c" "${from}:${to}" ]) const) - ); - - rewrites = depList: lib.fold mergeRewrites {} - (map (dep: dep.tbdRewrites) - (lib.filter (dep: dep ? tbdRewrites) depList)); - in - lib.escapeShellArgs (rewriteArgs (rewrites (builtins.attrValues deps))); - - mkFramework = { name, deps, private ? false }: - let self = stdenv.mkDerivation { - pname = "apple-${lib.optionalString private "private-"}framework-${name}"; - version = MacOSX-SDK.version; - - dontUnpack = true; - - # because we copy files from the system - preferLocalBuild = true; - - disallowedRequisites = [ MacOSX-SDK ]; - - nativeBuildInputs = [ buildPackages.darwin.rewrite-tbd ]; - - installPhase = '' - mkdir -p $out/Library/Frameworks - - cp -r ${MacOSX-SDK}${standardFrameworkPath name private} $out/Library/Frameworks - - if [[ -d ${MacOSX-SDK}/usr/lib/swift/${name}.swiftmodule ]]; then - mkdir -p $out/lib/swift - cp -r -t $out/lib/swift \ - ${MacOSX-SDK}/usr/lib/swift/${name}.swiftmodule \ - ${MacOSX-SDK}/usr/lib/swift/libswift${name}.tbd - fi - - # Fix and check tbd re-export references - chmod u+w -R $out - find $out -name '*.tbd' -type f | while read tbd; do - echo "Fixing re-exports in $tbd" - rewrite-tbd \ - -p ${standardFrameworkPath name private}/:$out/Library/Frameworks/${name}.framework/ \ - -p /usr/lib/swift/:$out/lib/swift/ \ - ${mkDepsRewrites deps} \ - -r ${builtins.storeDir} \ - "$tbd" - done - ''; - - propagatedBuildInputs = builtins.attrValues deps; - - passthru = { - tbdRewrites = { - prefix."${standardFrameworkPath name private}/" = "${self}/Library/Frameworks/${name}.framework/"; - }; - }; - - meta = with lib; { - description = "Apple SDK framework ${name}"; - maintainers = with maintainers; [ copumpkin ]; - platforms = platforms.darwin; - }; - }; - in self; - - framework = name: deps: mkFramework { inherit name deps; private = false; }; - privateFramework = name: deps: mkFramework { inherit name deps; private = true; }; -in rec { - libs = { - xpc = stdenv.mkDerivation { - name = "apple-lib-xpc"; - dontUnpack = true; - - installPhase = '' - mkdir -p $out/include - pushd $out/include >/dev/null - cp -r "${MacOSX-SDK}/usr/include/xpc" $out/include/xpc - cp "${MacOSX-SDK}/usr/include/launch.h" $out/include/launch.h - popd >/dev/null - ''; - }; - - Xplugin = stdenv.mkDerivation { - name = "apple-lib-Xplugin"; - dontUnpack = true; - - propagatedBuildInputs = with frameworks; [ - OpenGL ApplicationServices Carbon IOKit CoreGraphics CoreServices CoreText - ]; - - installPhase = '' - mkdir -p $out/include $out/lib - ln -s "${MacOSX-SDK}/include/Xplugin.h" $out/include/Xplugin.h - cp ${MacOSX-SDK}/usr/lib/libXplugin.1.tbd $out/lib - ln -s libXplugin.1.tbd $out/lib/libXplugin.tbd - ''; - }; - - utmp = stdenv.mkDerivation { - name = "apple-lib-utmp"; - dontUnpack = true; - - installPhase = '' - mkdir -p $out/include - pushd $out/include >/dev/null - ln -s "${MacOSX-SDK}/include/utmp.h" - ln -s "${MacOSX-SDK}/include/utmpx.h" - popd >/dev/null - ''; - }; - - sandbox = stdenv.mkDerivation { - name = "apple-lib-sandbox"; - - dontUnpack = true; - dontBuild = true; - - installPhase = '' - mkdir -p $out/include $out/lib - ln -s "${MacOSX-SDK}/usr/include/sandbox.h" $out/include/sandbox.h - cp "${MacOSX-SDK}/usr/lib/libsandbox.1.tbd" $out/lib - ln -s libsandbox.1.tbd $out/lib/libsandbox.tbd - ''; - }; - - libDER = stdenv.mkDerivation { - name = "apple-lib-libDER"; - dontUnpack = true; - installPhase = '' - mkdir -p $out/include - cp -r ${MacOSX-SDK}/usr/include/libDER $out/include - ''; - }; - - simd = stdenv.mkDerivation { - name = "apple-lib-simd"; - dontUnpack = true; - installPhase = '' - mkdir -p $out/include - cp -r ${MacOSX-SDK}/usr/include/simd $out/include - ''; - }; - }; - - frameworks = let - # Dependency map created by gen-frameworks.py. - generatedDeps = import ./frameworks.nix { - inherit frameworks libs; - }; - - # Additional dependencies that are not picked up by gen-frameworks.py. - # Some of these are simply private frameworks the generator does not see. - extraDeps = with libs; with frameworks; let - inherit (pkgs.darwin.apple_sdk_11_0) libnetwork; - libobjc = pkgs.darwin.apple_sdk_11_0.objc4; - in { - # Below this comment are entries migrated from before the generator was - # added. If, for a given framework, you are able to reverify the extra - # deps are really necessary on top of the generator deps, move it above - # this comment (and maybe document your findings). - AVFoundation = { inherit ApplicationServices AVFCapture AVFCore; }; - Accelerate = { inherit CoreWLAN IOBluetooth; }; - AddressBook = { inherit AddressBookCore ContactsPersistence libobjc; }; - AppKit = { inherit AudioToolbox AudioUnit UIFoundation; }; - AudioToolbox = { inherit AudioToolboxCore; }; - AudioUnit = { inherit Carbon CoreAudio; }; - Carbon = { inherit IOKit QuartzCore libobjc; }; - CoreAudio = { inherit IOKit; }; - CoreFoundation = { inherit libobjc; }; - CoreGraphics = { inherit SystemConfiguration; }; - CoreMIDIServer = { inherit CoreMIDI; }; - CoreMedia = { inherit ApplicationServices AudioToolbox AudioUnit; }; - CoreServices = { inherit CoreAudio NetFS ServiceManagement; }; - CoreWLAN = { inherit SecurityFoundation; }; - DiscRecording = { inherit IOKit libobjc; }; - Foundation = { inherit SystemConfiguration libobjc; }; - GameKit = { inherit GameCenterFoundation GameCenterUI GameCenterUICore ReplayKit; }; - ICADevices = { inherit Carbon libobjc; }; - IOBluetooth = { inherit CoreBluetooth; }; - JavaScriptCore = { inherit libobjc; }; - Kernel = { inherit IOKit; }; - LinkPresentation = { inherit URLFormatting; }; - MediaToolbox = { inherit AudioUnit; }; - MetricKit = { inherit SignpostMetrics; }; - Network = { inherit libnetwork; }; - PCSC = { inherit CoreData; }; - PassKit = { inherit PassKitCore; }; - QTKit = { inherit CoreMedia CoreMediaIO MediaToolbox VideoToolbox; }; - Quartz = { inherit QTKit; }; - QuartzCore = { inherit ApplicationServices CoreImage CoreVideo Metal OpenCL libobjc; }; - Security = { inherit IOKit libDER; }; - TWAIN = { inherit Carbon; }; - VideoDecodeAcceleration = { inherit CoreVideo; }; - WebKit = { inherit ApplicationServices Carbon libobjc; }; - }; - - # Overrides for framework derivations. - overrides = super: { - CoreFoundation = lib.overrideDerivation super.CoreFoundation (drv: { - setupHook = ./cf-setup-hook.sh; - }); - - # This framework doesn't exist in newer SDKs (somewhere around 10.13), but - # there are references to it in nixpkgs. - QuickTime = throw "QuickTime framework not available"; - - # Seems to be appropriate given https://developer.apple.com/forums/thread/666686 - JavaVM = super.JavaNativeFoundation; - - CoreVideo = lib.overrideDerivation super.CoreVideo (drv: { - installPhase = drv.installPhase + '' - # When used as a module, complains about a missing import for - # Darwin.C.stdint. Apparently fixed in later SDKs. - sed -e "/CFBase.h/ i #include " \ - -i $out/Library/Frameworks/CoreVideo.framework/Headers/CVBase.h - ''; - }); - - System = lib.overrideDerivation super.System (drv: { - installPhase = drv.installPhase + '' - # Contrarily to the other frameworks, System framework's TBD file - # is a symlink pointing to ${MacOSX-SDK}/usr/lib/libSystem.B.tbd. - # This produces an error when installing the framework as: - # 1. The original file is not copied into the output directory - # 2. Even if it was copied, the relative path wouldn't match - # Thus, it is easier to replace the file than to fix the symlink. - cp --remove-destination ${MacOSX-SDK}/usr/lib/libSystem.B.tbd \ - $out/Library/Frameworks/System.framework/Versions/B/System.tbd - ''; - }); - }; - - # Merge extraDeps into generatedDeps. - deps = generatedDeps // ( - lib.mapAttrs - (name: deps: generatedDeps.${name} // deps) - extraDeps - ); - - # Create derivations, and add private frameworks. - bareFrameworks = (lib.mapAttrs framework deps) // ( - lib.mapAttrs privateFramework (import ./private-frameworks.nix { - inherit frameworks; - libobjc = pkgs.darwin.apple_sdk_11_0.objc4; - }) - ); - in - # Apply derivation overrides. - bareFrameworks // overrides bareFrameworks; -} diff --git a/pkgs/os-specific/darwin/apple-sdk-11.0/cf-setup-hook.sh b/pkgs/os-specific/darwin/apple-sdk-11.0/cf-setup-hook.sh deleted file mode 100644 index b64eb95f2ded7..0000000000000 --- a/pkgs/os-specific/darwin/apple-sdk-11.0/cf-setup-hook.sh +++ /dev/null @@ -1,6 +0,0 @@ -forceLinkCoreFoundationFramework() { - NIX_CFLAGS_COMPILE="-F@out@/Library/Frameworks${NIX_CFLAGS_COMPILE:+ }${NIX_CFLAGS_COMPILE-}" - NIX_LDFLAGS+=" @out@/Library/Frameworks/CoreFoundation.framework/CoreFoundation.tbd" -} - -preConfigureHooks+=(forceLinkCoreFoundationFramework) diff --git a/pkgs/os-specific/darwin/apple-sdk-11.0/default.nix b/pkgs/os-specific/darwin/apple-sdk-11.0/default.nix index c64f011c0534d..889f484b0475c 100644 --- a/pkgs/os-specific/darwin/apple-sdk-11.0/default.nix +++ b/pkgs/os-specific/darwin/apple-sdk-11.0/default.nix @@ -1,160 +1,303 @@ -{ stdenvNoCC, fetchurl, newScope, lib, pkgs -, stdenv, overrideCC -, xar, cpio, python3, pbzx }: +# Compatibility stubs for packages that used the old SDK frameworks. +# TODO(@reckenrode) Make these stubs warn after framework usage has been cleaned up in nixpkgs. +{ + lib, + callPackage, + newScope, + overrideSDK, + pkgs, + stdenv, + stdenvNoCC, +}: let - mkSusDerivation = args: stdenvNoCC.mkDerivation (args // { - dontBuild = true; - darwinDontCodeSign = true; + mkStub = callPackage ../apple-sdk/mk-stub.nix { } "11.0"; - nativeBuildInputs = [ cpio pbzx ]; + stdenvs = + { + stdenv = overrideSDK stdenv "11.0"; + } + // builtins.listToAttrs ( + map + (v: { + name = "llvmPackages_${v}"; + value = pkgs."llvmPackages_${v}" // { + stdenv = overrideSDK pkgs."llvmPackages_${v}".stdenv "11.0"; + }; + }) + [ + "12" + "13" + "14" + "15" + "16" + ] + ); +in +stdenvs +// lib.genAttrs [ + "CLTools_Executables" + "IOKit" + "Libsystem" + "LibsystemCross" + "MacOSX-SDK" + "configd" + "darwin-stubs" + "libcharset" + "libcompression" + "libnetwork" + "libpm" + "libunwind" + "objc4" + "sdkRoot" +] mkStub +// { + frameworks = lib.genAttrs [ + "AGL" + "AVFCapture" + "AVFCore" + "AVFoundation" + "AVKit" + "Accelerate" + "Accessibility" + "Accounts" + "AdServices" + "AdSupport" + "AddressBook" + "AddressBookCore" + "AppKit" + "AppTrackingTransparency" + "Apple80211" + "AppleScriptKit" + "AppleScriptObjC" + "ApplicationServices" + "AudioToolbox" + "AudioToolboxCore" + "AudioUnit" + "AudioVideoBridging" + "AuthenticationServices" + "AutomaticAssessmentConfiguration" + "Automator" + "BackgroundTasks" + "BusinessChat" + "CFNetwork" + "CalendarStore" + "CallKit" + "Carbon" + "ClassKit" + "CloudKit" + "Cocoa" + "Collaboration" + "ColorSync" + "Combine" + "Contacts" + "ContactsPersistence" + "ContactsUI" + "CoreAudio" + "CoreAudioKit" + "CoreAudioTypes" + "CoreBluetooth" + "CoreData" + "CoreDisplay" + "CoreFoundation" + "CoreGraphics" + "CoreHaptics" + "CoreImage" + "CoreLocation" + "CoreMIDI" + "CoreMIDIServer" + "CoreML" + "CoreMedia" + "CoreMediaIO" + "CoreMotion" + "CoreServices" + "CoreSpotlight" + "CoreSymbolication" + "CoreTelephony" + "CoreText" + "CoreVideo" + "CoreWLAN" + "CryptoKit" + "CryptoTokenKit" + "DVDPlayback" + "DebugSymbols" + "DeveloperToolsSupport" + "DeviceCheck" + "DirectoryService" + "DiscRecording" + "DiscRecordingUI" + "DiskArbitration" + "DisplayServices" + "DriverKit" + "EventKit" + "ExceptionHandling" + "ExecutionPolicy" + "ExternalAccessory" + "FWAUserLib" + "FileProvider" + "FileProviderUI" + "FinderSync" + "ForceFeedback" + "Foundation" + "GLKit" + "GLUT" + "GSS" + "GameCenterFoundation" + "GameCenterUI" + "GameCenterUICore" + "GameController" + "GameKit" + "GameplayKit" + "HIDDriverKit" + "Hypervisor" + "ICADevices" + "IMServicePlugIn" + "IOBluetooth" + "IOBluetoothUI" + "IOKit" + "IOSurface" + "IOUSBHost" + "IdentityLookup" + "ImageCaptureCore" + "ImageIO" + "InputMethodKit" + "InstallerPlugins" + "InstantMessage" + "Intents" + "JavaNativeFoundation" + "JavaRuntimeSupport" + "JavaScriptCore" + "JavaVM" + "Kerberos" + "Kernel" + "KernelManagement" + "LDAP" + "LatentSemanticMapping" + "LinkPresentation" + "LocalAuthentication" + "MLCompute" + "MapKit" + "MediaAccessibility" + "MediaLibrary" + "MediaPlayer" + "MediaRemote" + "MediaToolbox" + "Message" + "Metal" + "MetalKit" + "MetalPerformanceShaders" + "MetalPerformanceShadersGraph" + "MetricKit" + "ModelIO" + "MultipeerConnectivity" + "MultitouchSupport" + "NaturalLanguage" + "NearbyInteraction" + "NetFS" + "Network" + "NetworkExtension" + "NetworkingDriverKit" + "NotificationCenter" + "OSAKit" + "OSLog" + "OpenAL" + "OpenCL" + "OpenDirectory" + "OpenGL" + "PCIDriverKit" + "PCSC" + "PDFKit" + "ParavirtualizedGraphics" + "PassKit" + "PassKitCore" + "PencilKit" + "Photos" + "PhotosUI" + "PreferencePanes" + "PushKit" + "Python" + "QTKit" + "Quartz" + "QuartzCore" + "QuickLook" + "QuickLookThumbnailing" + "QuickTime" + "RealityKit" + "ReplayKit" + "Ruby" + "SafariServices" + "SceneKit" + "ScreenSaver" + "ScreenTime" + "ScriptingBridge" + "Security" + "SecurityFoundation" + "SecurityInterface" + "SensorKit" + "ServiceManagement" + "SignpostMetrics" + "SkyLight" + "Social" + "SoundAnalysis" + "Speech" + "SpriteKit" + "StoreKit" + "SwiftUI" + "SyncServices" + "System" + "SystemConfiguration" + "SystemExtensions" + "TWAIN" + "Tcl" + "Tk" + "UIFoundation" + "URLFormatting" + "USBDriverKit" + "UniformTypeIdentifiers" + "UserNotifications" + "UserNotificationsUI" + "VideoDecodeAcceleration" + "VideoSubscriberAccount" + "VideoToolbox" + "Virtualization" + "Vision" + "WebKit" + "WidgetKit" + "iTunesLibrary" + "vmnet" + ] mkStub; - outputs = [ "out" ]; + libs = lib.genAttrs [ + "Xplugin" + "utmp" + "libDER" + "xpc" + "sandbox" + "simd" + ] mkStub; - unpackPhase = '' - pbzx $src | cpio -idm - ''; - - passthru = { - inherit (args) version; - }; - }); - - MacOSX-SDK = mkSusDerivation { - pname = "MacOSX-SDK"; - version = "11.0.0"; - - # https://swscan.apple.com/content/catalogs/others/index-11-10.15-10.14-10.13-10.12-10.11-10.10-10.9-mountainlion-lion-snowleopard-leopard.merged-1.sucatalog - src = fetchurl { - url = "http://swcdn.apple.com/content/downloads/46/21/001-89745-A_56FM390IW5/v1um2qppgfdnam2e9cdqcqu2r6k8aa3lis/CLTools_macOSNMOS_SDK.pkg"; - sha256 = "0n425smj4q1vxbza8fzwnk323fyzbbq866q32w288c44hl5yhwsf"; - }; - - installPhase = '' - mv Library/Developer/CommandLineTools/SDKs/MacOSX11.1.sdk $out - ''; - }; - - CLTools_Executables = mkSusDerivation { - pname = "CLTools_Executables"; - version = "11.0.0"; - - # https://swscan.apple.com/content/catalogs/others/index-11-10.15-10.14-10.13-10.12-10.11-10.10-10.9-mountainlion-lion-snowleopard-leopard.merged-1.sucatalog - src = fetchurl { - url = "http://swcdn.apple.com/content/downloads/46/21/001-89745-A_56FM390IW5/v1um2qppgfdnam2e9cdqcqu2r6k8aa3lis/CLTools_Executables.pkg"; - sha256 = "0nvb1qx7l81l2wcl8wvgbpsg5rcn51ylhivqmlfr2hrrv3zrrpl0"; - }; - - installPhase = '' - mv Library/Developer/CommandLineTools $out - ''; - }; - - mkCc = cc: - if lib.versionAtLeast stdenv.hostPlatform.darwinSdkVersion "11" then cc - else - cc.override { - bintools = stdenv.cc.bintools.override { libc = packages.Libsystem; }; - libc = packages.Libsystem; - }; - - mkStdenv = stdenv: - if lib.versionAtLeast stdenv.hostPlatform.darwinSdkVersion "11" then stdenv - else - let - darwinMinVersion = "10.12"; - darwinSdkVersion = "11.0"; - in - (overrideCC stdenv (mkCc stdenv.cc)).override { - extraBuildInputs = [ pkgs.darwin.apple_sdk_11_0.frameworks.CoreFoundation ]; - buildPlatform = stdenv.buildPlatform // { inherit darwinMinVersion darwinSdkVersion; }; - hostPlatform = stdenv.hostPlatform // { inherit darwinMinVersion darwinSdkVersion; }; - targetPlatform = stdenv.targetPlatform // { inherit darwinMinVersion darwinSdkVersion; }; - }; - - stdenvs = { - stdenv = mkStdenv stdenv; - } // builtins.listToAttrs (map - (v: { - name = "llvmPackages_${v}"; - value = pkgs."llvmPackages_${v}" // { - stdenv = mkStdenv pkgs."llvmPackages_${v}".stdenv; - clang = mkCc pkgs."llvmPackages_${v}".clang; - }; - }) - [ "12" "13" "14" "15" "16" ] + callPackage = newScope ( + lib.optionalAttrs stdenv.isDarwin stdenvs // { inherit (pkgs.darwin.apple_sdk_11_0) rustPlatform; } ); - callPackage = newScope (packages // pkgs.darwin // { inherit MacOSX-SDK; }); - - packages = stdenvs // { - inherit (callPackage ./apple_sdk.nix { }) frameworks libs; - - # TODO: this is nice to be private. is it worth the callPackage above? - # Probably, I don't think that callPackage costs much at all. - inherit MacOSX-SDK CLTools_Executables; - - Libsystem = callPackage ./libSystem.nix { }; - LibsystemCross = pkgs.darwin.Libsystem; - libcharset = callPackage ./libcharset.nix { }; - libcompression = callPackage ./libcompression.nix { }; - libunwind = callPackage ./libunwind.nix { }; - libnetwork = callPackage ./libnetwork.nix { }; - libpm = callPackage ./libpm.nix { }; - # Avoid introducing a new objc4 if stdenv already has one, to prevent - # conflicting LLVM modules. - objc4 = stdenv.objc4 or (callPackage ./libobjc.nix { }); - - sdkRoot = pkgs.callPackage ../apple-sdk/sdkRoot.nix { sdkVersion = "11.0"; }; - - # questionable aliases - configd = pkgs.darwin.apple_sdk.frameworks.SystemConfiguration; - inherit (pkgs.darwin.apple_sdk.frameworks) IOKit; - - xcodebuild = pkgs.xcbuild.override { - inherit (pkgs.darwin.apple_sdk_11_0) stdenv; - inherit (pkgs.darwin.apple_sdk_11_0.frameworks) CoreServices CoreGraphics ImageIO; - }; - - rustPlatform = pkgs.makeRustPlatform { + rustPlatform = + pkgs.makeRustPlatform { inherit (pkgs.darwin.apple_sdk_11_0) stdenv; inherit (pkgs) rustc cargo; - } // { - inherit (pkgs.callPackage ../../../build-support/rust/hooks { - inherit (pkgs.darwin.apple_sdk_11_0) stdenv; - inherit (pkgs) cargo rustc; - clang = mkCc pkgs.clang; - }) bindgenHook; + } + // { + inherit + (pkgs.callPackage ../../../build-support/rust/hooks { + inherit (pkgs.darwin.apple_sdk_11_0) stdenv; + inherit (pkgs) cargo rustc; + }) + bindgenHook + ; }; - callPackage = newScope (lib.optionalAttrs stdenv.hostPlatform.isDarwin (stdenvs // rec { - inherit (pkgs.darwin.apple_sdk_11_0) xcodebuild rustPlatform; - darwin = pkgs.darwin.overrideScope (_: prev: { - inherit (prev.darwin.apple_sdk_11_0) - IOKit - Libsystem - LibsystemCross - Security - configd - libcharset - libunwind - objc4 - ; - apple_sdk = prev.darwin.apple_sdk_11_0; - CF = prev.darwin.apple_sdk_11_0.CoreFoundation; - }); - xcbuild = xcodebuild; - })); + stdenv = overrideSDK stdenv "11.0"; - darwin-stubs = stdenvNoCC.mkDerivation { - pname = "darwin-stubs"; - inherit (MacOSX-SDK) version; + xcodebuild = pkgs.xcodebuild; - buildCommand = '' - mkdir -p "$out" - ln -s ${MacOSX-SDK}/System "$out/System" - ln -s ${MacOSX-SDK}/usr "$out/usr" - ''; - }; - }; -in packages + version = "11.0"; +} diff --git a/pkgs/os-specific/darwin/apple-sdk-11.0/frameworks.nix b/pkgs/os-specific/darwin/apple-sdk-11.0/frameworks.nix deleted file mode 100644 index fa6945f76718f..0000000000000 --- a/pkgs/os-specific/darwin/apple-sdk-11.0/frameworks.nix +++ /dev/null @@ -1,196 +0,0 @@ -# This file is generated by gen-frameworks.nix. -# Do not edit, put overrides in apple_sdk.nix instead. -{ libs, frameworks }: with libs; with frameworks; -{ - AGL = { inherit Carbon OpenGL; }; - AVFoundation = { inherit AudioToolbox CoreAudio CoreAudioTypes CoreFoundation CoreGraphics CoreImage CoreMIDI CoreMedia CoreVideo Foundation IOKit ImageIO MediaToolbox Metal QuartzCore UniformTypeIdentifiers simd; }; - AVKit = { inherit AVFoundation AppKit Cocoa Foundation; }; - Accelerate = { inherit CoreFoundation CoreGraphics CoreVideo Foundation IOKit Metal; }; - Accessibility = { inherit CoreGraphics Foundation; }; - Accounts = { inherit Foundation; }; - AdServices = { inherit Foundation; }; - AdSupport = { inherit Foundation; }; - AddressBook = { inherit Carbon Cocoa CoreFoundation Foundation; }; - AppKit = { inherit ApplicationServices CloudKit CoreData CoreFoundation CoreGraphics CoreImage CoreLocation Foundation IOKit Metal OpenGL QuartzCore; }; - AppTrackingTransparency = { inherit Foundation; }; - AppleScriptKit = {}; - AppleScriptObjC = { inherit Foundation; }; - ApplicationServices = { inherit ColorSync CoreFoundation CoreGraphics CoreServices CoreText ImageIO; }; - AudioToolbox = { inherit Carbon CoreAudio CoreAudioTypes CoreFoundation CoreMIDI Foundation; }; - AudioUnit = { inherit AudioToolbox; }; - AudioVideoBridging = { inherit Foundation IOKit; }; - AuthenticationServices = { inherit AppKit Foundation; }; - AutomaticAssessmentConfiguration = { inherit Foundation; }; - Automator = { inherit AppKit Cocoa Foundation OSAKit; }; - BackgroundTasks = { inherit Foundation; }; - BusinessChat = { inherit Cocoa Foundation; }; - CFNetwork = { inherit CoreFoundation; }; - CalendarStore = {}; - CallKit = { inherit CoreFoundation CoreGraphics Foundation IOKit; }; - Carbon = { inherit ApplicationServices CoreServices Foundation Security; }; - ClassKit = { inherit CoreGraphics Foundation; }; - CloudKit = { inherit CoreFoundation CoreGraphics CoreLocation Foundation IOKit; }; - Cocoa = { inherit AppKit CoreData Foundation; }; - Collaboration = { inherit AppKit CoreServices Foundation; }; - ColorSync = { inherit CoreFoundation; }; - Combine = {}; - Contacts = { inherit CoreFoundation CoreGraphics Foundation IOKit; }; - ContactsUI = { inherit AppKit; }; - CoreAudio = { inherit CoreAudioTypes CoreFoundation; }; - CoreAudioKit = { inherit AppKit AudioUnit Cocoa Foundation; }; - CoreAudioTypes = { inherit CoreFoundation; }; - CoreBluetooth = { inherit Foundation; }; - CoreData = { inherit CloudKit Combine CoreFoundation CoreGraphics CoreLocation Foundation IOKit; }; - CoreDisplay = {}; - CoreFoundation = {}; - CoreGraphics = { inherit CoreFoundation IOKit; }; - CoreHaptics = { inherit Foundation; }; - CoreImage = { inherit ApplicationServices CoreFoundation CoreGraphics CoreVideo Foundation IOKit IOSurface ImageIO Metal OpenGL; }; - CoreLocation = { inherit CoreFoundation CoreGraphics Foundation IOKit; }; - CoreMIDI = { inherit CoreFoundation CoreGraphics Foundation IOKit; }; - CoreMIDIServer = {}; - CoreML = { inherit CoreFoundation CoreGraphics CoreVideo Foundation IOKit ImageIO Metal; }; - CoreMedia = { inherit CoreAudio CoreAudioTypes CoreFoundation CoreGraphics CoreVideo Foundation IOKit Metal; }; - CoreMediaIO = { inherit CoreFoundation CoreMedia; }; - CoreMotion = { inherit Foundation; }; - CoreServices = { inherit CFNetwork CoreFoundation DiskArbitration Security; }; - CoreSpotlight = { inherit Foundation UniformTypeIdentifiers; }; - CoreTelephony = {}; - CoreText = { inherit CoreFoundation CoreGraphics; }; - CoreVideo = { inherit ApplicationServices CoreFoundation CoreGraphics IOSurface Metal OpenGL; }; - CoreWLAN = { inherit Foundation IOKit; }; - CryptoKit = { inherit CoreFoundation CoreGraphics Foundation IOKit LocalAuthentication Security; }; - CryptoTokenKit = { inherit CoreFoundation CoreGraphics Foundation IOKit Security; }; - DVDPlayback = { inherit ApplicationServices CoreFoundation Security; }; - DeveloperToolsSupport = { inherit Foundation; }; - DeviceCheck = { inherit Foundation; }; - DirectoryService = { inherit CoreFoundation; }; - DiscRecording = { inherit CoreServices Foundation; }; - DiscRecordingUI = { inherit Carbon Cocoa DiscRecording; }; - DiskArbitration = { inherit CoreFoundation IOKit; }; - DriverKit = {}; - EventKit = { inherit CoreGraphics CoreLocation Foundation; }; - ExceptionHandling = { inherit Foundation; }; - ExecutionPolicy = { inherit Foundation; }; - ExternalAccessory = { inherit Foundation; }; - FWAUserLib = { inherit IOKit; }; - FileProvider = { inherit CoreGraphics Foundation; }; - FileProviderUI = { inherit AppKit FileProvider Foundation; }; - FinderSync = { inherit AppKit Foundation; }; - ForceFeedback = { inherit CoreFoundation IOKit; }; - Foundation = { inherit ApplicationServices Combine CoreFoundation CoreGraphics CoreServices IOKit Security; }; - GLKit = { inherit AppKit CloudKit CoreData CoreFoundation CoreGraphics CoreImage CoreLocation Foundation IOKit Metal ModelIO OpenGL QuartzCore simd; }; - GLUT = { inherit OpenGL; }; - GSS = { inherit CoreFoundation; }; - GameController = { inherit AppKit Foundation IOKit; }; - GameKit = { inherit AppKit Cocoa Contacts CoreGraphics Foundation GameController GameplayKit Metal MetalKit ModelIO SceneKit SpriteKit simd; }; - GameplayKit = { inherit AppKit CloudKit CoreData CoreFoundation CoreGraphics CoreImage CoreLocation Foundation GLKit IOKit Metal ModelIO QuartzCore SceneKit SpriteKit simd; }; - HIDDriverKit = { inherit IOKit USBDriverKit; }; - Hypervisor = {}; - ICADevices = { inherit CoreFoundation CoreGraphics CoreServices IOBluetooth; }; - IMServicePlugIn = { inherit Foundation; }; - IOBluetooth = { inherit CoreAudio CoreFoundation CoreServices Foundation IOKit; }; - IOBluetoothUI = { inherit Cocoa IOBluetooth; }; - IOKit = { inherit CoreFoundation; }; - IOSurface = { inherit CoreFoundation Foundation IOKit; }; - IOUSBHost = { inherit Foundation IOKit; }; - IdentityLookup = { inherit Foundation; }; - ImageCaptureCore = { inherit Cocoa CoreGraphics Foundation; }; - ImageIO = { inherit CoreFoundation CoreGraphics; }; - InputMethodKit = { inherit Carbon Cocoa Foundation; }; - InstallerPlugins = {}; - InstantMessage = {}; - Intents = { inherit CoreFoundation CoreGraphics CoreLocation Foundation IOKit; }; - JavaNativeFoundation = { inherit Foundation; }; - JavaRuntimeSupport = { inherit ApplicationServices Cocoa Foundation QuartzCore; }; - JavaScriptCore = { inherit CoreFoundation CoreGraphics Foundation; }; - Kerberos = {}; - Kernel = {}; - KernelManagement = { inherit Foundation; }; - LDAP = {}; - LatentSemanticMapping = { inherit Carbon CoreFoundation; }; - LinkPresentation = { inherit AppKit Foundation; }; - LocalAuthentication = { inherit Foundation; }; - MLCompute = { inherit CoreFoundation CoreGraphics Foundation IOKit Metal; }; - MapKit = { inherit AppKit CloudKit CoreData CoreFoundation CoreGraphics CoreImage CoreLocation Foundation IOKit Metal QuartzCore; }; - MediaAccessibility = { inherit CoreFoundation CoreGraphics CoreText QuartzCore; }; - MediaLibrary = { inherit Foundation; }; - MediaPlayer = { inherit AVFoundation CoreGraphics Foundation; }; - MediaToolbox = { inherit AudioToolbox CoreFoundation CoreMedia; }; - Message = {}; - Metal = { inherit CoreFoundation CoreGraphics Foundation IOKit IOSurface; }; - MetalKit = { inherit AppKit CloudKit CoreData CoreFoundation CoreGraphics CoreImage CoreLocation Foundation IOKit Metal ModelIO QuartzCore simd; }; - MetalPerformanceShaders = { inherit CoreGraphics Foundation Metal simd; }; - MetalPerformanceShadersGraph = { inherit Foundation MetalPerformanceShaders; }; - MetricKit = { inherit CoreFoundation CoreGraphics Foundation IOKit; }; - ModelIO = { inherit CoreFoundation CoreGraphics Foundation IOKit simd; }; - MultipeerConnectivity = { inherit Cocoa Foundation; }; - NaturalLanguage = { inherit CoreFoundation CoreGraphics Foundation IOKit; }; - NearbyInteraction = { inherit CoreFoundation CoreGraphics Foundation IOKit simd; }; - NetFS = { inherit CoreFoundation; }; - Network = { inherit CoreFoundation Foundation Security; }; - NetworkExtension = { inherit Foundation Network Security; }; - NetworkingDriverKit = {}; - NotificationCenter = { inherit AppKit Foundation; }; - OSAKit = { inherit Carbon Cocoa; }; - OSLog = { inherit CoreFoundation CoreGraphics Foundation IOKit; }; - OpenAL = {}; - OpenCL = { inherit OpenGL; }; - OpenDirectory = { inherit CoreFoundation Foundation; }; - OpenGL = {}; - PCIDriverKit = { inherit IOKit; }; - PCSC = {}; - PDFKit = { inherit AppKit Cocoa; }; - ParavirtualizedGraphics = { inherit AppKit CoreVideo Foundation IOSurface Metal; }; - PassKit = { inherit AppKit Contacts CoreGraphics Foundation; }; - PencilKit = { inherit AppKit CloudKit Cocoa CoreData CoreFoundation CoreGraphics CoreImage CoreLocation Foundation IOKit Metal QuartzCore; }; - Photos = { inherit AVFoundation CoreAudio CoreFoundation CoreGraphics CoreImage CoreLocation CoreMIDI CoreMedia Foundation IOKit ImageIO Metal QuartzCore UniformTypeIdentifiers simd; }; - PhotosUI = { inherit AppKit Foundation MapKit Photos; }; - PreferencePanes = { inherit Cocoa; }; - PushKit = { inherit Foundation; }; - Python = { inherit Carbon; }; - QTKit = {}; - Quartz = { inherit AppKit ApplicationServices Cocoa Foundation ImageCaptureCore OpenGL PDFKit QuartzCore QuickLook; }; - QuartzCore = { inherit CoreFoundation CoreGraphics CoreImage CoreVideo Foundation IOKit Metal OpenGL; }; - QuickLook = { inherit ApplicationServices CoreFoundation; }; - QuickLookThumbnailing = { inherit CoreGraphics Foundation UniformTypeIdentifiers; }; - RealityKit = { inherit AVFoundation AppKit AudioToolbox CloudKit Combine CoreAudio CoreData CoreFoundation CoreGraphics CoreImage CoreLocation CoreMIDI CoreText Foundation IOKit Metal MultipeerConnectivity QuartzCore simd; }; - ReplayKit = { inherit AVFoundation AppKit Foundation; }; - Ruby = {}; - SafariServices = { inherit AppKit CloudKit CoreData CoreFoundation CoreGraphics CoreImage CoreLocation Foundation IOKit Metal QuartzCore; }; - SceneKit = { inherit AppKit CloudKit CoreData CoreFoundation CoreGraphics CoreImage CoreLocation Foundation GLKit IOKit Metal ModelIO QuartzCore simd; }; - ScreenSaver = { inherit AppKit Foundation; }; - ScreenTime = { inherit AppKit Foundation; }; - ScriptingBridge = { inherit ApplicationServices CoreServices Foundation; }; - Security = { inherit CoreFoundation; }; - SecurityFoundation = { inherit Foundation Security; }; - SecurityInterface = { inherit AppKit Cocoa Security SecurityFoundation; }; - SensorKit = { inherit CoreFoundation CoreLocation Foundation; }; - ServiceManagement = { inherit CoreFoundation Security; }; - Social = { inherit AppKit Foundation; }; - SoundAnalysis = { inherit AVFoundation CoreML CoreMedia Foundation; }; - Speech = { inherit AVFoundation CoreAudio CoreFoundation CoreGraphics CoreImage CoreMIDI CoreMedia Foundation IOKit Metal QuartzCore UniformTypeIdentifiers simd; }; - SpriteKit = { inherit AppKit CloudKit Cocoa CoreData CoreFoundation CoreGraphics CoreImage CoreLocation Foundation GLKit IOKit Metal ModelIO QuartzCore simd; }; - StoreKit = { inherit AppKit CoreGraphics Foundation; }; - SwiftUI = { inherit AppKit CloudKit Combine CoreData CoreFoundation CoreGraphics CoreImage CoreLocation DeveloperToolsSupport Foundation IOKit Metal QuartzCore UniformTypeIdentifiers; }; - SyncServices = {}; - System = {}; - SystemConfiguration = { inherit CoreFoundation Security; }; - SystemExtensions = { inherit Foundation; }; - TWAIN = {}; - Tcl = {}; - Tk = {}; - USBDriverKit = { inherit IOKit; }; - UniformTypeIdentifiers = { inherit CoreFoundation CoreGraphics Foundation IOKit; }; - UserNotifications = { inherit Foundation; }; - UserNotificationsUI = { inherit AppKit; }; - VideoDecodeAcceleration = {}; - VideoSubscriberAccount = { inherit Foundation; }; - VideoToolbox = { inherit CoreFoundation CoreGraphics CoreMedia CoreVideo; }; - Virtualization = { inherit CoreFoundation CoreGraphics Foundation IOKit; }; - Vision = { inherit CoreAudio CoreFoundation CoreGraphics CoreML CoreMedia CoreVideo Foundation IOKit ImageIO Metal simd; }; - WebKit = { inherit AppKit CloudKit CoreData CoreFoundation CoreGraphics CoreImage CoreLocation Foundation IOKit JavaScriptCore Metal OpenGL QuartzCore; }; - WidgetKit = { inherit Combine CoreFoundation CoreGraphics CoreVideo Foundation IOKit Intents Metal SwiftUI; }; - iTunesLibrary = { inherit Foundation; }; - vmnet = {}; -} diff --git a/pkgs/os-specific/darwin/apple-sdk-11.0/libSystem.nix b/pkgs/os-specific/darwin/apple-sdk-11.0/libSystem.nix deleted file mode 100644 index b661da75febe6..0000000000000 --- a/pkgs/os-specific/darwin/apple-sdk-11.0/libSystem.nix +++ /dev/null @@ -1,88 +0,0 @@ -{ stdenvNoCC, buildPackages, MacOSX-SDK }: - -stdenvNoCC.mkDerivation { - pname = "libSystem"; - version = MacOSX-SDK.version; - - dontBuild = true; - dontUnpack = true; - - nativeBuildInputs = [ buildPackages.darwin.rewrite-tbd ]; - - includeDirs = [ - "CommonCrypto" "_types" "architecture" "arpa" "atm" "bank" "bsd" "bsm" - "corecrypto" "corpses" "default_pager" "device" "dispatch" "hfs" "i386" - "iokit" "kern" "libkern" "mach" "mach-o" "mach_debug" "machine" "malloc" - "miscfs" "net" "netinet" "netinet6" "netkey" "nfs" "os" "osfmk" "pexpert" - "platform" "protocols" "pthread" "rpc" "rpcsvc" "secure" "security" - "servers" "sys" "uuid" "vfs" "voucher" "xlocale" - ] ++ [ - "arm" "xpc" "arm64" - ]; - - csu = [ - "bundle1.o" "crt0.o" "crt1.10.5.o" "crt1.10.6.o" "crt1.o" "dylib1.10.5.o" - "dylib1.o" "gcrt1.o" "lazydylib1.o" - ]; - - installPhase = '' - mkdir -p $out/{include,lib/swift} - - for dir in $includeDirs; do - from=${MacOSX-SDK}/usr/include/$dir - if [ -e "$from" ]; then - cp -dr $from $out/include - else - echo "Header directory '$from' doesn't exist: skipping" - fi - done - - cp -d \ - ${MacOSX-SDK}/usr/include/*.h \ - ${MacOSX-SDK}/usr/include/*.modulemap \ - ${MacOSX-SDK}/usr/include/*.apinotes \ - $out/include - - rm $out/include/tk*.h $out/include/tcl*.h - - cp -dr \ - ${MacOSX-SDK}/usr/lib/libSystem.* \ - ${MacOSX-SDK}/usr/lib/system \ - $out/lib - - # Extra libraries - for name in c dbm dl info m mx poll proc pthread rpcsvc util gcc_s.1 resolv; do - cp -d \ - ${MacOSX-SDK}/usr/lib/lib$name.tbd \ - ${MacOSX-SDK}/usr/lib/lib$name.*.tbd \ - $out/lib - done - - for name in os Dispatch; do - cp -dr \ - ${MacOSX-SDK}/usr/lib/swift/$name.swiftmodule \ - ${MacOSX-SDK}/usr/lib/swift/libswift$name.tbd \ - $out/lib/swift - done - - for f in $csu; do - from=${MacOSX-SDK}/usr/lib/$f - if [ -e "$from" ]; then - cp -d $from $out/lib - else - echo "Csu file '$from' doesn't exist: skipping" - fi - done - - chmod u+w -R $out/lib - find $out -name '*.tbd' -type f | while read tbd; do - rewrite-tbd \ - -c /usr/lib/libsystem.dylib:$out/lib/libsystem.dylib \ - -p /usr/lib/system/:$out/lib/system/ \ - -p /usr/lib/swift/:$out/lib/swift/ \ - -r ${builtins.storeDir} \ - "$tbd" - done - ''; -} - diff --git a/pkgs/os-specific/darwin/apple-sdk-11.0/libcharset.nix b/pkgs/os-specific/darwin/apple-sdk-11.0/libcharset.nix deleted file mode 100644 index bf55037ab6057..0000000000000 --- a/pkgs/os-specific/darwin/apple-sdk-11.0/libcharset.nix +++ /dev/null @@ -1,16 +0,0 @@ -{ stdenvNoCC, buildPackages, MacOSX-SDK }: - -stdenvNoCC.mkDerivation { - pname = "libcharset"; - version = MacOSX-SDK.version; - - dontUnpack = true; - dontBuild = true; - - nativeBuildInputs = [ buildPackages.darwin.checkReexportsHook ]; - - installPhase = '' - mkdir -p $out/{include,lib} - cp ${MacOSX-SDK}/usr/lib/libcharset* $out/lib - ''; -} diff --git a/pkgs/os-specific/darwin/apple-sdk-11.0/libcompression.nix b/pkgs/os-specific/darwin/apple-sdk-11.0/libcompression.nix deleted file mode 100644 index 92a45b7c5a50c..0000000000000 --- a/pkgs/os-specific/darwin/apple-sdk-11.0/libcompression.nix +++ /dev/null @@ -1,20 +0,0 @@ -{ stdenvNoCC, buildPackages, MacOSX-SDK }: - -let self = stdenvNoCC.mkDerivation { - pname = "libcompression"; - version = MacOSX-SDK.version; - - dontUnpack = true; - dontBuild = true; - - installPhase = '' - mkdir -p $out/lib - cp ${MacOSX-SDK}/usr/lib/libcompression* $out/lib - ''; - - passthru = { - tbdRewrites = { - const."/usr/lib/libcompression.dylib" = "${self}/lib/libcompression.dylib"; - }; - }; -}; in self diff --git a/pkgs/os-specific/darwin/apple-sdk-11.0/libnetwork.nix b/pkgs/os-specific/darwin/apple-sdk-11.0/libnetwork.nix deleted file mode 100644 index 2e5c0593bf406..0000000000000 --- a/pkgs/os-specific/darwin/apple-sdk-11.0/libnetwork.nix +++ /dev/null @@ -1,20 +0,0 @@ -{ stdenvNoCC, buildPackages, MacOSX-SDK }: - -let self = stdenvNoCC.mkDerivation { - pname = "libnetwork"; - version = MacOSX-SDK.version; - - dontUnpack = true; - dontBuild = true; - - installPhase = '' - mkdir -p $out/lib - cp ${MacOSX-SDK}/usr/lib/libnetwork* $out/lib - ''; - - passthru = { - tbdRewrites = { - const."/usr/lib/libnetwork.dylib" = "${self}/lib/libnetwork.dylib"; - }; - }; -}; in self diff --git a/pkgs/os-specific/darwin/apple-sdk-11.0/libobjc.nix b/pkgs/os-specific/darwin/apple-sdk-11.0/libobjc.nix deleted file mode 100644 index 9288097ef3699..0000000000000 --- a/pkgs/os-specific/darwin/apple-sdk-11.0/libobjc.nix +++ /dev/null @@ -1,24 +0,0 @@ -{ stdenvNoCC, MacOSX-SDK, libcharset }: - -let self = stdenvNoCC.mkDerivation { - pname = "libobjc"; - version = MacOSX-SDK.version; - - dontUnpack = true; - dontBuild = true; - - installPhase = '' - mkdir -p $out/{include,lib/swift} - cp -r ${MacOSX-SDK}/usr/include/objc $out/include - cp ${MacOSX-SDK}/usr/lib/libobjc* $out/lib - cp -r ${MacOSX-SDK}/usr/lib/swift/ObjectiveC.swiftmodule $out/lib/swift - cp ${MacOSX-SDK}/usr/lib/swift/libswiftObjectiveC.tbd $out/lib/swift - ''; - - passthru = { - tbdRewrites = { - const."/usr/lib/libobjc.A.dylib" = "${self}/lib/libobjc.A.dylib"; - const."/usr/lib/swift/libswiftObjectiveC.dylib" = "${self}/lib/swift/libswiftObjectiveC.dylib"; - }; - }; -}; in self diff --git a/pkgs/os-specific/darwin/apple-sdk-11.0/libpm.nix b/pkgs/os-specific/darwin/apple-sdk-11.0/libpm.nix deleted file mode 100644 index 995f2b20ce706..0000000000000 --- a/pkgs/os-specific/darwin/apple-sdk-11.0/libpm.nix +++ /dev/null @@ -1,23 +0,0 @@ -{ stdenvNoCC, MacOSX-SDK, checkReexportsHook }: - -stdenvNoCC.mkDerivation { - pname = "libpm"; - version = MacOSX-SDK.version; - - dontUnpack = true; - dontBuild = true; - - nativeBuildInputs = [ checkReexportsHook ]; - - installPhase = '' - mkdir -p $out/lib - cp ${MacOSX-SDK}/usr/lib/libpm* $out/lib - ''; - - passthru = { - tbdRewrites = { - const."/usr/lib/libpmenergy.dylib" = "${placeholder "out"}/lib/libpmenergy.dylib"; - const."/usr/lib/libpmsample.dylib" = "${placeholder "out"}/lib/libpmsample.dylib"; - }; - }; -} diff --git a/pkgs/os-specific/darwin/apple-sdk-11.0/libunwind.nix b/pkgs/os-specific/darwin/apple-sdk-11.0/libunwind.nix deleted file mode 100644 index 885780eba75cd..0000000000000 --- a/pkgs/os-specific/darwin/apple-sdk-11.0/libunwind.nix +++ /dev/null @@ -1,24 +0,0 @@ -{ stdenvNoCC, buildPackages, MacOSX-SDK }: - -stdenvNoCC.mkDerivation { - pname = "libunwind"; - version = MacOSX-SDK.version; - - dontUnpack = true; - dontBuild = true; - - nativeBuildInputs = [ buildPackages.darwin.checkReexportsHook ]; - - installPhase = '' - mkdir -p $out/include/mach-o - - cp \ - ${MacOSX-SDK}/usr/include/libunwind.h \ - ${MacOSX-SDK}/usr/include/unwind.h \ - $out/include - - cp \ - ${MacOSX-SDK}/usr/include/mach-o/compact_unwind_encoding.h \ - $out/include/mach-o - ''; -} diff --git a/pkgs/os-specific/darwin/apple-sdk-11.0/private-frameworks.nix b/pkgs/os-specific/darwin/apple-sdk-11.0/private-frameworks.nix deleted file mode 100644 index 4566c8af84f52..0000000000000 --- a/pkgs/os-specific/darwin/apple-sdk-11.0/private-frameworks.nix +++ /dev/null @@ -1,32 +0,0 @@ -{ frameworks, libobjc }: with frameworks; -# generated by hand to avoid exposing all private frameworks -# frameworks here are only the necessary ones used by public frameworks. -{ - Apple80211 = {}; - AVFCapture = {}; - AVFCore = {}; - AddressBookCore = { inherit ContactsPersistence; }; - AudioToolboxCore = {}; - ContactsPersistence = {}; - GameCenterFoundation = {}; - GameCenterUI = {}; - GameCenterUICore = {}; - MediaRemote = {}; - PassKitCore = {}; - SignpostMetrics = {}; - SkyLight = {}; - UIFoundation = {}; - URLFormatting = {}; - - # Also expose CoreSymbolication; used by `root` package. - CoreSymbolication = {}; - - # Also expose DebugSymbols; used by `llvmPackages_8.lldb` package. - DebugSymbols = {}; - - # Also expose DisplayServices; used by `sketchybar` package. - DisplayServices = { inherit libobjc; }; - - # Also expose MultitouchSupport; used by `chuck` package. - MultitouchSupport = {}; -} diff --git a/pkgs/top-level/darwin-packages.nix b/pkgs/top-level/darwin-packages.nix index 97a3036062e94..b09461150576b 100644 --- a/pkgs/top-level/darwin-packages.nix +++ b/pkgs/top-level/darwin-packages.nix @@ -57,9 +57,7 @@ makeScopeWithSplicing' { }; # macOS 11.0 SDK - apple_sdk_11_0 = pkgs.callPackage ../os-specific/darwin/apple-sdk-11.0 { - fetchurl = fetchurlBoot; - }; + apple_sdk_11_0 = pkgs.callPackage ../os-specific/darwin/apple-sdk-11.0 { }; # macOS 12.3 SDK apple_sdk_12_3 = pkgs.callPackage ../os-specific/darwin/apple-sdk-12.3 { }; @@ -94,13 +92,15 @@ makeScopeWithSplicing' { ) Security; }; - stubs = lib.genAttrs [ + stubs = { + inherit apple_sdk_11_0; + } // lib.genAttrs [ ] (mkStub apple_sdk.version); in impure-cmds // appleSourcePackages // chooseLibs // stubs // { - inherit apple_sdk apple_sdk_10_12 apple_sdk_11_0 apple_sdk_12_3; + inherit apple_sdk apple_sdk_10_12 apple_sdk_12_3; stdenvNoCF = stdenv.override { extraBuildInputs = []; From 480227777b6217686ed7def88549dc0a46d968ff Mon Sep 17 00:00:00 2001 From: Randy Eckenrode Date: Thu, 26 Sep 2024 20:55:53 -0400 Subject: [PATCH 019/157] darwin.apple_sdk_12_3: convert frameworks and libs to stubs --- .../apple-sdk-12.3/CLTools_Executables.nix | 27 -- .../apple-sdk-12.3/CLTools_macOSNMOS_SDK.nix | 28 -- .../apple-sdk-12.3/apple-sdk-releases.json | 20 -- .../darwin/apple-sdk-12.3/default.nix | 293 +++++++++++++++--- .../apple-sdk-12.3/frameworks/default.nix | 146 --------- .../apple-sdk-12.3/frameworks/fixups.nix | 163 ---------- .../apple-sdk-12.3/frameworks/private.nix | 35 --- .../apple-sdk-12.3/frameworks/public.nix | 209 ------------- .../darwin/apple-sdk-12.3/libSystem.nix | 96 ------ .../darwin/apple-sdk-12.3/libnetwork.nix | 16 - .../darwin/apple-sdk-12.3/libobjc.nix | 22 -- .../darwin/apple-sdk-12.3/libpm.nix | 25 -- .../darwin/apple-sdk-12.3/libs/Xplugin.nix | 30 -- .../darwin/apple-sdk-12.3/libs/default.nix | 10 - .../darwin/apple-sdk-12.3/libs/libDER.nix | 11 - .../darwin/apple-sdk-12.3/libs/sandbox.nix | 13 - .../darwin/apple-sdk-12.3/libs/simd.nix | 11 - .../darwin/apple-sdk-12.3/libs/utmp.nix | 12 - .../darwin/apple-sdk-12.3/libs/xpc.nix | 12 - .../darwin/apple-sdk-12.3/libunwind.nix | 28 -- pkgs/top-level/darwin-packages.nix | 4 +- 21 files changed, 257 insertions(+), 954 deletions(-) delete mode 100644 pkgs/os-specific/darwin/apple-sdk-12.3/CLTools_Executables.nix delete mode 100644 pkgs/os-specific/darwin/apple-sdk-12.3/CLTools_macOSNMOS_SDK.nix delete mode 100644 pkgs/os-specific/darwin/apple-sdk-12.3/apple-sdk-releases.json delete mode 100644 pkgs/os-specific/darwin/apple-sdk-12.3/frameworks/default.nix delete mode 100644 pkgs/os-specific/darwin/apple-sdk-12.3/frameworks/fixups.nix delete mode 100644 pkgs/os-specific/darwin/apple-sdk-12.3/frameworks/private.nix delete mode 100644 pkgs/os-specific/darwin/apple-sdk-12.3/frameworks/public.nix delete mode 100644 pkgs/os-specific/darwin/apple-sdk-12.3/libSystem.nix delete mode 100644 pkgs/os-specific/darwin/apple-sdk-12.3/libnetwork.nix delete mode 100644 pkgs/os-specific/darwin/apple-sdk-12.3/libobjc.nix delete mode 100644 pkgs/os-specific/darwin/apple-sdk-12.3/libpm.nix delete mode 100644 pkgs/os-specific/darwin/apple-sdk-12.3/libs/Xplugin.nix delete mode 100644 pkgs/os-specific/darwin/apple-sdk-12.3/libs/default.nix delete mode 100644 pkgs/os-specific/darwin/apple-sdk-12.3/libs/libDER.nix delete mode 100644 pkgs/os-specific/darwin/apple-sdk-12.3/libs/sandbox.nix delete mode 100644 pkgs/os-specific/darwin/apple-sdk-12.3/libs/simd.nix delete mode 100644 pkgs/os-specific/darwin/apple-sdk-12.3/libs/utmp.nix delete mode 100644 pkgs/os-specific/darwin/apple-sdk-12.3/libs/xpc.nix delete mode 100644 pkgs/os-specific/darwin/apple-sdk-12.3/libunwind.nix diff --git a/pkgs/os-specific/darwin/apple-sdk-12.3/CLTools_Executables.nix b/pkgs/os-specific/darwin/apple-sdk-12.3/CLTools_Executables.nix deleted file mode 100644 index f3ff413d0cae3..0000000000000 --- a/pkgs/os-specific/darwin/apple-sdk-12.3/CLTools_Executables.nix +++ /dev/null @@ -1,27 +0,0 @@ -{ - stdenvNoCC, - fetchurl, - cpio, - pbzx, - version, -}: - -let - releases = builtins.fromJSON (builtins.readFile ./apple-sdk-releases.json); -in -stdenvNoCC.mkDerivation (finalAttrs: { - pname = "CLTools_Executables"; - inherit version; - - src = fetchurl releases.${version}.${finalAttrs.pname}; - - nativeBuildInputs = [ - cpio - pbzx - ]; - - buildCommand = '' - pbzx $src | cpio -idm - mv Library/Developer/CommandLineTools $out - ''; -}) diff --git a/pkgs/os-specific/darwin/apple-sdk-12.3/CLTools_macOSNMOS_SDK.nix b/pkgs/os-specific/darwin/apple-sdk-12.3/CLTools_macOSNMOS_SDK.nix deleted file mode 100644 index 7af2c48cc0819..0000000000000 --- a/pkgs/os-specific/darwin/apple-sdk-12.3/CLTools_macOSNMOS_SDK.nix +++ /dev/null @@ -1,28 +0,0 @@ -{ - lib, - stdenvNoCC, - fetchurl, - cpio, - pbzx, - version, -}: - -let - releases = builtins.fromJSON (builtins.readFile ./apple-sdk-releases.json); -in -stdenvNoCC.mkDerivation (finalAttrs: { - pname = "CLTools_macOSNMOS_SDK"; - inherit version; - - src = fetchurl releases.${version}.${finalAttrs.pname}; - - nativeBuildInputs = [ - cpio - pbzx - ]; - - buildCommand = '' - pbzx $src | cpio -idm - mv Library/Developer/CommandLineTools/SDKs/MacOSX${lib.versions.majorMinor version}.sdk $out - ''; -}) diff --git a/pkgs/os-specific/darwin/apple-sdk-12.3/apple-sdk-releases.json b/pkgs/os-specific/darwin/apple-sdk-12.3/apple-sdk-releases.json deleted file mode 100644 index 87e01f0039ce2..0000000000000 --- a/pkgs/os-specific/darwin/apple-sdk-12.3/apple-sdk-releases.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "12.3": { - "CLTools_Executables": { - "hash": "sha256-XlxHwCq+rtBF3Yyfdob3UEHN7YKzb7JF84lRmZbB/50=", - "url": "https://swcdn.apple.com/content/downloads/24/42/002-83793-A_74JRE8GVAT/rlnkct919wgc5c0pjq986z5bb9h62uvni2/CLTools_Executables.pkg" - }, - "CLTools_macOSLMOS_SDK": { - "hash": "sha256-mY9YTlyTujV6R89WaNmkJrfOQatXnoSW8gKxnawQz5Q=", - "url": "https://swcdn.apple.com/content/downloads/24/42/002-83793-A_74JRE8GVAT/rlnkct919wgc5c0pjq986z5bb9h62uvni2/CLTools_macOSLMOS_SDK.pkg" - }, - "CLTools_macOSNMOS_SDK": { - "hash": "sha256-Tr9VCeCP5udmh09U/zPQG2c4ky1LXscBwPfgpRy8uds=", - "url": "https://swcdn.apple.com/content/downloads/24/42/002-83793-A_74JRE8GVAT/rlnkct919wgc5c0pjq986z5bb9h62uvni2/CLTools_macOSNMOS_SDK.pkg" - }, - "CLTools_macOS_SDK": { - "hash": "sha256-2xwYLfiYuEdck7/8NY3iqiPKvoG9HAjXt8Ewyp9c0Es=", - "url": "https://swcdn.apple.com/content/downloads/24/42/002-83793-A_74JRE8GVAT/rlnkct919wgc5c0pjq986z5bb9h62uvni2/CLTools_macOS_SDK.pkg" - } - } -} diff --git a/pkgs/os-specific/darwin/apple-sdk-12.3/default.nix b/pkgs/os-specific/darwin/apple-sdk-12.3/default.nix index 85444ec95e614..468465b192772 100644 --- a/pkgs/os-specific/darwin/apple-sdk-12.3/default.nix +++ b/pkgs/os-specific/darwin/apple-sdk-12.3/default.nix @@ -1,49 +1,266 @@ +# Compatibility stubs for packages that used the old SDK frameworks. +# TODO(@reckenrode) Make these stubs warn after framework usage has been cleaned up in nixpkgs. { lib, + callPackage, newScope, - overrideCC, + overrideSDK, pkgs, stdenv, stdenvNoCC, }: let - version = "12.3"; - - MacOSX-SDK = callPackage ./CLTools_macOSNMOS_SDK.nix { inherit version; }; - callPackage = newScope (pkgs.darwin // packages); - - packages = { - # Make sure we pass our special `callPackage` instead of using packages.callPackage which - # does not have necessary attributes in scope. - frameworks = callPackage ./frameworks { inherit callPackage; }; - libs = callPackage ./libs { inherit callPackage; }; - - CLTools_Executables = callPackage ./CLTools_Executables.nix { inherit version; }; - Libsystem = callPackage ./libSystem.nix { }; - LibsystemCross = callPackage ./libSystem.nix { }; - libunwind = callPackage ./libunwind.nix { }; - libnetwork = callPackage ./libnetwork.nix { }; - libpm = callPackage ./libpm.nix { }; - # Avoid introducing a new objc4 if stdenv already has one, to prevent - # conflicting LLVM modules. - objc4 = stdenv.objc4 or (callPackage ./libobjc.nix { }); - - darwin-stubs = stdenvNoCC.mkDerivation { - pname = "darwin-stubs"; - inherit (MacOSX-SDK) version; - - preferLocalBuild = true; - allowSubstitutes = false; + mkStub = callPackage ../apple-sdk/mk-stub.nix { } "12.3"; +in +lib.genAttrs [ + "CLTools_Executables" + "Libsystem" + "LibsystemCross" + "darwin-stubs" + "libnetwork" + "libpm" + "libunwind" + "objc4" + "sdkRoot" +] mkStub +// { + frameworks = lib.genAttrs [ + "AGL" + "AVFAudio" + "AVFCapture" + "AVFCore" + "AVFoundation" + "AVKit" + "Accelerate" + "Accessibility" + "Accounts" + "AdServices" + "AdSupport" + "AddressBook" + "AddressBookCore" + "AppKit" + "AppTrackingTransparency" + "AppleScriptKit" + "AppleScriptObjC" + "ApplicationServices" + "AudioToolbox" + "AudioToolboxCore" + "AudioUnit" + "AudioVideoBridging" + "AuthenticationServices" + "AutomaticAssessmentConfiguration" + "Automator" + "BackgroundTasks" + "BusinessChat" + "CFNetwork" + "CHIP" + "CalendarStore" + "CallKit" + "Carbon" + "ClassKit" + "CloudKit" + "Cocoa" + "Collaboration" + "ColorSync" + "Combine" + "Contacts" + "ContactsPersistence" + "ContactsUI" + "CoreAudio" + "CoreAudioKit" + "CoreAudioTypes" + "CoreBluetooth" + "CoreData" + "CoreDisplay" + "CoreFoundation" + "CoreGraphics" + "CoreHaptics" + "CoreImage" + "CoreLocation" + "CoreMIDI" + "CoreMIDIServer" + "CoreML" + "CoreMedia" + "CoreMediaIO" + "CoreMotion" + "CoreServices" + "CoreSpotlight" + "CoreSymbolication" + "CoreTelephony" + "CoreText" + "CoreVideo" + "CoreWLAN" + "CreateML" + "CryptoKit" + "CryptoTokenKit" + "DVDPlayback" + "DataDetection" + "DebugSymbols" + "DeveloperToolsSupport" + "DeviceActivity" + "DeviceCheck" + "DirectoryService" + "DiscRecording" + "DiscRecordingUI" + "DiskArbitration" + "DisplayServices" + "DriverKit" + "EventKit" + "ExceptionHandling" + "ExecutionPolicy" + "ExposureNotification" + "ExternalAccessory" + "FWAUserLib" + "FileProvider" + "FileProviderUI" + "FinderSync" + "ForceFeedback" + "Foundation" + "GLKit" + "GLUT" + "GSS" + "GameCenterFoundation" + "GameCenterUI" + "GameCenterUICore" + "GameController" + "GameKit" + "GameplayKit" + "GroupActivities" + "Hypervisor" + "ICADevices" + "IMServicePlugIn" + "IOBluetooth" + "IOBluetoothUI" + "IOKit" + "IOSurface" + "IOUSBHost" + "IdentityLookup" + "ImageCaptureCore" + "ImageIO" + "InputMethodKit" + "InstallerPlugins" + "InstantMessage" + "Intents" + "IntentsUI" + "JavaNativeFoundation" + "JavaRuntimeSupport" + "JavaScriptCore" + "JavaVM" + "Kerberos" + "Kernel" + "KernelManagement" + "LDAP" + "LatentSemanticMapping" + "LinkPresentation" + "LocalAuthentication" + "LocalAuthenticationEmbeddedUI" + "MLCompute" + "MailKit" + "ManagedSettings" + "MapKit" + "MediaAccessibility" + "MediaLibrary" + "MediaPlayer" + "MediaToolbox" + "Message" + "Metal" + "MetalKit" + "MetalPerformanceShaders" + "MetalPerformanceShadersGraph" + "MetricKit" + "ModelIO" + "MultipeerConnectivity" + "MultitouchSupport" + "MusicKit" + "NaturalLanguage" + "NearbyInteraction" + "NetFS" + "Network" + "NetworkExtension" + "NotificationCenter" + "OSAKit" + "OSLog" + "OpenAL" + "OpenCL" + "OpenDirectory" + "OpenGL" + "PCSC" + "PDFKit" + "PHASE" + "ParavirtualizedGraphics" + "PassKit" + "PassKitCore" + "PencilKit" + "Photos" + "PhotosUI" + "PreferencePanes" + "PushKit" + "QTKit" + "Quartz" + "QuartzCore" + "QuickLook" + "QuickLookThumbnailing" + "QuickLookUI" + "QuickTime" + "RealityFoundation" + "RealityKit" + "ReplayKit" + "Ruby" + "SafariServices" + "SceneKit" + "ScreenCaptureKit" + "ScreenSaver" + "ScreenTime" + "ScriptingBridge" + "Security" + "SecurityFoundation" + "SecurityInterface" + "SensorKit" + "ServiceManagement" + "ShazamKit" + "SignpostMetrics" + "SkyLight" + "Social" + "SoundAnalysis" + "Speech" + "SpriteKit" + "StoreKit" + "SwiftUI" + "SyncServices" + "System" + "SystemConfiguration" + "SystemExtensions" + "TWAIN" + "TabularData" + "Tcl" + "Tk" + "UIFoundation" + "URLFormatting" + "UniformTypeIdentifiers" + "UserNotifications" + "UserNotificationsUI" + "VideoDecodeAcceleration" + "VideoSubscriberAccount" + "VideoToolbox" + "Virtualization" + "Vision" + "WebKit" + "WidgetKit" + "iTunesLibrary" + "vmnet" + ] mkStub; - buildCommand = '' - mkdir -p "$out" - ln -s ${MacOSX-SDK}/System "$out/System" - ln -s ${MacOSX-SDK}/usr "$out/usr" - ''; - }; + libs = lib.genAttrs [ + "Xplugin" + "utmp" + "libDER" + "xpc" + "sandbox" + "simd" + "utmp" + "xpc" + ] mkStub; - sdkRoot = pkgs.callPackage ../apple-sdk/sdkRoot.nix { sdkVersion = version; }; - }; -in -packages + version = "12.3"; +} diff --git a/pkgs/os-specific/darwin/apple-sdk-12.3/frameworks/default.nix b/pkgs/os-specific/darwin/apple-sdk-12.3/frameworks/default.nix deleted file mode 100644 index 8ae0cd649c93c..0000000000000 --- a/pkgs/os-specific/darwin/apple-sdk-12.3/frameworks/default.nix +++ /dev/null @@ -1,146 +0,0 @@ -{ - lib, - stdenvNoCC, - buildPackages, - # macOS things - callPackage, - darwin-stubs, -}: - -let - inherit (darwin-stubs) version; - fixup-frameworks = callPackage ./fixups.nix { }; - private-frameworks = callPackage ./private.nix { }; - public-frameworks = callPackage ./public.nix { }; - - mkDepsRewrites = - deps: - let - mergeRewrites = x: y: { - prefix = lib.mergeAttrs (x.prefix or { }) (y.prefix or { }); - const = lib.mergeAttrs (x.const or { }) (y.const or { }); - }; - - rewriteArgs = - { - prefix ? { }, - const ? { }, - }: - lib.concatLists ( - (lib.mapAttrsToList (from: to: [ - "-p" - "${from}:${to}" - ]) prefix) - ++ (lib.mapAttrsToList (from: to: [ - "-c" - "${from}:${to}" - ]) const) - ); - - rewrites = - depList: - lib.fold mergeRewrites { } ( - map (dep: dep.tbdRewrites) (lib.filter (dep: dep ? tbdRewrites) depList) - ); - in - lib.escapeShellArgs (rewriteArgs (rewrites (lib.attrValues deps))); - - mkFramework = - { - name, - deps, - private ? false, - }: - let - standardFrameworkPath = - name: private: - "/System/Library/${lib.optionalString private "Private"}Frameworks/${name}.framework"; - - self = stdenvNoCC.mkDerivation { - pname = "apple-${lib.optionalString private "private-"}framework-${name}"; - inherit (darwin-stubs) version; - - # because we copy files from the system - preferLocalBuild = true; - - dontUnpack = true; - dontBuild = true; - - disallowedRequisites = [ darwin-stubs ]; - - nativeBuildInputs = [ buildPackages.darwin.rewrite-tbd ]; - - installPhase = '' - mkdir -p $out/Library/Frameworks - - cp -r ${darwin-stubs}${standardFrameworkPath name private} $out/Library/Frameworks - - if [[ -d ${darwin-stubs}/usr/lib/swift/${name}.swiftmodule ]]; then - mkdir -p $out/lib/swift - cp -r -t $out/lib/swift \ - ${darwin-stubs}/usr/lib/swift/${name}.swiftmodule \ - ${darwin-stubs}/usr/lib/swift/libswift${name}.tbd - fi - - # Fix and check tbd re-export references - chmod u+w -R $out - find $out -name '*.tbd' -type f | while IFS=$'\n' read tbd; do - echo "Fixing re-exports in $tbd" - rewrite-tbd \ - -p ${standardFrameworkPath name private}/:$out/Library/Frameworks/${name}.framework/ \ - -p /usr/lib/swift/:$out/lib/swift/ \ - ${mkDepsRewrites deps} \ - -r ${builtins.storeDir} \ - "$tbd" - done - ''; - - propagatedBuildInputs = lib.attrValues deps; - - passthru.tbdRewrites.prefix."${standardFrameworkPath name private}/" = "${self}/Library/Frameworks/${name}.framework/"; - - meta = with lib; { - description = "Apple SDK framework ${name}"; - maintainers = [ ]; - platforms = platforms.darwin; - }; - }; - in - self; - - # Helper functions for creating framework derivations. - framework = - name: deps: - mkFramework { - inherit name deps; - private = false; - }; - - # Helper functions for creating private framework derivations. - privateFramework = - name: deps: - mkFramework { - inherit name deps; - private = true; - }; - - # Merge addToFrameworks into public-frameworks and remove elements of removeFromFrameworks. - deps = - let - inherit (fixup-frameworks) addToFrameworks removeFromFrameworks; - fixupDeps = - name: deps: - lib.pipe deps [ - # Add dependencies from addToFrameworks. - (deps: lib.recursiveUpdate deps (addToFrameworks.${name} or { })) - # Keep dependencies not in removeFromFrameworks. - (lib.filterAttrs (depName: _: !(removeFromFrameworks.${name}.${depName} or false))) - ]; - in - lib.mapAttrs fixupDeps public-frameworks; - - # Create derivations and add private frameworks. - bareFrameworks = - (lib.mapAttrs framework deps) // (lib.mapAttrs privateFramework private-frameworks); -in -bareFrameworks // fixup-frameworks.overrideFrameworks bareFrameworks diff --git a/pkgs/os-specific/darwin/apple-sdk-12.3/frameworks/fixups.nix b/pkgs/os-specific/darwin/apple-sdk-12.3/frameworks/fixups.nix deleted file mode 100644 index 6068395c4ae2e..0000000000000 --- a/pkgs/os-specific/darwin/apple-sdk-12.3/frameworks/fixups.nix +++ /dev/null @@ -1,163 +0,0 @@ -{ - lib, - # macOS things - frameworks, - libnetwork, - libs, - darwin-stubs, - objc4, -}: - -{ - # Used to add dependencies which are not picked up by gen-frameworks.py. - # Some of these are simply private frameworks the generator does not see. - # Trial and error, building things and adding dependencies when they fail. - addToFrameworks = - let - inherit (libs) libDER; - libobjc = objc4; - in - with frameworks; - { - # Below this comment are entries migrated from before the generator was - # added. If, for a given framework, you are able to reverify the extra - # deps are really necessary on top of the generator deps, move it above - # this comment (and maybe document your findings). - AVFoundation = { - inherit ApplicationServices AVFCapture AVFCore; - }; - Accelerate = { - inherit CoreWLAN IOBluetooth; - }; - AddressBook = { - inherit AddressBookCore ContactsPersistence libobjc; - }; - AppKit = { - inherit AudioToolbox AudioUnit UIFoundation; - }; - AudioToolbox = { - inherit AudioToolboxCore; - }; - AudioUnit = { - inherit Carbon CoreAudio; - }; - Carbon = { - inherit IOKit QuartzCore libobjc; - }; - CoreAudio = { - inherit IOKit; - }; - CoreData = { - inherit CloudKit; - }; - CoreFoundation = { - inherit libobjc; - }; - CoreGraphics = { - inherit SystemConfiguration; - }; - CoreMIDIServer = { - inherit CoreMIDI; - }; - CoreMedia = { - inherit ApplicationServices AudioToolbox AudioUnit; - }; - CoreServices = { - inherit CoreAudio NetFS ServiceManagement; - }; - CoreWLAN = { - inherit SecurityFoundation; - }; - DiscRecording = { - inherit IOKit libobjc; - }; - Foundation = { - inherit SystemConfiguration libobjc; - }; - GameKit = { - inherit - GameCenterFoundation - GameCenterUI - GameCenterUICore - ReplayKit - ; - }; - ICADevices = { - inherit Carbon libobjc; - }; - IOBluetooth = { - inherit CoreBluetooth; - }; - JavaScriptCore = { - inherit libobjc; - }; - Kernel = { - inherit IOKit; - }; - LinkPresentation = { - inherit URLFormatting; - }; - MediaToolbox = { - inherit AudioUnit; - }; - MetricKit = { - inherit SignpostMetrics; - }; - Network = { - inherit libnetwork; - }; - PCSC = { - inherit CoreData; - }; - PassKit = { - inherit PassKitCore; - }; - QTKit = { - inherit - CoreMedia - CoreMediaIO - MediaToolbox - VideoToolbox - ; - }; - Quartz = { - inherit QTKit; - }; - QuartzCore = { - inherit - ApplicationServices - CoreImage - CoreVideo - Metal - OpenCL - libobjc - ; - }; - Security = { - inherit IOKit libDER; - }; - TWAIN = { - inherit Carbon; - }; - VideoDecodeAcceleration = { - inherit CoreVideo; - }; - WebKit = { - inherit ApplicationServices Carbon libobjc; - }; - }; - - # Used to remove dependencies which are picked up by gen-frameworks.py -- used mainly to break - # cyclic dependencies. - removeFromFrameworks = { }; - - # Overrides for framework derivations. - overrideFrameworks = super: { - # This framework doesn't exist in newer SDKs (somewhere around 10.13), but - # there are references to it in nixpkgs. - QuickTime = throw "QuickTime framework not available"; - - # Seems to be appropriate given https://developer.apple.com/forums/thread/666686 - JavaVM = super.JavaNativeFoundation; - }; -} diff --git a/pkgs/os-specific/darwin/apple-sdk-12.3/frameworks/private.nix b/pkgs/os-specific/darwin/apple-sdk-12.3/frameworks/private.nix deleted file mode 100644 index d58b28fa02715..0000000000000 --- a/pkgs/os-specific/darwin/apple-sdk-12.3/frameworks/private.nix +++ /dev/null @@ -1,35 +0,0 @@ -{ objc4, frameworks }: - -# generated by hand to avoid exposing all private frameworks -# frameworks here are only the necessary ones used by public frameworks. -{ - AVFCapture = { }; - AVFCore = { }; - AddressBookCore = { - inherit (frameworks) ContactsPersistence; - }; - AudioToolboxCore = { }; - ContactsPersistence = { }; - UIFoundation = { }; - GameCenterFoundation = { }; - GameCenterUI = { }; - GameCenterUICore = { }; - URLFormatting = { }; - SignpostMetrics = { }; - PassKitCore = { }; - SkyLight = { }; - - # Also expose CoreSymbolication; used by `root` package. - CoreSymbolication = { }; - - # Also expose DebugSymbols; used by `llvmPackages_8.lldb` package. - DebugSymbols = { }; - - # Also expose DisplayServices; used by `sketchybar` package. - DisplayServices = { - libobjc = objc4; - }; - - # Also expose MultitouchSupport; used by `chuck` package. - MultitouchSupport = { }; -} diff --git a/pkgs/os-specific/darwin/apple-sdk-12.3/frameworks/public.nix b/pkgs/os-specific/darwin/apple-sdk-12.3/frameworks/public.nix deleted file mode 100644 index 4488c84bf1245..0000000000000 --- a/pkgs/os-specific/darwin/apple-sdk-12.3/frameworks/public.nix +++ /dev/null @@ -1,209 +0,0 @@ -# This file is generated by gen-frameworks.nix. -# Do not edit, put overrides in apple_sdk.nix instead. -{ libs, frameworks }: with libs; with frameworks; -{ - AGL = { inherit Carbon OpenGL; }; - AVFAudio = { inherit AudioToolbox CoreAudioTypes CoreMIDI CoreMedia Foundation; }; - AVFoundation = { inherit AVFAudio CoreAudio CoreFoundation CoreGraphics CoreImage CoreMIDI CoreMedia CoreVideo Foundation IOKit ImageIO MediaToolbox Metal QuartzCore UniformTypeIdentifiers simd; }; - AVKit = { inherit AVFoundation AppKit Cocoa Foundation; }; - Accelerate = { inherit CoreFoundation CoreGraphics CoreVideo Foundation IOKit Metal; }; - Accessibility = { inherit CoreFoundation CoreGraphics Foundation IOKit; }; - Accounts = { inherit Foundation; }; - AdServices = { inherit Foundation; }; - AdSupport = { inherit Foundation; }; - AddressBook = { inherit Carbon Cocoa CoreFoundation Foundation; }; - AppKit = { inherit Accessibility ApplicationServices CoreData CoreFoundation CoreGraphics CoreImage Foundation IOKit Metal OpenGL QuartzCore; }; - AppTrackingTransparency = { inherit Foundation; }; - AppleScriptKit = {}; - AppleScriptObjC = { inherit Foundation; }; - ApplicationServices = { inherit ColorSync CoreFoundation CoreGraphics CoreServices CoreText ImageIO; }; - AudioToolbox = { inherit Carbon CoreAudio CoreAudioTypes CoreFoundation CoreMIDI Foundation; }; - AudioUnit = { inherit AudioToolbox; }; - AudioVideoBridging = { inherit Foundation IOKit; }; - AuthenticationServices = { inherit AppKit Foundation; }; - AutomaticAssessmentConfiguration = { inherit Foundation; }; - Automator = { inherit AppKit Cocoa Foundation OSAKit; }; - BackgroundTasks = { inherit Foundation; }; - BusinessChat = { inherit Cocoa Foundation; }; - CFNetwork = { inherit CoreFoundation; }; - CHIP = { inherit Foundation Security; }; - CalendarStore = {}; - CallKit = { inherit CoreFoundation CoreGraphics Foundation IOKit; }; - Carbon = { inherit ApplicationServices CoreServices Foundation Security; }; - ClassKit = { inherit CoreGraphics Foundation; }; - CloudKit = { inherit CoreFoundation CoreGraphics CoreLocation Foundation IOKit; }; - Cocoa = { inherit AppKit CoreData Foundation; }; - Collaboration = { inherit AppKit CoreServices Foundation; }; - ColorSync = { inherit CoreFoundation; }; - Combine = {}; - Contacts = { inherit CoreFoundation CoreGraphics Foundation IOKit; }; - ContactsUI = { inherit AppKit; }; - CoreAudio = { inherit CoreAudioTypes CoreFoundation; }; - CoreAudioKit = { inherit AppKit AudioUnit Cocoa Foundation; }; - CoreAudioTypes = { inherit CoreFoundation; }; - CoreBluetooth = { inherit Foundation; }; - CoreData = { inherit Combine CoreFoundation CoreGraphics Foundation IOKit; }; - CoreDisplay = {}; - CoreFoundation = {}; - CoreGraphics = { inherit CoreFoundation IOKit; }; - CoreHaptics = { inherit Foundation; }; - CoreImage = { inherit ApplicationServices CoreFoundation CoreGraphics CoreVideo Foundation IOKit IOSurface ImageIO Metal OpenGL; }; - CoreLocation = { inherit CoreFoundation CoreGraphics Foundation IOKit; }; - CoreMIDI = { inherit CoreFoundation CoreGraphics Foundation IOKit; }; - CoreMIDIServer = {}; - CoreML = { inherit CoreFoundation CoreGraphics CoreVideo Foundation IOKit ImageIO Metal; }; - CoreMedia = { inherit CoreAudio CoreAudioTypes CoreFoundation CoreGraphics CoreVideo Foundation IOKit Metal; }; - CoreMediaIO = { inherit CoreAudio CoreFoundation CoreGraphics CoreMedia Foundation IOKit Metal; }; - CoreMotion = { inherit Foundation; }; - CoreServices = { inherit CFNetwork CoreFoundation DiskArbitration Security; }; - CoreSpotlight = { inherit Foundation UniformTypeIdentifiers; }; - CoreTelephony = {}; - CoreText = { inherit CoreFoundation CoreGraphics; }; - CoreVideo = { inherit ApplicationServices CoreFoundation CoreGraphics IOSurface Metal OpenGL; }; - CoreWLAN = { inherit Foundation IOKit; }; - CreateML = { inherit AVFoundation Combine CoreAudio CoreFoundation CoreGraphics CoreImage CoreML CoreMedia CoreServices CoreVideo Foundation IOKit ImageIO Metal MetalPerformanceShaders NaturalLanguage TabularData VideoToolbox Vision simd; }; - CryptoKit = { inherit CoreFoundation CoreGraphics Foundation IOKit LocalAuthentication Security; }; - CryptoTokenKit = { inherit CoreFoundation CoreGraphics Foundation IOKit Security; }; - DVDPlayback = { inherit ApplicationServices CoreFoundation Security; }; - DataDetection = { inherit CoreFoundation CoreGraphics Foundation IOKit; }; - DeveloperToolsSupport = {}; - DeviceActivity = { inherit Foundation ManagedSettings; }; - DeviceCheck = { inherit Foundation; }; - DirectoryService = { inherit CoreFoundation; }; - DiscRecording = { inherit CoreServices Foundation; }; - DiscRecordingUI = { inherit Carbon Cocoa DiscRecording; }; - DiskArbitration = { inherit CoreFoundation IOKit; }; - DriverKit = {}; - EventKit = { inherit CoreGraphics CoreLocation Foundation; }; - ExceptionHandling = { inherit Foundation; }; - ExecutionPolicy = { inherit Foundation; }; - ExposureNotification = { inherit Foundation; }; - ExternalAccessory = { inherit Foundation; }; - FWAUserLib = { inherit IOKit; }; - FileProvider = { inherit CoreFoundation CoreGraphics Foundation IOKit; }; - FileProviderUI = { inherit AppKit FileProvider Foundation; }; - FinderSync = { inherit AppKit Foundation; }; - ForceFeedback = { inherit CoreFoundation IOKit; }; - Foundation = { inherit Combine CoreFoundation CoreGraphics CoreServices IOKit Security; }; - GLKit = { inherit AppKit CoreData CoreFoundation CoreGraphics CoreImage Foundation IOKit Metal ModelIO OpenGL QuartzCore simd; }; - GLUT = { inherit OpenGL; }; - GSS = { inherit CoreFoundation; }; - GameController = { inherit AppKit Foundation IOKit; }; - GameKit = { inherit AppKit Cocoa Contacts CoreGraphics Foundation GameController GameplayKit Metal MetalKit ModelIO SceneKit SpriteKit simd; }; - GameplayKit = { inherit AppKit CoreData CoreFoundation CoreGraphics CoreImage Foundation GLKit IOKit Metal ModelIO QuartzCore SceneKit SpriteKit simd; }; - GroupActivities = { inherit AVFoundation Combine CoreGraphics CryptoKit Foundation Network UniformTypeIdentifiers; }; - Hypervisor = {}; - ICADevices = { inherit CoreFoundation CoreGraphics CoreServices IOBluetooth; }; - IMServicePlugIn = { inherit Foundation; }; - IOBluetooth = { inherit CoreAudio CoreFoundation CoreServices Foundation IOKit; }; - IOBluetoothUI = { inherit Cocoa IOBluetooth; }; - IOKit = { inherit CoreFoundation; }; - IOSurface = { inherit CoreFoundation Foundation IOKit; }; - IOUSBHost = { inherit Foundation IOKit; }; - IdentityLookup = { inherit Foundation; }; - ImageCaptureCore = { inherit Cocoa CoreGraphics Foundation; }; - ImageIO = { inherit CoreFoundation CoreGraphics; }; - InputMethodKit = { inherit Carbon Cocoa Foundation; }; - InstallerPlugins = {}; - InstantMessage = {}; - Intents = { inherit CoreFoundation CoreGraphics CoreLocation Foundation IOKit UserNotifications; }; - IntentsUI = { inherit AppKit; }; - JavaNativeFoundation = { inherit Foundation; }; - JavaRuntimeSupport = { inherit ApplicationServices Cocoa Foundation QuartzCore; }; - JavaScriptCore = { inherit CoreFoundation CoreGraphics Foundation; }; - Kerberos = {}; - Kernel = {}; - KernelManagement = { inherit Foundation; }; - LDAP = {}; - LatentSemanticMapping = { inherit Carbon CoreFoundation; }; - LinkPresentation = { inherit AppKit Foundation; }; - LocalAuthentication = { inherit Foundation; }; - LocalAuthenticationEmbeddedUI = { inherit AppKit Foundation LocalAuthentication; }; - MLCompute = { inherit CoreFoundation CoreGraphics Foundation IOKit Metal; }; - MailKit = { inherit AppKit Foundation; }; - ManagedSettings = { inherit Combine Foundation; }; - MapKit = { inherit AppKit CoreData CoreFoundation CoreGraphics CoreImage CoreLocation Foundation IOKit Metal QuartzCore; }; - MediaAccessibility = { inherit CoreFoundation CoreGraphics CoreText; }; - MediaLibrary = { inherit Foundation; }; - MediaPlayer = { inherit AVFoundation CoreGraphics Foundation; }; - MediaToolbox = { inherit AudioToolbox CoreFoundation CoreMedia; }; - Message = {}; - Metal = { inherit CoreFoundation CoreGraphics Foundation IOKit IOSurface; }; - MetalKit = { inherit AppKit CoreData CoreFoundation CoreGraphics CoreImage Foundation IOKit Metal ModelIO QuartzCore simd; }; - MetalPerformanceShaders = { inherit CoreGraphics Foundation Metal simd; }; - MetalPerformanceShadersGraph = { inherit Foundation MetalPerformanceShaders; }; - MetricKit = { inherit CoreFoundation CoreGraphics Foundation IOKit; }; - ModelIO = { inherit CoreFoundation CoreGraphics Foundation IOKit simd; }; - MultipeerConnectivity = { inherit Cocoa Foundation; }; - MusicKit = { inherit Combine CoreGraphics Foundation; }; - NaturalLanguage = { inherit CoreFoundation CoreGraphics Foundation IOKit; }; - NearbyInteraction = { inherit CoreFoundation CoreGraphics Foundation IOKit simd; }; - NetFS = { inherit CoreFoundation; }; - Network = { inherit CoreFoundation Foundation Security; }; - NetworkExtension = { inherit Foundation Network Security; }; - NotificationCenter = { inherit AppKit Foundation; }; - OSAKit = { inherit Carbon Cocoa; }; - OSLog = { inherit CoreFoundation CoreGraphics Foundation IOKit; }; - OpenAL = {}; - OpenCL = { inherit OpenGL; }; - OpenDirectory = { inherit CoreFoundation Foundation; }; - OpenGL = {}; - PCSC = {}; - PDFKit = { inherit AppKit Cocoa; }; - PHASE = { inherit AVFAudio AVFoundation CoreAudioTypes Foundation ModelIO simd; }; - ParavirtualizedGraphics = { inherit AppKit CoreVideo Foundation IOSurface Metal; }; - PassKit = { inherit AppKit Contacts CoreData CoreFoundation CoreGraphics CoreImage Foundation IOKit Metal QuartzCore; }; - PencilKit = { inherit AppKit Cocoa CoreData CoreFoundation CoreGraphics CoreImage Foundation IOKit Metal QuartzCore; }; - Photos = { inherit AVFoundation CoreAudio CoreFoundation CoreGraphics CoreImage CoreLocation CoreMIDI CoreMedia Foundation IOKit ImageIO Metal QuartzCore UniformTypeIdentifiers simd; }; - PhotosUI = { inherit AppKit Foundation MapKit Photos; }; - PreferencePanes = { inherit Cocoa; }; - PushKit = { inherit Foundation; }; - QTKit = {}; - Quartz = { inherit AppKit ApplicationServices Cocoa Foundation ImageCaptureCore OpenGL PDFKit QuartzCore QuickLookUI; }; - QuartzCore = { inherit CoreFoundation CoreGraphics CoreImage CoreVideo Foundation IOKit Metal OpenGL; }; - QuickLook = { inherit ApplicationServices CoreFoundation; }; - QuickLookThumbnailing = { inherit CoreGraphics Foundation UniformTypeIdentifiers; }; - QuickLookUI = { inherit AppKit CoreData CoreFoundation CoreGraphics CoreImage Foundation IOKit Metal PDFKit QuartzCore QuickLook UniformTypeIdentifiers; }; - RealityFoundation = { inherit AVFAudio AVFoundation AppKit AudioToolbox Combine CoreAudio CoreFoundation CoreGraphics CoreMIDI CoreMedia CoreMotion CoreText CoreVideo Foundation IOKit Metal QuartzCore simd; }; - RealityKit = { inherit AppKit Combine CoreData CoreFoundation CoreGraphics CoreImage Foundation IOKit Metal MultipeerConnectivity QuartzCore RealityFoundation simd; }; - ReplayKit = { inherit AVFoundation AppKit Foundation; }; - Ruby = {}; - SafariServices = { inherit AppKit CoreData CoreFoundation CoreGraphics CoreImage Foundation IOKit Metal QuartzCore; }; - SceneKit = { inherit AppKit CoreData CoreFoundation CoreGraphics CoreImage Foundation GLKit IOKit Metal ModelIO QuartzCore simd; }; - ScreenCaptureKit = { inherit AppKit CoreGraphics CoreMedia Foundation; }; - ScreenSaver = { inherit AppKit Foundation; }; - ScreenTime = { inherit AppKit Foundation; }; - ScriptingBridge = { inherit ApplicationServices CoreServices Foundation; }; - Security = { inherit CoreFoundation; }; - SecurityFoundation = { inherit Foundation Security; }; - SecurityInterface = { inherit AppKit Cocoa Security SecurityFoundation; }; - SensorKit = { inherit CoreFoundation CoreLocation Foundation; }; - ServiceManagement = { inherit CoreFoundation Security; }; - ShazamKit = { inherit AVFAudio CoreAudio CoreFoundation CoreGraphics CoreMIDI CoreMedia Foundation IOKit Metal MusicKit; }; - Social = { inherit AppKit Foundation; }; - SoundAnalysis = { inherit AVFoundation CoreAudio CoreFoundation CoreGraphics CoreImage CoreMIDI CoreML CoreMedia Foundation IOKit Metal QuartzCore UniformTypeIdentifiers simd; }; - Speech = { inherit AVFoundation CoreAudio CoreFoundation CoreGraphics CoreImage CoreMIDI CoreMedia Foundation IOKit Metal QuartzCore UniformTypeIdentifiers simd; }; - SpriteKit = { inherit AppKit Cocoa CoreData CoreFoundation CoreGraphics CoreImage Foundation GLKit IOKit Metal ModelIO QuartzCore simd; }; - StoreKit = { inherit AppKit CoreData CoreFoundation CoreGraphics CoreImage CryptoKit Foundation IOKit Metal QuartzCore Security; }; - SwiftUI = { inherit Accessibility AppKit Combine CoreData CoreFoundation CoreGraphics CoreImage DeveloperToolsSupport Foundation IOKit Metal QuartzCore UniformTypeIdentifiers; }; - SyncServices = {}; - System = {}; - SystemConfiguration = { inherit CoreFoundation Security; }; - SystemExtensions = { inherit Foundation; }; - TWAIN = {}; - TabularData = { inherit Combine Foundation; }; - Tcl = {}; - Tk = {}; - UniformTypeIdentifiers = { inherit CoreFoundation CoreGraphics Foundation IOKit; }; - UserNotifications = { inherit Foundation; }; - UserNotificationsUI = { inherit AppKit; }; - VideoDecodeAcceleration = {}; - VideoSubscriberAccount = { inherit Foundation; }; - VideoToolbox = { inherit CoreFoundation CoreGraphics CoreMedia CoreVideo; }; - Virtualization = { inherit AppKit Cocoa CoreData CoreFoundation CoreGraphics CoreImage Foundation IOKit Metal QuartzCore; }; - Vision = { inherit CoreAudio CoreFoundation CoreGraphics CoreML CoreMedia CoreVideo Foundation IOKit ImageIO Metal simd; }; - WebKit = { inherit AppKit CoreData CoreFoundation CoreGraphics CoreImage Foundation IOKit JavaScriptCore Metal QuartzCore; }; - WidgetKit = { inherit Combine CoreFoundation CoreGraphics Foundation IOKit Intents SwiftUI UniformTypeIdentifiers; }; - iTunesLibrary = { inherit Foundation; }; - vmnet = {}; -} diff --git a/pkgs/os-specific/darwin/apple-sdk-12.3/libSystem.nix b/pkgs/os-specific/darwin/apple-sdk-12.3/libSystem.nix deleted file mode 100644 index 5d57038a46573..0000000000000 --- a/pkgs/os-specific/darwin/apple-sdk-12.3/libSystem.nix +++ /dev/null @@ -1,96 +0,0 @@ -{ - stdenvNoCC, - buildPackages, - darwin-stubs, -}: - -stdenvNoCC.mkDerivation { - pname = "libSystem"; - inherit (darwin-stubs) version; - - nativeBuildInputs = [ buildPackages.darwin.rewrite-tbd ]; - - csu = [ - "bundle1.o" - "crt0.o" - "crt1.10.5.o" - "crt1.10.6.o" - "crt1.o" - "dylib1.10.5.o" - "dylib1.o" - "gcrt1.o" - "lazydylib1.o" - ]; - - buildCommand = - '' - mkdir -p $out/{include,lib/swift} - '' - # Copy each directory in ${darwin-stubs}/usr/include into $out/include - + '' - for dir in $(ls -d ${darwin-stubs}/usr/include/*/); do - cp -dr $dir $out/include - done - '' - # Copy each header and modulemap file in ${darwin-stubs}/usr/include into $out/include - + '' - cp -d \ - ${darwin-stubs}/usr/include/*.h \ - ${darwin-stubs}/usr/include/*.modulemap \ - $out/include - '' - # Remove curses.h, ncurses.h, ncurses_dll.h, and unctrl.h which conflict with ncurses. - # Then, remove the module map for ncurses. - # NOTE: The sed expression expects the module map to use consistent indentation across - # releases. If this changes, the sed expression will need to be updated. - # - # For example, right now we assume that there is one leading space before the - # "explicit" keyword and that the closing brace is on its own line (also with one - # leading space). - + '' - rm $out/include/{curses,ncurses,ncurses_dll,unctrl}.h - sed -i -e '/^ explicit module ncurses {/,/^ }$/d' $out/include/module.modulemap - '' - + '' - rm $out/include/tk*.h $out/include/tcl*.h - - cp -dr \ - ${darwin-stubs}/usr/lib/libSystem.* \ - ${darwin-stubs}/usr/lib/system \ - $out/lib - - # Extra libraries - for name in c dbm dl info m mx poll proc pthread rpcsvc util gcc_s.1 resolv; do - cp -d \ - ${darwin-stubs}/usr/lib/lib$name.tbd \ - ${darwin-stubs}/usr/lib/lib$name.*.tbd \ - $out/lib - done - - for name in os Dispatch; do - cp -dr \ - ${darwin-stubs}/usr/lib/swift/$name.swiftmodule \ - ${darwin-stubs}/usr/lib/swift/libswift$name.tbd \ - $out/lib/swift - done - - for f in $csu; do - from=${darwin-stubs}/usr/lib/$f - if [ -e "$from" ]; then - cp -d $from $out/lib - else - echo "Csu file '$from' doesn't exist: skipping" - fi - done - - chmod u+w -R $out/lib - find $out -name '*.tbd' -type f | while read tbd; do - rewrite-tbd \ - -c /usr/lib/libsystem.dylib:$out/lib/libsystem.dylib \ - -p /usr/lib/system/:$out/lib/system/ \ - -p /usr/lib/swift/:$out/lib/swift/ \ - -r ${builtins.storeDir} \ - "$tbd" - done - ''; -} diff --git a/pkgs/os-specific/darwin/apple-sdk-12.3/libnetwork.nix b/pkgs/os-specific/darwin/apple-sdk-12.3/libnetwork.nix deleted file mode 100644 index e7bae2fc77a08..0000000000000 --- a/pkgs/os-specific/darwin/apple-sdk-12.3/libnetwork.nix +++ /dev/null @@ -1,16 +0,0 @@ -{ stdenvNoCC, darwin-stubs }: - -let - self = stdenvNoCC.mkDerivation { - pname = "libnetwork"; - inherit (darwin-stubs) version; - - buildCommand = '' - mkdir -p $out/lib - cp ${darwin-stubs}/usr/lib/libnetwork* $out/lib - ''; - - passthru.tbdRewrites.const."/usr/lib/libnetwork.dylib" = "${self}/lib/libnetwork.dylib"; - }; -in -self diff --git a/pkgs/os-specific/darwin/apple-sdk-12.3/libobjc.nix b/pkgs/os-specific/darwin/apple-sdk-12.3/libobjc.nix deleted file mode 100644 index 14d7e92c8a540..0000000000000 --- a/pkgs/os-specific/darwin/apple-sdk-12.3/libobjc.nix +++ /dev/null @@ -1,22 +0,0 @@ -{ stdenvNoCC, darwin-stubs }: - -let - self = stdenvNoCC.mkDerivation { - pname = "libobjc"; - inherit (darwin-stubs) version; - - buildCommand = '' - mkdir -p $out/{include,lib/swift} - cp -r ${darwin-stubs}/usr/include/objc $out/include - cp ${darwin-stubs}/usr/lib/libobjc* $out/lib - cp -r ${darwin-stubs}/usr/lib/swift/ObjectiveC.swiftmodule $out/lib/swift - cp ${darwin-stubs}/usr/lib/swift/libswiftObjectiveC.tbd $out/lib/swift - ''; - - passthru.tbdRewrites = { - const."/usr/lib/libobjc.A.dylib" = "${self}/lib/libobjc.A.dylib"; - const."/usr/lib/swift/libswiftObjectiveC.dylib" = "${self}/lib/swift/libswiftObjectiveC.dylib"; - }; - }; -in -self diff --git a/pkgs/os-specific/darwin/apple-sdk-12.3/libpm.nix b/pkgs/os-specific/darwin/apple-sdk-12.3/libpm.nix deleted file mode 100644 index 110b9a1ab4789..0000000000000 --- a/pkgs/os-specific/darwin/apple-sdk-12.3/libpm.nix +++ /dev/null @@ -1,25 +0,0 @@ -{ - stdenvNoCC, - buildPackages, - darwin-stubs, -}: - -stdenvNoCC.mkDerivation { - pname = "libpm"; - inherit (darwin-stubs) version; - - dontUnpack = true; - dontBuild = true; - - nativeBuildInputs = [ buildPackages.darwin.checkReexportsHook ]; - - installPhase = '' - mkdir -p $out/lib - cp ${darwin-stubs}/usr/lib/libpm* $out/lib - ''; - - passthru.tbdRewrites = { - const."/usr/lib/libpmenergy.dylib" = "${placeholder "out"}/lib/libpmenergy.dylib"; - const."/usr/lib/libpmsample.dylib" = "${placeholder "out"}/lib/libpmsample.dylib"; - }; -} diff --git a/pkgs/os-specific/darwin/apple-sdk-12.3/libs/Xplugin.nix b/pkgs/os-specific/darwin/apple-sdk-12.3/libs/Xplugin.nix deleted file mode 100644 index 6e125c001183c..0000000000000 --- a/pkgs/os-specific/darwin/apple-sdk-12.3/libs/Xplugin.nix +++ /dev/null @@ -1,30 +0,0 @@ -{ - frameworks, - darwin-stubs, - stdenvNoCC, -}: - -stdenvNoCC.mkDerivation { - pname = "apple-lib-Xplugin"; - inherit (darwin-stubs) version; - - dontUnpack = true; - dontBuild = true; - - propagatedBuildInputs = with frameworks; [ - OpenGL - ApplicationServices - Carbon - IOKit - CoreGraphics - CoreServices - CoreText - ]; - - installPhase = '' - mkdir -p $out/include $out/lib - cp "${darwin-stubs}/include/Xplugin.h" $out/include/Xplugin.h - cp ${darwin-stubs}/usr/lib/libXplugin.1.tbd $out/lib - ln -s libXplugin.1.tbd $out/lib/libXplugin.tbd - ''; -} diff --git a/pkgs/os-specific/darwin/apple-sdk-12.3/libs/default.nix b/pkgs/os-specific/darwin/apple-sdk-12.3/libs/default.nix deleted file mode 100644 index 87a36ba32b62e..0000000000000 --- a/pkgs/os-specific/darwin/apple-sdk-12.3/libs/default.nix +++ /dev/null @@ -1,10 +0,0 @@ -{ callPackage }: - -{ - libDER = callPackage ./libDER.nix { }; - sandbox = callPackage ./sandbox.nix { }; - simd = callPackage ./simd.nix { }; - utmp = callPackage ./utmp.nix { }; - xpc = callPackage ./xpc.nix { }; - Xplugin = callPackage ./Xplugin.nix { }; -} diff --git a/pkgs/os-specific/darwin/apple-sdk-12.3/libs/libDER.nix b/pkgs/os-specific/darwin/apple-sdk-12.3/libs/libDER.nix deleted file mode 100644 index 4aa8e2bd95509..0000000000000 --- a/pkgs/os-specific/darwin/apple-sdk-12.3/libs/libDER.nix +++ /dev/null @@ -1,11 +0,0 @@ -{ darwin-stubs, stdenvNoCC }: - -stdenvNoCC.mkDerivation { - pname = "apple-lib-libDER"; - inherit (darwin-stubs) version; - - buildCommand = '' - mkdir -p $out/include - cp -r ${darwin-stubs}/usr/include/libDER $out/include - ''; -} diff --git a/pkgs/os-specific/darwin/apple-sdk-12.3/libs/sandbox.nix b/pkgs/os-specific/darwin/apple-sdk-12.3/libs/sandbox.nix deleted file mode 100644 index f4e9955a0b9b5..0000000000000 --- a/pkgs/os-specific/darwin/apple-sdk-12.3/libs/sandbox.nix +++ /dev/null @@ -1,13 +0,0 @@ -{ darwin-stubs, stdenvNoCC }: - -stdenvNoCC.mkDerivation { - pname = "apple-lib-sandbox"; - inherit (darwin-stubs) version; - - buildCommand = '' - mkdir -p $out/include $out/lib - cp "${darwin-stubs}/usr/include/sandbox.h" $out/include/sandbox.h - cp "${darwin-stubs}/usr/lib/libsandbox.1.tbd" $out/lib - ln -s libsandbox.1.tbd $out/lib/libsandbox.tbd - ''; -} diff --git a/pkgs/os-specific/darwin/apple-sdk-12.3/libs/simd.nix b/pkgs/os-specific/darwin/apple-sdk-12.3/libs/simd.nix deleted file mode 100644 index 45226a5bec59b..0000000000000 --- a/pkgs/os-specific/darwin/apple-sdk-12.3/libs/simd.nix +++ /dev/null @@ -1,11 +0,0 @@ -{ darwin-stubs, stdenvNoCC }: - -stdenvNoCC.mkDerivation { - pname = "apple-lib-simd"; - inherit (darwin-stubs) version; - - buildCommand = '' - mkdir -p $out/include - cp -r ${darwin-stubs}/usr/include/simd $out/include - ''; -} diff --git a/pkgs/os-specific/darwin/apple-sdk-12.3/libs/utmp.nix b/pkgs/os-specific/darwin/apple-sdk-12.3/libs/utmp.nix deleted file mode 100644 index bc85b9be35b50..0000000000000 --- a/pkgs/os-specific/darwin/apple-sdk-12.3/libs/utmp.nix +++ /dev/null @@ -1,12 +0,0 @@ -{ darwin-stubs, stdenvNoCC }: - -stdenvNoCC.mkDerivation { - pname = "apple-lib-utmp"; - inherit (darwin-stubs) version; - - buildCommand = '' - mkdir -p $out/include - cp "${darwin-stubs}/include/utmp.h" $out/include - cp "${darwin-stubs}/include/utmpx.h" $out/include - ''; -} diff --git a/pkgs/os-specific/darwin/apple-sdk-12.3/libs/xpc.nix b/pkgs/os-specific/darwin/apple-sdk-12.3/libs/xpc.nix deleted file mode 100644 index 8c9848daf9caf..0000000000000 --- a/pkgs/os-specific/darwin/apple-sdk-12.3/libs/xpc.nix +++ /dev/null @@ -1,12 +0,0 @@ -{ darwin-stubs, stdenvNoCC }: - -stdenvNoCC.mkDerivation { - pname = "apple-lib-xpc"; - inherit (darwin-stubs) version; - - buildCommand = '' - mkdir -p $out/include - cp -r "${darwin-stubs}/usr/include/xpc" $out/include/xpc - cp "${darwin-stubs}/usr/include/launch.h" $out/include/launch.h - ''; -} diff --git a/pkgs/os-specific/darwin/apple-sdk-12.3/libunwind.nix b/pkgs/os-specific/darwin/apple-sdk-12.3/libunwind.nix deleted file mode 100644 index c1846a9bf92f5..0000000000000 --- a/pkgs/os-specific/darwin/apple-sdk-12.3/libunwind.nix +++ /dev/null @@ -1,28 +0,0 @@ -{ - stdenvNoCC, - buildPackages, - darwin-stubs, -}: - -stdenvNoCC.mkDerivation { - pname = "libunwind"; - inherit (darwin-stubs) version; - - dontUnpack = true; - dontBuild = true; - - nativeBuildInputs = [ buildPackages.darwin.checkReexportsHook ]; - - installPhase = '' - mkdir -p $out/include/mach-o - - cp \ - ${darwin-stubs}/usr/include/libunwind.h \ - ${darwin-stubs}/usr/include/unwind.h \ - $out/include - - cp \ - ${darwin-stubs}/usr/include/mach-o/compact_unwind_encoding.h \ - $out/include/mach-o - ''; -} diff --git a/pkgs/top-level/darwin-packages.nix b/pkgs/top-level/darwin-packages.nix index b09461150576b..823825e10c7d6 100644 --- a/pkgs/top-level/darwin-packages.nix +++ b/pkgs/top-level/darwin-packages.nix @@ -93,14 +93,14 @@ makeScopeWithSplicing' { }; stubs = { - inherit apple_sdk_11_0; + inherit apple_sdk_11_0 apple_sdk_12_3; } // lib.genAttrs [ ] (mkStub apple_sdk.version); in impure-cmds // appleSourcePackages // chooseLibs // stubs // { - inherit apple_sdk apple_sdk_10_12 apple_sdk_12_3; + inherit apple_sdk apple_sdk_10_12; stdenvNoCF = stdenv.override { extraBuildInputs = []; From 0a3c487571ac6ad4ceef83562cbb15c3c1c7a6bd Mon Sep 17 00:00:00 2001 From: Randy Eckenrode Date: Wed, 25 Sep 2024 22:16:56 -0400 Subject: [PATCH 020/157] darwin.apple_sdk: convert frameworks and libs to stubs --- .../darwin/apple-sdk/cf-setup-hook.sh | 9 - pkgs/os-specific/darwin/apple-sdk/default.nix | 610 ++++++++---------- .../darwin/apple-sdk/frameworks.nix | 130 ---- .../darwin/apple-sdk/impure-deps.nix | 256 -------- .../private-frameworks-setup-hook.sh | 8 - pkgs/os-specific/darwin/apple-sdk/sdkRoot.nix | 68 -- .../darwin/apple-sdk/security-setup-hook.sh | 10 - pkgs/top-level/darwin-packages.nix | 10 +- 8 files changed, 263 insertions(+), 838 deletions(-) delete mode 100644 pkgs/os-specific/darwin/apple-sdk/cf-setup-hook.sh delete mode 100644 pkgs/os-specific/darwin/apple-sdk/frameworks.nix delete mode 100644 pkgs/os-specific/darwin/apple-sdk/impure-deps.nix delete mode 100644 pkgs/os-specific/darwin/apple-sdk/private-frameworks-setup-hook.sh delete mode 100644 pkgs/os-specific/darwin/apple-sdk/sdkRoot.nix delete mode 100644 pkgs/os-specific/darwin/apple-sdk/security-setup-hook.sh diff --git a/pkgs/os-specific/darwin/apple-sdk/cf-setup-hook.sh b/pkgs/os-specific/darwin/apple-sdk/cf-setup-hook.sh deleted file mode 100644 index 5d0f58f48b481..0000000000000 --- a/pkgs/os-specific/darwin/apple-sdk/cf-setup-hook.sh +++ /dev/null @@ -1,9 +0,0 @@ -linkSystemCoreFoundationFramework() { - NIX_CFLAGS_COMPILE="-F@out@/Library/Frameworks${NIX_CFLAGS_COMPILE:+ }${NIX_CFLAGS_COMPILE-}" - # gross! many symbols (such as _OBJC_CLASS_$_NSArray) are defined in system CF, but not - # in the opensource release - # if the package needs private headers, we assume they also want to link with system CF - NIX_LDFLAGS+=" @out@/Library/Frameworks/CoreFoundation.framework/CoreFoundation.tbd" -} - -preConfigureHooks+=(linkSystemCoreFoundationFramework) diff --git a/pkgs/os-specific/darwin/apple-sdk/default.nix b/pkgs/os-specific/darwin/apple-sdk/default.nix index 1cd5afe193016..388de3730380e 100644 --- a/pkgs/os-specific/darwin/apple-sdk/default.nix +++ b/pkgs/os-specific/darwin/apple-sdk/default.nix @@ -1,360 +1,272 @@ -{ stdenv, stdenvNoCC, fetchurl, cpio, pbzx, pkgs, lib, darwin-stubs, print-reexports }: +# Compatibility stubs for packages that used the old SDK frameworks. +# TODO(@reckenrode) Make these stubs warn after framework usage has been cleaned up in nixpkgs. +{ lib, callPackage }: let - # sadly needs to be exported because security_tool needs it - sdk = stdenv.mkDerivation rec { - pname = "MacOS_SDK"; - version = "10.12"; - - # This URL comes from https://swscan.apple.com/content/catalogs/others/index-10.12.merged-1.sucatalog, which we found by: - # 1. Google: site:swscan.apple.com and look for a name that seems appropriate for your version - # 2. In the resulting file, search for a file called DevSDK ending in .pkg - # 3. ??? - # 4. Profit - src = fetchurl { - url = "http://swcdn.apple.com/content/downloads/33/36/041-90419-A_7JJ4H9ZHO2/xs88ob5wjz6riz7g6764twblnvksusg4ps/DevSDK_OSX1012.pkg"; - sha256 = "13xq34sb7383b37hwy076gnhf96prpk1b4087p87xnwswxbrisih"; - }; - - nativeBuildInputs = [ cpio pbzx ]; - - outputs = [ "out" "dev" "man" ]; - - unpackPhase = '' - pbzx $src | cpio -idm - ''; - - sourceRoot = "."; - - installPhase = '' - mkdir -p $out - - cp -R System/Library $out - cp -R usr/* $out - - pushd $out/lib - cp ${darwin-stubs}/usr/lib/libcups*.tbd . - ln -s libcups.2.tbd libcups.tbd - ln -s libcupscgi.1.tbd libcupscgi.tbd - ln -s libcupsimage.2.tbd libcupsimage.tbd - ln -s libcupsmime.1.tbd libcupsmime.tbd - ln -s libcupsppdc.1.tbd libcupsppdc.tbd - popd - ''; - - meta = with lib; { - description = "Apple SDK ${version}"; - maintainers = with maintainers; [ copumpkin ]; - platforms = platforms.darwin; - }; - }; - - mkFrameworkSubs = name: deps: - let - deps' = deps // { "${name}" = placeholder "out"; }; - substArgs = lib.concatMap (x: [ "--subst-var-by" x deps'."${x}" ]) (lib.attrNames deps'); - in lib.escapeShellArgs substArgs; - - framework = name: deps: stdenv.mkDerivation { - name = "apple-framework-${name}"; - - dontUnpack = true; - - # because we copy files from the system - preferLocalBuild = true; - - disallowedRequisites = [ sdk ]; - - nativeBuildInputs = [ print-reexports ]; - - extraTBDFiles = []; - - installPhase = '' - linkFramework() { - local path="$1" - local nested_path="$1" - if [ "$path" == "JavaNativeFoundation.framework" ]; then - local nested_path="JavaVM.framework/Versions/A/Frameworks/JavaNativeFoundation.framework" - fi - if [ "$path" == "JavaRuntimeSupport.framework" ]; then - local nested_path="JavaVM.framework/Versions/A/Frameworks/JavaRuntimeSupport.framework" - fi - local name="$(basename "$path" .framework)" - local current="$(readlink "/System/Library/Frameworks/$nested_path/Versions/Current")" - if [ -z "$current" ]; then - current=A - fi - - local dest="$out/Library/Frameworks/$path" - - mkdir -p "$dest/Versions/$current" - pushd "$dest/Versions/$current" >/dev/null - - if [ -d "${sdk.out}/Library/Frameworks/$nested_path/Versions/$current/Headers" ]; then - cp -R "${sdk.out}/Library/Frameworks/$nested_path/Versions/$current/Headers" . - elif [ -d "${sdk.out}/Library/Frameworks/$name.framework/Versions/$current/Headers" ]; then - current="$(readlink "/System/Library/Frameworks/$name.framework/Versions/Current")" - cp -R "${sdk.out}/Library/Frameworks/$name.framework/Versions/$current/Headers" . - fi - - local tbd_source=${darwin-stubs}/System/Library/Frameworks/$nested_path/Versions/$current - if [ "${name}" != "Kernel" ]; then - # The Kernel.framework has headers but no actual library component. - cp -v $tbd_source/*.tbd . - fi - - if [ -d "$tbd_source/Libraries" ]; then - mkdir Libraries - cp -v $tbd_source/Libraries/*.tbd Libraries/ - fi - - ln -s -L "/System/Library/Frameworks/$nested_path/Versions/$current/Resources" - - if [ -f "/System/Library/Frameworks/$nested_path/module.map" ]; then - ln -s "/System/Library/Frameworks/$nested_path/module.map" - fi - - pushd "${sdk.out}/Library/Frameworks/$nested_path/Versions/$current" >/dev/null - local children=$(echo Frameworks/*.framework) - popd >/dev/null - - for child in $children; do - childpath="$path/Versions/$current/$child" - linkFramework "$childpath" - done - - pushd ../.. >/dev/null - ln -s "$current" Versions/Current - ln -s Versions/Current/* . - popd >/dev/null - - popd >/dev/null - } - - linkFramework "${name}.framework" - - # linkFramework is recursive, the rest of the processing is not. - - local tbd_source=${darwin-stubs}/System/Library/Frameworks/${name}.framework - for tbd in $extraTBDFiles; do - local tbd_dest_dir=$out/Library/Frameworks/${name}.framework/$(dirname "$tbd") - mkdir -p "$tbd_dest_dir" - cp -v "$tbd_source/$tbd" "$tbd_dest_dir" - done - - # Fix and check tbd re-export references - find $out -name '*.tbd' | while read tbd; do - echo "Fixing re-exports in $tbd" - substituteInPlace "$tbd" ${mkFrameworkSubs name deps} - - echo "Checking re-exports in $tbd" - print-reexports "$tbd" | while read target; do - local expected="''${target%.dylib}.tbd" - if ! [ -e "$expected" ]; then - echo -e "Re-export missing:\n\t$target\n\t(expected $expected)" - echo -e "While processing\n\t$tbd" - exit 1 - else - echo "Re-exported target $target ok" - fi - done - done - ''; - - propagatedBuildInputs = builtins.attrValues deps; - - meta = with lib; { - description = "Apple SDK framework ${name}"; - maintainers = with maintainers; [ copumpkin ]; - platforms = platforms.darwin; - }; - }; - - tbdOnlyFramework = name: { private ? true }: stdenv.mkDerivation { - name = "apple-framework-${name}"; - dontUnpack = true; - installPhase = '' - mkdir -p $out/Library/Frameworks/ - cp -r ${darwin-stubs}/System/Library/${lib.optionalString private "Private"}Frameworks/${name}.framework \ - $out/Library/Frameworks - - cd $out/Library/Frameworks/${name}.framework - - versions=(./Versions/*) - if [ "''${#versions[@]}" != 1 ]; then - echo "Unable to determine current version of framework ${name}" - exit 1 - fi - current=$(basename ''${versions[0]}) - - chmod u+w -R . - ln -s "$current" Versions/Current - ln -s Versions/Current/* . - - # NOTE there's no re-export checking here, this is probably wrong - ''; - }; -in rec { - libs = { - xpc = stdenv.mkDerivation { - name = "apple-lib-xpc"; - dontUnpack = true; - - installPhase = '' - mkdir -p $out/include - pushd $out/include >/dev/null - cp -r "${lib.getDev sdk}/include/xpc" $out/include/xpc - cp "${lib.getDev sdk}/include/launch.h" $out/include/launch.h - popd >/dev/null - ''; - }; - - Xplugin = stdenv.mkDerivation { - name = "apple-lib-Xplugin"; - dontUnpack = true; - - # Not enough - __propagatedImpureHostDeps = [ "/usr/lib/libXplugin.1.dylib" ]; - - propagatedBuildInputs = with frameworks; [ - OpenGL ApplicationServices Carbon IOKit CoreGraphics CoreServices CoreText - ]; - - installPhase = '' - mkdir -p $out/include $out/lib - ln -s "${lib.getDev sdk}/include/Xplugin.h" $out/include/Xplugin.h - cp ${darwin-stubs}/usr/lib/libXplugin.1.tbd $out/lib - ln -s libXplugin.1.tbd $out/lib/libXplugin.tbd - ''; - }; - - utmp = stdenv.mkDerivation { - name = "apple-lib-utmp"; - dontUnpack = true; - - installPhase = '' - mkdir -p $out/include - pushd $out/include >/dev/null - ln -s "${lib.getDev sdk}/include/utmp.h" - ln -s "${lib.getDev sdk}/include/utmpx.h" - popd >/dev/null - ''; - }; - - sandbox = stdenv.mkDerivation { - name = "apple-lib-sandbox"; - dontUnpack = true; - - installPhase = '' - mkdir -p $out/include $out/lib - ln -s "${lib.getDev sdk}/include/sandbox.h" $out/include/sandbox.h - cp "${darwin-stubs}/usr/lib/libsandbox.1.tbd" $out/lib - ln -s libsandbox.1.tbd $out/lib/libsandbox.tbd - ''; - }; - - simd = stdenvNoCC.mkDerivation { - name = "apple-lib-simd"; - - preferLocalBuild = true; - allowSubstitutes = false; - - buildCommand = "echo 'simd library not available in the 10.12 SDK'; exit 1"; - }; - }; - - overrides = super: { - AppKit = lib.overrideDerivation super.AppKit (drv: { - __propagatedImpureHostDeps = drv.__propagatedImpureHostDeps or [] ++ [ - "/System/Library/PrivateFrameworks/" - ]; - }); - - Carbon = lib.overrideDerivation super.Carbon (drv: { - extraTBDFiles = [ "Versions/A/Frameworks/HTMLRendering.framework/Versions/A/HTMLRendering.tbd" ]; - }); - - CoreFoundation = lib.overrideDerivation super.CoreFoundation (drv: { - setupHook = ./cf-setup-hook.sh; - }); - - CoreMedia = lib.overrideDerivation super.CoreMedia (drv: { - __propagatedImpureHostDeps = drv.__propagatedImpureHostDeps or [] ++ [ - "/System/Library/Frameworks/CoreImage.framework" - ]; - }); - - CoreMIDI = lib.overrideDerivation super.CoreMIDI (drv: { - __propagatedImpureHostDeps = drv.__propagatedImpureHostDeps or [] ++ [ - "/System/Library/PrivateFrameworks/" - ]; - setupHook = ./private-frameworks-setup-hook.sh; - }); - - IMServicePlugIn = lib.overrideDerivation super.IMServicePlugIn (drv: { - extraTBDFiles = [ "Versions/A/Frameworks/IMServicePlugInSupport.framework/Versions/A/IMServicePlugInSupport.tbd" ]; - }); - - Security = lib.overrideDerivation super.Security (drv: { - setupHook = ./security-setup-hook.sh; - }); - - QuartzCore = lib.overrideDerivation super.QuartzCore (drv: { - installPhase = drv.installPhase + '' - f="$out/Library/Frameworks/QuartzCore.framework/Headers/CoreImage.h" - substituteInPlace "$f" \ - --replace "QuartzCore/../Frameworks/CoreImage.framework/Headers" "CoreImage" - ''; - }); - - MetalKit = lib.overrideDerivation super.MetalKit (drv: { - installPhase = drv.installPhase + '' - mkdir -p $out/include/simd - cp ${lib.getDev sdk}/include/simd/*.h $out/include/simd/ - ''; - }); - - System = lib.overrideDerivation super.System (drv: { - installPhase = '' - mkdir -p $out/Library/Frameworks/System.framework/Versions/B - ln -s $out/Library/Frameworks/System.framework/Versions/{B,Current} - ln -s ${pkgs.darwin.Libsystem}/lib/libSystem.B.tbd $out/Library/Frameworks/System.framework/Versions/B/System.tbd - ln -s $out/Library/Frameworks/System.framework/{Versions/Current/,}System.tbd - ''; - }); - - WebKit = lib.overrideDerivation super.WebKit (drv: { - extraTBDFiles = [ - "Versions/A/Frameworks/WebCore.framework/Versions/A/WebCore.tbd" - "Versions/A/Frameworks/WebKitLegacy.framework/Versions/A/WebKitLegacy.tbd" - ]; - }); - } // lib.genAttrs [ + mkStub = callPackage ./mk-stub.nix { } "10.12"; + + frameworks = lib.genAttrs [ + "AGL" + "AVFoundation" + "AVKit" + "Accelerate" + "Accounts" + "AddressBook" + "AppKit" + "AppKitScripting" + "AppleScriptKit" + "AppleScriptObjC" + "ApplicationServices" + "AudioToolbox" + "AudioUnit" + "AudioVideoBridging" + "Automator" + "CFNetwork" + "CalendarStore" + "Carbon" + "Cocoa" + "Collaboration" "ContactsPersistence" + "CoreAudio" + "CoreAudioKit" + "CoreBluetooth" + "CoreData" + "CoreFoundation" + "CoreGraphics" + "CoreImage" + "CoreLocation" + "CoreMIDI" + "CoreMIDIServer" + "CoreMedia" + "CoreMediaIO" + "CoreServices" "CoreSymbolication" + "CoreText" + "CoreVideo" + "CoreWLAN" + "DVDPlayback" "DebugSymbols" + "DirectoryService" + "DiscRecording" + "DiscRecordingUI" + "DiskArbitration" "DisplayServices" + "EventKit" + "ExceptionHandling" + "FWAUserLib" + "ForceFeedback" + "Foundation" + "GLKit" + "GLUT" + "GSS" "GameCenter" + "GameController" + "GameKit" + "GameplayKit" + "Hypervisor" + "ICADevices" + "IMServicePlugIn" + "IOBluetooth" + "IOBluetoothUI" + "IOKit" + "IOSurface" + "ImageCaptureCore" + "ImageIO" + "InputMethodKit" + "InstallerPlugins" + "InstantMessage" + "JavaFrameEmbedding" + "JavaNativeFoundation" + "JavaRuntimeSupport" + "JavaScriptCore" + "JavaVM" + "Kerberos" + "Kernel" + "LDAP" + "LatentSemanticMapping" + "LocalAuthentication" + "MapKit" + "MediaAccessibility" + "MediaPlayer" + "MediaToolbox" + "Metal" + "MetalKit" + "ModelIO" "MultitouchSupport" + "NetFS" + "OSAKit" + "OpenAL" + "OpenCL" + "OpenDirectory" + "OpenGL" + "PCSC" + "PreferencePanes" + "PubSub" + "QTKit" + "Quartz" + "QuartzCore" + "QuickLook" + "QuickTime" + "SceneKit" + "ScreenSaver" + "Scripting" + "ScriptingBridge" + "Security" + "SecurityFoundation" + "SecurityInterface" + "ServiceManagement" "SkyLight" + "Social" + "SpriteKit" + "StoreKit" + "SyncServices" + "System" + "SystemConfiguration" + "TWAIN" + "Tcl" "UIFoundation" - ] - (x: tbdOnlyFramework x {}); - - bareFrameworks = lib.mapAttrs framework (import ./frameworks.nix { - inherit frameworks libs; - inherit (pkgs.darwin) libobjc; - }); - - frameworks = bareFrameworks // overrides bareFrameworks; - - inherit darwin-stubs; - - objc4 = pkgs.darwin.libobjc; - - sdkRoot = pkgs.callPackage ./sdkRoot.nix { sdkVersion = "10.12.4"; }; - - inherit (pkgs.darwin) Libsystem; - - inherit sdk; + "VideoDecodeAcceleration" + "VideoToolbox" + "WebKit" + "vmnet" + ] mkStub; + + bareFrameworks = lib.genAttrs [ + "AGL" + "AVFoundation" + "AVKit" + "Accelerate" + "Accounts" + "AddressBook" + "AppKit" + "AppKitScripting" + "AppleScriptKit" + "AppleScriptObjC" + "ApplicationServices" + "AudioToolbox" + "AudioUnit" + "AudioVideoBridging" + "Automator" + "CFNetwork" + "CalendarStore" + "Carbon" + "Cocoa" + "Collaboration" + "CoreAudio" + "CoreAudioKit" + "CoreBluetooth" + "CoreData" + "CoreFoundation" + "CoreGraphics" + "CoreImage" + "CoreLocation" + "CoreMIDI" + "CoreMIDIServer" + "CoreMedia" + "CoreMediaIO" + "CoreServices" + "CoreText" + "CoreVideo" + "CoreWLAN" + "DVDPlayback" + "DirectoryService" + "DiscRecording" + "DiscRecordingUI" + "DiskArbitration" + "EventKit" + "ExceptionHandling" + "FWAUserLib" + "ForceFeedback" + "Foundation" + "GLKit" + "GLUT" + "GSS" + "GameCenter" + "GameController" + "GameKit" + "GameplayKit" + "Hypervisor" + "ICADevices" + "IMServicePlugIn" + "IOBluetooth" + "IOBluetoothUI" + "IOKit" + "IOSurface" + "ImageCaptureCore" + "ImageIO" + "InputMethodKit" + "InstallerPlugins" + "InstantMessage" + "JavaFrameEmbedding" + "JavaNativeFoundation" + "JavaRuntimeSupport" + "JavaScriptCore" + "JavaVM" + "Kerberos" + "Kernel" + "LDAP" + "LatentSemanticMapping" + "LocalAuthentication" + "MapKit" + "MediaAccessibility" + "MediaPlayer" + "MediaToolbox" + "Metal" + "MetalKit" + "ModelIO" + "NetFS" + "OSAKit" + "OpenAL" + "OpenCL" + "OpenDirectory" + "OpenGL" + "PCSC" + "PreferencePanes" + "PubSub" + "QTKit" + "Quartz" + "QuartzCore" + "QuickLook" + "QuickTime" + "SceneKit" + "ScreenSaver" + "Scripting" + "ScriptingBridge" + "Security" + "SecurityFoundation" + "SecurityInterface" + "ServiceManagement" + "Social" + "SpriteKit" + "StoreKit" + "SyncServices" + "System" + "SystemConfiguration" + "TWAIN" + "Tcl" + "VideoDecodeAcceleration" + "VideoToolbox" + "WebKit" + "vmnet" + ] mkStub; +in +{ + inherit bareFrameworks frameworks; + + libs = lib.genAttrs [ + "Xplugin" + "sandbox" + "simd" + "utmp" + "xpc" + ] mkStub; + + version = "10.12"; } +// lib.genAttrs [ + "darwin-stubs" + "Libsystem" + "objc4" + "sdk" + "sdkRoot" +] mkStub diff --git a/pkgs/os-specific/darwin/apple-sdk/frameworks.nix b/pkgs/os-specific/darwin/apple-sdk/frameworks.nix deleted file mode 100644 index a9fbcc066a3ca..0000000000000 --- a/pkgs/os-specific/darwin/apple-sdk/frameworks.nix +++ /dev/null @@ -1,130 +0,0 @@ -# Current as of 10.12 -# Epic weird knot-tying happening here. -# TODO: clean up the process for generating this and include it - -{ frameworks, libs, libobjc, }: - -with frameworks; with libs; { - AGL = { inherit Carbon OpenGL; }; - AVFoundation = { inherit ApplicationServices CoreGraphics CoreMedia MediaToolbox; }; - AVKit = {}; - Accounts = {}; - AddressBook = { inherit libobjc Carbon ContactsPersistence; }; - AppKit = { inherit ApplicationServices AudioToolbox AudioUnit Foundation QuartzCore UIFoundation; }; - AppKitScripting = {}; - AppleScriptKit = {}; - AppleScriptObjC = {}; - AudioToolbox = { inherit CoreAudio CoreMIDI; }; - AudioUnit = { inherit AudioToolbox Carbon CoreAudio; }; - AudioVideoBridging = { inherit Foundation; }; - Automator = {}; - CFNetwork = {}; - CalendarStore = {}; - Cocoa = { inherit AppKit CoreData; }; - Collaboration = {}; - # Impure version of CoreFoundation, this should not be used unless another - # framework includes headers that are not available in the pure version. - CoreFoundation = {}; - CoreAudio = { inherit IOKit; }; - CoreAudioKit = { inherit AudioUnit; }; - CoreData = {}; - CoreGraphics = { inherit Accelerate IOKit IOSurface SystemConfiguration; }; - CoreImage = {}; - CoreLocation = {}; - CoreMIDI = {}; - CoreMIDIServer = { inherit CoreMIDI; }; - CoreMedia = { inherit ApplicationServices AudioToolbox AudioUnit CoreAudio CoreGraphics CoreVideo; }; - CoreMediaIO = { inherit CoreMedia; }; - CoreText = { inherit CoreGraphics; }; - CoreVideo = { inherit ApplicationServices CoreGraphics IOSurface OpenGL; }; - CoreWLAN = { inherit SecurityFoundation; }; - DVDPlayback = {}; - DirectoryService = {}; - DiscRecording = { inherit libobjc CoreServices IOKit; }; - DiscRecordingUI = {}; - DiskArbitration = { inherit IOKit; }; - EventKit = {}; - ExceptionHandling = {}; - FWAUserLib = {}; - ForceFeedback = { inherit IOKit; }; - Foundation = { inherit libobjc CoreFoundation Security ApplicationServices SystemConfiguration; }; - GLKit = {}; - GLUT = { inherit OpenGL; }; - GSS = {}; - GameCenter = {}; - GameController = {}; - GameKit = { inherit Cocoa Foundation GameCenter GameController GameplayKit Metal MetalKit ModelIO SceneKit SpriteKit; }; - GameplayKit = {}; - Hypervisor = {}; - ICADevices = { inherit libobjc Carbon IOBluetooth; }; - IMServicePlugIn = {}; - IOBluetoothUI = { inherit IOBluetooth; }; - IOKit = {}; - IOSurface = { inherit IOKit xpc; }; - ImageCaptureCore = {}; - ImageIO = { inherit CoreGraphics; }; - InputMethodKit = { inherit Carbon; }; - InstallerPlugins = {}; - InstantMessage = {}; - JavaFrameEmbedding = {}; - JavaNativeFoundation = {}; - JavaRuntimeSupport = {}; - JavaScriptCore = { inherit libobjc; }; - Kerberos = {}; - Kernel = { inherit IOKit; }; - LDAP = {}; - LatentSemanticMapping = { inherit Carbon; }; - LocalAuthentication = {}; - MapKit = {}; - MediaAccessibility = { inherit CoreGraphics CoreText QuartzCore; }; - MediaPlayer = {}; - MediaToolbox = { inherit AudioToolbox AudioUnit CoreMedia; }; - Metal = {}; - MetalKit = { inherit ModelIO Metal; }; - ModelIO = {}; - NetFS = {}; - OSAKit = { inherit Carbon; }; - OpenAL = {}; - OpenCL = { inherit IOSurface OpenGL; }; - OpenGL = {}; - PCSC = { inherit CoreData; }; - PreferencePanes = {}; - PubSub = {}; - QTKit = { inherit CoreMediaIO CoreMedia MediaToolbox QuickTime VideoToolbox; }; - QuickLook = { inherit ApplicationServices; }; - SceneKit = {}; - ScreenSaver = {}; - Scripting = {}; - ScriptingBridge = {}; - Security = { inherit IOKit; }; - SecurityFoundation = {}; - SecurityInterface = { inherit Security SecurityFoundation; }; - ServiceManagement = { inherit Security; }; - Social = {}; - SpriteKit = {}; - StoreKit = {}; - SyncServices = {}; - System = {}; - SystemConfiguration = { inherit Security; }; - TWAIN = { inherit Carbon; }; - Tcl = {}; - VideoDecodeAcceleration = { inherit CoreVideo; }; - VideoToolbox = { inherit CoreMedia CoreVideo; }; - WebKit = { inherit libobjc ApplicationServices Carbon JavaScriptCore OpenGL; }; - - # Umbrellas - Accelerate = { inherit CoreWLAN IOBluetooth; }; - ApplicationServices = { inherit CoreGraphics CoreServices CoreText ImageIO; }; - Carbon = { inherit libobjc ApplicationServices CoreServices Foundation IOKit Security QuartzCore; }; - CoreBluetooth = {}; - # TODO: figure out which part of the umbrella depends on CoreFoundation and move it there. - CoreServices = { inherit CFNetwork CoreFoundation CoreAudio CoreData DiskArbitration Security NetFS OpenDirectory ServiceManagement; }; - IOBluetooth = { inherit CoreBluetooth IOKit; }; - JavaVM = {}; - OpenDirectory = {}; - Quartz = { inherit QuartzCore QuickLook QTKit; }; - QuartzCore = { inherit libobjc ApplicationServices CoreVideo OpenCL CoreImage Metal; }; - QuickTime = { inherit ApplicationServices AudioUnit Carbon CoreAudio CoreServices OpenGL QuartzCore; }; - - vmnet = {}; -} diff --git a/pkgs/os-specific/darwin/apple-sdk/impure-deps.nix b/pkgs/os-specific/darwin/apple-sdk/impure-deps.nix deleted file mode 100644 index c111492f2b3d6..0000000000000 --- a/pkgs/os-specific/darwin/apple-sdk/impure-deps.nix +++ /dev/null @@ -1,256 +0,0 @@ -rec { - CFNetwork = [ - "/System/Library/Frameworks/CFNetwork.framework" - "/usr/lib/libsqlite3.dylib" - "/usr/lib/libxml2.2.dylib" - ]; - ForceFeedback = [ - "/System/Library/Frameworks/ForceFeedback.framework" - ]; - AGL = [ - "/System/Library/Frameworks/AGL.framework" - ]; - IOKit = [ - "/System/Library/Frameworks/IOKit.framework" - ]; - JavaScriptCore = [ - "/System/Library/Frameworks/JavaScriptCore.framework" - ]; - QuickLook = [ - "/System/Library/Frameworks/QuickLook.framework" - ]; - Quartz = [ - "/System/Library/Frameworks/Quartz.framework" - "/System/Library/PrivateFrameworks/AppleSystemInfo.framework/Versions/A/AppleSystemInfo" - "/System/Library/PrivateFrameworks/CorePDF.framework/Versions/A/CorePDF" - "/usr/lib/libspindump.dylib" - ]; - ImageCaptureCore = [ - "/System/Library/Frameworks/ImageCaptureCore.framework" - ]; - VideoToolbox = [ - "/System/Library/Frameworks/VideoToolbox.framework" - "/System/Library/PrivateFrameworks/AppleVA.framework/Versions/A/AppleVA" - ]; - QuickTime = [ - "/System/Library/Frameworks/QuickTime.framework" - ]; - CoreMedia = [ - "/System/Library/Frameworks/CoreMedia.framework" - ]; - CoreMediaIO = [ - "/System/Library/Frameworks/CoreMediaIO.framework" - "/System/Library/PrivateFrameworks/AppSandbox.framework/Versions/A/AppSandbox" - "/System/Library/PrivateFrameworks/AppContainer.framework/Versions/A/AppContainer" - "/System/Library/PrivateFrameworks/SecCodeWrapper.framework/Versions/A/SecCodeWrapper" - "/System/Library/PrivateFrameworks/XPCService.framework/Versions/A/XPCService" - "/usr/lib/libsandbox.1.dylib" - "/usr/lib/libMatch.1.dylib" - ]; - MediaToolbox = [ - "/System/Library/Frameworks/MediaToolbox.framework" - "/System/Library/PrivateFrameworks/CoreAUC.framework/Versions/A/CoreAUC" - "/System/Library/PrivateFrameworks/NetworkStatistics.framework/Versions/A/NetworkStatistics" - ]; - QTKit = [ - "/System/Library/Frameworks/QTKit.framework" - "/System/Library/PrivateFrameworks/CoreMediaAuthoring.framework/Versions/A/CoreMediaAuthoring" - ]; - OSAKit = [ - "/System/Library/Frameworks/OSAKit.framework" - "/usr/lib/libexslt.0.dylib" - ]; - WebKit = [ - "/System/Library/Frameworks/WebKit.framework" - ]; - DiskArbitration = [ - "/System/Library/Frameworks/DiskArbitration.framework" - ]; - Security = [ - "/System/Library/Frameworks/Security.framework" - "/usr/lib/libbsm.0.dylib" - "/usr/lib/libbz2.1.0.dylib" - "/usr/lib/libpam.2.dylib" - "/usr/lib/libxar.1.dylib" - "/usr/lib/libxml2.2.dylib" - "/usr/lib/libsqlite3.dylib" - ]; - GSS = [ - "/System/Library/Frameworks/GSS.framework" - ]; - Kerberos = [ - "/System/Library/Frameworks/Kerberos.framework" - ]; - CoreServices = [ - "/System/Library/Frameworks/CoreServices.framework" - "/System/Library/PrivateFrameworks/DataDetectorsCore.framework/Versions/A/DataDetectorsCore" - "/System/Library/PrivateFrameworks/TCC.framework/Versions/A/TCC" - "/System/Library/PrivateFrameworks/LanguageModeling.framework/Versions/A/LanguageModeling" - "/usr/lib/libmecabra.dylib" - "/usr/lib/libcmph.dylib" - "/usr/lib/libiconv.2.dylib" - "/usr/lib/libxslt.1.dylib" - ] ++ Foundation; - IOSurface = [ - "/System/Library/Frameworks/IOSurface.framework" - ]; - CoreGraphics = [ - "/System/Library/Frameworks/CoreGraphics.framework" - "/System/Library/PrivateFrameworks/MultitouchSupport.framework/Versions/A/MultitouchSupport" - "/usr/lib/libbsm.0.dylib" - "/usr/lib/libz.1.dylib" - ]; - CoreText = [ - "/System/Library/Frameworks/CoreText.framework" - ]; - ImageIO = [ - "/System/Library/Frameworks/ImageIO.framework" - ]; - ApplicationServices = [ - "/System/Library/Frameworks/ApplicationServices.framework" - "/usr/lib/libcups.2.dylib" - "/usr/lib/libresolv.9.dylib" - ] ++ AudioToolbox; - OpenGL = [ - "/System/Library/Frameworks/OpenGL.framework" - ]; - CoreVideo = [ - "/System/Library/Frameworks/CoreVideo.framework" - ]; - QuartzCore = [ - "/System/Library/Frameworks/QuartzCore.framework" - "/System/Library/PrivateFrameworks/CrashReporterSupport.framework/Versions/A/CrashReporterSupport" - ]; - PCSC = [ - "/System/Library/Frameworks/PCSC.framework" - ]; - AppKit = [ - "/System/Library/Frameworks/AppKit.framework" - "/System/Library/PrivateFrameworks/Apple80211.framework/Versions/A/Apple80211" - "/System/Library/PrivateFrameworks/AppleJPEG.framework/Versions/A/AppleJPEG" - "/System/Library/PrivateFrameworks/AppleVPA.framework/Versions/A/AppleVPA" - "/System/Library/PrivateFrameworks/Backup.framework/Versions/A/Backup" - "/System/Library/PrivateFrameworks/ChunkingLibrary.framework/Versions/A/ChunkingLibrary" - "/System/Library/PrivateFrameworks/CommonAuth.framework/Versions/A/CommonAuth" - "/System/Library/PrivateFrameworks/CoreSymbolication.framework/Versions/A/CoreSymbolication" - "/System/Library/PrivateFrameworks/CoreUI.framework/Versions/A/CoreUI" - "/System/Library/PrivateFrameworks/CoreWiFi.framework/Versions/A/CoreWiFi" - "/System/Library/PrivateFrameworks/CrashReporterSupport.framework/Versions/A/CrashReporterSupport" - "/System/Library/PrivateFrameworks/DataDetectorsCore.framework/Versions/A/DataDetectorsCore" - "/System/Library/PrivateFrameworks/DebugSymbols.framework/Versions/A/DebugSymbols" - "/System/Library/PrivateFrameworks/DesktopServicesPriv.framework/Versions/A/DesktopServicesPriv" - "/System/Library/PrivateFrameworks/FaceCore.framework/Versions/A/FaceCore" - "/System/Library/PrivateFrameworks/GenerationalStorage.framework/Versions/A/GenerationalStorage" - "/System/Library/PrivateFrameworks/Heimdal.framework/Heimdal" - "/System/Library/PrivateFrameworks/Heimdal.framework/Versions/Current" - "/System/Library/PrivateFrameworks/Heimdal.framework/Versions/A/Heimdal" - "/System/Library/PrivateFrameworks/IconServices.framework/Versions/A/IconServices" - "/System/Library/PrivateFrameworks/LanguageModeling.framework/Versions/A/LanguageModeling" - "/System/Library/PrivateFrameworks/MultitouchSupport.framework/Versions/A/MultitouchSupport" - "/System/Library/PrivateFrameworks/NetAuth.framework/Versions/A/NetAuth" - "/System/Library/PrivateFrameworks/PerformanceAnalysis.framework/Versions/A/PerformanceAnalysis" - "/System/Library/PrivateFrameworks/RemoteViewServices.framework/Versions/A/RemoteViewServices" - "/System/Library/PrivateFrameworks/Sharing.framework/Versions/A/Sharing" - "/System/Library/PrivateFrameworks/SpeechRecognitionCore.framework/Versions/A/SpeechRecognitionCore" - "/System/Library/PrivateFrameworks/Symbolication.framework/Versions/A/Symbolication" - "/System/Library/PrivateFrameworks/TCC.framework/Versions/A/TCC" - "/System/Library/PrivateFrameworks/UIFoundation.framework/Versions/A/UIFoundation" - "/System/Library/PrivateFrameworks/login.framework/Versions/A/Frameworks/loginsupport.framework/Versions/A/loginsupport" - "/usr/lib/libCRFSuite.dylib" - "/usr/lib/libOpenScriptingUtil.dylib" - "/usr/lib/libarchive.2.dylib" - "/usr/lib/libbsm.0.dylib" - "/usr/lib/libbz2.1.0.dylib" - "/usr/lib/libc++.1.dylib" - "/usr/lib/libc++abi.dylib" - "/usr/lib/libcmph.dylib" - "/usr/lib/libcups.2.dylib" - "/usr/lib/libextension.dylib" - "/usr/lib/libheimdal-asn1.dylib" - "/usr/lib/libiconv.2.dylib" - "/usr/lib/libicucore.A.dylib" - "/usr/lib/liblangid.dylib" - "/usr/lib/liblzma.5.dylib" - "/usr/lib/libmecabra.dylib" - "/usr/lib/libpam.2.dylib" - "/usr/lib/libresolv.9.dylib" - "/usr/lib/libsqlite3.dylib" - "/usr/lib/libxar.1.dylib" - "/usr/lib/libxml2.2.dylib" - "/usr/lib/libxslt.1.dylib" - "/usr/lib/libz.1.dylib" - ]; - Foundation = [ - "/System/Library/Frameworks/Foundation.framework" - "/usr/lib/libextension.dylib" - "/usr/lib/libarchive.2.dylib" - "/usr/lib/liblzma.5.dylib" - "/usr/lib/liblangid.dylib" - "/usr/lib/libCRFSuite.dylib" - ]; - CoreData = [ - "/System/Library/Frameworks/CoreData.framework" - ]; - Cocoa = [ - "/System/Library/Frameworks/Cocoa.framework" - "/System/Library/PrivateFrameworks/UIFoundation.framework/Versions/A/UIFoundation" - "/System/Library/PrivateFrameworks/UIFoundation.framework/Versions/A" - ]; - Carbon = [ - "/System/Library/Frameworks/Carbon.framework" - "/System/Library/PrivateFrameworks/CoreUI.framework/Versions/A/CoreUI" - "/System/Library/PrivateFrameworks/DesktopServicesPriv.framework/Versions/A/DesktopServicesPriv" - "/System/Library/PrivateFrameworks/IconServices.framework/Versions/A/IconServices" - "/System/Library/PrivateFrameworks/ChunkingLibrary.framework/Versions/A/ChunkingLibrary" - "/System/Library/PrivateFrameworks/Sharing.framework/Versions/A/Sharing" - "/System/Library/PrivateFrameworks/Apple80211.framework/Versions/A/Apple80211" - "/System/Library/PrivateFrameworks/GenerationalStorage.framework/Versions/A/GenerationalStorage" - ]; - CoreAudio = [ - "/System/Library/Frameworks/CoreAudio.framework" - ]; - AudioUnit = [ - "/System/Library/Frameworks/AudioUnit.framework" - ]; - CoreMIDI = [ - "/System/Library/Frameworks/CoreMIDI.framework" - ]; - AudioToolbox = [ - "/System/Library/Frameworks/AudioToolbox.framework" - ]; - SystemConfiguration = [ - "/System/Library/Frameworks/SystemConfiguration.framework" - ]; - NetFS = [ - "/System/Library/Frameworks/NetFS.framework" - "/System/Library/PrivateFrameworks/NetAuth.framework/Versions/A/NetAuth" - "/System/Library/PrivateFrameworks/login.framework/Versions/A/Frameworks/loginsupport.framework/Versions/A/loginsupport" - ]; - Accelerate = [ - "/System/Library/Frameworks/Accelerate.framework" - ]; - OpenDirectory = [ - "/System/Library/Frameworks/OpenDirectory.framework" - ]; - ServiceManagement = [ - "/System/Library/Frameworks/ServiceManagement.framework" - ]; - OpenCL = [ - "/System/Library/Frameworks/OpenCL.framework" - ]; - CoreWLAN = [ - "/System/Library/Frameworks/CoreWLAN.framework" - ]; - IOBluetooth = [ - "/System/Library/Frameworks/IOBluetooth.framework" - ] ++ AudioUnit ++ CoreBluetooth; - CoreBluetooth = [ - "/System/Library/Frameworks/CoreBluetooth.framework" - ]; - SecurityFoundation = [ - "/System/Library/Frameworks/SecurityFoundation.framework" - ]; - Kernel = [ - "/System/Library/Frameworks/Kernel.framework" - ]; -} diff --git a/pkgs/os-specific/darwin/apple-sdk/private-frameworks-setup-hook.sh b/pkgs/os-specific/darwin/apple-sdk/private-frameworks-setup-hook.sh deleted file mode 100644 index a351c39de1307..0000000000000 --- a/pkgs/os-specific/darwin/apple-sdk/private-frameworks-setup-hook.sh +++ /dev/null @@ -1,8 +0,0 @@ -addPrivateFrameworks() { - flag="-F/System/Library/PrivateFrameworks" - if [[ "${NIX_CFLAGS_COMPILE-}" != *$flag* ]]; then - NIX_CFLAGS_COMPILE+=" $flag" - fi -} - -addEnvHooks "$hostOffset" addPrivateFrameworks diff --git a/pkgs/os-specific/darwin/apple-sdk/sdkRoot.nix b/pkgs/os-specific/darwin/apple-sdk/sdkRoot.nix deleted file mode 100644 index 67d9cbe031059..0000000000000 --- a/pkgs/os-specific/darwin/apple-sdk/sdkRoot.nix +++ /dev/null @@ -1,68 +0,0 @@ -{ - lib, - runCommand, - writeText, - sdkVersion, -}: - -let - sdkName = "MacOSX${sdkVersion}"; - toolchainName = "com.apple.dt.toolchain.XcodeDefault"; - productBuildVer = null; - - inherit (lib.generators) toPlist toJSON; - - SDKSettings = { - CanonicalName = "macosx${sdkVersion}"; - DisplayName = "macOS ${sdkVersion}"; - Toolchains = [ toolchainName ]; - Version = sdkVersion; - MaximumDeploymentTarget = "${sdkVersion}.99"; - isBaseSDK = "YES"; - }; - - SystemVersion = - lib.optionalAttrs (productBuildVer != null) { ProductBuildVersion = productBuildVer; } - // { - ProductName = "macOS"; - ProductVersion = sdkVersion; - }; -in -runCommand "sdkroot-${sdkVersion}" { } '' - sdk="$out/${sdkName}.sdk" - - install -D ${writeText "SDKSettings.plist" (toPlist { } SDKSettings)} "$sdk/SDKSettings.plist" - install -D ${writeText "SDKSettings.json" (toJSON { } SDKSettings)} "$sdk/SDKSettings.json" - install -D ${ - writeText "SystemVersion.plist" (toPlist { } SystemVersion) - } "$sdk/System/Library/CoreServices/SystemVersion.plist" - - ln -s "$sdk" "$sdk/usr" - - install -D '${../../../build-support/setup-hooks/role.bash}' "$out/nix-support/setup-hook" - cat >> "$out/nix-support/setup-hook" <<-hook - # - # See comments in cc-wrapper's setup hook. This works exactly the same way. - # - [[ -z \''${strictDeps-} ]] || (( "\$hostOffset" < 0 )) || return 0 - - sdkRootHook() { - # See ../../../build-support/setup-hooks/role.bash - local role_post - getHostRoleEnvHook - - # Only set the SDK root if one has not been set via this hook or some other means. - if [[ ! \$NIX_CFLAGS_COMPILE =~ isysroot ]]; then - export NIX_CFLAGS_COMPILE\''${role_post}+=' -isysroot $out/${sdkName}.sdk' - fi - } - - # See ../../../build-support/setup-hooks/role.bash - getTargetRole - - addEnvHooks "\$targetOffset" sdkRootHook - - # No local scope in sourced file - unset -v role_post - hook -'' diff --git a/pkgs/os-specific/darwin/apple-sdk/security-setup-hook.sh b/pkgs/os-specific/darwin/apple-sdk/security-setup-hook.sh deleted file mode 100644 index 35cea773f98b5..0000000000000 --- a/pkgs/os-specific/darwin/apple-sdk/security-setup-hook.sh +++ /dev/null @@ -1,10 +0,0 @@ -noDeprecatedDeclarations() { - # Security.framework has about 2000 deprecated constants, all of which the user will be - # warned about at compilation time - flag="-Wno-deprecated-declarations" - if [[ "${NIX_CFLAGS_COMPILE-}" != *$flag* ]]; then - NIX_CFLAGS_COMPILE+=" $flag" - fi -} - -addEnvHooks "$hostOffset" noDeprecatedDeclarations diff --git a/pkgs/top-level/darwin-packages.nix b/pkgs/top-level/darwin-packages.nix index 823825e10c7d6..82be7b181a47e 100644 --- a/pkgs/top-level/darwin-packages.nix +++ b/pkgs/top-level/darwin-packages.nix @@ -50,11 +50,7 @@ makeScopeWithSplicing' { impure-cmds = pkgs.callPackage ../os-specific/darwin/impure-cmds { }; # macOS 10.12 SDK - apple_sdk_10_12 = pkgs.callPackage ../os-specific/darwin/apple-sdk { - inherit (buildPackages.darwin) print-reexports; - inherit (self) darwin-stubs; - fetchurl = fetchurlBoot; - }; + apple_sdk_10_12 = pkgs.callPackage ../os-specific/darwin/apple-sdk { }; # macOS 11.0 SDK apple_sdk_11_0 = pkgs.callPackage ../os-specific/darwin/apple-sdk-11.0 { }; @@ -93,15 +89,13 @@ makeScopeWithSplicing' { }; stubs = { - inherit apple_sdk_11_0 apple_sdk_12_3; + inherit apple_sdk apple_sdk_10_12 apple_sdk_11_0 apple_sdk_12_3; } // lib.genAttrs [ ] (mkStub apple_sdk.version); in impure-cmds // appleSourcePackages // chooseLibs // stubs // { - inherit apple_sdk apple_sdk_10_12; - stdenvNoCF = stdenv.override { extraBuildInputs = []; }; From 9ecb69c827e608f916b161431d90b7f34009145b Mon Sep 17 00:00:00 2001 From: Randy Eckenrode Date: Sat, 5 Oct 2024 21:23:20 -0400 Subject: [PATCH 021/157] darwin.apple_sdk: drop gen-frameworks.py (replaced by new SDK pattern) --- pkgs/os-specific/darwin/gen-frameworks.py | 147 ---------------------- 1 file changed, 147 deletions(-) delete mode 100755 pkgs/os-specific/darwin/gen-frameworks.py diff --git a/pkgs/os-specific/darwin/gen-frameworks.py b/pkgs/os-specific/darwin/gen-frameworks.py deleted file mode 100755 index ec2a6c7c16ecd..0000000000000 --- a/pkgs/os-specific/darwin/gen-frameworks.py +++ /dev/null @@ -1,147 +0,0 @@ -#!/usr/bin/env nix-shell -#!nix-shell -i python -p python3 swiftPackages.swift-unwrapped - -""" -Generate a frameworks.nix for a macOS SDK. - -You may point this tool at an Xcode bundled SDK, but more ideal is using the -SDK from Nixpkgs. For example: - -SDK_PATH="$(nix-build --no-link -A darwin.apple_sdk_11_0.MacOSX-SDK)" -./gen-frameworks.py "$SDK_PATH" > ./new-frameworks.nix -""" - -import json -import os -import subprocess -import sys - -ALLOWED_LIBS = ["simd"] - -HEADER = """\ -# This file is generated by gen-frameworks.nix. -# Do not edit, put overrides in apple_sdk.nix instead. -{ libs, frameworks }: with libs; with frameworks; -{ -""" - -FOOTER = """\ -} -""" - - -def eprint(*args): - print(*args, file=sys.stderr) - - -def name_from_ident(ident): - return ident.get("swift", ident.get("clang")) - - -def scan_sdk(sdk): - # Find frameworks by scanning the SDK frameworks directory. - frameworks = [ - framework.removesuffix(".framework") - for framework in os.listdir(f"{sdk}/System/Library/Frameworks") - if not framework.startswith("_") - ] - frameworks.sort() - - # Determine the longest name for padding output. - width = len(max(frameworks, key=len)) - - output = HEADER - - for framework in frameworks: - deps = [] - - # Use Swift to scan dependencies, because a module may have both Clang - # and Swift parts. Using Clang only imports the Clang module, whereas - # using Swift will usually import both Clang + Swift overlay. - # - # TODO: The above is an assumption. Not sure if it's possible a Swift - # module completely shadows a Clang module. (Seems unlikely) - # - # TODO: Handle "module 'Foobar' is incompatible with feature 'swift'" - # - # If there were a similar Clang invocation for scanning, we could fix - # the above todos, but that doesn't appear to exist. - eprint(f"# scanning {framework}") - result = subprocess.run( - [ - "swiftc", - "-scan-dependencies", - # We provide a source snippet via stdin. - "-", - # Use the provided SDK. - "-sdk", - sdk, - # This search path is normally added automatically by the - # compiler based on the SDK, but we have a patch in place that - # removes that for SDKs in /nix/store, because our xcbuild stub - # SDK doesn't have the directory. - # (swift-prevent-sdk-dirs-warning.patch) - "-I", - f"{sdk}/usr/lib/swift", - # For some reason, 'lib/swift/shims' from both the SDK and - # Swift compiler are picked up, causing redefinition errors. - # This eliminates the latter. - "-resource-dir", - f"{sdk}/usr/lib/swift", - ], - input=f"import {framework}".encode(), - stdout=subprocess.PIPE, - ) - if result.returncode != 0: - eprint(f"# Scanning {framework} failed (exit code {result.returncode})") - result.stdout = b"" - - # Parse JSON output. - if len(result.stdout) != 0: - data = json.loads(result.stdout) - - # Entries in the modules list come in pairs. The first is an - # identifier (`{ swift: "foobar" }` or `{ clang: "foobar" }`), and - # the second metadata for that module. Here we look for the pair - # that matches the framework we're scanning (and ignore the rest). - modules = data["modules"] - for i in range(0, len(modules), 2): - ident, meta = modules[i : i + 2] - - # NOTE: We may match twice, for a Swift module _and_ for a - # Clang module. So matching here doesn't break from the loop, - # and deps is appended to. - if name_from_ident(ident) == framework: - dep_idents = meta["directDependencies"] - deps += [name_from_ident(ident) for ident in dep_idents] - # List unfiltered deps in progress output. - eprint(ident, "->", dep_idents) - - # Filter out modules that are not separate derivations. - # Also filter out duplicates (when a Swift overlay imports the Clang module) - allowed = frameworks + ALLOWED_LIBS - deps = set([dep for dep in deps if dep in allowed]) - - # Filter out self-references. (Swift overlay importing Clang module.) - if framework in deps: - deps.remove(framework) - - # Generate a Nix attribute line. - if len(deps) != 0: - deps = list(deps) - deps.sort() - deps = " ".join(deps) - output += f" {framework.ljust(width)} = {{ inherit {deps}; }};\n" - else: - output += f" {framework.ljust(width)} = {{}};\n" - - output += FOOTER - sys.stdout.write(output) - - -if __name__ == "__main__": - if len(sys.argv) != 2: - eprint(f"Usage: {sys.argv[0]} ") - sys.exit(64) - - scan_sdk(sys.argv[1]) From c218ce1e4de9ff13ff0ae58385c78e9c055367b0 Mon Sep 17 00:00:00 2001 From: Randy Eckenrode Date: Sat, 21 Sep 2024 10:06:58 -0400 Subject: [PATCH 022/157] darwin: replace framework chooser with stubs --- pkgs/top-level/darwin-packages.nix | 25 +------------------------ 1 file changed, 1 insertion(+), 24 deletions(-) diff --git a/pkgs/top-level/darwin-packages.nix b/pkgs/top-level/darwin-packages.nix index 82be7b181a47e..5317cab970fc1 100644 --- a/pkgs/top-level/darwin-packages.nix +++ b/pkgs/top-level/darwin-packages.nix @@ -65,36 +65,13 @@ makeScopeWithSplicing' { }.${stdenv.hostPlatform.darwinSdkVersion} or (throw "Unsupported sdk: ${stdenv.hostPlatform.darwinSdkVersion}"); - # Pick the source of libraries: either Apple's open source releases, or the - # SDK. - useAppleSDKLibs = lib.versionAtLeast stdenv.hostPlatform.darwinSdkVersion "11"; - - selectAttrs = attrs: names: - lib.listToAttrs (lib.concatMap (n: lib.optionals (attrs ? "${n}") [(lib.nameValuePair n attrs."${n}")]) names); - - chooseLibs = ( - # There are differences in which libraries are exported. Avoid evaluation - # errors when a package is not provided. - selectAttrs ( - if useAppleSDKLibs - then apple_sdk - else appleSourcePackages - ) ["Libsystem" "LibsystemCross" "libcharset" "libunwind" "objc4" "configd" "IOKit"] - ) // { - inherit ( - if useAppleSDKLibs - then apple_sdk.frameworks - else appleSourcePackages - ) Security; - }; - stubs = { inherit apple_sdk apple_sdk_10_12 apple_sdk_11_0 apple_sdk_12_3; } // lib.genAttrs [ ] (mkStub apple_sdk.version); in -impure-cmds // appleSourcePackages // chooseLibs // stubs // { +impure-cmds // appleSourcePackages // stubs // { stdenvNoCF = stdenv.override { extraBuildInputs = []; From 97d75cb619e2bd83547ac6a7c899784d97af4401 Mon Sep 17 00:00:00 2001 From: Randy Eckenrode Date: Sun, 29 Sep 2024 13:54:47 -0400 Subject: [PATCH 023/157] {bintools,cc}-wrapper: set up Darwin SDK paths MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. --- .../add-darwin-ldflags-before.sh | 10 ++++++++++ pkgs/build-support/cc-wrapper/add-flags.sh | 18 +++++++++++++++++- 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/pkgs/build-support/bintools-wrapper/add-darwin-ldflags-before.sh b/pkgs/build-support/bintools-wrapper/add-darwin-ldflags-before.sh index 75d9484846a8c..afcfce8ea9d52 100644 --- a/pkgs/build-support/bintools-wrapper/add-darwin-ldflags-before.sh +++ b/pkgs/build-support/bintools-wrapper/add-darwin-ldflags-before.sh @@ -79,3 +79,13 @@ if [ ! "$havePlatformVersionFlag" ]; then extraBefore+=(-@darwinPlatform@_version_min "${@darwinMinVersionVariable@_@suffixSalt@:-@darwinMinVersion@}") fi fi + +mangleVarSingle DEVELOPER_DIR ${role_suffixes[@]+"${role_suffixes[@]}"} + +# Allow wrapped bintools to do something useful when no `DEVELOPER_DIR` is set, which can happen when +# the compiler is run outside of a stdenv or intentionally in an environment with no environment variables set. +DEVELOPER_DIR=${DEVELOPER_DIR_@suffixSalt@} + +# Darwin looks for frameworks in the SDK located at `DEVELOPER_DIR`. +extraBefore+=("-F$DEVELOPER_DIR/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks") +extraBefore+=("-L$DEVELOPER_DIR/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/lib") diff --git a/pkgs/build-support/cc-wrapper/add-flags.sh b/pkgs/build-support/cc-wrapper/add-flags.sh index 2c3dc8884023b..6683337b77b97 100644 --- a/pkgs/build-support/cc-wrapper/add-flags.sh +++ b/pkgs/build-support/cc-wrapper/add-flags.sh @@ -78,12 +78,28 @@ if [ -e @out@/nix-support/cc-cflags-before ]; then NIX_CFLAGS_COMPILE_BEFORE_@suffixSalt@="$(< @out@/nix-support/cc-cflags-before) $NIX_CFLAGS_COMPILE_BEFORE_@suffixSalt@" fi -# Only add darwin min version flag if a default darwin min version is set, +# Only add darwin min version flag and set up `DEVELOPER_DIR` if a default darwin min version is set, # which is a signal that we're targetting darwin. if [ "@darwinMinVersion@" ]; then mangleVarSingle @darwinMinVersionVariable@ ${role_suffixes[@]+"${role_suffixes[@]}"} NIX_CFLAGS_COMPILE_BEFORE_@suffixSalt@="-m@darwinPlatformForCC@-version-min=${@darwinMinVersionVariable@_@suffixSalt@:-@darwinMinVersion@} $NIX_CFLAGS_COMPILE_BEFORE_@suffixSalt@" + + # `DEVELOPER_DIR` is used to dynamically locate libSystem (and the SDK frameworks) based on the SDK at that path. + mangleVarSingle DEVELOPER_DIR ${role_suffixes[@]+"${role_suffixes[@]}"} + + # Allow wrapped compilers to do something useful when no `DEVELOPER_DIR` is set, which can happen when + # the compiler is run outside of a stdenv or intentionally in an environment with no environment variables set. + DEVELOPER_DIR=${DEVELOPER_DIR_@suffixSalt@} + + # xcbuild needs `SDKROOT` to be the name of the SDK, which it sets in its own wrapper, + # but compilers expect it to point to the absolute path. + SDKROOT="$DEVELOPER_DIR/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk" + + # Set up various library paths since compilers may not support (or may have disabled) finding them in the sysroot. + NIX_CFLAGS_COMPILE_BEFORE_@suffixSalt@+=" -isysroot $SDKROOT" + NIX_CFLAGS_COMPILE_@suffixSalt@+=" -idirafter $SDKROOT/usr/include" + NIX_CFLAGS_COMPILE_@suffixSalt@+=" -iframework $SDKROOT/System/Library/Frameworks" fi # That way forked processes will not extend these environment variables again. From 51755b0c00881bfe1602db0eb689efd2c66bcc20 Mon Sep 17 00:00:00 2001 From: Randy Eckenrode Date: Sun, 29 Sep 2024 13:54:47 -0400 Subject: [PATCH 024/157] {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). --- .../bintools-wrapper/add-darwin-ldflags-before.sh | 2 +- pkgs/build-support/bintools-wrapper/default.nix | 4 ++++ pkgs/build-support/cc-wrapper/add-flags.sh | 2 +- pkgs/build-support/cc-wrapper/default.nix | 4 ++++ 4 files changed, 10 insertions(+), 2 deletions(-) diff --git a/pkgs/build-support/bintools-wrapper/add-darwin-ldflags-before.sh b/pkgs/build-support/bintools-wrapper/add-darwin-ldflags-before.sh index afcfce8ea9d52..79f0546403f7a 100644 --- a/pkgs/build-support/bintools-wrapper/add-darwin-ldflags-before.sh +++ b/pkgs/build-support/bintools-wrapper/add-darwin-ldflags-before.sh @@ -84,7 +84,7 @@ mangleVarSingle DEVELOPER_DIR ${role_suffixes[@]+"${role_suffixes[@]}"} # Allow wrapped bintools to do something useful when no `DEVELOPER_DIR` is set, which can happen when # the compiler is run outside of a stdenv or intentionally in an environment with no environment variables set. -DEVELOPER_DIR=${DEVELOPER_DIR_@suffixSalt@} +DEVELOPER_DIR=${DEVELOPER_DIR_@suffixSalt@:-@fallback_sdk@} # Darwin looks for frameworks in the SDK located at `DEVELOPER_DIR`. extraBefore+=("-F$DEVELOPER_DIR/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks") diff --git a/pkgs/build-support/bintools-wrapper/default.nix b/pkgs/build-support/bintools-wrapper/default.nix index b64e97345ab5c..4a64573501025 100644 --- a/pkgs/build-support/bintools-wrapper/default.nix +++ b/pkgs/build-support/bintools-wrapper/default.nix @@ -10,6 +10,7 @@ , stdenvNoCC , runtimeShell , bintools ? null, libc ? null, coreutils ? null, gnugrep ? null +, apple-sdk ? null , netbsd ? null , sharedLibraryLoader ? if libc == null then @@ -412,6 +413,9 @@ stdenvNoCC.mkDerivation { inherit dynamicLinker targetPrefix suffixSalt coreutils_bin; inherit bintools_bin libc_bin libc_dev libc_lib; default_hardening_flags_str = builtins.toString defaultHardeningFlags; + } // lib.optionalAttrs (apple-sdk != null && stdenvNoCC.targetPlatform.isDarwin) { + # Wrapped compilers should do something useful even when no SDK is provided at `DEVELOPER_DIR`. + fallback_sdk = apple-sdk.__spliced.buildTarget or apple-sdk; }; meta = diff --git a/pkgs/build-support/cc-wrapper/add-flags.sh b/pkgs/build-support/cc-wrapper/add-flags.sh index 6683337b77b97..cd5396f45f8b4 100644 --- a/pkgs/build-support/cc-wrapper/add-flags.sh +++ b/pkgs/build-support/cc-wrapper/add-flags.sh @@ -90,7 +90,7 @@ if [ "@darwinMinVersion@" ]; then # Allow wrapped compilers to do something useful when no `DEVELOPER_DIR` is set, which can happen when # the compiler is run outside of a stdenv or intentionally in an environment with no environment variables set. - DEVELOPER_DIR=${DEVELOPER_DIR_@suffixSalt@} + DEVELOPER_DIR=${DEVELOPER_DIR_@suffixSalt@:-@fallback_sdk@} # xcbuild needs `SDKROOT` to be the name of the SDK, which it sets in its own wrapper, # but compilers expect it to point to the absolute path. diff --git a/pkgs/build-support/cc-wrapper/default.nix b/pkgs/build-support/cc-wrapper/default.nix index 01f91b408e382..ed55e37cb76ae 100644 --- a/pkgs/build-support/cc-wrapper/default.nix +++ b/pkgs/build-support/cc-wrapper/default.nix @@ -10,6 +10,7 @@ , stdenvNoCC , runtimeShell , cc ? null, libc ? null, bintools, coreutils ? null +, apple-sdk ? null , zlib ? null , nativeTools, noLibc ? false, nativeLibc, nativePrefix ? "" , propagateDoc ? cc != null && cc ? man @@ -749,6 +750,9 @@ stdenvNoCC.mkDerivation { inherit libc_bin libc_dev libc_lib; inherit darwinPlatformForCC darwinMinVersion darwinMinVersionVariable; default_hardening_flags_str = builtins.toString defaultHardeningFlags; + } // lib.optionalAttrs (apple-sdk != null && stdenvNoCC.targetPlatform.isDarwin) { + # Wrapped compilers should do something useful even when no SDK is provided at `DEVELOPER_DIR`. + fallback_sdk = apple-sdk.__spliced.buildTarget or apple-sdk; }; meta = From 826edbf7190c7249394f9180652bc8969aa8198a Mon Sep 17 00:00:00 2001 From: Randy Eckenrode Date: Sun, 29 Sep 2024 13:54:47 -0400 Subject: [PATCH 025/157] {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. --- pkgs/build-support/bintools-wrapper/default.nix | 3 ++- pkgs/build-support/cc-wrapper/default.nix | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/pkgs/build-support/bintools-wrapper/default.nix b/pkgs/build-support/bintools-wrapper/default.nix index 4a64573501025..868bc8cdae1ff 100644 --- a/pkgs/build-support/bintools-wrapper/default.nix +++ b/pkgs/build-support/bintools-wrapper/default.nix @@ -108,7 +108,8 @@ let coreutils_bin = optionalString (!nativeTools) (getBin coreutils); # See description in cc-wrapper. - suffixSalt = replaceStrings ["-" "."] ["_" "_"] targetPlatform.config; + suffixSalt = replaceStrings ["-" "."] ["_" "_"] targetPlatform.config + + lib.optionalString (targetPlatform.isDarwin && targetPlatform.isStatic) "_static"; # The dynamic linker has different names on different platforms. This is a # shell glob that ought to match it. diff --git a/pkgs/build-support/cc-wrapper/default.nix b/pkgs/build-support/cc-wrapper/default.nix index ed55e37cb76ae..34b23acc80e34 100644 --- a/pkgs/build-support/cc-wrapper/default.nix +++ b/pkgs/build-support/cc-wrapper/default.nix @@ -115,7 +115,8 @@ let # without interfering. For the moment, it is defined as the target triple, # adjusted to be a valid bash identifier. This should be considered an # unstable implementation detail, however. - suffixSalt = replaceStrings ["-" "."] ["_" "_"] targetPlatform.config; + suffixSalt = replaceStrings ["-" "."] ["_" "_"] targetPlatform.config + + lib.optionalString (targetPlatform.isDarwin && targetPlatform.isStatic) "_static"; useGccForLibs = useCcForLibs && libcxx == null From a556a81f121a852a423159422ca619bc82d31e52 Mon Sep 17 00:00:00 2001 From: Randy Eckenrode Date: Sat, 7 Sep 2024 22:01:39 -0400 Subject: [PATCH 026/157] atf: build with the bootstrap stdenv on Darwin --- pkgs/top-level/all-packages.nix | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 01461c7dcbabc..936f308149852 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -23761,6 +23761,17 @@ with pkgs; }; } ../os-specific/darwin/darwin-min-version-hook/setup-hook.sh; + ### DEVELOPMENT / TESTING TOOLS + + atf = callPackage ../by-name/at/atf/package.nix { + stdenv = + # atf is a dependency of libiconv. Avoid an infinite recursion with `pkgsStatic` by using a bootstrap stdenv. + if stdenv.hostPlatform.isDarwin then + darwin.bootstrapStdenv + else + stdenv; + }; + ### DEVELOPMENT / LIBRARIES / AGDA agdaPackages = callPackage ./agda-packages.nix { From 54d591b2b4a7b29479e04ffde0f1338d208a4171 Mon Sep 17 00:00:00 2001 From: Randy Eckenrode Date: Fri, 30 Aug 2024 21:48:43 -0400 Subject: [PATCH 027/157] cmake: undo `/var/empty` workaround for Darwin SDK paths MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. --- pkgs/by-name/cm/cmake/package.nix | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/pkgs/by-name/cm/cmake/package.nix b/pkgs/by-name/cm/cmake/package.nix index 985b07cfb8a62..4ccac77995412 100644 --- a/pkgs/by-name/cm/cmake/package.nix +++ b/pkgs/by-name/cm/cmake/package.nix @@ -181,6 +181,14 @@ stdenv.mkDerivation (finalAttrs: { sed -i 's|bin/cmake|${buildPackages.cmakeMinimal}/bin/cmake|g' Makefile ''; + # Undo some of `fixCmakeFiles` for Darwin to make sure that checks for libraries in the SDK find them + # (e.g., `find_library(MATH_LIBRARY m)` should find `$SDKROOT/usr/lib/libm.tbd`). + postFixup = lib.optionalString stdenv.hostPlatform.isDarwin '' + substituteInPlace "$out/share/cmake-${lib.versions.majorMinor finalAttrs.version}/Modules/Platform/Darwin.cmake" \ + --replace-fail '/var/empty/include' '/usr/include' \ + --replace-fail '/var/empty/lib' '/usr/lib' + ''; + dontUseCmakeConfigure = true; enableParallelBuilding = true; From 472d10b75bd462bb1e94625d23f9da5f15457d24 Mon Sep 17 00:00:00 2001 From: Randy Eckenrode Date: Fri, 16 Aug 2024 20:15:45 -0400 Subject: [PATCH 028/157] cmake: do in fact use the Darwin SDK in the setup hook --- pkgs/by-name/cm/cmake/setup-hook.sh | 3 --- 1 file changed, 3 deletions(-) diff --git a/pkgs/by-name/cm/cmake/setup-hook.sh b/pkgs/by-name/cm/cmake/setup-hook.sh index 0bb0426bca824..3df8b9bd986b0 100755 --- a/pkgs/by-name/cm/cmake/setup-hook.sh +++ b/pkgs/by-name/cm/cmake/setup-hook.sh @@ -57,9 +57,6 @@ cmakeConfigurePhase() { # because we usually do not package the framework prependToVar cmakeFlags "-DCMAKE_FIND_FRAMEWORK=LAST" - # we never want to use the global macOS SDK - prependToVar cmakeFlags "-DCMAKE_OSX_SYSROOT=" - # correctly detect our clang compiler prependToVar cmakeFlags "-DCMAKE_POLICY_DEFAULT_CMP0025=NEW" From a79ed0daec90cfe0e053fd3f5be8c84fca865e48 Mon Sep 17 00:00:00 2001 From: Randy Eckenrode Date: Fri, 16 Aug 2024 20:15:45 -0400 Subject: [PATCH 029/157] gnutar: make sure libiconv is linked MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit gnutar’s `configure` detects libiconv but fails to link it on Darwin. --- pkgs/tools/archivers/gnutar/default.nix | 13 ++++------- .../archivers/gnutar/link-libiconv.patch | 23 +++++++++++++++++++ 2 files changed, 28 insertions(+), 8 deletions(-) create mode 100644 pkgs/tools/archivers/gnutar/link-libiconv.patch diff --git a/pkgs/tools/archivers/gnutar/default.nix b/pkgs/tools/archivers/gnutar/default.nix index f9b5415b4f8e4..292b39738dfc7 100644 --- a/pkgs/tools/archivers/gnutar/default.nix +++ b/pkgs/tools/archivers/gnutar/default.nix @@ -17,12 +17,9 @@ stdenv.mkDerivation rec { sha256 = "sha256-TWL/NzQux67XSFNTI5MMfPlKz3HDWRiCsmp+pQ8+3BY="; }; - # avoid retaining reference to CF during stdenv bootstrap - configureFlags = lib.optionals stdenv.hostPlatform.isDarwin [ - "gt_cv_func_CFPreferencesCopyAppValue=no" - "gt_cv_func_CFLocaleCopyCurrent=no" - "gt_cv_func_CFLocaleCopyPreferredLanguages=no" - ]; + # GNU tar fails to link libiconv even though the configure script detects it. + # https://savannah.gnu.org/bugs/index.php?64441 + patches = [ ./link-libiconv.patch ]; # gnutar tries to call into gettext between `fork` and `exec`, # which is not safe on darwin. @@ -33,8 +30,8 @@ stdenv.mkDerivation rec { outputs = [ "out" "info" ]; - nativeBuildInputs = lib.optional stdenv.hostPlatform.isDarwin autoreconfHook - ++ lib.optional (!stdenv.hostPlatform.isDarwin) updateAutotoolsGnuConfigScriptsHook; + nativeBuildInputs = [ autoreconfHook ]; + # Add libintl on Darwin specifically as it fails to link (or skip) # NLS on it's own: # "_libintl_textdomain", referenced from: diff --git a/pkgs/tools/archivers/gnutar/link-libiconv.patch b/pkgs/tools/archivers/gnutar/link-libiconv.patch new file mode 100644 index 0000000000000..a515c37c39ca1 --- /dev/null +++ b/pkgs/tools/archivers/gnutar/link-libiconv.patch @@ -0,0 +1,23 @@ +From 8632df398b2f548465ebe68b8f494c0d6f8d913d Mon Sep 17 00:00:00 2001 +From: Sergey Poznyakoff +Date: Tue, 18 Jul 2023 17:02:23 +0300 +Subject: Fix savannah bug #64441 + +* src/Makefile.am (tar_LDADD): Add libiconv libraries. +--- + src/Makefile.am | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/src/Makefile.am b/src/Makefile.am +index 36c9543..e2ec58d 100644 +--- a/src/Makefile.am ++++ b/src/Makefile.am +@@ -52,4 +52,5 @@ AM_CFLAGS = $(WARN_CFLAGS) $(WERROR_CFLAGS) + tar_LDADD = $(LIBS) ../lib/libtar.a ../gnu/libgnu.a\ + $(LIB_ACL) $(LIB_CLOCK_GETTIME) $(LIB_EACCESS)\ + $(LIB_GETRANDOM) $(LIB_HARD_LOCALE) $(FILE_HAS_ACL_LIB) $(LIB_MBRTOWC)\ +- $(LIB_SELINUX) $(LIB_SETLOCALE_NULL) ++ $(LIB_SELINUX) $(LIB_SETLOCALE_NULL) \ ++ $(LIBINTL) $(LIBICONV) +-- +cgit v1.1 From f1480a23ece3d3ae7596235cc3626444e4a62c36 Mon Sep 17 00:00:00 2001 From: Randy Eckenrode Date: Sat, 7 Sep 2024 22:01:39 -0400 Subject: [PATCH 030/157] 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. --- pkgs/top-level/all-packages.nix | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 936f308149852..4f3b647767f82 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -21470,7 +21470,16 @@ with pkgs; libplacebo = callPackage ../development/libraries/libplacebo { }; - libpng = callPackage ../development/libraries/libpng { }; + libpng = callPackage ../development/libraries/libpng { + stdenv = + # libpng is a dependency of xcbuild. Avoid an infinite recursion by using a bootstrap stdenv + # that does not propagate xcrun. + if stdenv.hostPlatform.isDarwin then + darwin.bootstrapStdenv + else + stdenv; + }; + libpng12 = callPackage ../development/libraries/libpng/12.nix { }; libpostal = callPackage ../development/libraries/libpostal { }; From 1ebcfd5758083575ecaf172aace1afd3d3d1b8d5 Mon Sep 17 00:00:00 2001 From: Randy Eckenrode Date: Sun, 29 Sep 2024 14:12:55 -0400 Subject: [PATCH 031/157] 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. --- pkgs/development/libraries/libuv/default.nix | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pkgs/development/libraries/libuv/default.nix b/pkgs/development/libraries/libuv/default.nix index 8d1d36344d7e1..7f9aac48e7258 100644 --- a/pkgs/development/libraries/libuv/default.nix +++ b/pkgs/development/libraries/libuv/default.nix @@ -3,6 +3,7 @@ , fetchFromGitHub , autoconf , automake +, darwin , libtool , pkg-config , pkgsStatic @@ -86,6 +87,8 @@ stdenv.mkDerivation (finalAttrs: { nativeBuildInputs = [ automake autoconf libtool pkg-config ]; + buildInputs = lib.optionals stdenv.hostPlatform.isDarwin [ darwin.libutil ]; + preConfigure = '' LIBTOOLIZE=libtoolize ./autogen.sh ''; From 5a60ff8315b67c0d95540329deb207b75c58cfbd Mon Sep 17 00:00:00 2001 From: Randy Eckenrode Date: Sat, 7 Sep 2024 22:01:39 -0400 Subject: [PATCH 032/157] 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. --- pkgs/top-level/all-packages.nix | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 4f3b647767f82..e822d46ec9e16 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -21800,6 +21800,13 @@ with pkgs; libxml2 = callPackage ../development/libraries/libxml2 { python = python3; + stdenv = + # libxml2 is a dependency of xcbuild. Avoid an infinite recursion by using a bootstrap stdenv + # that does not propagate xcrun. + if stdenv.hostPlatform.isDarwin then + darwin.bootstrapStdenv + else + stdenv; }; libxml2Python = let From 25c6fe1dc384173795d50ddbe701f0d87d5049b1 Mon Sep 17 00:00:00 2001 From: Randy Eckenrode Date: Mon, 23 Sep 2024 22:24:15 -0400 Subject: [PATCH 033/157] llvmPackages.clang: backport __ENVIRONMENT_OS_VERSION_MIN_REQUIRED__ MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Newer SDKs use this on Darwin. Without it, using the 14.4 and 15.0 SDKs won’t work with clang 16. --- .../compilers/llvm/common/default.nix | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/pkgs/development/compilers/llvm/common/default.nix b/pkgs/development/compilers/llvm/common/default.nix index 72eafab196606..681e563d65a7b 100644 --- a/pkgs/development/compilers/llvm/common/default.nix +++ b/pkgs/development/compilers/llvm/common/default.nix @@ -540,6 +540,23 @@ let libllvmLibdir = "${tools.libllvm.lib}/lib"; }) ] + # Backport version logic from Clang 16. This is needed by the following patch. + ++ lib.optional (lib.versionOlder (lib.versions.major metadata.release_version) "16") (fetchpatch { + name = "clang-darwin-Use-consistent-version-define-stringifying-logic.patch"; + url = "https://github.com/llvm/llvm-project/commit/60a33ded751c86fff9ac1c4bdd2b341fbe4b0649.patch?full_index=1"; + includes = [ "lib/Basic/Targets/OSTargets.cpp" ]; + stripLen = 1; + hash = "sha256-YVTSg5eZLz3po2AUczPNXCK26JA3CuTh6Iqp7hAAKIs="; + }) + # Backport `__ENVIRONMENT_OS_VERSION_MIN_REQUIRED__` support from Clang 17. + # This is needed by newer SDKs (14+). + ++ lib.optional (lib.versionOlder (lib.versions.major metadata.release_version) "17") (fetchpatch { + name = "clang-darwin-An-OS-version-preprocessor-define.patch"; + url = "https://github.com/llvm/llvm-project/commit/c8e2dd8c6f490b68e41fe663b44535a8a21dfeab.patch?full_index=1"; + includes = [ "lib/Basic/Targets/OSTargets.cpp" ]; + stripLen = 1; + hash = "sha256-Vs32kql7N6qtLqc12FtZHURcbenA7+N3E/nRRX3jdig="; + }) ++ lib.optional (lib.versions.major metadata.release_version == "18") (fetchpatch { name = "tweak-tryCaptureVariable-for-unevaluated-lambdas.patch"; url = "https://github.com/llvm/llvm-project/commit/3d361b225fe89ce1d8c93639f27d689082bd8dad.patch"; From 4dc3227d4c4646bec09e13c11087b5f89682c0fe Mon Sep 17 00:00:00 2001 From: Randy Eckenrode Date: Mon, 23 Sep 2024 22:06:54 -0400 Subject: [PATCH 034/157] llvmPackages.clang: use the system libunwind on Darwin MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. --- .../compilers/llvm/common/default.nix | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/pkgs/development/compilers/llvm/common/default.nix b/pkgs/development/compilers/llvm/common/default.nix index 681e563d65a7b..c863d0d8a82ab 100644 --- a/pkgs/development/compilers/llvm/common/default.nix +++ b/pkgs/development/compilers/llvm/common/default.nix @@ -781,16 +781,20 @@ let bintools = bintools'; extraPackages = [ targetLlvmLibraries.compiler-rt-no-libc ] - ++ lib.optionals (!stdenv.targetPlatform.isWasm && !stdenv.targetPlatform.isFreeBSD) [ - targetLlvmLibraries.libunwind - ]; + ++ lib.optionals + ( + !stdenv.targetPlatform.isWasm && !stdenv.targetPlatform.isFreeBSD && !stdenv.targetPlatform.isDarwin + ) + [ + targetLlvmLibraries.libunwind + ]; extraBuildCommands = lib.optionalString (lib.versions.major metadata.release_version == "13") ( '' echo "-rtlib=compiler-rt -Wno-unused-command-line-argument" >> $out/nix-support/cc-cflags echo "-B${targetLlvmLibraries.compiler-rt-no-libc}/lib" >> $out/nix-support/cc-cflags '' - + lib.optionalString (!stdenv.targetPlatform.isWasm) '' + + lib.optionalString (!stdenv.targetPlatform.isWasm && !stdenv.targetPlatform.isDarwin) '' echo "--unwindlib=libunwind" >> $out/nix-support/cc-cflags echo "-L${targetLlvmLibraries.libunwind}/lib" >> $out/nix-support/cc-ldflags '' @@ -811,7 +815,7 @@ let "-B${targetLlvmLibraries.compiler-rt-no-libc}/lib" ] ++ lib.optional ( - !stdenv.targetPlatform.isWasm && !stdenv.targetPlatform.isFreeBSD + !stdenv.targetPlatform.isWasm && !stdenv.targetPlatform.isFreeBSD && !stdenv.targetPlatform.isDarwin ) "--unwindlib=libunwind" ++ lib.optional ( !stdenv.targetPlatform.isWasm @@ -820,7 +824,7 @@ let ) "-lunwind" ++ lib.optional stdenv.targetPlatform.isWasm "-fno-exceptions"; nixSupport.cc-ldflags = lib.optionals ( - !stdenv.targetPlatform.isWasm && !stdenv.targetPlatform.isFreeBSD + !stdenv.targetPlatform.isWasm && !stdenv.targetPlatform.isFreeBSD && !stdenv.targetPlatform.isDarwin ) [ "-L${targetLlvmLibraries.libunwind}/lib" ]; } ); From d3114e05d777039ae04a9c39ce798140ccb81ed9 Mon Sep 17 00:00:00 2001 From: Randy Eckenrode Date: Mon, 23 Sep 2024 22:06:54 -0400 Subject: [PATCH 035/157] 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). --- .../compilers/llvm/common/default.nix | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/pkgs/development/compilers/llvm/common/default.nix b/pkgs/development/compilers/llvm/common/default.nix index c863d0d8a82ab..35525e379f2b9 100644 --- a/pkgs/development/compilers/llvm/common/default.nix +++ b/pkgs/development/compilers/llvm/common/default.nix @@ -1012,14 +1012,11 @@ let let # temp rename to avoid infinite recursion stdenv = - if args.stdenv.hostPlatform.useLLVM or false then + # Darwin needs to use a bootstrap stdenv to avoid an infinite recursion when cross-compiling. + if args.stdenv.hostPlatform.isDarwin then + overrideCC darwin.bootstrapStdenv buildLlvmTools.clangWithLibcAndBasicRtAndLibcxx + else if args.stdenv.hostPlatform.useLLVM or false then overrideCC args.stdenv buildLlvmTools.clangWithLibcAndBasicRtAndLibcxx - else if - lib.versionAtLeast metadata.release_version "16" - && args.stdenv.hostPlatform.isDarwin - && args.stdenv.hostPlatform.isStatic - then - overrideCC args.stdenv buildLlvmTools.clangNoCompilerRtWithLibc else args.stdenv; in @@ -1038,10 +1035,10 @@ let patches = compiler-rtPatches; doFakeLibgcc = stdenv.hostPlatform.useLLVM or false; stdenv = - if stdenv.hostPlatform.isDarwin && stdenv.hostPlatform == stdenv.buildPlatform then - stdenv + # Darwin needs to use a bootstrap stdenv to avoid an infinite recursion when cross-compiling. + if stdenv.hostPlatform.isDarwin then + overrideCC darwin.bootstrapStdenv buildLlvmTools.clangNoLibcNoRt else - # TODO: make this branch unconditional next rebuild overrideCC stdenv buildLlvmTools.clangNoLibcNoRt; }; From 654e19fb8311738c9112dce9409ca37ef4d2103f Mon Sep 17 00:00:00 2001 From: Randy Eckenrode Date: Mon, 23 Sep 2024 21:19:20 -0400 Subject: [PATCH 036/157] llvmPackages.compiler-rt: always build sanitizers on Darwin MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Also enable TSAN since the SDK has xpc. There’s no reason to disable it. --- .../llvm/common/compiler-rt/default.nix | 23 ++++++++++--------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/pkgs/development/compilers/llvm/common/compiler-rt/default.nix b/pkgs/development/compilers/llvm/common/compiler-rt/default.nix index a6d727739d271..d26ce0628c634 100644 --- a/pkgs/development/compilers/llvm/common/compiler-rt/default.nix +++ b/pkgs/development/compilers/llvm/common/compiler-rt/default.nix @@ -7,6 +7,8 @@ , src ? null , monorepoSrc ? null , runCommand +, apple-sdk +, apple-sdk_10_13 , cmake , ninja , python3 @@ -46,6 +48,14 @@ let baseName = "compiler-rt"; pname = baseName + lib.optionalString (haveLibc) "-libc"; + # Sanitizers require 10.13 or newer. Instead of disabling them for most x86_64-darwin users, + # build them with a newer SDK and the default (10.12) deployment target. + apple-sdk' = + if lib.versionOlder (lib.getVersion apple-sdk) "10.13" then + apple-sdk_10_13.override { enableBootstrap = true; } + else + apple-sdk.override { enableBootstrap = true; }; + src' = if monorepoSrc != null then runCommand "${baseName}-src-${version}" {} '' mkdir -p "$out" @@ -129,29 +139,20 @@ stdenv.mkDerivation ({ "-DDARWIN_macosx_OVERRIDE_SDK_VERSION=ON" "-DDARWIN_osx_ARCHS=${stdenv.hostPlatform.darwinArch}" "-DDARWIN_osx_BUILTIN_ARCHS=${stdenv.hostPlatform.darwinArch}" + "-DSANITIZER_MIN_OSX_VERSION=${stdenv.hostPlatform.darwinMinVersion}" ] ++ lib.optionals (lib.versionAtLeast release_version "15") [ # `COMPILER_RT_DEFAULT_TARGET_ONLY` does not apply to Darwin: # https://github.com/llvm/llvm-project/blob/27ef42bec80b6c010b7b3729ed0528619521a690/compiler-rt/cmake/base-config-ix.cmake#L153 "-DCOMPILER_RT_ENABLE_IOS=OFF" - ]) ++ lib.optionals (lib.versionAtLeast version "19" && stdenv.hostPlatform.isDarwin && lib.versionOlder stdenv.hostPlatform.darwinMinVersion "10.13") [ - "-DSANITIZER_MIN_OSX_VERSION=10.10" - ] ++ lib.optionals (noSanitizers && lib.versionAtLeast release_version "19") [ + ]) ++ lib.optionals (noSanitizers && lib.versionAtLeast release_version "19") [ "-DCOMPILER_RT_BUILD_CTX_PROFILE=OFF" ] ++ devExtraCmakeFlags; outputs = [ "out" "dev" ]; - # TSAN requires XPC on Darwin, which we have no public/free source files for. We can depend on the Apple frameworks - # to get it, but they're unfree. Since LLVM is rather central to the stdenv, we patch out TSAN support so that Hydra - # can build this. If we didn't do it, basically the entire nixpkgs on Darwin would have an unfree dependency and we'd - # get no binary cache for the entire platform. If you really find yourself wanting the TSAN, make this controllable by - # a flag and turn the flag off during the stdenv build. postPatch = lib.optionalString (!stdenv.hostPlatform.isDarwin) '' substituteInPlace cmake/builtin-config-ix.cmake \ --replace 'set(X86 i386)' 'set(X86 i386 i486 i586 i686)' - '' + lib.optionalString stdenv.hostPlatform.isDarwin '' - substituteInPlace cmake/config-ix.cmake \ - --replace 'set(COMPILER_RT_HAS_TSAN TRUE)' 'set(COMPILER_RT_HAS_TSAN FALSE)' '' + lib.optionalString (!haveLibc) ((lib.optionalString (lib.versionAtLeast release_version "18") '' substituteInPlace lib/builtins/aarch64/sme-libc-routines.c \ --replace "" "" From 7647c6834a3b1390634842d8097dfa839cab0c89 Mon Sep 17 00:00:00 2001 From: Randy Eckenrode Date: Mon, 23 Sep 2024 21:19:20 -0400 Subject: [PATCH 037/157] llvmPackages.compiler-rt: avoid propagating the SDK in static builds --- .../compilers/llvm/common/compiler-rt/default.nix | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pkgs/development/compilers/llvm/common/compiler-rt/default.nix b/pkgs/development/compilers/llvm/common/compiler-rt/default.nix index d26ce0628c634..bc8a1e82c8342 100644 --- a/pkgs/development/compilers/llvm/common/compiler-rt/default.nix +++ b/pkgs/development/compilers/llvm/common/compiler-rt/default.nix @@ -81,7 +81,10 @@ stdenv.mkDerivation ({ ++ lib.optional stdenv.hostPlatform.isDarwin xcbuild.xcrun; buildInputs = lib.optional (stdenv.hostPlatform.isLinux && stdenv.hostPlatform.isRiscV) linuxHeaders - ++ lib.optional (stdenv.hostPlatform.isFreeBSD) freebsd.include; + ++ lib.optional (stdenv.hostPlatform.isFreeBSD) freebsd.include + # Adding the bootstrap SDK to `buildInputs` on static builds propagates it, breaking `xcrun`. + # This can be removed once the minimum SDK >10.12 on x86_64-darwin. + ++ lib.optionals (stdenv.hostPlatform.isDarwin && !stdenv.hostPlatform.isStatic) [ apple-sdk' ]; env.NIX_CFLAGS_COMPILE = toString ([ "-DSCUDO_DEFAULT_OPTIONS=DeleteSizeMismatch=0:DeallocationTypeMismatch=0" From 2fd9a1abeb51a0cc5a43d07151752f4e40908ff1 Mon Sep 17 00:00:00 2001 From: Randy Eckenrode Date: Mon, 23 Sep 2024 21:19:20 -0400 Subject: [PATCH 038/157] 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. --- .../compilers/llvm/common/compiler-rt/default.nix | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/pkgs/development/compilers/llvm/common/compiler-rt/default.nix b/pkgs/development/compilers/llvm/common/compiler-rt/default.nix index bc8a1e82c8342..dad5c504f08ad 100644 --- a/pkgs/development/compilers/llvm/common/compiler-rt/default.nix +++ b/pkgs/development/compilers/llvm/common/compiler-rt/default.nix @@ -12,7 +12,6 @@ , cmake , ninja , python3 -, xcbuild , libllvm , libcxx , linuxHeaders @@ -77,8 +76,7 @@ stdenv.mkDerivation ({ nativeBuildInputs = [ cmake ] ++ (lib.optional (lib.versionAtLeast release_version "15") ninja) - ++ [ python3 libllvm.dev ] - ++ lib.optional stdenv.hostPlatform.isDarwin xcbuild.xcrun; + ++ [ python3 libllvm.dev ]; buildInputs = lib.optional (stdenv.hostPlatform.isLinux && stdenv.hostPlatform.isRiscV) linuxHeaders ++ lib.optional (stdenv.hostPlatform.isFreeBSD) freebsd.include @@ -139,7 +137,8 @@ stdenv.mkDerivation ({ ] ++ lib.optionals (stdenv.hostPlatform.isDarwin) (lib.optionals (lib.versionAtLeast release_version "16") [ "-DCMAKE_LIPO=${lib.getBin stdenv.cc.bintools.bintools}/bin/${stdenv.cc.targetPrefix}lipo" ] ++ [ - "-DDARWIN_macosx_OVERRIDE_SDK_VERSION=ON" + "-DDARWIN_macosx_CACHED_SYSROOT=${apple-sdk'.sdkroot}" + "-DDARWIN_macosx_OVERRIDE_SDK_VERSION=${lib.versions.majorMinor (lib.getVersion apple-sdk)}" "-DDARWIN_osx_ARCHS=${stdenv.hostPlatform.darwinArch}" "-DDARWIN_osx_BUILTIN_ARCHS=${stdenv.hostPlatform.darwinArch}" "-DSANITIZER_MIN_OSX_VERSION=${stdenv.hostPlatform.darwinMinVersion}" From e6a4c83d20d7e8ae3866f751becb1f40ec7916b3 Mon Sep 17 00:00:00 2001 From: Randy Eckenrode Date: Mon, 23 Sep 2024 21:19:20 -0400 Subject: [PATCH 039/157] llvmPackages.compiler-rt: fix compiler-rt bootstrap on Darwin MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. --- .../compilers/llvm/common/compiler-rt/default.nix | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pkgs/development/compilers/llvm/common/compiler-rt/default.nix b/pkgs/development/compilers/llvm/common/compiler-rt/default.nix index dad5c504f08ad..8a2cec5180333 100644 --- a/pkgs/development/compilers/llvm/common/compiler-rt/default.nix +++ b/pkgs/development/compilers/llvm/common/compiler-rt/default.nix @@ -136,6 +136,11 @@ stdenv.mkDerivation ({ "-DCOMPILER_RT_OS_DIR=baremetal" ] ++ lib.optionals (stdenv.hostPlatform.isDarwin) (lib.optionals (lib.versionAtLeast release_version "16") [ "-DCMAKE_LIPO=${lib.getBin stdenv.cc.bintools.bintools}/bin/${stdenv.cc.targetPrefix}lipo" + ] ++ lib.optionals (!haveLibcxx) [ + # Darwin fails to detect that the compiler supports the `-g` flag when there is no libc++ during the + # compiler-rt bootstrap, which prevents compiler-rt from building. The `-g` flag is required by the + # Darwin support, so force it to be enabled during the first stage of the compiler-rt bootstrap. + "-DCOMPILER_RT_HAS_G_FLAG=ON" ] ++ [ "-DDARWIN_macosx_CACHED_SYSROOT=${apple-sdk'.sdkroot}" "-DDARWIN_macosx_OVERRIDE_SDK_VERSION=${lib.versions.majorMinor (lib.getVersion apple-sdk)}" From 3e5acdacdd54b1c8d9c254d6cc722cef7b01aef8 Mon Sep 17 00:00:00 2001 From: Randy Eckenrode Date: Mon, 23 Sep 2024 21:19:20 -0400 Subject: [PATCH 040/157] 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. --- .../llvm/common/compiler-rt/default.nix | 25 +++++++++++-------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/pkgs/development/compilers/llvm/common/compiler-rt/default.nix b/pkgs/development/compilers/llvm/common/compiler-rt/default.nix index 8a2cec5180333..ad8d837b77ac3 100644 --- a/pkgs/development/compilers/llvm/common/compiler-rt/default.nix +++ b/pkgs/development/compilers/llvm/common/compiler-rt/default.nix @@ -84,16 +84,21 @@ stdenv.mkDerivation ({ # This can be removed once the minimum SDK >10.12 on x86_64-darwin. ++ lib.optionals (stdenv.hostPlatform.isDarwin && !stdenv.hostPlatform.isStatic) [ apple-sdk' ]; - env.NIX_CFLAGS_COMPILE = toString ([ - "-DSCUDO_DEFAULT_OPTIONS=DeleteSizeMismatch=0:DeallocationTypeMismatch=0" - ] ++ lib.optionals (!haveLibc) [ - # The compiler got stricter about this, and there is a usellvm patch below - # which patches out the assert include causing an implicit definition of - # assert. It would be nicer to understand why compiler-rt thinks it should - # be able to #include in the first place; perhaps it's in the - # wrong, or perhaps there is a way to provide an assert.h. - "-Wno-error=implicit-function-declaration" - ]); + env = { + NIX_CFLAGS_COMPILE = toString ([ + "-DSCUDO_DEFAULT_OPTIONS=DeleteSizeMismatch=0:DeallocationTypeMismatch=0" + ] ++ lib.optionals (!haveLibc) [ + # The compiler got stricter about this, and there is a usellvm patch below + # which patches out the assert include causing an implicit definition of + # assert. It would be nicer to understand why compiler-rt thinks it should + # be able to #include in the first place; perhaps it's in the + # wrong, or perhaps there is a way to provide an assert.h. + "-Wno-error=implicit-function-declaration" + ]); + } // lib.optionalAttrs (stdenv.hostPlatform.isDarwin) { + # Work around clang’s trying to invoke unprefixed-ld on Darwin when `-target` is passed. + NIX_CFLAGS_LINK = "--ld-path=${stdenv.cc.bintools}/bin/${stdenv.cc.targetPrefix}ld"; + }; cmakeFlags = [ "-DCOMPILER_RT_DEFAULT_TARGET_ONLY=ON" From 18211adceb903a2efc9cf99e36c87718ba3846c3 Mon Sep 17 00:00:00 2001 From: Randy Eckenrode Date: Mon, 23 Sep 2024 22:06:54 -0400 Subject: [PATCH 041/157] 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++. --- pkgs/development/compilers/llvm/common/default.nix | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/pkgs/development/compilers/llvm/common/default.nix b/pkgs/development/compilers/llvm/common/default.nix index 35525e379f2b9..414313422064c 100644 --- a/pkgs/development/compilers/llvm/common/default.nix +++ b/pkgs/development/compilers/llvm/common/default.nix @@ -1120,7 +1120,11 @@ let ) # https://github.com/llvm/llvm-project/issues/64226 (metadata.getVersionFile "libcxx/0001-darwin-10.12-mbstate_t-fix.patch"); - stdenv = overrideCC stdenv buildLlvmTools.clangWithLibcAndBasicRt; + stdenv = + if stdenv.hostPlatform.isDarwin then + overrideCC darwin.bootstrapStdenv buildLlvmTools.clangWithLibcAndBasicRt + else + overrideCC stdenv buildLlvmTools.clangWithLibcAndBasicRt; } // lib.optionalAttrs (lib.versionOlder metadata.release_version "14") { # TODO: remove this, causes LLVM 13 packages rebuild. From 34ce30c35aa9c0da664b7afebddf66c71131d54a Mon Sep 17 00:00:00 2001 From: Randy Eckenrode Date: Mon, 23 Sep 2024 22:06:54 -0400 Subject: [PATCH 042/157] llvmPackages.libllvm: disable tests when built in the Darwin bootstrap MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. --- .../compilers/llvm/common/llvm/default.nix | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/pkgs/development/compilers/llvm/common/llvm/default.nix b/pkgs/development/compilers/llvm/common/llvm/default.nix index 281a21ca15242..bdaeb23827c10 100644 --- a/pkgs/development/compilers/llvm/common/llvm/default.nix +++ b/pkgs/development/compilers/llvm/common/llvm/default.nix @@ -17,6 +17,7 @@ # TODO: Can this memory corruption bug still occur? # , enableGoldPlugin ? libbfd.hasPluginAPI +, ld64 , libbfd , libpfm , libxml2 @@ -46,6 +47,11 @@ let inherit (lib) optional optionals optionalString; + # Is there a better way to do this? Darwin wants to disable tests in the first + # LLVM rebuild, but overriding doesn’t work when building libc++, libc++abi, + # and libunwind. It also wants to disable LTO in the first rebuild. + isDarwinBootstrap = lib.getName stdenv == "bootstrap-stage-xclang-stdenv-darwin"; + # Used when creating a version-suffixed symlink of libLLVM.dylib shortVersion = lib.concatStringsSep "." (lib.take 1 (lib.splitString "." release_version)); @@ -66,7 +72,7 @@ let # # So, we "manually" assemble one python derivation for the package to depend # on, taking into account whether checks are enabled or not: - python = if doCheck then + python = if doCheck && !isDarwinBootstrap then # Note that we _explicitly_ ask for a python interpreter for our host # platform here; the splicing that would ordinarily take care of this for # us does not seem to work once we use `withPackages`. @@ -91,14 +97,14 @@ let patches' = patches ++ lib.optionals enablePolly pollyPatches; in -stdenv.mkDerivation (rec { +stdenv.mkDerivation (finalAttrs: { inherit pname version; src = src'; patches = patches'; sourceRoot = if lib.versionOlder release_version "13" then null - else "${src.name}/${pname}"; + else "${finalAttrs.src.name}/${pname}"; outputs = [ "out" "lib" "dev" "python" ]; @@ -342,13 +348,13 @@ stdenv.mkDerivation (rec { ]; in flagsForLlvmConfig ++ [ "-DLLVM_INSTALL_UTILS=ON" # Needed by rustc - "-DLLVM_BUILD_TESTS=${if doCheck then "ON" else "OFF"}" + "-DLLVM_BUILD_TESTS=${if finalAttrs.finalPackage.doCheck then "ON" else "OFF"}" "-DLLVM_ENABLE_FFI=ON" "-DLLVM_HOST_TRIPLE=${stdenv.hostPlatform.config}" "-DLLVM_DEFAULT_TARGET_TRIPLE=${stdenv.hostPlatform.config}" "-DLLVM_ENABLE_DUMP=ON" (lib.cmakeBool "LLVM_ENABLE_TERMINFO" enableTerminfo) - ] ++ optionals (!doCheck) [ + ] ++ optionals (!finalAttrs.finalPackage.doCheck) [ "-DLLVM_INCLUDE_TESTS=OFF" ] ++ optionals stdenv.hostPlatform.isStatic [ # Disables building of shared libs, -fPIC is still injected by cc-wrapper @@ -428,7 +434,7 @@ stdenv.mkDerivation (rec { cp NATIVE/bin/llvm-config $dev/bin/llvm-config-native ''); - inherit doCheck; + doCheck = !isDarwinBootstrap && doCheck; checkTarget = "check-all"; From bf45402971c5773a7c07eb8000a2d84395fd4294 Mon Sep 17 00:00:00 2001 From: Randy Eckenrode Date: Sat, 7 Sep 2024 22:01:39 -0400 Subject: [PATCH 043/157] 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. --- pkgs/top-level/all-packages.nix | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index e822d46ec9e16..c081a7026bef1 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -22201,7 +22201,14 @@ with pkgs; ncurses = if stdenv.hostPlatform.useiOSPrebuilt then null - else callPackage ../development/libraries/ncurses { }; + else callPackage ../development/libraries/ncurses { + # ncurses is included in the SDK. Avoid an infinite recursion by using a bootstrap stdenv. + stdenv = + if stdenv.isDarwin then + darwin.bootstrapStdenv + else + stdenv; + }; ndi = callPackage ../development/libraries/ndi { }; From aef4614421f4d8142d627bb3dcdbb013549fc573 Mon Sep 17 00:00:00 2001 From: Randy Eckenrode Date: Wed, 2 Oct 2024 19:07:09 -0400 Subject: [PATCH 044/157] xar: add xarMinimal xarMinimal allows e2fsprogs to build fuse2fs again on Darwin. See https://github.com/NixOS/nixpkgs/pull/339412. --- pkgs/by-name/xa/xar/package.nix | 2 +- pkgs/top-level/all-packages.nix | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/pkgs/by-name/xa/xar/package.nix b/pkgs/by-name/xa/xar/package.nix index 4ad071f36a1f0..1331041c98af5 100644 --- a/pkgs/by-name/xa/xar/package.nix +++ b/pkgs/by-name/xa/xar/package.nix @@ -30,7 +30,7 @@ xar, }: stdenv.mkDerivation (finalAttrs: { - pname = "xar"; + pname = "xar${lib.optionalString (e2fsprogs == null) "-minimal"}"; version = "498"; src = fetchFromGitHub { diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index c081a7026bef1..d607957706aaf 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -13874,6 +13874,10 @@ with pkgs; zig = buildPackages.zig_0_12; }; + # A minimal xar is needed to break an infinite recursion between macfuse-stubs and xar. + # It is also needed to reduce the amount of unnecessary stuff in the Darwin bootstrap. + xarMinimal = callPackage ../by-name/xa/xar/package.nix { e2fsprogs = null; }; + xclip = callPackage ../tools/misc/xclip { }; xcur2png = callPackage ../tools/graphics/xcur2png { }; From 45e65c16d24be282fab4d7a5138fb087b5fa3bda Mon Sep 17 00:00:00 2001 From: Randy Eckenrode Date: Sun, 22 Sep 2024 18:33:28 -0400 Subject: [PATCH 045/157] xcbuild: move to pkgs/by-name --- .../tools => by-name/xc}/xcbuild/default.nix | 0 .../tools => by-name/xc}/xcbuild/includes.patch | 0 .../wrapper.nix => by-name/xc/xcbuild/package.nix} | 0 .../tools => by-name/xc}/xcbuild/platforms.nix | 0 .../tools => by-name/xc}/xcbuild/sdks.nix | 0 .../tools => by-name/xc}/xcbuild/setup-hook.sh | 0 .../tools => by-name/xc}/xcbuild/toolchains.nix | 0 pkgs/top-level/all-packages.nix | 14 +++++++++++--- 8 files changed, 11 insertions(+), 3 deletions(-) rename pkgs/{development/tools => by-name/xc}/xcbuild/default.nix (100%) rename pkgs/{development/tools => by-name/xc}/xcbuild/includes.patch (100%) rename pkgs/{development/tools/xcbuild/wrapper.nix => by-name/xc/xcbuild/package.nix} (100%) rename pkgs/{development/tools => by-name/xc}/xcbuild/platforms.nix (100%) rename pkgs/{development/tools => by-name/xc}/xcbuild/sdks.nix (100%) rename pkgs/{development/tools => by-name/xc}/xcbuild/setup-hook.sh (100%) rename pkgs/{development/tools => by-name/xc}/xcbuild/toolchains.nix (100%) diff --git a/pkgs/development/tools/xcbuild/default.nix b/pkgs/by-name/xc/xcbuild/default.nix similarity index 100% rename from pkgs/development/tools/xcbuild/default.nix rename to pkgs/by-name/xc/xcbuild/default.nix diff --git a/pkgs/development/tools/xcbuild/includes.patch b/pkgs/by-name/xc/xcbuild/includes.patch similarity index 100% rename from pkgs/development/tools/xcbuild/includes.patch rename to pkgs/by-name/xc/xcbuild/includes.patch diff --git a/pkgs/development/tools/xcbuild/wrapper.nix b/pkgs/by-name/xc/xcbuild/package.nix similarity index 100% rename from pkgs/development/tools/xcbuild/wrapper.nix rename to pkgs/by-name/xc/xcbuild/package.nix diff --git a/pkgs/development/tools/xcbuild/platforms.nix b/pkgs/by-name/xc/xcbuild/platforms.nix similarity index 100% rename from pkgs/development/tools/xcbuild/platforms.nix rename to pkgs/by-name/xc/xcbuild/platforms.nix diff --git a/pkgs/development/tools/xcbuild/sdks.nix b/pkgs/by-name/xc/xcbuild/sdks.nix similarity index 100% rename from pkgs/development/tools/xcbuild/sdks.nix rename to pkgs/by-name/xc/xcbuild/sdks.nix diff --git a/pkgs/development/tools/xcbuild/setup-hook.sh b/pkgs/by-name/xc/xcbuild/setup-hook.sh similarity index 100% rename from pkgs/development/tools/xcbuild/setup-hook.sh rename to pkgs/by-name/xc/xcbuild/setup-hook.sh diff --git a/pkgs/development/tools/xcbuild/toolchains.nix b/pkgs/by-name/xc/xcbuild/toolchains.nix similarity index 100% rename from pkgs/development/tools/xcbuild/toolchains.nix rename to pkgs/by-name/xc/xcbuild/toolchains.nix diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index d607957706aaf..4df69b1c16034 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -18701,14 +18701,22 @@ with pkgs; xcode-install = callPackage ../development/tools/xcode-install { }; - xcodebuild = callPackage ../development/tools/xcbuild/wrapper.nix { + xcbuild = callPackage ../by-name/xc/xcbuild/package.nix { inherit (darwin.apple_sdk.frameworks) CoreServices CoreGraphics ImageIO; + stdenv = + # xcbuild is included in the SDK. Avoid an infinite recursion by using a bootstrap stdenv. + if stdenv.hostPlatform.isDarwin then + darwin.bootstrapStdenv + else + stdenv; }; - xcbuild = xcodebuild; + xcbuildHook = makeSetupHook { name = "xcbuild-hook"; propagatedBuildInputs = [ xcbuild ]; - } ../development/tools/xcbuild/setup-hook.sh ; + } ../by-name/xc/xcbuild/setup-hook.sh; + + xcodebuild = xcbuild; xcpretty = callPackage ../development/tools/xcpretty { }; From f51c62a7f8bedf65e819b428b8948f861e3c4072 Mon Sep 17 00:00:00 2001 From: Randy Eckenrode Date: Thu, 3 Oct 2024 19:06:50 -0400 Subject: [PATCH 046/157] xcbuild: format with nixfmt-rfc-style --- pkgs/by-name/xc/xcbuild/package.nix | 270 +++++++++++++++------------- 1 file changed, 144 insertions(+), 126 deletions(-) diff --git a/pkgs/by-name/xc/xcbuild/package.nix b/pkgs/by-name/xc/xcbuild/package.nix index 9c8c846e5cca6..e533eda9a9e93 100644 --- a/pkgs/by-name/xc/xcbuild/package.nix +++ b/pkgs/by-name/xc/xcbuild/package.nix @@ -1,9 +1,18 @@ -{ lib, stdenv, makeWrapper, writeText, writeTextFile, runCommand, callPackage -, CoreServices, ImageIO, CoreGraphics -, xcodePlatform ? stdenv.targetPlatform.xcodePlatform or "MacOSX" -, xcodeVer ? stdenv.targetPlatform.xcodeVer or "9.4.1" -, sdkVer ? stdenv.targetPlatform.darwinSdkVersion or "10.12" -, productBuildVer ? null +{ + lib, + stdenv, + makeWrapper, + writeText, + writeTextFile, + runCommand, + callPackage, + CoreServices, + ImageIO, + CoreGraphics, + xcodePlatform ? stdenv.targetPlatform.xcodePlatform or "MacOSX", + xcodeVer ? stdenv.targetPlatform.xcodeVer or "9.4.1", + sdkVer ? stdenv.targetPlatform.darwinSdkVersion or "10.12", + productBuildVer ? null, }: let @@ -17,38 +26,45 @@ let xcodeSelectVersion = "2349"; xcbuild = callPackage ./default.nix { - inherit CoreServices ImageIO CoreGraphics stdenv; + inherit + CoreServices + ImageIO + CoreGraphics + stdenv + ; }; - toolchains = callPackage ./toolchains.nix { - inherit toolchainName stdenv; - }; + toolchains = callPackage ./toolchains.nix { inherit toolchainName stdenv; }; sdks = callPackage ./sdks.nix { - inherit toolchainName sdkName xcodePlatform sdkVer productBuildVer; + inherit + toolchainName + sdkName + xcodePlatform + sdkVer + productBuildVer + ; }; - platforms = callPackage ./platforms.nix { - inherit sdks xcodePlatform stdenv; - }; + platforms = callPackage ./platforms.nix { inherit sdks xcodePlatform stdenv; }; xcconfig = writeText "nix.xcconfig" '' SDKROOT=${sdkName} ''; xcode-select = writeText "xcode-select" '' -#!${stdenv.shell} -while [ $# -gt 0 ]; do - case "$1" in - -h | --help) ;; # noop - -s | --switch) shift;; # noop - -r | --reset) ;; # noop - -v | --version) echo xcode-select version ${xcodeSelectVersion} ;; - -p | -print-path | --print-path) echo @DEVELOPER_DIR@ ;; - --install) ;; # noop - esac - shift -done + #!${stdenv.shell} + while [ $# -gt 0 ]; do + case "$1" in + -h | --help) ;; # noop + -s | --switch) shift;; # noop + -r | --reset) ;; # noop + -v | --version) echo xcode-select version ${xcodeSelectVersion} ;; + -p | -print-path | --print-path) echo @DEVELOPER_DIR@ ;; + --install) ;; # noop + esac + shift + done ''; xcrun = writeTextFile { @@ -56,49 +72,49 @@ done executable = true; destination = "/bin/xcrun"; text = '' -#!${stdenv.shell} -args=( "$@" ) - -# If an SDK was requested, check that it matches. -for ((i = 0; i < ''${#args[@]}; i++)); do - case "''${args[i]}" in - --sdk | -sdk) - i=$((i + 1)) - if [[ "''${args[i]}" != '${xcrunSdkName}' ]]; then - echo >&2 "xcodebuild: error: SDK \"''${args[i]}\" cannot be located." - exit 1 + #!${stdenv.shell} + args=( "$@" ) + + # If an SDK was requested, check that it matches. + for ((i = 0; i < ''${#args[@]}; i++)); do + case "''${args[i]}" in + --sdk | -sdk) + i=$((i + 1)) + if [[ "''${args[i]}" != '${xcrunSdkName}' ]]; then + echo >&2 "xcodebuild: error: SDK \"''${args[i]}\" cannot be located." + exit 1 + fi + ;; + esac + done + + while [ $# -gt 0 ]; do + case "$1" in + --sdk | -sdk) shift ;; + --toolchain | -toolchain) shift ;; + --find | -find | -f) + shift + command -v $1 || exit 1 ;; + --log | -log) ;; # noop + --verbose | -verbose) ;; # noop + --no-cache | -no-cache) ;; # noop + --kill-cache | -kill-cache) ;; # noop + --show-sdk-path | -show-sdk-path) + echo ${sdks}/${sdkName}.sdk ;; + --show-sdk-platform-path | -show-sdk-platform-path) + echo ${platforms}/${xcodePlatform}.platform ;; + --show-sdk-version | -show-sdk-version) + echo ${sdkVer} ;; + --show-sdk-build-version | -show-sdk-build-version) + echo ${sdkBuildVersion} ;; + *) break ;; + esac + shift + done + + if ! [[ -z "$@" ]]; then + exec "$@" fi - ;; - esac -done - -while [ $# -gt 0 ]; do - case "$1" in - --sdk | -sdk) shift ;; - --toolchain | -toolchain) shift ;; - --find | -find | -f) - shift - command -v $1 || exit 1 ;; - --log | -log) ;; # noop - --verbose | -verbose) ;; # noop - --no-cache | -no-cache) ;; # noop - --kill-cache | -kill-cache) ;; # noop - --show-sdk-path | -show-sdk-path) - echo ${sdks}/${sdkName}.sdk ;; - --show-sdk-platform-path | -show-sdk-platform-path) - echo ${platforms}/${xcodePlatform}.platform ;; - --show-sdk-version | -show-sdk-version) - echo ${sdkVer} ;; - --show-sdk-build-version | -show-sdk-build-version) - echo ${sdkBuildVersion} ;; - *) break ;; - esac - shift -done - -if ! [[ -z "$@" ]]; then - exec "$@" -fi ''; checkPhase = '' ${stdenv.shellDryRun} "$target" @@ -107,61 +123,63 @@ fi in -runCommand "xcodebuild-${xcbuild.version}" { - nativeBuildInputs = [ makeWrapper ]; - inherit (xcbuild) meta; - - # ensure that the toolchain goes in PATH - propagatedBuildInputs = [ "${toolchains}/XcodeDefault.xctoolchain" ]; - - passthru = { - inherit xcbuild xcrun; - toolchain = "${toolchains}/XcodeDefault.xctoolchain"; - sdk = "${sdks}/${sdkName}"; - platform = "${platforms}/${xcodePlatform}.platform"; - }; - - preferLocalBuild = true; -} '' - mkdir -p $out/bin - - ln -s $out $out/usr - - mkdir -p $out/Library/Xcode - ln -s ${xcbuild}/Library/Xcode/Specifications $out/Library/Xcode/Specifications - - ln -s ${platforms} $out/Platforms - ln -s ${toolchains} $out/Toolchains - - mkdir -p $out/Applications/Xcode.app/Contents - ln -s $out $out/Applications/Xcode.app/Contents/Developer - - # The native xcodebuild command supports an invocation like "xcodebuild -version -sdk" without specifying the specific SDK, so we simulate this by - # detecting this case and simulating the output; printing the header and appending the normal output via appending the sdk version to the positional - # arguments we pass through to the wrapped xcodebuild. - makeWrapper ${xcbuild}/bin/xcodebuild $out/bin/xcodebuild \ - --add-flags "-xcconfig ${xcconfig}" \ - --add-flags "DERIVED_DATA_DIR=." \ - --set DEVELOPER_DIR "$out" \ - --set SDKROOT ${sdkName} \ - --run '[ "$#" -eq 2 ] && [ "$1" = "-version" ] && [ "$2" = "-sdk" ] && echo ${sdkName}.sdk - macOS ${sdkVer} \(macosx${sdkVer}\) && set -- "$@" "${sdkName}"' \ - --run '[ "$1" = "-version" ] && [ "$#" -eq 1 ] && (echo Xcode ${xcodeVer}; echo Build version ${sdkBuildVersion}) && exit 0' \ - --run '[ "$1" = "-license" ] && exit 0' - - substitute ${xcode-select} $out/bin/xcode-select \ - --subst-var-by DEVELOPER_DIR $out/Applications/Xcode.app/Contents/Developer - chmod +x $out/bin/xcode-select - - cp ${xcrun}/bin/xcrun $out/bin/xcrun - - for bin in PlistBuddy actool builtin-copy builtin-copyPlist \ - builtin-copyStrings builtin-copyTiff \ - builtin-embeddedBinaryValidationUtility \ - builtin-infoPlistUtility builtin-lsRegisterURL \ - builtin-productPackagingUtility builtin-validationUtility \ - lsbom plutil; do - ln -s ${xcbuild}/bin/$bin $out/bin/$bin - done - - fixupPhase -'' +runCommand "xcodebuild-${xcbuild.version}" + { + nativeBuildInputs = [ makeWrapper ]; + inherit (xcbuild) meta; + + # ensure that the toolchain goes in PATH + propagatedBuildInputs = [ "${toolchains}/XcodeDefault.xctoolchain" ]; + + passthru = { + inherit xcbuild xcrun; + toolchain = "${toolchains}/XcodeDefault.xctoolchain"; + sdk = "${sdks}/${sdkName}"; + platform = "${platforms}/${xcodePlatform}.platform"; + }; + + preferLocalBuild = true; + } + '' + mkdir -p $out/bin + + ln -s $out $out/usr + + mkdir -p $out/Library/Xcode + ln -s ${xcbuild}/Library/Xcode/Specifications $out/Library/Xcode/Specifications + + ln -s ${platforms} $out/Platforms + ln -s ${toolchains} $out/Toolchains + + mkdir -p $out/Applications/Xcode.app/Contents + ln -s $out $out/Applications/Xcode.app/Contents/Developer + + # The native xcodebuild command supports an invocation like "xcodebuild -version -sdk" without specifying the specific SDK, so we simulate this by + # detecting this case and simulating the output; printing the header and appending the normal output via appending the sdk version to the positional + # arguments we pass through to the wrapped xcodebuild. + makeWrapper ${xcbuild}/bin/xcodebuild $out/bin/xcodebuild \ + --add-flags "-xcconfig ${xcconfig}" \ + --add-flags "DERIVED_DATA_DIR=." \ + --set DEVELOPER_DIR "$out" \ + --set SDKROOT ${sdkName} \ + --run '[ "$#" -eq 2 ] && [ "$1" = "-version" ] && [ "$2" = "-sdk" ] && echo ${sdkName}.sdk - macOS ${sdkVer} \(macosx${sdkVer}\) && set -- "$@" "${sdkName}"' \ + --run '[ "$1" = "-version" ] && [ "$#" -eq 1 ] && (echo Xcode ${xcodeVer}; echo Build version ${sdkBuildVersion}) && exit 0' \ + --run '[ "$1" = "-license" ] && exit 0' + + substitute ${xcode-select} $out/bin/xcode-select \ + --subst-var-by DEVELOPER_DIR $out/Applications/Xcode.app/Contents/Developer + chmod +x $out/bin/xcode-select + + cp ${xcrun}/bin/xcrun $out/bin/xcrun + + for bin in PlistBuddy actool builtin-copy builtin-copyPlist \ + builtin-copyStrings builtin-copyTiff \ + builtin-embeddedBinaryValidationUtility \ + builtin-infoPlistUtility builtin-lsRegisterURL \ + builtin-productPackagingUtility builtin-validationUtility \ + lsbom plutil; do + ln -s ${xcbuild}/bin/$bin $out/bin/$bin + done + + fixupPhase + '' From 15ac6579425fe3bf65604d806c9d5711db3c85d5 Mon Sep 17 00:00:00 2001 From: Randy Eckenrode Date: Sun, 22 Sep 2024 18:44:26 -0400 Subject: [PATCH 047/157] 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. --- pkgs/by-name/xc/xcbuild/default.nix | 80 ----- pkgs/by-name/xc/xcbuild/package.nix | 282 +++++++--------- .../xc/xcbuild/{ => patches}/includes.patch | 0 pkgs/by-name/xc/xcbuild/platforms.nix | 301 ------------------ pkgs/by-name/xc/xcbuild/sdks.nix | 32 -- pkgs/by-name/xc/xcbuild/toolchains.nix | 73 ----- pkgs/top-level/all-packages.nix | 1 - 7 files changed, 114 insertions(+), 655 deletions(-) delete mode 100644 pkgs/by-name/xc/xcbuild/default.nix rename pkgs/by-name/xc/xcbuild/{ => patches}/includes.patch (100%) delete mode 100644 pkgs/by-name/xc/xcbuild/platforms.nix delete mode 100644 pkgs/by-name/xc/xcbuild/sdks.nix delete mode 100644 pkgs/by-name/xc/xcbuild/toolchains.nix diff --git a/pkgs/by-name/xc/xcbuild/default.nix b/pkgs/by-name/xc/xcbuild/default.nix deleted file mode 100644 index e30700ca20258..0000000000000 --- a/pkgs/by-name/xc/xcbuild/default.nix +++ /dev/null @@ -1,80 +0,0 @@ -{ lib, stdenv, cmake, fetchFromGitHub, zlib, libxml2, libpng -, CoreServices, CoreGraphics, ImageIO, ninja }: - -let - googletest = fetchFromGitHub { - owner = "google"; - repo = "googletest"; - rev = "43359642a1c16ad3f4fc575c7edd0cb935810815"; - sha256 = "0y4xaah62fjr3isaryc3vfz3mn9xflr00vchdimj8785milxga4q"; - }; - - linenoise = fetchFromGitHub { - owner = "antirez"; - repo = "linenoise"; - rev = "c894b9e59f02203dbe4e2be657572cf88c4230c3"; - sha256 = "0wasql7ph5g473zxhc2z47z3pjp42q0dsn4gpijwzbxawid71b4w"; - }; -in stdenv.mkDerivation { - pname = "xcbuild"; - - # Once a version is released that includes - # https://github.com/facebook/xcbuild/commit/183c087a6484ceaae860c6f7300caf50aea0d710, - # we can stop doing this -pre thing. - version = "0.1.2-pre"; - - src = fetchFromGitHub { - owner = "facebook"; - repo = "xcbuild"; - rev = "32b9fbeb69bfa2682bd0351ec2f14548aaedd554"; - sha256 = "1xxwg2849jizxv0g1hy0b1m3i7iivp9bmc4f5pi76swsn423d41m"; - }; - - patches = [ ./includes.patch ]; - - prePatch = '' - rmdir ThirdParty/* - cp -r --no-preserve=all ${googletest} ThirdParty/googletest - cp -r --no-preserve=all ${linenoise} ThirdParty/linenoise - ''; - - postPatch = lib.optionalString (!stdenv.hostPlatform.isDarwin) '' - # Fix build on gcc-13 due to missing includes - sed -e '1i #include ' -i \ - Libraries/libutil/Headers/libutil/Permissions.h \ - Libraries/pbxbuild/Headers/pbxbuild/Tool/AuxiliaryFile.h \ - Libraries/pbxbuild/Headers/pbxbuild/Tool/Invocation.h - - # Avoid a glibc >= 2.25 deprecation warning that gets fatal via -Werror. - sed 1i'#include ' \ - -i Libraries/xcassets/Headers/xcassets/Slot/SystemVersion.h - '' + lib.optionalString stdenv.hostPlatform.isDarwin '' - # Apple Open Sourced LZFSE, but not libcompression, and it isn't - # part of an impure framework we can add - substituteInPlace Libraries/libcar/Sources/Rendition.cpp \ - --replace "#if HAVE_LIBCOMPRESSION" "#if 0" - ''; - - # TODO: instruct cmake not to put it in /usr, rather than cleaning up - postInstall = '' - mv $out/usr/* $out - rmdir $out/usr - cp liblinenoise.* $out/lib/ - ''; - - env.NIX_CFLAGS_COMPILE = "-Wno-error"; - - cmakeFlags = [ "-GNinja" ]; - - nativeBuildInputs = [ cmake ninja ]; - buildInputs = [ zlib libxml2 libpng ] - ++ lib.optionals stdenv.hostPlatform.isDarwin [ CoreServices CoreGraphics ImageIO ]; - - meta = with lib; { - description = "Xcode-compatible build tool"; - homepage = "https://github.com/facebook/xcbuild"; - platforms = platforms.unix; - maintainers = with maintainers; [ copumpkin matthewbauer ]; - license = with licenses; [ bsd2 bsd3 ]; - }; -} diff --git a/pkgs/by-name/xc/xcbuild/package.nix b/pkgs/by-name/xc/xcbuild/package.nix index e533eda9a9e93..8fc3d74286f55 100644 --- a/pkgs/by-name/xc/xcbuild/package.nix +++ b/pkgs/by-name/xc/xcbuild/package.nix @@ -1,185 +1,131 @@ { lib, + cmake, + darwin, + fetchFromGitHub, + libpng, + libxml2, + makeBinaryWrapper, + ninja, stdenv, - makeWrapper, - writeText, - writeTextFile, - runCommand, - callPackage, - CoreServices, - ImageIO, - CoreGraphics, - xcodePlatform ? stdenv.targetPlatform.xcodePlatform or "MacOSX", - xcodeVer ? stdenv.targetPlatform.xcodeVer or "9.4.1", - sdkVer ? stdenv.targetPlatform.darwinSdkVersion or "10.12", - productBuildVer ? null, + zlib, + + # These arguments are obsolete but required to avoid evaluation errors for now + CoreGraphics ? null, + CoreServices ? null, + ImageIO ? null, }: let - - toolchainName = "com.apple.dt.toolchain.XcodeDefault"; - sdkName = "${xcodePlatform}${sdkVer}"; - xcrunSdkName = lib.toLower xcodePlatform; - - # TODO: expose MACOSX_DEPLOYMENT_TARGET in nix so we can use it here. - sdkBuildVersion = "17E189"; - xcodeSelectVersion = "2349"; - - xcbuild = callPackage ./default.nix { - inherit - CoreServices - ImageIO - CoreGraphics - stdenv - ; + googletest = fetchFromGitHub { + owner = "google"; + repo = "googletest"; + rev = "43359642a1c16ad3f4fc575c7edd0cb935810815"; + sha256 = "sha256-mKjXaawFHSRrbJBtADJ1Pdk6vtuD+ax0HFk6YaBSnXg="; }; - toolchains = callPackage ./toolchains.nix { inherit toolchainName stdenv; }; - - sdks = callPackage ./sdks.nix { - inherit - toolchainName - sdkName - xcodePlatform - sdkVer - productBuildVer - ; + linenoise = fetchFromGitHub { + owner = "antirez"; + repo = "linenoise"; + rev = "c894b9e59f02203dbe4e2be657572cf88c4230c3"; + sha256 = "sha256-nKxwWuSqr89lvI9Y3QAW5Mo7/iFfMNj/OOQVeA/FWnE="; + }; +in +stdenv.mkDerivation (finalAttrs: { + pname = "xcbuild"; + + outputs = [ + "out" + "xcrun" + ]; + + # Once a version is released that includes + # https://github.com/facebook/xcbuild/commit/183c087a6484ceaae860c6f7300caf50aea0d710, + # we can stop doing this -pre thing. + version = "0.1.2-pre"; + + src = fetchFromGitHub { + owner = "facebook"; + repo = "xcbuild"; + rev = "32b9fbeb69bfa2682bd0351ec2f14548aaedd554"; + sha256 = "1xxwg2849jizxv0g1hy0b1m3i7iivp9bmc4f5pi76swsn423d41m"; }; - platforms = callPackage ./platforms.nix { inherit sdks xcodePlatform stdenv; }; + patches = [ + # Add missing header for `abort` + ./patches/includes.patch + ]; - xcconfig = writeText "nix.xcconfig" '' - SDKROOT=${sdkName} + prePatch = '' + rmdir ThirdParty/* + cp -r --no-preserve=all ${googletest} ThirdParty/googletest + cp -r --no-preserve=all ${linenoise} ThirdParty/linenoise ''; - xcode-select = writeText "xcode-select" '' - #!${stdenv.shell} - while [ $# -gt 0 ]; do - case "$1" in - -h | --help) ;; # noop - -s | --switch) shift;; # noop - -r | --reset) ;; # noop - -v | --version) echo xcode-select version ${xcodeSelectVersion} ;; - -p | -print-path | --print-path) echo @DEVELOPER_DIR@ ;; - --install) ;; # noop - esac - shift - done + postPatch = + lib.optionalString (!stdenv.hostPlatform.isDarwin) '' + # Fix build on gcc-13 due to missing includes + sed -e '1i #include ' -i \ + Libraries/libutil/Headers/libutil/Permissions.h \ + Libraries/pbxbuild/Headers/pbxbuild/Tool/AuxiliaryFile.h \ + Libraries/pbxbuild/Headers/pbxbuild/Tool/Invocation.h + + # Avoid a glibc >= 2.25 deprecation warning that gets fatal via -Werror. + sed 1i'#include ' \ + -i Libraries/xcassets/Headers/xcassets/Slot/SystemVersion.h + '' + + lib.optionalString stdenv.hostPlatform.isDarwin '' + # Apple Open Sourced LZFSE, but not libcompression, and it isn't + # part of an impure framework we can add + substituteInPlace Libraries/libcar/Sources/Rendition.cpp \ + --replace "#if HAVE_LIBCOMPRESSION" "#if 0" + ''; + + strictDeps = true; + + env.NIX_CFLAGS_COMPILE = "-Wno-error"; + + nativeBuildInputs = [ + cmake + makeBinaryWrapper + ninja + ]; + + buildInputs = [ + libpng + libxml2 + zlib + ]; + + # TODO: instruct cmake not to put it in /usr, rather than cleaning up + postInstall = '' + mv $out/usr/* $out + rmdir $out/usr + cp liblinenoise.* $out/lib/ + + mkdir -p "$xcrun/bin" + ln -s "$out/bin/xcrun" "$xcrun/bin/xcrun" + + # xcbuild and xcrun support absolute paths, but they can’t find the SDK with the way it’s set up in + # the store. Fortunately, the combination of `DEVELOPER_DIR` and a plain `SDKROOT` is enough. + wrapProgram "$out/bin/xcbuild" --set SDKROOT macosx + wrapProgram "$out/bin/xcrun" --set SDKROOT macosx ''; - xcrun = writeTextFile { - name = "xcrun"; - executable = true; - destination = "/bin/xcrun"; - text = '' - #!${stdenv.shell} - args=( "$@" ) - - # If an SDK was requested, check that it matches. - for ((i = 0; i < ''${#args[@]}; i++)); do - case "''${args[i]}" in - --sdk | -sdk) - i=$((i + 1)) - if [[ "''${args[i]}" != '${xcrunSdkName}' ]]; then - echo >&2 "xcodebuild: error: SDK \"''${args[i]}\" cannot be located." - exit 1 - fi - ;; - esac - done - - while [ $# -gt 0 ]; do - case "$1" in - --sdk | -sdk) shift ;; - --toolchain | -toolchain) shift ;; - --find | -find | -f) - shift - command -v $1 || exit 1 ;; - --log | -log) ;; # noop - --verbose | -verbose) ;; # noop - --no-cache | -no-cache) ;; # noop - --kill-cache | -kill-cache) ;; # noop - --show-sdk-path | -show-sdk-path) - echo ${sdks}/${sdkName}.sdk ;; - --show-sdk-platform-path | -show-sdk-platform-path) - echo ${platforms}/${xcodePlatform}.platform ;; - --show-sdk-version | -show-sdk-version) - echo ${sdkVer} ;; - --show-sdk-build-version | -show-sdk-build-version) - echo ${sdkBuildVersion} ;; - *) break ;; - esac - shift - done - - if ! [[ -z "$@" ]]; then - exec "$@" - fi - ''; - checkPhase = '' - ${stdenv.shellDryRun} "$target" - ''; - }; + __structuredAttrs = true; -in + passthru = { + xcbuild = lib.warn "xcbuild.xcbuild is deprecated and will be removed; use xcbuild instead." finalAttrs.finalPackage; + }; -runCommand "xcodebuild-${xcbuild.version}" - { - nativeBuildInputs = [ makeWrapper ]; - inherit (xcbuild) meta; - - # ensure that the toolchain goes in PATH - propagatedBuildInputs = [ "${toolchains}/XcodeDefault.xctoolchain" ]; - - passthru = { - inherit xcbuild xcrun; - toolchain = "${toolchains}/XcodeDefault.xctoolchain"; - sdk = "${sdks}/${sdkName}"; - platform = "${platforms}/${xcodePlatform}.platform"; - }; - - preferLocalBuild = true; - } - '' - mkdir -p $out/bin - - ln -s $out $out/usr - - mkdir -p $out/Library/Xcode - ln -s ${xcbuild}/Library/Xcode/Specifications $out/Library/Xcode/Specifications - - ln -s ${platforms} $out/Platforms - ln -s ${toolchains} $out/Toolchains - - mkdir -p $out/Applications/Xcode.app/Contents - ln -s $out $out/Applications/Xcode.app/Contents/Developer - - # The native xcodebuild command supports an invocation like "xcodebuild -version -sdk" without specifying the specific SDK, so we simulate this by - # detecting this case and simulating the output; printing the header and appending the normal output via appending the sdk version to the positional - # arguments we pass through to the wrapped xcodebuild. - makeWrapper ${xcbuild}/bin/xcodebuild $out/bin/xcodebuild \ - --add-flags "-xcconfig ${xcconfig}" \ - --add-flags "DERIVED_DATA_DIR=." \ - --set DEVELOPER_DIR "$out" \ - --set SDKROOT ${sdkName} \ - --run '[ "$#" -eq 2 ] && [ "$1" = "-version" ] && [ "$2" = "-sdk" ] && echo ${sdkName}.sdk - macOS ${sdkVer} \(macosx${sdkVer}\) && set -- "$@" "${sdkName}"' \ - --run '[ "$1" = "-version" ] && [ "$#" -eq 1 ] && (echo Xcode ${xcodeVer}; echo Build version ${sdkBuildVersion}) && exit 0' \ - --run '[ "$1" = "-license" ] && exit 0' - - substitute ${xcode-select} $out/bin/xcode-select \ - --subst-var-by DEVELOPER_DIR $out/Applications/Xcode.app/Contents/Developer - chmod +x $out/bin/xcode-select - - cp ${xcrun}/bin/xcrun $out/bin/xcrun - - for bin in PlistBuddy actool builtin-copy builtin-copyPlist \ - builtin-copyStrings builtin-copyTiff \ - builtin-embeddedBinaryValidationUtility \ - builtin-infoPlistUtility builtin-lsRegisterURL \ - builtin-productPackagingUtility builtin-validationUtility \ - lsbom plutil; do - ln -s ${xcbuild}/bin/$bin $out/bin/$bin - done - - fixupPhase - '' + meta = { + description = "Xcode-compatible build tool"; + homepage = "https://github.com/facebook/xcbuild"; + license = with lib.licenses; [ + bsd2 + bsd3 + ]; + maintainers = lib.teams.darwin.members; + platforms = lib.platforms.unix; + }; +}) diff --git a/pkgs/by-name/xc/xcbuild/includes.patch b/pkgs/by-name/xc/xcbuild/patches/includes.patch similarity index 100% rename from pkgs/by-name/xc/xcbuild/includes.patch rename to pkgs/by-name/xc/xcbuild/patches/includes.patch diff --git a/pkgs/by-name/xc/xcbuild/platforms.nix b/pkgs/by-name/xc/xcbuild/platforms.nix deleted file mode 100644 index 333e5471b976f..0000000000000 --- a/pkgs/by-name/xc/xcbuild/platforms.nix +++ /dev/null @@ -1,301 +0,0 @@ -{ stdenv, runCommand, lib, sdks, xcodePlatform, writeText }: - -let - - inherit (lib.generators) toPlist; - - Info = { - CFBundleIdentifier = "com.apple.platform.${lib.toLower xcodePlatform}"; - Type = "Platform"; - Name = lib.toLower xcodePlatform; - }; - - Version = { - ProjectName = "OSXPlatformSupport"; - }; - - # These files are all based off of Xcode spec fies found in - # /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/Library/Xcode/PrivatePlugIns/IDEOSXSupportCore.ideplugin/Contents/Resources. - - # Based off of the "MacOSX Architectures.xcspec" file. All i386 stuff - # is removed because NixPkgs only supports darwin-x86_64 and darwin-arm64. - Architectures = [ - { - Identifier = "Standard"; - Type = "Architecture"; - Name = "Standard Architectures (Apple Silicon, 64-bit Intel)"; - RealArchitectures = [ "arm64" "x86_64" ]; - ArchitectureSetting = "ARCHS_STANDARD"; - } - { - Identifier = "Universal"; - Type = "Architecture"; - Name = "Universal (Apple Silicon, 64-bit Intel)"; - RealArchitectures = [ "arm64" "x86_64" ]; - ArchitectureSetting = "ARCHS_STANDARD_32_64_BIT"; - } - { - Identifier = "Native"; - Type = "Architecture"; - Name = "Native Architecture of Build Machine"; - ArchitectureSetting = "NATIVE_ARCH_ACTUAL"; - } - { - Identifier = "Standard64bit"; - Type = "Architecture"; - Name = "Apple Silicon, 64-bit Intel"; - RealArchitectures = [ "arm64" "x86_64" ]; - ArchitectureSetting = "ARCHS_STANDARD_64_BIT"; - } - { - Identifier = if stdenv.hostPlatform.isAarch64 then "arm64" else "x86_64"; - Type = "Architecture"; - Name = "Apple Silicon or Intel 64-bit"; - } - { - Identifier = "Standard_Including_64_bit"; - Type = "Architecture"; - Name = "Standard Architectures (including 64-bit)"; - RealArchitectures = [ "arm64" "x86_64" ]; - ArchitectureSetting = "ARCHS_STANDARD_INCLUDING_64_BIT"; - } - ]; - - # Based off of the "MacOSX Package Types.xcspec" file. Only keep the - # bare minimum needed. - PackageTypes = [ - { - Identifier = "com.apple.package-type.mach-o-executable"; - Type = "PackageType"; - Name = "Mach-O Executable"; - DefaultBuildSettings = { - EXECUTABLE_NAME = "$(EXECUTABLE_PREFIX)$(PRODUCT_NAME)$(EXECUTABLE_VARIANT_SUFFIX)$(EXECUTABLE_SUFFIX)"; - EXECUTABLE_PATH = "$(EXECUTABLE_NAME)"; - }; - ProductReference = { - FileType = "compiled.mach-o.executable"; - Name = "$(EXECUTABLE_NAME)"; - }; - } - { - Identifier = "com.apple.package-type.mach-o-objfile"; - Type = "PackageType"; - Name = "Mach-O Object File"; - DefaultBuildSettings = { - EXECUTABLE_NAME = "$(EXECUTABLE_PREFIX)$(PRODUCT_NAME)$(EXECUTABLE_VARIANT_SUFFIX)$(EXECUTABLE_SUFFIX)"; - EXECUTABLE_PATH = "$(EXECUTABLE_NAME)"; - }; - ProductReference = { - FileType = "compiled.mach-o.objfile"; - Name = "$(EXECUTABLE_NAME)"; - }; - } - { - Identifier = "com.apple.package-type.mach-o-dylib"; - Type = "PackageType"; - Name = "Mach-O Dynamic Library"; - DefaultBuildSettings = { - EXECUTABLE_NAME = "$(EXECUTABLE_PREFIX)$(PRODUCT_NAME)$(EXECUTABLE_VARIANT_SUFFIX)$(EXECUTABLE_SUFFIX)"; - EXECUTABLE_PATH = "$(EXECUTABLE_NAME)"; - }; - ProductReference = { - FileType = "compiled.mach-o.dylib"; - Name = "$(EXECUTABLE_NAME)"; - }; - } - { - Identifier = "com.apple.package-type.static-library"; - Type = "PackageType"; - Name = "Mach-O Static Library"; - DefaultBuildSettings = { - EXECUTABLE_PREFIX = "lib"; - EXECUTABLE_SUFFIX = ".a"; - EXECUTABLE_NAME = "$(EXECUTABLE_PREFIX)$(PRODUCT_NAME)$(EXECUTABLE_VARIANT_SUFFIX)$(EXECUTABLE_SUFFIX)"; - EXECUTABLE_PATH = "$(EXECUTABLE_NAME)"; - }; - ProductReference = { - FileType = "archive.ar"; - Name = "$(EXECUTABLE_NAME)"; - IsLaunchable = "NO"; - }; - } - { - Identifier = "com.apple.package-type.wrapper"; - Type = "PackageType"; - Name = "Wrapper"; - DefaultBuildSettings = { - WRAPPER_SUFFIX = ".bundle"; - WRAPPER_NAME = "$(WRAPPER_PREFIX)$(PRODUCT_NAME)$(WRAPPER_SUFFIX)"; - CONTENTS_FOLDER_PATH = "$(WRAPPER_NAME)/Contents"; - EXECUTABLE_NAME = "$(EXECUTABLE_PREFIX)$(PRODUCT_NAME)$(EXECUTABLE_VARIANT_SUFFIX)$(EXECUTABLE_SUFFIX)"; - EXECUTABLE_FOLDER_PATH = "$(CONTENTS_FOLDER_PATH)/MacOS"; - EXECUTABLE_PATH = "$(EXECUTABLE_FOLDER_PATH)/$(EXECUTABLE_NAME)"; - INFOPLIST_PATH = "$(CONTENTS_FOLDER_PATH)/Info.plist"; - INFOSTRINGS_PATH = "$(LOCALIZED_RESOURCES_FOLDER_PATH)/InfoPlist.strings"; - PKGINFO_PATH = "$(CONTENTS_FOLDER_PATH)/PkgInfo"; - PBDEVELOPMENTPLIST_PATH = "$(CONTENTS_FOLDER_PATH)/pbdevelopment.plist"; - VERSIONPLIST_PATH = "$(CONTENTS_FOLDER_PATH)/version.plist"; - PUBLIC_HEADERS_FOLDER_PATH = "$(CONTENTS_FOLDER_PATH)/Headers"; - PRIVATE_HEADERS_FOLDER_PATH = "$(CONTENTS_FOLDER_PATH)/PrivateHeaders"; - EXECUTABLES_FOLDER_PATH = "$(CONTENTS_FOLDER_PATH)/Executables"; - FRAMEWORKS_FOLDER_PATH = "$(CONTENTS_FOLDER_PATH)/Frameworks"; - SHARED_FRAMEWORKS_FOLDER_PATH = "$(CONTENTS_FOLDER_PATH)/SharedFrameworks"; - SHARED_SUPPORT_FOLDER_PATH = "$(CONTENTS_FOLDER_PATH)/SharedSupport"; - UNLOCALIZED_RESOURCES_FOLDER_PATH = "$(CONTENTS_FOLDER_PATH)/Resources"; - LOCALIZED_RESOURCES_FOLDER_PATH = "$(UNLOCALIZED_RESOURCES_FOLDER_PATH)/$(DEVELOPMENT_LANGUAGE).lproj"; - DOCUMENTATION_FOLDER_PATH = "$(LOCALIZED_RESOURCES_FOLDER_PATH)/Documentation"; - PLUGINS_FOLDER_PATH = "$(CONTENTS_FOLDER_PATH)/PlugIns"; - SCRIPTS_FOLDER_PATH = "$(UNLOCALIZED_RESOURCES_FOLDER_PATH)/Scripts"; - }; - ProductReference = { - FileType = "wrapper.cfbundle"; - Name = "$(WRAPPER_NAME)"; - IsLaunchable = "NO"; - }; - } - { - Identifier = "com.apple.package-type.wrapper.application"; - Type = "PackageType"; - BasedOn = "com.apple.package-type.wrapper"; - Name = "Application Wrapper"; - DefaultBuildSettings = { - GENERATE_PKGINFO_FILE = "YES"; - }; - ProductReference = { - FileType = "wrapper.application"; - Name = "$(WRAPPER_NAME)"; - IsLaunchable = "YES"; - }; - } - ]; - - # Based off of the "MacOSX Product Types.xcspec" file. All - # bundles/wrapper are removed, because we prefer dynamic products in - # NixPkgs. - ProductTypes = [ - { - Identifier = "com.apple.product-type.tool"; - Type = "ProductType"; - Name = "Command-line Tool"; - PackageTypes = [ "com.apple.package-type.mach-o-executable" ]; - } - { - Identifier = "com.apple.product-type.objfile"; - Type = "ProductType"; - Name = "Object File"; - PackageTypes = [ "com.apple.package-type.mach-o-objfile" ]; - } - { - Identifier = "com.apple.product-type.library.dynamic"; - Type = "ProductType"; - Name = "Dynamic Library"; - PackageTypes = [ "com.apple.package-type.mach-o-dylib" ]; - DefaultBuildProperties = { - FULL_PRODUCT_NAME = "$(EXECUTABLE_NAME)"; - MACH_O_TYPE = "mh_dylib"; - REZ_EXECUTABLE = "YES"; - EXECUTABLE_SUFFIX = ".$(EXECUTABLE_EXTENSION)"; - EXECUTABLE_EXTENSION = "dylib"; - DYLIB_COMPATIBILITY_VERSION = "1"; - DYLIB_CURRENT_VERSION = "1"; - FRAMEWORK_FLAG_PREFIX = "-framework"; - LIBRARY_FLAG_PREFIX = "-l"; - LIBRARY_FLAG_NOSPACE = "YES"; - STRIP_STYLE = "debugging"; - GCC_INLINES_ARE_PRIVATE_EXTERN = "YES"; - CODE_SIGNING_ALLOWED = "YES"; - CODE_SIGNING_REQUIRED = "NO"; - }; - } - { - Identifier = "com.apple.product-type.library.static"; - Type = "ProductType"; - Name = "Static Library"; - PackageTypes = [ "com.apple.package-type.static-library" ]; - DefaultBuildProperties = { - FULL_PRODUCT_NAME = "$(EXECUTABLE_NAME)"; - MACH_O_TYPE = "staticlib"; - REZ_EXECUTABLE = "YES"; - EXECUTABLE_PREFIX = "lib"; - EXECUTABLE_SUFFIX = ".$(EXECUTABLE_EXTENSION)"; - EXECUTABLE_EXTENSION = "a"; - FRAMEWORK_FLAG_PREFIX = "-framework"; - LIBRARY_FLAG_PREFIX = "-l"; - LIBRARY_FLAG_NOSPACE = "YES"; - STRIP_STYLE = "debugging"; - SEPARATE_STRIP = "YES"; - CLANG_ENABLE_MODULE_DEBUGGING = "NO"; - }; - } - { - Type = "ProductType"; - Identifier = "com.apple.product-type.bundle"; - Name = "Bundle"; - DefaultBuildProperties = { - FULL_PRODUCT_NAME = "$(WRAPPER_NAME)"; - MACH_O_TYPE = "mh_bundle"; - WRAPPER_PREFIX = ""; - WRAPPER_SUFFIX = ".$(WRAPPER_EXTENSION)"; - WRAPPER_EXTENSION = "bundle"; - WRAPPER_NAME = "$(WRAPPER_PREFIX)$(PRODUCT_NAME)$(WRAPPER_SUFFIX)"; - FRAMEWORK_FLAG_PREFIX = "-framework"; - LIBRARY_FLAG_PREFIX = "-l"; - LIBRARY_FLAG_NOSPACE = "YES"; - STRIP_STYLE = "non-global"; - }; - PackageTypes = [ "com.apple.package-type.wrapper" ]; - IsWrapper = "YES"; - HasInfoPlist = "YES"; - HasInfoPlistStrings = "YES"; - } - { - Identifier = "com.apple.product-type.application"; - Type = "ProductType"; - BasedOn = "com.apple.product-type.bundle"; - Name = "Application"; - DefaultBuildProperties = { - MACH_O_TYPE = "mh_execute"; - WRAPPER_SUFFIX = ".$(WRAPPER_EXTENSION)"; - WRAPPER_EXTENSION = "app"; - }; - PackageTypes = [ "com.apple.package-type.wrapper.application" ]; - } - { - Type = "ProductType"; - Identifier = "com.apple.product-type.framework"; - Name = "Bundle"; - DefaultBuildProperties = { - FULL_PRODUCT_NAME = "$(WRAPPER_NAME)"; - MACH_O_TYPE = "mh_bundle"; - WRAPPER_PREFIX = ""; - WRAPPER_SUFFIX = ".$(WRAPPER_EXTENSION)"; - WRAPPER_EXTENSION = "bundle"; - WRAPPER_NAME = "$(WRAPPER_PREFIX)$(PRODUCT_NAME)$(WRAPPER_SUFFIX)"; - FRAMEWORK_FLAG_PREFIX = "-framework"; - LIBRARY_FLAG_PREFIX = "-l"; - LIBRARY_FLAG_NOSPACE = "YES"; - STRIP_STYLE = "non-global"; - }; - PackageTypes = [ "com.apple.package-type.wrapper" ]; - IsWrapper = "YES"; - HasInfoPlist = "YES"; - HasInfoPlistStrings = "YES"; - } - ]; - -in - -runCommand "Platforms" {} '' - platform=$out/${xcodePlatform}.platform - - install -D ${writeText "Info.plist" (toPlist {} Info)} $platform/Info.plist - install -D ${writeText "version.plist" (toPlist {} Version)} $platform/version.plist - install -D ${writeText "Architectures.xcspec" (toPlist {} Architectures)} $platform/Developer/Library/Xcode/Specifications/Architectures.xcspec - install -D ${writeText "PackageTypes.xcspec" (toPlist {} PackageTypes)} $platform/Developer/Library/Xcode/Specifications/PackageTypes.xcspec - install -D ${writeText "ProductTypes.xcspec" (toPlist {} ProductTypes)} $platform/Developer/Library/Xcode/Specifications/ProductTypes.xcspec - - ln -s $platform $platform/usr - - mkdir -p $platform/Developer - ln -s ${sdks} $platform/Developer/SDKs -'' diff --git a/pkgs/by-name/xc/xcbuild/sdks.nix b/pkgs/by-name/xc/xcbuild/sdks.nix deleted file mode 100644 index bf16bf132d774..0000000000000 --- a/pkgs/by-name/xc/xcbuild/sdks.nix +++ /dev/null @@ -1,32 +0,0 @@ -{ runCommand, lib, toolchainName, sdkName -, writeText, xcodePlatform, sdkVer, productBuildVer }: - -let - inherit (lib.generators) toPlist toJSON; - - SDKSettings = { - CanonicalName = sdkName; - DisplayName = sdkName; - Toolchains = [ toolchainName ]; - Version = sdkVer; - MaximumDeploymentTarget = sdkVer; - isBaseSDK = "YES"; - }; - - SystemVersion = lib.optionalAttrs (productBuildVer != null) { - ProductBuildVersion = productBuildVer; - } // { - ProductName = "Mac OS X"; - ProductVersion = sdkVer; - }; -in - -runCommand "SDKs" {} '' - sdk=$out/${sdkName}.sdk - install -D ${writeText "SDKSettings.plist" (toPlist {} SDKSettings)} $sdk/SDKSettings.plist - install -D ${writeText "SDKSettings.json" (toJSON {} SDKSettings)} $sdk/SDKSettings.json - install -D ${writeText "SystemVersion.plist" (toPlist {} SystemVersion)} $sdk/System/Library/CoreServices/SystemVersion.plist - ln -s $sdk $sdk/usr - - ln -s $sdk $out/${xcodePlatform}.sdk -'' diff --git a/pkgs/by-name/xc/xcbuild/toolchains.nix b/pkgs/by-name/xc/xcbuild/toolchains.nix deleted file mode 100644 index 2da12ba7cbcbe..0000000000000 --- a/pkgs/by-name/xc/xcbuild/toolchains.nix +++ /dev/null @@ -1,73 +0,0 @@ -{ runCommand, toolchainName, fetchurl, stdenv -, buildPackages, lib, writeText }: - -let - - inherit (lib) getBin optionalString; - inherit (lib.generators) toPlist; - - ToolchainInfo = { - Identifier = toolchainName; - }; - - # We could pull this out of developer_cmds but it adds an annoying - # loop if we want to bootstrap and this is just a tiny script so I'm - # not going to bother. - mkdep-darwin-src = fetchurl { - url = "https://opensource.apple.com/source/developer_cmds/developer_cmds-63/mkdep/mkdep.sh"; - sha256 = "0n4wpqfslfjs5zbys5yri8pfi2awyhlmknsf6laa5jzqbzq9x541"; - executable = true; - }; -in - -runCommand "Toolchains" {} ('' - toolchain=$out/XcodeDefault.xctoolchain - mkdir -p $toolchain - - install -D ${writeText "ToolchainInfo.plist" (toPlist {} ToolchainInfo)} $toolchain/ToolchainInfo.plist - - ln -s $toolchain $toolchain/usr - - mkdir -p $toolchain/include - mkdir -p $toolchain/lib - mkdir -p $toolchain/libexec - mkdir -p $toolchain/share - mkdir -p $toolchain/bin - - for bin in ${getBin stdenv.cc}/bin/*; do - ln -s $bin $toolchain/bin - done - - for bin in ${getBin stdenv.cc.bintools.bintools}/bin/*; do - if ! [ -e "$toolchain/bin/$(basename $bin)" ]; then - ln -s $bin $toolchain/bin - fi - done - - ln -s ${buildPackages.bison}/bin/yacc $toolchain/bin/yacc - ln -s ${buildPackages.bison}/bin/bison $toolchain/bin/bison - ln -s ${buildPackages.flex}/bin/flex $toolchain/bin/flex - ln -s ${buildPackages.flex}/bin/flex++ $toolchain/bin/flex++ - ln -s $toolchain/bin/flex $toolchain/bin/lex - - ln -s ${buildPackages.m4}/bin/m4 $toolchain/bin/m4 - ln -s $toolchain/bin/m4 $toolchain/bin/gm4 - - ln -s ${buildPackages.unifdef}/bin/unifdef $toolchain/bin/unifdef - ln -s ${buildPackages.unifdef}/bin/unifdefall $toolchain/bin/unifdefall - - ln -s ${buildPackages.gperf}/bin/gperf $toolchain/bin/gperf - ln -s ${buildPackages.indent}/bin/indent $toolchain/bin/indent - ln -s ${buildPackages.ctags}/bin/ctags $toolchain/bin/ctags -'' + optionalString stdenv.hostPlatform.isDarwin '' - for bin in ${getBin buildPackages.cctools}/bin/*; do - if ! [ -e "$toolchain/bin/$(basename $bin)" ]; then - ln -s $bin $toolchain/bin - fi - done - - ln -s ${buildPackages.darwin.bootstrap_cmds}/bin/mig $toolchain/bin - mkdir -p $toolchain/libexec - ln -s ${buildPackages.darwin.bootstrap_cmds}/libexec/migcom $toolchain/libexec - ln -s ${mkdep-darwin-src} $toolchain/bin/mkdep -'') diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 4df69b1c16034..34839400f48c2 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -18702,7 +18702,6 @@ with pkgs; xcode-install = callPackage ../development/tools/xcode-install { }; xcbuild = callPackage ../by-name/xc/xcbuild/package.nix { - inherit (darwin.apple_sdk.frameworks) CoreServices CoreGraphics ImageIO; stdenv = # xcbuild is included in the SDK. Avoid an infinite recursion by using a bootstrap stdenv. if stdenv.hostPlatform.isDarwin then From 118a214ac5f31abe7491d371f5153292fbcb939a Mon Sep 17 00:00:00 2001 From: Randy Eckenrode Date: Thu, 3 Oct 2024 07:47:30 -0400 Subject: [PATCH 048/157] 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. --- pkgs/by-name/xc/xcbuild/package.nix | 31 ++++++++++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) diff --git a/pkgs/by-name/xc/xcbuild/package.nix b/pkgs/by-name/xc/xcbuild/package.nix index 8fc3d74286f55..3f2560caa203c 100644 --- a/pkgs/by-name/xc/xcbuild/package.nix +++ b/pkgs/by-name/xc/xcbuild/package.nix @@ -10,12 +10,41 @@ stdenv, zlib, - # These arguments are obsolete but required to avoid evaluation errors for now + # These arguments are obsolete but required to avoid evaluation errors (for now). CoreGraphics ? null, CoreServices ? null, ImageIO ? null, + + # These are deprecated and do nothing. They’re needed for compatibility and will + # warn eventually once in-tree uses are cleaned up. + xcodePlatform ? null, + xcodeVer ? null, + sdkVer ? null, + productBuildVer ? null, }: +let + attrs = { + inherit + xcodePlatform + xcodeVer + sdkVer + productBuildVer + ; + }; +in +assert lib.warnIf (lib.any (attr: attr != null) (lib.attrValues attrs)) '' + The following arguments are deprecated and do nothing: ${ + lib.concatStringsSep ", " (lib.attrNames (lib.filterAttrs (_: value: value != null) attrs)) + } + + xcbuild will dynamically pick up the SDK and SDK version based + on the SDK used in nixpkgs. If you need to use a different SDK, + add the appropriate SDK to your package’s `buildInputs`. + + See the stdenv documentation for how to use `apple-sdk`. +'' true; + let googletest = fetchFromGitHub { owner = "google"; From 49834c3000ad469d560f73256d1e8133a8793a5f Mon Sep 17 00:00:00 2001 From: Randy Eckenrode Date: Sat, 5 Oct 2024 08:59:47 -0400 Subject: [PATCH 049/157] xcbuild: suppress warning for now Enabling this by default requires additional clean that will be done after the Darwin refactor has been merged. --- pkgs/by-name/xc/xcbuild/package.nix | 43 +++++++++++++++-------------- 1 file changed, 22 insertions(+), 21 deletions(-) diff --git a/pkgs/by-name/xc/xcbuild/package.nix b/pkgs/by-name/xc/xcbuild/package.nix index 3f2560caa203c..956286adcc8d8 100644 --- a/pkgs/by-name/xc/xcbuild/package.nix +++ b/pkgs/by-name/xc/xcbuild/package.nix @@ -23,27 +23,28 @@ productBuildVer ? null, }: -let - attrs = { - inherit - xcodePlatform - xcodeVer - sdkVer - productBuildVer - ; - }; -in -assert lib.warnIf (lib.any (attr: attr != null) (lib.attrValues attrs)) '' - The following arguments are deprecated and do nothing: ${ - lib.concatStringsSep ", " (lib.attrNames (lib.filterAttrs (_: value: value != null) attrs)) - } - - xcbuild will dynamically pick up the SDK and SDK version based - on the SDK used in nixpkgs. If you need to use a different SDK, - add the appropriate SDK to your package’s `buildInputs`. - - See the stdenv documentation for how to use `apple-sdk`. -'' true; +# TODO(@reckenrode) enable this warning after uses in nixpkgs have been fixed +#let +# attrs = { +# inherit +# xcodePlatform +# xcodeVer +# sdkVer +# productBuildVer +# ; +# }; +#in +#assert lib.warnIf (lib.any (attr: attr != null) (lib.attrValues attrs)) '' +# The following arguments are deprecated and do nothing: ${ +# lib.concatStringsSep ", " (lib.attrNames (lib.filterAttrs (_: value: value != null) attrs)) +# } +# +# xcbuild will dynamically pick up the SDK and SDK version based +# on the SDK used in nixpkgs. If you need to use a different SDK, +# add the appropriate SDK to your package’s `buildInputs`. +# +# See the stdenv documentation for how to use `apple-sdk`. +#'' true; let googletest = fetchFromGitHub { From fee84be7523bee59232f3e86fa74e4ed7e55dcb8 Mon Sep 17 00:00:00 2001 From: Randy Eckenrode Date: Sat, 5 Oct 2024 16:10:51 -0400 Subject: [PATCH 050/157] xcbuild: suppress xcbuild passthru warning for now --- pkgs/by-name/xc/xcbuild/package.nix | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pkgs/by-name/xc/xcbuild/package.nix b/pkgs/by-name/xc/xcbuild/package.nix index 956286adcc8d8..46db531053371 100644 --- a/pkgs/by-name/xc/xcbuild/package.nix +++ b/pkgs/by-name/xc/xcbuild/package.nix @@ -145,7 +145,9 @@ stdenv.mkDerivation (finalAttrs: { __structuredAttrs = true; passthru = { - xcbuild = lib.warn "xcbuild.xcbuild is deprecated and will be removed; use xcbuild instead." finalAttrs.finalPackage; + xcbuild = + # lib.warn "xcbuild.xcbuild is deprecated and will be removed; use xcbuild instead." + finalAttrs.finalPackage; }; meta = { From dd569d89133b9157011be854d1f3af0d8ca6c3b5 Mon Sep 17 00:00:00 2001 From: Randy Eckenrode Date: Sun, 22 Sep 2024 18:44:26 -0400 Subject: [PATCH 051/157] xcbuild: avoid `xcrun` invoking itself via `/usr/bin` stubs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. --- pkgs/by-name/xc/xcbuild/package.nix | 2 + ...ork-bomb-when-searching-system-paths.patch | 47 +++++++++++++++++++ 2 files changed, 49 insertions(+) create mode 100644 pkgs/by-name/xc/xcbuild/patches/Avoid-fork-bomb-when-searching-system-paths.patch diff --git a/pkgs/by-name/xc/xcbuild/package.nix b/pkgs/by-name/xc/xcbuild/package.nix index 46db531053371..f08cf4328576a 100644 --- a/pkgs/by-name/xc/xcbuild/package.nix +++ b/pkgs/by-name/xc/xcbuild/package.nix @@ -84,6 +84,8 @@ stdenv.mkDerivation (finalAttrs: { patches = [ # Add missing header for `abort` ./patches/includes.patch + # Prevent xcrun from recursively invoking itself + ./patches/Avoid-fork-bomb-when-searching-system-paths.patch ]; prePatch = '' diff --git a/pkgs/by-name/xc/xcbuild/patches/Avoid-fork-bomb-when-searching-system-paths.patch b/pkgs/by-name/xc/xcbuild/patches/Avoid-fork-bomb-when-searching-system-paths.patch new file mode 100644 index 0000000000000..bad8621e4b8cb --- /dev/null +++ b/pkgs/by-name/xc/xcbuild/patches/Avoid-fork-bomb-when-searching-system-paths.patch @@ -0,0 +1,47 @@ +diff --git a/Libraries/xcsdk/Tools/xcrun.cpp b/Libraries/xcsdk/Tools/xcrun.cpp +index 9d6d4576d7..7400267c2b 100644 +--- a/Libraries/xcsdk/Tools/xcrun.cpp ++++ b/Libraries/xcsdk/Tools/xcrun.cpp +@@ -23,6 +23,8 @@ + #include + #include + ++#include ++ + using libutil::DefaultFilesystem; + using libutil::Filesystem; + using libutil::FSUtil; +@@ -398,6 +400,8 @@ + fprintf(stderr, "\n"); + } + ++ std::unordered_map environment = processContext->environmentVariables(); ++ + /* + * Collect search paths for the tool. + * Can be in toolchains, target (if one is provided), developer root, +@@ -408,6 +412,15 @@ + executablePaths.insert(executablePaths.end(), defaultExecutablePaths.begin(), defaultExecutablePaths.end()); + + /* ++ * Don’t look for tools in `/usr/bin` because it can cause an infinite recursion when `xcrun` finds a shim ++ * that tries to invoke `xcrun` to run the tool. ++ */ ++ executablePaths.erase( ++ std::remove(executablePaths.begin(), executablePaths.end(), "/usr/bin"), ++ executablePaths.end() ++ ); ++ ++ /* + * Find the tool to execute. + */ + ext::optional executable = filesystem->findExecutable(*options.tool(), executablePaths); +@@ -428,8 +441,6 @@ + } else { + /* Run is the default. */ + +- std::unordered_map environment = processContext->environmentVariables(); +- + if (target != nullptr) { + /* + * Update effective environment to include the target path. From 75bc428cf2428e275d36daba7e9aea85a6edceba Mon Sep 17 00:00:00 2001 From: Randy Eckenrode Date: Sun, 22 Sep 2024 19:19:09 -0400 Subject: [PATCH 052/157] 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. --- pkgs/by-name/xc/xcbuild/package.nix | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/pkgs/by-name/xc/xcbuild/package.nix b/pkgs/by-name/xc/xcbuild/package.nix index f08cf4328576a..7b574aa919949 100644 --- a/pkgs/by-name/xc/xcbuild/package.nix +++ b/pkgs/by-name/xc/xcbuild/package.nix @@ -69,16 +69,12 @@ stdenv.mkDerivation (finalAttrs: { "xcrun" ]; - # Once a version is released that includes - # https://github.com/facebook/xcbuild/commit/183c087a6484ceaae860c6f7300caf50aea0d710, - # we can stop doing this -pre thing. - version = "0.1.2-pre"; - + version = "0.1.1-unstable-2019-11-20"; src = fetchFromGitHub { owner = "facebook"; repo = "xcbuild"; - rev = "32b9fbeb69bfa2682bd0351ec2f14548aaedd554"; - sha256 = "1xxwg2849jizxv0g1hy0b1m3i7iivp9bmc4f5pi76swsn423d41m"; + rev = "dbaee552d2f13640773eb1ad3c79c0d2aca7229c"; + hash = "sha256-7mvSuRCWU/LlIBdmnC59F4SSzJPEcQhlmEK13PNe1xc="; }; patches = [ From 1fd1796e65ddb690e7697d84b2e93904e59dcc53 Mon Sep 17 00:00:00 2001 From: Randy Eckenrode Date: Sat, 7 Sep 2024 22:01:39 -0400 Subject: [PATCH 053/157] 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. --- pkgs/top-level/all-packages.nix | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 34839400f48c2..17fa21ed11300 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -23701,7 +23701,15 @@ with pkgs; zeitgeist = callPackage ../development/libraries/zeitgeist { }; - zlib = callPackage ../development/libraries/zlib { }; + zlib = callPackage ../development/libraries/zlib { + stdenv = + # zlib is a dependency of xcbuild. Avoid an infinite recursion by using a bootstrap stdenv + # that does not propagate xcrun. + if stdenv.hostPlatform.isDarwin then + darwin.bootstrapStdenv + else + stdenv; + }; zlib-ng = callPackage ../development/libraries/zlib-ng { }; From 76a5ef680e010ef1ce0ebea2e2fadacf401acefc Mon Sep 17 00:00:00 2001 From: Randy Eckenrode Date: Tue, 24 Sep 2024 21:43:34 -0400 Subject: [PATCH 054/157] darwin.stdenv: rework for the new SDK MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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_ 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%. --- pkgs/stdenv/darwin/default.nix | 2474 ++++++++------------------------ 1 file changed, 637 insertions(+), 1837 deletions(-) diff --git a/pkgs/stdenv/darwin/default.nix b/pkgs/stdenv/darwin/default.nix index 588e3b03d92ba..1a9c77d73e725 100644 --- a/pkgs/stdenv/darwin/default.nix +++ b/pkgs/stdenv/darwin/default.nix @@ -28,7 +28,14 @@ assert crossSystem == localSystem; let inherit (localSystem) system; - useAppleSDKLibs = lib.versionAtLeast localSystem.darwinSdkVersion "11"; + sdkMajorVersion = + let + inherit (localSystem) darwinSdkVersion; + in + if lib.versionOlder darwinSdkVersion "11" then + lib.versions.majorMinor darwinSdkVersion + else + lib.versions.major darwinSdkVersion; commonImpureHostDeps = [ "/bin/sh" @@ -41,11 +48,13 @@ let isBuiltByNixpkgsCompiler = pkg: isFromNixpkgs pkg && isFromNixpkgs pkg.stdenv.cc.cc; isBuiltByBootstrapFilesCompiler = pkg: isFromNixpkgs pkg && isFromBootstrapFiles pkg.stdenv.cc.cc; + # Dependencies in dependency sets should be mutually exclusive. + mergeDisjointAttrs = lib.foldl' lib.attrsets.unionOfDisjoint { }; + commonPreHook = '' export NIX_ENFORCE_NO_NATIVE=''${NIX_ENFORCE_NO_NATIVE-1} export NIX_ENFORCE_PURITY=''${NIX_ENFORCE_PURITY-1} export NIX_IGNORE_LD_THROUGH_GCC=1 - unset SDKROOT ''; bootstrapTools = @@ -92,7 +101,7 @@ let if prevStage.llvmPackages.clang-unwrapped == null then null else - lib.makeOverridable (import ../../build-support/cc-wrapper) { + prevStage.wrapCCWith { name = "${name}-clang-wrapper"; nativeTools = false; @@ -106,7 +115,7 @@ let extraBuildCommands = let - inherit (prevStage.llvmPackages) clang-unwrapped compiler-rt release_version; + inherit (prevStage.llvmPackages) clang-unwrapped compiler-rt; in '' function clangResourceRootIncludePath() { @@ -130,7 +139,7 @@ let bintools = prevStage.darwin.binutils; isClang = true; - libc = prevStage.darwin.Libsystem; + libc = prevStage.darwin.libSystem; inherit (prevStage.llvmPackages) libcxx; inherit lib; @@ -151,8 +160,8 @@ let inherit config; - extraBuildInputs = [ prevStage.darwin.CF ]; - extraNativeBuildInputs = extraNativeBuildInputs ++ [ prevStage.darwin.apple_sdk.sdkRoot ]; + extraBuildInputs = [ prevStage.apple-sdk ]; + inherit extraNativeBuildInputs; preHook = lib.optionalString (!isBuiltByNixpkgsCompiler bash) '' @@ -204,6 +213,132 @@ let inherit config overlays; stdenv = thisStdenv; }; + + # Dependencies - these are packages that are rebuilt together in groups. Defining them here ensures they are + # asserted and overlayed together. It also removes a lot of clutter from the stage definitions. + # + # When multiple dependency sets share a dependency, it should be put in the one that will be (re)built first. + # That makes sure everything else will share the same dependency in the final stdenv. + + allDeps = + checkFn: sets: + let + sets' = mergeDisjointAttrs sets; + result = lib.all checkFn (lib.attrValues sets'); + resultDetails = lib.mapAttrs (_: checkFn) sets'; + in + lib.traceIf (!result) (lib.deepSeq resultDetails resultDetails) result; + + # These packages are built in stage 1 then never built again. They must not be included in the final overlay + # or as dependencies to packages that are in the final overlay. They are mostly tools used as native build inputs. + # Any libraries in the list must only be used as dependencies of packages in this list. + stage1Packages = prevStage: { + inherit (prevStage) + atf + autoconf + automake + bison + brotli + cmake + cpio + cyrus_sasl + ed + expat + flex + gettext + groff + jq + kyua + libedit + libtool + m4 + meson + ninja + openldap + openssh + patchutils + pbzx + perl + pkg-config + python3 + python3Minimal + scons + serf + sqlite + subversion + texinfo + unzip + which + ; + }; + + # These packages include both the core bintools (other than LLVM) packages as well as their dependencies. + bintoolsPackages = prevStage: { + inherit (prevStage) + cctools + ld64 + bzip2 + coreutils + gmp + gnugrep + libtapi + openssl + pcre2 + xar + xz + ; + }; + + darwinPackages = prevStage: { inherit (prevStage.darwin) locale sigtool; }; + darwinPackagesNoCC = prevStage: { + inherit (prevStage.darwin) binutils binutils-unwrapped libSystem; + }; + + # These packages are not allowed to be used in the Darwin bootstrap + disallowedPackages = prevStage: { inherit (prevStage) binutils-unwrapped curl; }; + + # LLVM tools packages are staged separately (xclang, stage3) from LLVM libs (xclang). + llvmLibrariesPackages = prevStage: { inherit (prevStage.llvmPackages) compiler-rt libcxx; }; + llvmLibrariesDeps = _: { }; + + llvmToolsPackages = prevStage: { + inherit (prevStage.llvmPackages) + clang-unwrapped + libclang + libllvm + lld + llvm + ; + }; + + llvmToolsDeps = prevStage: { inherit (prevStage) libffi; }; + + # SDK packages include propagated packages and source release packages built during the bootstrap. + sdkPackages = prevStage: { + inherit (prevStage) + bash + libpng + libxml2 + libxo + ncurses + openbsm + openpam + xcbuild + zlib + ; + }; + sdkDarwinPackages = prevStage: { + inherit (prevStage.darwin) + Csu + adv_cmds + libiconv + libresolv + libsbuf + system_cmds + ; + }; + sdkPackagesNoCC = prevStage: { inherit (prevStage) apple-sdk; }; + in assert bootstrapTools.passthru.isFromBootstrapFiles or false; # sanity check [ @@ -212,8 +347,10 @@ assert bootstrapTools.passthru.isFromBootstrapFiles or false; # sanity check { __raw = true; - cctools = true; - ld64 = true; + apple-sdk = null; + + cctools = null; + ld64 = null; coreutils = null; gnugrep = null; @@ -221,22 +358,20 @@ assert bootstrapTools.passthru.isFromBootstrapFiles or false; # sanity check pbzx = null; cpio = null; + jq = null; + darwin = { - apple_sdk.sdkRoot = null; binutils = null; binutils-unwrapped = null; - print-reexports = null; - rewrite-tbd = null; + libSystem = null; sigtool = null; - CF = null; - Libsystem = null; }; llvmPackages = { clang-unwrapped = null; - libllvm = null; - libcxx = null; compiler-rt = null; + libcxx = null; + libllvm = null; }; } ) @@ -267,90 +402,12 @@ assert bootstrapTools.passthru.isFromBootstrapFiles or false; # sanity check gnugrep = bootstrapTools; pbzx = bootstrapTools; - cctools = super.stdenv.mkDerivation { - pname = "bootstrap-stage0-cctools"; - version = "boot"; + jq = null; - buildCommand = '' - declare -a cctools=( - ar - bitcode_strip - check_dylib - checksyms - cmpdylib - codesign_allocate - ctf_insert - depinfo - diagtest - gas - gprof - install_name_tool - libtool - lipo - mtoc - mtor - nm - nmedit - otool - pagestuff - ranlib - redo_prebinding - seg_addr_table - seg_hack - segedit - size - strings - strip - vtool - ) - - mkdir -p "$out/bin" - for tool in "''${cctools[@]}"; do - toolsrc="${bootstrapTools}/bin/$tool" - if [ -e "$toolsrc" ]; then - ln -s "$toolsrc" "$out/bin" - fi - done - - # Copy only the required headers to avoid accidentally linking headers that belong to other packages, - # which can cause problems when building Libsystem in the source-based SDK. - declare -a machohdrs=( - arch.h - fat.h - fixup-chains.h - getsect.h - ldsyms.h - loader.h - nlist.h - ranlib.h - reloc.h - stab.h - swap.h - arm - arm64 - hppa - i386 - i860 - m68k - m88k - ppc - sparc - x86_64 - ) - - mkdir -p "$out/include/mach-o" - for header in "''${machohdrs[@]}"; do - machosrc="${bootstrapTools}/include-Libsystem/mach-o/$header" - if [ -e "$machosrc" ]; then - cp -r "$machosrc" "$out/include/mach-o/$header" - fi - done - ''; - - passthru = { - isFromBootstrapFiles = true; - targetPrefix = ""; - }; + cctools = bootstrapTools // { + libtool = bootstrapTools; + targetPrefix = ""; + version = "boot"; }; ld64 = bootstrapTools // { @@ -359,12 +416,7 @@ assert bootstrapTools.passthru.isFromBootstrapFiles or false; # sanity check }; darwin = super.darwin.overrideScope ( - selfDarwin: superDarwin: - { - # Prevent CF from being propagated to the initial stdenv. Packages that require it - # will have to manually add it to their build inputs. - CF = null; - + selfDarwin: superDarwin: { binutils = super.wrapBintoolsWith { name = "bootstrap-stage0-binutils-wrapper"; @@ -372,7 +424,7 @@ assert bootstrapTools.passthru.isFromBootstrapFiles or false; # sanity check nativeLibc = false; expand-response-params = ""; - libc = selfDarwin.Libsystem; + libc = selfDarwin.libSystem; inherit lib; inherit (self) stdenvNoCC coreutils gnugrep; @@ -398,13 +450,13 @@ assert bootstrapTools.passthru.isFromBootstrapFiles or false; # sanity check }; binutils-unwrapped = - (superDarwin.binutils-unwrapped.overrideAttrs (old: { - version = "boot"; - passthru = (old.passthru or { }) // { - isFromBootstrapFiles = true; - }; - })).override - { enableManpages = false; }; + (superDarwin.binutils-unwrapped.override { enableManpages = false; }).overrideAttrs + (old: { + version = "boot"; + passthru = (old.passthru or { }) // { + isFromBootstrapFiles = true; + }; + }); locale = self.stdenv.mkDerivation { name = "bootstrap-stage0-locale"; @@ -413,38 +465,8 @@ assert bootstrapTools.passthru.isFromBootstrapFiles or false; # sanity check ''; }; - print-reexports = bootstrapTools; - - rewrite-tbd = bootstrapTools; - sigtool = bootstrapTools; } - // lib.optionalAttrs (!useAppleSDKLibs) { - Libsystem = self.stdenv.mkDerivation { - name = "bootstrap-stage0-Libsystem"; - buildCommand = '' - mkdir -p $out - - cp -r ${selfDarwin.darwin-stubs}/usr/lib $out/lib - chmod -R +w $out/lib - substituteInPlace $out/lib/libSystem.B.tbd --replace /usr/lib/system $out/lib/system - - ln -s libSystem.B.tbd $out/lib/libSystem.tbd - - for name in c dbm dl info m mx poll proc pthread rpcsvc util gcc_s.10.4 gcc_s.10.5; do - ln -s libSystem.tbd $out/lib/lib$name.tbd - done - - ln -s ${bootstrapTools}/lib/*.o $out/lib - - ln -s ${bootstrapTools}/lib/libresolv.9.dylib $out/lib - ln -s libresolv.9.dylib $out/lib/libresolv.dylib - - ln -s ${bootstrapTools}/include-Libsystem $out/include - ''; - passthru.isFromBootstrapFiles = true; - }; - } ); llvmPackages = @@ -498,10 +520,27 @@ assert bootstrapTools.passthru.isFromBootstrapFiles or false; # sanity check ''; passthru.isFromBootstrapFiles = true; }; + lld = self.stdenv.mkDerivation { + name = "bootstrap-stage0-lld"; + buildCommand = ""; + passthru = { + isLLVM = true; + isFromBootstrapFiles = true; + }; + }; } ); libraries = super.llvmPackages.libraries.extend ( _: _: { + compiler-rt = self.stdenv.mkDerivation { + name = "bootstrap-stage0-compiler-rt"; + buildCommand = '' + mkdir -p $out/lib $out/share + ln -s ${bootstrapTools}/lib/libclang_rt* $out/lib + ln -s ${bootstrapTools}/lib/darwin $out/lib + ''; + passthru.isFromBootstrapFiles = true; + }; libcxx = self.stdenv.mkDerivation { name = "bootstrap-stage0-libcxx"; buildCommand = '' @@ -514,15 +553,6 @@ assert bootstrapTools.passthru.isFromBootstrapFiles or false; # sanity check isFromBootstrapFiles = true; }; }; - compiler-rt = self.stdenv.mkDerivation { - name = "bootstrap-stage0-compiler-rt"; - buildCommand = '' - mkdir -p $out/lib $out/share - ln -s ${bootstrapTools}/lib/libclang_rt* $out/lib - ln -s ${bootstrapTools}/lib/darwin $out/lib - ''; - passthru.isFromBootstrapFiles = true; - }; } ); in @@ -542,119 +572,105 @@ assert bootstrapTools.passthru.isFromBootstrapFiles or false; # sanity check ( prevStage: # previous stage0 stdenv: - assert lib.all isFromBootstrapFiles ( - with prevStage; - [ - bash - cctools - coreutils - cpio - gnugrep - ld64 - ] - ++ lib.optionals useAppleSDKLibs [ pbzx ] - ); - - assert lib.all isFromBootstrapFiles ( - with prevStage.darwin; - [ - binutils-unwrapped - print-reexports - rewrite-tbd - sigtool - ] - ); - - assert (!useAppleSDKLibs) -> lib.all isFromBootstrapFiles (with prevStage.darwin; [ Libsystem ]); - assert useAppleSDKLibs -> lib.all isFromNixpkgs (with prevStage.darwin; [ Libsystem ]); - assert lib.all isFromNixpkgs ( - with prevStage.darwin; - [ - dyld - launchd - xnu - ] - ); - assert (with prevStage.darwin; (!useAppleSDKLibs) -> CF == null); - - assert lib.all isFromBootstrapFiles ( - with prevStage.llvmPackages; - [ - clang-unwrapped - libclang - libllvm - llvm - compiler-rt - libcxx - ] - ); - - stageFun prevStage { - name = "bootstrap-stage1"; - - overrides = self: super: { + assert allDeps isFromBootstrapFiles [ + (llvmToolsPackages prevStage) + (llvmLibrariesPackages prevStage) + { inherit (prevStage) - ccWrapperStdenv + bash cctools coreutils + cpio gnugrep ld64 + pbzx ; + inherit (prevStage.darwin) binutils-unwrapped sigtool; + } + ]; + + assert allDeps isFromNixpkgs [ + (sdkPackagesNoCC prevStage) + { inherit (prevStage.darwin) binutils libSystem; } + ]; + + stageFun prevStage { + name = "bootstrap-stage1"; + + overrides = self: super: { + inherit (prevStage) ccWrapperStdenv cctools ld64; binutils-unwrapped = builtins.throw "nothing in the Darwin bootstrap should depend on GNU binutils"; curl = builtins.throw "nothing in the Darwin bootstrap can depend on curl"; # Use this stage’s CF to build CMake. It’s required but can’t be included in the stdenv. cmake = self.cmakeMinimal; - cmakeMinimal = super.cmakeMinimal.overrideAttrs (old: { - buildInputs = old.buildInputs ++ [ self.darwin.CF ]; - }); + + # Use libiconvReal with gettext to break an infinite recursion. + gettext = super.gettext.override { libiconv = super.libiconvReal; }; # Disable tests because they use dejagnu, which fails to run. libffi = super.libffi.override { doCheck = false; }; - # Use libconvReal to break an infinite recursion. It will be dropped in the next stage. - libiconv = super.libiconvReal; - # Avoid pulling in a full python and its extra dependencies for the llvm/clang builds. libxml2 = super.libxml2.override { pythonSupport = false; }; + # Avoid pulling in openldap just to run Meson’s tests. + meson = super.meson.overrideAttrs { doInstallCheck = false; }; ninja = super.ninja.override { buildDocs = false; }; - # Use this stage’s CF to build Python. It’s required, but it can’t be included in the stdenv. - python3 = self.python3Minimal; - python3Minimal = - (super.python3Minimal.override { self = self.python3Minimal; }).overrideAttrs - (old: { - buildInputs = old.buildInputs or [ ] ++ [ self.darwin.CF ]; - }); + # pkg-config builds glib, which checks for `arpa/nameser.h` and fails to build if it can’t find it. + # libresolv is normally propagated by the SDK, but propagation is disabled early in the bootstrap. + # Trying to add libresolv as a dependency causes an infinite recursion. Use pkgconf instead. + pkg-config = + (super.pkg-config.override { + pkg-config = self.libpkgconf.override { + removeReferencesTo = self.removeReferencesTo.override { + # Avoid an infinite recursion by using the previous stage‘s sigtool. + signingUtils = prevStage.darwin.signingUtils.override { inherit (prevStage.darwin) sigtool; }; + }; + }; + baseBinName = "pkgconf"; + }).overrideAttrs + # Passthru the wrapped pkgconf’s stdenv to make the bootstrap assertions happy. + ( + old: { + passthru = old.passthru or { } // { + inherit (self) stdenv; + }; + } + ); + + # Use a full Python for the bootstrap. This allows Meson to be built in stage 1 and makes it easier to build + # packages that have Python dependencies. + python3 = self.python3-bootstrap; + python3-bootstrap = super.python3.override { + self = self.python3-bootstrap; + pythonAttr = "python3-bootstrap"; + enableLTO = false; + }; - scons = super.scons.override { python3Packages = self.python3Minimal.pkgs; }; + scons = super.scons.override { python3Packages = self.python3.pkgs; }; darwin = super.darwin.overrideScope ( selfDarwin: superDarwin: { - apple_sdk = superDarwin.apple_sdk // { - inherit (prevStage.darwin.apple_sdk) sdkRoot; - }; - - # Use this stage’s CF to build configd. It’s required, but it can’t be included in the stdenv. - configd = superDarwin.configd.overrideAttrs (old: { - buildInputs = old.buildInputs or [ ] ++ [ self.darwin.CF ]; - }); - signingUtils = prevStage.darwin.signingUtils.override { inherit (selfDarwin) sigtool; }; postLinkSignHook = prevStage.darwin.postLinkSignHook.override { inherit (selfDarwin) sigtool; }; - # Rewrap binutils with the real Libsystem + adv_cmds = superDarwin.adv_cmds.override { + # Break an infinite recursion between CMake and libtapi. CMake requires adv_cmds.ps, and adv_cmds + # requires a newer SDK that requires libtapi to build, which requires CMake. + inherit (prevStage) apple-sdk_11; + }; + + # Rewrap binutils with the real libSystem binutils = superDarwin.binutils.override { inherit (self) coreutils; bintools = selfDarwin.binutils-unwrapped; - libc = selfDarwin.Libsystem; - # TODO(@sternenseemann): can this be removed? - runtimeShell = "${bootstrapTools}/bin/bash"; + libc = selfDarwin.libSystem; - # Bootstrap tools cctools needs the hook to make sure things are signed properly. + # Bootstrap tools cctools needs the hook and wrappers to make sure things are signed properly. # This can be dropped once the bootstrap tools cctools has been updated to 1010.6. extraBuildCommands = '' echo 'source ${selfDarwin.postLinkSignHook}' >> $out/nix-support/post-link-hook @@ -680,296 +696,11 @@ assert bootstrapTools.passthru.isFromBootstrapFiles or false; # sanity check ); llvmPackages = - super.llvmPackages - // ( - let - tools = super.llvmPackages.tools.extend ( - _: _: { - inherit (prevStage.llvmPackages) - clang-unwrapped - libclang - libllvm - llvm - ; - } - ); - libraries = super.llvmPackages.libraries.extend ( - _: _: { inherit (prevStage.llvmPackages) compiler-rt libcxx; } - ); - in - { - inherit tools libraries; - inherit (prevStage.llvmPackages) release_version; - } - // tools - // libraries - ); - }; - - extraNativeBuildInputs = lib.optionals localSystem.isAarch64 [ - prevStage.updateAutotoolsGnuConfigScriptsHook - prevStage.gnu-config - ]; - - extraPreHook = '' - stripDebugFlags="-S" # llvm-strip does not support "-p" for Mach-O - ''; - } - ) - - # Build sysctl for use by LLVM’s check phase. It must be built separately to avoid an infinite recursion. - ( - prevStage: - # previous stage1 stdenv: - assert lib.all isFromBootstrapFiles ( - with prevStage; - [ - cctools - coreutils - gnugrep - ld64 - ] - ); - - assert lib.all isBuiltByBootstrapFilesCompiler ( - with prevStage; - [ - autoconf - automake - bash - bison - brotli - cmake - cpio - cyrus_sasl - db - ed - expat - flex - gettext - gmp - groff - icu - libedit - libffi - libiconv - libidn2 - libkrb5 - libssh2 - libtool - libunistring - libxml2 - m4 - ncurses - nghttp2 - ninja - openldap - openssh - openssl - patchutils - pbzx - perl - pkg-config.pkg-config - python3 - python3Minimal - scons - serf - sqlite - subversion - texinfo - unzip - which - xz - zlib - zstd - ] - ); - - assert lib.all isBuiltByBootstrapFilesCompiler ( - with prevStage.darwin; - [ - locale - print-reexports - rewrite-tbd - sigtool - ] - ); - - assert - (!useAppleSDKLibs) - -> lib.all isBuiltByBootstrapFilesCompiler ( - with prevStage.darwin; - [ - Libsystem - configd - ] - ); - assert (!useAppleSDKLibs) -> lib.all isFromNixpkgs (with prevStage.darwin; [ CF ]); - assert - useAppleSDKLibs - -> lib.all isFromNixpkgs ( - with prevStage.darwin; - [ - CF - Libsystem - libobjc - ] - ); - assert lib.all isFromNixpkgs ( - with prevStage.darwin; - [ - binutils-unwrapped - dyld - launchd - xnu - ] - ); - - assert lib.all isFromBootstrapFiles ( - with prevStage.llvmPackages; - [ - clang-unwrapped - libclang - libllvm - llvm - compiler-rt - libcxx - ] - ); - - assert lib.getVersion prevStage.stdenv.cc.bintools.bintools == "boot"; - - stageFun prevStage { - name = "bootstrap-stage1-sysctl"; - - overrides = self: super: { - inherit (prevStage) - ccWrapperStdenv - autoconf - automake - bash - binutils-unwrapped - bison - brotli - cctools - cmake - cmakeMinimal - coreutils - cpio - curl - cyrus_sasl - db - ed - expat - flex - gettext - gmp - gnugrep - groff - icu - ld64 - libedit - libffi - libidn2 - libkrb5 - libssh2 - libtool - libunistring - libxml2 - m4 - ncurses - nghttp2 - ninja - openldap - openssh - openssl - patchutils - pbzx - perl - pkg-config - python3Minimal - scons - sed - serf - sharutils - sqlite - subversion - texinfo - unzip - which - xz - zlib - zstd - ; - - # Avoid pulling in openldap just to run Meson’s tests. - meson = super.meson.overrideAttrs { doInstallCheck = false; }; - - # The bootstrap Python needs its own `pythonAttr` to make sure the override works properly. - python3 = self.python3-bootstrap; - python3-bootstrap = super.python3.override { - self = self.python3-bootstrap; - pythonAttr = "python3-bootstrap"; - enableLTO = false; - }; - - darwin = super.darwin.overrideScope ( - _: superDarwin: { - inherit (prevStage.darwin) - CF - sdkRoot - Libsystem - binutils - binutils-unwrapped - configd - darwin-stubs - dtrace - dyld - launchd - libclosure - libdispatch - libobjc - locale - objc4 - postLinkSignHook - print-reexports - rewrite-tbd - signingUtils - sigtool - ; - - apple_sdk = superDarwin.apple_sdk // { - inherit (prevStage.darwin.apple_sdk) sdkRoot; - }; - } - ); - - llvmPackages = - super.llvmPackages - // ( - let - tools = super.llvmPackages.tools.extend ( - _: _: { - inherit (prevStage.llvmPackages) - clang-unwrapped - libclang - libllvm - llvm - ; - clang = prevStage.stdenv.cc; - } - ); - libraries = super.llvmPackages.libraries.extend ( - _: _: { inherit (prevStage.llvmPackages) compiler-rt libcxx; } - ); - in - { - inherit tools libraries; - inherit (prevStage.llvmPackages) release_version; - } - // tools - // libraries - ); + let + tools = super.llvmPackages.tools.extend (_: _: llvmToolsPackages prevStage); + libraries = super.llvmPackages.libraries.extend (_: _: llvmLibrariesPackages prevStage); + in + super.llvmPackages // { inherit tools libraries; } // tools // libraries; }; extraNativeBuildInputs = lib.optionals localSystem.isAarch64 [ @@ -984,275 +715,62 @@ assert bootstrapTools.passthru.isFromBootstrapFiles or false; # sanity check ) # First rebuild of LLVM. While this LLVM is linked to a bunch of junk from the bootstrap tools, - # the libc++ and libc++abi it produces are not. The compiler will be rebuilt in a later stage, - # but those libraries will be used in the final stdenv. - # - # Rebuild coreutils and gnugrep to avoid unwanted references to the bootstrap tools on `PATH`. - # - # The first build of cctools is deferred until this stage because it depends on LLVM headers - # that are not included in the bootstrap tools tarball. + # the compiler-rt, libc++, and libc++abi it produces are not. The compiler will be + # rebuilt in a later stage, but those libraries will be used in the final stdenv. ( prevStage: - # previous stage-sysctl stdenv: - assert lib.all isFromBootstrapFiles ( - with prevStage; - [ - cctools - coreutils - gnugrep - ld64 - ] - ); - - assert lib.all isBuiltByBootstrapFilesCompiler ( - with prevStage; - [ - atf - autoconf - automake - bash - bison - brotli - cmake - cpio - cyrus_sasl - db - ed - expat - flex - gettext - gmp - groff - icu - kyua - libedit - libffi - libiconv - libidn2 - libkrb5 - libssh2 - libtapi - libtool - libunistring - libxml2 - m4 - meson - ncurses - nghttp2 - ninja - openldap - openssh - openssl - patchutils - pbzx - perl - pkg-config.pkg-config - python3 - python3Minimal - scons - serf - sqlite - subversion - sysctl.provider - texinfo - unzip - which - xz - zlib - zstd - ] - ); - - assert lib.all isBuiltByBootstrapFilesCompiler ( - with prevStage.darwin; - [ - locale - print-reexports - rewrite-tbd - sigtool - ] - ); - - assert - (!useAppleSDKLibs) - -> lib.all isBuiltByBootstrapFilesCompiler ( - with prevStage.darwin; - [ - Libsystem - configd - ] - ); - assert (!useAppleSDKLibs) -> lib.all isFromNixpkgs (with prevStage.darwin; [ CF ]); - assert - useAppleSDKLibs - -> lib.all isFromNixpkgs ( - with prevStage.darwin; - [ - CF - Libsystem - libobjc - ] - ); - assert lib.all isFromNixpkgs ( - with prevStage.darwin; - [ - binutils-unwrapped - dyld - launchd - xnu - ] - ); - - assert lib.all isFromBootstrapFiles ( - with prevStage.llvmPackages; - [ - clang-unwrapped - libclang - libllvm - llvm - compiler-rt - libcxx - ] - ); + # previous stage1 stdenv: + assert allDeps isFromBootstrapFiles [ + (llvmLibrariesPackages prevStage) + (llvmToolsPackages prevStage) + { inherit (prevStage) ld64; } + ]; + + assert allDeps isBuiltByBootstrapFilesCompiler [ + (stage1Packages prevStage) + (darwinPackages prevStage) + (llvmLibrariesDeps prevStage) + (llvmToolsDeps prevStage) + (sdkPackages prevStage) + (sdkDarwinPackages prevStage) + ]; + + assert allDeps isFromNixpkgs [ + (darwinPackagesNoCC prevStage) + (sdkPackagesNoCC prevStage) + ]; stageFun prevStage { name = "bootstrap-stage-xclang"; - overrides = self: super: { - inherit (prevStage) - ccWrapperStdenv - atf - autoconf - automake - bash - binutils-unwrapped - bison - brotli - cmake - cmakeMinimal - cpio - curl - cyrus_sasl - db - ed - expat - flex - gettext - gmp - groff - icu - kyua - libedit - libffi - libiconv - libidn2 - libkrb5 - libssh2 - libtool - libunistring - libxml2 - m4 - meson - ncurses - nghttp2 - ninja - openldap - openssh - openssl - patchutils - pbzx - perl - pkg-config - python3 - python3Minimal - scons - sed - serf - sharutils - sqlite - subversion - sysctl - texinfo - unzip - which - xz - zlib - zstd - ; - - # Disable ld64’s install check phase because the required LTO libraries are not built yet. - ld64 = super.ld64.overrideAttrs { doInstallCheck = false; }; - - darwin = super.darwin.overrideScope ( - selfDarwin: superDarwin: { - inherit (prevStage.darwin) - CF - Libsystem - configd - darwin-stubs - dyld - launchd - libclosure - libdispatch - libobjc - locale - objc4 - postLinkSignHook - print-reexports - rewrite-tbd - signingUtils - sigtool - ; - - apple_sdk = superDarwin.apple_sdk // { - inherit (prevStage.darwin.apple_sdk) sdkRoot; - }; + overrides = + self: super: + mergeDisjointAttrs [ + (stage1Packages prevStage) + (disallowedPackages prevStage) + # Only cctools and ld64 are rebuilt from `bintoolsPackages` to avoid rebuilding their dependencies + # again in this stage after building them in stage 1. + (lib.filterAttrs (name: _: name != "ld64" && name != "cctools") (bintoolsPackages prevStage)) + (llvmToolsDeps prevStage) + (sdkPackages prevStage) + (sdkPackagesNoCC prevStage) + { + inherit (prevStage) ccWrapperStdenv; - binutils = superDarwin.binutils.override { - inherit (prevStage) expand-response-params; - libc = selfDarwin.Libsystem; - }; + # Disable ld64’s install check phase because the required LTO libraries are not built yet. + ld64 = super.ld64.overrideAttrs { doInstallCheck = false; }; - # Avoid building unnecessary Python dependencies due to building LLVM manpages. - binutils-unwrapped = superDarwin.binutils-unwrapped.override { enableManpages = false; }; + darwin = super.darwin.overrideScope ( + selfDarwin: superDarwin: + darwinPackages prevStage + // sdkDarwinPackages prevStage + // { + inherit (prevStage.darwin) libSystem; + binutils-unwrapped = superDarwin.binutils-unwrapped.override { enableManpages = false; }; + } + ); } - ); - - llvmPackages = - super.llvmPackages - // ( - let - llvmMajor = lib.versions.major super.llvmPackages.release_version; - - # libc++, and libc++abi do not need CoreFoundation. Avoid propagating the CF from prior - # stages to the final stdenv via rpath by dropping it from `extraBuildInputs`. - stdenvNoCC = super.stdenvNoCC.override { extraBuildInputs = [ ]; }; - stdenvNoCF = self.stdenv.override { extraBuildInputs = [ ]; }; - - libcxxBootstrapStdenv = self.overrideCC stdenvNoCF ( - self.llvmPackages.clangNoCompilerRtWithLibc.override { - nixSupport.cc-cflags = [ "-nostdlib" ]; - nixSupport.cc-ldflags = [ "-lSystem" ]; - } - ); - - tools = super.llvmPackages.tools.extend ( - selfTools: superTools: { - # LLVM’s check phase takes a while to run, so disable it in the first LLVM build to speed up the bootstrap. - libllvm = superTools.libllvm.override { doCheck = false; }; - } - ); - - libraries = super.llvmPackages.libraries.extend ( - selfLib: superLib: { - compiler-rt = null; - libcxx = superLib.libcxx.override ({ stdenv = libcxxBootstrapStdenv; }); - } - ); - in - { inherit tools libraries; } // tools // libraries - ); - }; + ]; extraNativeBuildInputs = lib.optionals localSystem.isAarch64 [ prevStage.updateAutotoolsGnuConfigScriptsHook @@ -1265,295 +783,79 @@ assert bootstrapTools.passthru.isFromBootstrapFiles or false; # sanity check } ) - # This stage rebuilds Libsystem. It also rebuilds bash, which will be needed in later stages + # This stage rebuilds the SDK. It also rebuilds bash, which will be needed in later stages # to use in patched shebangs (e.g., to make sure `icu-config` uses bash from nixpkgs). ( prevStage: # previous stage-xclang stdenv: - assert lib.all isBuiltByBootstrapFilesCompiler ( - with prevStage; - [ - atf - autoconf - automake - bash - bison - cctools - cmake - cmakeMinimal - coreutils - cpio - cyrus_sasl - db - ed - expat - flex - gettext - gmp - gnugrep - groff - icu - kyua - ld64 - libedit - libtapi - libtool - m4 - meson - ninja - openbsm - openldap - openpam - openssh - patchutils - pbzx - perl - pkg-config.pkg-config - python3 - python3Minimal - scons - serf - sqlite - subversion - sysctl.provider - texinfo - unzip - which - xz - ] - ); - - assert lib.all isBuiltByBootstrapFilesCompiler ( - with prevStage; - [ - brotli - libffi - libiconv - libidn2 - libkrb5 - libssh2 - libunistring - libxml2 - ncurses - nghttp2 - openssl - zlib - zstd - ] - ); - - assert lib.all isBuiltByBootstrapFilesCompiler ( - with prevStage.darwin; - [ - locale - print-reexports - rewrite-tbd - sigtool - ] - ); - - assert - (!useAppleSDKLibs) - -> lib.all isBuiltByBootstrapFilesCompiler ( - with prevStage.darwin; - [ - Libsystem - configd - ] - ); - assert (!useAppleSDKLibs) -> lib.all isFromNixpkgs (with prevStage.darwin; [ CF ]); - assert - useAppleSDKLibs - -> lib.all isFromNixpkgs ( - with prevStage.darwin; - [ - CF - Libsystem - libobjc - ] - ); - assert lib.all isFromNixpkgs ( - with prevStage.darwin; - [ - binutils-unwrapped - dyld - launchd - libclosure - libdispatch - xnu - ] - ); - - assert lib.all isBuiltByBootstrapFilesCompiler ( - with prevStage.llvmPackages; - [ - clang-unwrapped - libclang - libllvm - llvm - ] - ); - assert lib.all isBuiltByNixpkgsCompiler (with prevStage.llvmPackages; [ libcxx ]); - assert prevStage.llvmPackages.compiler-rt == null; + assert allDeps isBuiltByBootstrapFilesCompiler [ + (stage1Packages prevStage) + (bintoolsPackages prevStage) + (darwinPackages prevStage) + (llvmToolsDeps prevStage) + (llvmToolsPackages prevStage) + (sdkPackages prevStage) + (sdkDarwinPackages prevStage) + ]; + + assert allDeps isBuiltByNixpkgsCompiler [ + (llvmLibrariesDeps prevStage) + (llvmLibrariesPackages prevStage) + ]; + + assert allDeps isFromNixpkgs [ + (darwinPackagesNoCC prevStage) + (sdkPackagesNoCC prevStage) + ]; stageFun prevStage { - name = "bootstrap-stage2"; - overrides = self: super: { - inherit (prevStage) - ccWrapperStdenv - atf - autoconf - automake - binutils-unwrapped - bison - brotli - cctools - cmake - cmakeMinimal - coreutils - cpio - curl - cyrus_sasl - db - ed - expat - flex - gettext - gmp - gnugrep - groff - icu - kyua - ld64 - libedit - libffi - libiconv - libidn2 - libkrb5 - libssh2 - libtapi - libtool - libunistring - libxml2 - m4 - meson - ncurses - nghttp2 - ninja - openbsm - openldap - openpam - openssh - openssl - patchutils - pbzx - perl - pkg-config - python3 - python3Minimal - scons - serf - sqlite - subversion - sysctl - texinfo - unzip - which - xz - zlib - zstd - ; + overrides = + self: super: + mergeDisjointAttrs [ + (stage1Packages prevStage) + (disallowedPackages prevStage) + (bintoolsPackages prevStage) + (llvmLibrariesDeps prevStage) + (llvmToolsDeps prevStage) + { + inherit (prevStage) ccWrapperStdenv; - # Bash must be linked against the system CoreFoundation instead of the open-source one. - # Otherwise, there will be a dependency cycle: bash -> CF -> icu -> bash (for icu^dev). - bash = super.bash.overrideAttrs (super: { - buildInputs = super.buildInputs ++ [ self.darwin.apple_sdk.frameworks.CoreFoundation ]; - }); + # Avoid an infinite recursion due to the SDK’s including ncurses, which depends on bash in its `dev` output. + bash = super.bash.override { stdenv = self.darwin.bootstrapStdenv; }; - darwin = super.darwin.overrideScope ( - selfDarwin: superDarwin: { - inherit (prevStage.darwin) - binutils-unwrapped - configd - darwin-stubs - launchd - locale - postLinkSignHook - print-reexports - rewrite-tbd - signingUtils - sigtool - ; - - apple_sdk = superDarwin.apple_sdk // { - inherit (prevStage.darwin.apple_sdk) sdkRoot; + # Avoid pulling in a full python and its extra dependencies for the llvm/clang builds. + libxml2 = super.libxml2.override { pythonSupport = false; }; + + # Use Bash from this stage to avoid propagating Bash from a previous stage to the final stdenv. + ncurses = super.ncurses.override { + stdenv = self.darwin.bootstrapStdenv.override { shell = lib.getExe self.bash; }; }; - # Rewrap binutils so it uses the rebuilt Libsystem. - binutils = - superDarwin.binutils.override { - inherit (prevStage) expand-response-params; - libc = selfDarwin.Libsystem; - } + darwin = super.darwin.overrideScope ( + selfDarwin: superDarwin: + darwinPackages prevStage // { - passthru = { - inherit (prevStage.bintools.passthru) isFromBootstrapFiles; + inherit (prevStage.darwin) binutils-unwrapped; + # Rewrap binutils so it uses the rebuilt Libsystem. + binutils = superDarwin.binutils.override { + inherit (prevStage) expand-response-params; + libc = selfDarwin.libSystem; }; - }; - } - ); - - llvmPackages = - super.llvmPackages - // ( - let - tools = super.llvmPackages.tools.extend ( - _: _: { - inherit (prevStage.llvmPackages) - clang-unwrapped - clangNoCompilerRtWithLibc - libclang - lld - libllvm - llvm - ; - } - ); - - libraries = super.llvmPackages.libraries.extend ( - selfLib: superLib: { - inherit (prevStage.llvmPackages) libcxx; - - # Make sure compiler-rt is linked against the CF from this stage, which can be - # propagated to the final stdenv. CF is required by ASAN. - compiler-rt = superLib.compiler-rt.override ({ - inherit (self.llvmPackages) libllvm; - stdenv = self.stdenv.override { extraBuildInputs = [ self.darwin.CF ]; }; - }); - } - ); - in - { - inherit tools libraries; - inherit (prevStage.llvmPackages) release_version; - } - // tools - // libraries - ); + } + ); - # Don’t link anything in this stage against CF to prevent propagating CF from prior stages to - # the final stdenv, which happens because of the rpath hook. - stdenvNoCC = super.stdenvNoCC.override { extraBuildInputs = [ ]; }; - stdenv = - let - stdenvNoCF = super.stdenv.override { extraBuildInputs = [ ]; }; - in - self.overrideCC stdenvNoCF ( - self.llvmPackages.clangNoCompilerRtWithLibc.override { inherit (self.llvmPackages) libcxx; } - ); - }; + llvmPackages = + let + tools = super.llvmPackages.tools.extend ( + _: _: llvmToolsPackages prevStage // { inherit (prevStage.llvmPackages) clangNoCompilerRtWithLibc; } + ); + libraries = super.llvmPackages.libraries.extend (_: _: llvmLibrariesPackages prevStage); + in + super.llvmPackages // { inherit tools libraries; } // tools // libraries; + } + ]; extraNativeBuildInputs = lib.optionals localSystem.isAarch64 [ prevStage.updateAutotoolsGnuConfigScriptsHook @@ -1567,231 +869,79 @@ assert bootstrapTools.passthru.isFromBootstrapFiles or false; # sanity check ) # Rebuild LLVM with LLVM. This stage also rebuilds certain dependencies needed by LLVM. - # - # LLVM requires: libcxx libffi libiconv libxml2 ncurses python3 zlib + # The SDK (but not its other inputs) is also rebuilt this stage to pick up the rebuilt cctools for `libtool`. ( prevStage: # previous stage2 stdenv: - assert lib.all isBuiltByBootstrapFilesCompiler ( - with prevStage; - [ - autoconf - automake - bison - brotli - cctools - cmake - cmakeMinimal - coreutils - cpio - cyrus_sasl - db - ed - expat - flex - gettext - gmp - gnugrep - groff - icu - ld64 - libedit - libffi - libiconv - libidn2 - libkrb5 - libssh2 - libtool - libtapi - libunistring - libxml2 - m4 - meson - ncurses - nghttp2 - ninja - openbsm - openldap - openpam - openssh - openssl - patchutils - pbzx - perl - pkg-config.pkg-config - python3 - python3Minimal - scons - serf - sqlite - subversion - sysctl.provider - texinfo - unzip - which - xz - zstd - zlib - ] - ); - assert lib.all isBuiltByNixpkgsCompiler (with prevStage; [ bash ]); - - assert lib.all isBuiltByBootstrapFilesCompiler ( - with prevStage.darwin; - [ - locale - print-reexports - rewrite-tbd - sigtool - ] - ); - - assert - (!useAppleSDKLibs) -> lib.all isBuiltByBootstrapFilesCompiler (with prevStage.darwin; [ configd ]); - assert - (!useAppleSDKLibs) -> lib.all isBuiltByNixpkgsCompiler (with prevStage.darwin; [ Libsystem ]); - assert (!useAppleSDKLibs) -> lib.all isFromNixpkgs (with prevStage.darwin; [ CF ]); - assert - useAppleSDKLibs - -> lib.all isFromNixpkgs ( - with prevStage.darwin; - [ - CF - Libsystem - libobjc - ] - ); - assert lib.all isFromNixpkgs ( - with prevStage.darwin; - [ - binutils-unwrapped - dyld - launchd - libclosure - libdispatch - xnu - ] - ); - - assert lib.all isBuiltByBootstrapFilesCompiler ( - with prevStage.llvmPackages; - [ - clang-unwrapped - libclang - libllvm - llvm - ] - ); - assert lib.all isBuiltByNixpkgsCompiler (with prevStage.llvmPackages; [ libcxx ]); + assert allDeps isBuiltByBootstrapFilesCompiler [ + (stage1Packages prevStage) + (bintoolsPackages prevStage) + (darwinPackages prevStage) + (llvmToolsPackages prevStage) + (llvmToolsDeps prevStage) + ]; + + assert allDeps isBuiltByNixpkgsCompiler [ + (llvmLibrariesDeps prevStage) + (llvmLibrariesPackages prevStage) + (sdkPackages prevStage) + (sdkDarwinPackages prevStage) + ]; + + assert allDeps isFromNixpkgs [ + (darwinPackagesNoCC prevStage) + (sdkPackagesNoCC prevStage) + ]; stageFun prevStage { - name = "bootstrap-stage3"; - overrides = self: super: { - inherit (prevStage) - ccWrapperStdenv - autoconf - automake - bash - binutils-unwrapped - bison - brotli - cmake - cmakeMinimal - coreutils - cpio - curl - cyrus_sasl - db - ed - expat - flex - gettext - gmp - gnugrep - groff - libedit - libidn2 - libkrb5 - libssh2 - libtool - libunistring - m4 - meson - nghttp2 - ninja - openbsm - openldap - openpam - openssh - openssl - patchutils - pbzx - perl - pkg-config - python3 - python3Minimal - scons - sed - serf - sharutils - sqlite - subversion - sysctl - texinfo - unzip - which - xz - zstd - ; + overrides = + self: super: + mergeDisjointAttrs [ + (stage1Packages prevStage) + (disallowedPackages prevStage) + (llvmLibrariesDeps prevStage) + (sdkPackages prevStage) + { + inherit (prevStage) ccWrapperStdenv; - # Disable tests because they use dejagnu, which fails to run. - libffi = super.libffi.override { doCheck = false; }; + # Disable tests because they use dejagnu, which fails to run. + libffi = super.libffi.override { doCheck = false; }; - # Avoid pulling in a full python and its extra dependencies for the llvm/clang builds. - libxml2 = super.libxml2.override { pythonSupport = false; }; + darwin = super.darwin.overrideScope ( + selfDarwin: superDarwin: + darwinPackages prevStage + // sdkDarwinPackages prevStage + // { + inherit (prevStage.darwin) libSystem; + + # binutils-unwrapped needs to build the LLVM man pages, which requires a lot of Python stuff + # that ultimately ends up depending on git. Fortunately, the git dependency is only for check + # inputs. The following set of overrides allow the LLVM documentation to be built without + # pulling curl (and other packages like ffmpeg) into the stdenv bootstrap. + binutils-unwrapped = superDarwin.binutils-unwrapped.override (old: { + llvm-manpages = super.llvmPackages.llvm-manpages.override { + python3Packages = self.python3.pkgs.overrideScope ( + _: superPython: { + hatch-vcs = superPython.hatch-vcs.overrideAttrs { doInstallCheck = false; }; + markdown-it-py = superPython.markdown-it-py.overrideAttrs { doInstallCheck = false; }; + mdit-py-plugins = superPython.mdit-py-plugins.overrideAttrs { doInstallCheck = false; }; + myst-parser = superPython.myst-parser.overrideAttrs { doInstallCheck = false; }; + } + ); + }; + }); + } + ); - darwin = super.darwin.overrideScope ( - selfDarwin: superDarwin: { - inherit (prevStage.darwin) - CF - Libsystem - binutils - binutils-unwrapped - configd - darwin-stubs - dyld - launchd - libclosure - libdispatch - libobjc - locale - objc4 - postLinkSignHook - print-reexports - rewrite-tbd - signingUtils - sigtool - ; - - apple_sdk = superDarwin.apple_sdk // { - inherit (prevStage.darwin.apple_sdk) sdkRoot; - }; + llvmPackages = + let + libraries = super.llvmPackages.libraries.extend (_: _: llvmLibrariesPackages prevStage); + in + super.llvmPackages // { inherit libraries; } // libraries; } - ); - - llvmPackages = - super.llvmPackages - // ( - let - libraries = super.llvmPackages.libraries.extend ( - _: _: { inherit (prevStage.llvmPackages) compiler-rt libcxx; } - ); - in - { inherit libraries; } // libraries - ); - }; + ]; extraNativeBuildInputs = lib.optionals localSystem.isAarch64 [ prevStage.updateAutotoolsGnuConfigScriptsHook @@ -1809,287 +959,99 @@ assert bootstrapTools.passthru.isFromBootstrapFiles or false; # sanity check ( prevStage: # previous stage3 stdenv: - assert lib.all isBuiltByBootstrapFilesCompiler ( - with prevStage; - [ - autoconf - automake - bison - brotli - cmake - cmakeMinimal - coreutils - cpio - cyrus_sasl - db - ed - expat - flex - gettext - gmp - gnugrep - groff - libedit - libidn2 - libkrb5 - libssh2 - libtool - libunistring - m4 - meson - nghttp2 - ninja - openbsm - openldap - openpam - openssh - openssl - patchutils - pbzx - perl - pkg-config.pkg-config - python3 - python3Minimal - scons - serf - sqlite - subversion - sysctl.provider - texinfo - unzip - which - xz - zstd - ] - ); - - assert lib.all isBuiltByNixpkgsCompiler ( - with prevStage; - [ - bash - cctools - icu - ld64 - libtapi - libffi - libiconv - libxml2 - zlib - ] - ); - - assert lib.all isBuiltByBootstrapFilesCompiler ( - with prevStage.darwin; - [ - locale - print-reexports - rewrite-tbd - sigtool - ] - ); - - assert - (!useAppleSDKLibs) -> lib.all isBuiltByBootstrapFilesCompiler (with prevStage.darwin; [ configd ]); - assert - (!useAppleSDKLibs) -> lib.all isBuiltByNixpkgsCompiler (with prevStage.darwin; [ Libsystem ]); - assert (!useAppleSDKLibs) -> lib.all isFromNixpkgs (with prevStage.darwin; [ CF ]); - assert - useAppleSDKLibs - -> lib.all isFromNixpkgs ( - with prevStage.darwin; - [ - CF - Libsystem - libobjc - ] - ); - assert lib.all isFromNixpkgs ( - with prevStage.darwin; - [ - binutils-unwrapped - dyld - launchd - libclosure - libdispatch - xnu - ] - ); - - assert lib.all isBuiltByNixpkgsCompiler ( - with prevStage.llvmPackages; - [ - clang-unwrapped - libclang - libllvm - llvm - compiler-rt - libcxx - ] - ); + assert allDeps isBuiltByBootstrapFilesCompiler [ + (stage1Packages prevStage) + (darwinPackages prevStage) + ]; + + assert allDeps isBuiltByNixpkgsCompiler [ + (bintoolsPackages prevStage) + (llvmLibrariesDeps prevStage) + (llvmLibrariesPackages prevStage) + (llvmToolsDeps prevStage) + (llvmToolsPackages prevStage) + (sdkPackages prevStage) + (sdkDarwinPackages prevStage) + ]; + + assert allDeps isFromNixpkgs [ + (darwinPackagesNoCC prevStage) + (sdkPackagesNoCC prevStage) + ]; stageFun prevStage { - name = "bootstrap-stage4"; - overrides = self: super: { - inherit (prevStage) - ccWrapperStdenv - autoconf - automake - bash - binutils-unwrapped - bison - cmake - cmakeMinimal - curl - cyrus_sasl - db - expat - flex - groff - libedit - libtool - m4 - meson - ninja - openldap - openssh - patchutils - perl - pkg-config - python3 - python3Minimal - scons - serf - sqlite - subversion - sysctl - texinfo - unzip - which - - # CF dependencies - don’t rebuild them. - icu - - # LLVM dependencies - don’t rebuild them. - libffi - libiconv - libiconv-darwin - libxml2 - ncurses - zlib - ; - - darwin = super.darwin.overrideScope ( - selfDarwin: superDarwin: { - inherit (prevStage.darwin) - dyld - CF - Libsystem - darwin-stubs - # CF dependencies - don’t rebuild them. - libobjc - objc4 - ; - - apple_sdk = superDarwin.apple_sdk // { - inherit (prevStage.darwin.apple_sdk) sdkRoot; - }; + overrides = + self: super: + mergeDisjointAttrs [ + (bintoolsPackages prevStage) + (disallowedPackages prevStage) + (llvmLibrariesDeps prevStage) + (llvmToolsDeps prevStage) + (sdkPackages prevStage) + (sdkPackagesNoCC prevStage) + { + inherit (prevStage) ccWrapperStdenv; - signingUtils = superDarwin.signingUtils.override { inherit (selfDarwin) sigtool; }; + # Rebuild locales and sigtool with the new clang. + darwin = super.darwin.overrideScope ( + _: superDarwin: + sdkDarwinPackages prevStage + // { + inherit (prevStage.darwin) binutils-unwrapped libSystem; + binutils = superDarwin.binutils.override { + # Build expand-response-params with last stage like below + inherit (prevStage) expand-response-params; + }; + } + ); - binutils = superDarwin.binutils.override { - inherit (prevStage) expand-response-params; + llvmPackages = + let + tools = super.llvmPackages.tools.extend ( + _: _: + llvmToolsPackages prevStage + // { + libcxxClang = super.wrapCCWith rec { + nativeTools = false; + nativeLibc = false; - bintools = selfDarwin.binutils-unwrapped; - libc = selfDarwin.Libsystem; - }; + inherit (prevStage) expand-response-params; - # binutils-unwrapped needs to build the LLVM man pages, which requires a lot of Python stuff - # that ultimately ends up depending on git. Fortunately, the git dependency is only for check - # inputs. The following set of overrides allow the LLVM documentation to be built without - # pulling curl (and other packages like ffmpeg) into the stdenv bootstrap. - binutils-unwrapped = superDarwin.binutils-unwrapped.override (old: { - llvm-manpages = super.llvmPackages.llvm-manpages.override { - python3Packages = self.python3.pkgs.overrideScope ( - _: superPython: { - hatch-vcs = superPython.hatch-vcs.overrideAttrs { doInstallCheck = false; }; - markdown-it-py = superPython.markdown-it-py.overrideAttrs { doInstallCheck = false; }; - mdit-py-plugins = superPython.mdit-py-plugins.overrideAttrs { doInstallCheck = false; }; - myst-parser = superPython.myst-parser.overrideAttrs { doInstallCheck = false; }; - } - ); - }; - }); - } - ); + extraPackages = [ self.llvmPackages.compiler-rt ]; - llvmPackages = - super.llvmPackages - // ( - let - tools = super.llvmPackages.tools.extend ( - _: _: { - inherit (prevStage.llvmPackages) - clang-unwrapped - libclang - libllvm - llvm - ; - libcxxClang = lib.makeOverridable (import ../../build-support/cc-wrapper) { - nativeTools = false; - nativeLibc = false; - - inherit (prevStage) expand-response-params; - - extraPackages = [ self.llvmPackages.compiler-rt ]; - - extraBuildCommands = - let - inherit (self.llvmPackages) clang-unwrapped compiler-rt release_version; - - # Clang 16+ uses only the major version in resource-root, but older versions use the complete one. - clangResourceRootIncludePath = - clangLib: clangRelease: - let - clangVersion = - if lib.versionAtLeast clangRelease "16" then lib.versions.major clangRelease else clangRelease; - in - "${clangLib}/lib/clang/${clangVersion}/include"; - in - '' + extraBuildCommands = '' rsrc="$out/resource-root" mkdir "$rsrc" - ln -s "${clangResourceRootIncludePath clang-unwrapped.lib release_version}" "$rsrc" - ln -s "${compiler-rt.out}/lib" "$rsrc/lib" - ln -s "${compiler-rt.out}/share" "$rsrc/share" + ln -s "${cc.lib}/lib/clang/${lib.versions.major (lib.getVersion cc)}/include" "$rsrc" echo "-resource-dir=$rsrc" >> $out/nix-support/cc-cflags + ln -s "${prevStage.llvmPackages.compiler-rt.out}/lib" "$rsrc/lib" + ln -s "${prevStage.llvmPackages.compiler-rt.out}/share" "$rsrc/share" ''; - cc = self.llvmPackages.clang-unwrapped; - bintools = self.darwin.binutils; + cc = self.llvmPackages.clang-unwrapped; + bintools = self.darwin.binutils; - isClang = true; - libc = self.darwin.Libsystem; - inherit (self.llvmPackages) libcxx; + isClang = true; + libc = self.darwin.libSystem; + inherit (self.llvmPackages) libcxx; - inherit lib; - inherit (self) - stdenvNoCC - coreutils - gnugrep - runtimeShell - ; - }; - } - ); - libraries = super.llvmPackages.libraries.extend ( - _: _: { inherit (prevStage.llvmPackages) compiler-rt libcxx; } - ); - in - { inherit tools libraries; } // tools // libraries - ); - }; + inherit lib; + inherit (self) + stdenvNoCC + coreutils + gnugrep + runtimeShell + ; + }; + } + ); + libraries = super.llvmPackages.libraries.extend (_: _: llvmLibrariesPackages prevStage); + in + super.llvmPackages // { inherit tools libraries; } // tools // libraries; + } + ]; extraNativeBuildInputs = lib.optionals localSystem.isAarch64 [ prevStage.updateAutotoolsGnuConfigScriptsHook @@ -2111,141 +1073,24 @@ assert bootstrapTools.passthru.isFromBootstrapFiles or false; # sanity check ( prevStage: # previous stage4 stdenv: - assert lib.all isBuiltByNixpkgsCompiler ( - with prevStage; - [ - bash - brotli - bzip2 - cctools - cpio - diffutils - ed - file - findutils - gawk - gettext - gmp - gnugrep - gnumake - gnused - gnutar - gzip - icu - ld64 - libffi - libiconv - libidn2 - libkrb5 - libssh2 - libtapi - libunistring - libxml2 - libyaml - ncurses - nghttp2 - openbsm - openpam - openssl - patch - pbzx - pcre - xar - xz - zlib - zstd - ] - ); - - assert lib.all isBuiltByNixpkgsCompiler ( - with prevStage.darwin; - [ - locale - print-reexports - rewrite-tbd - sigtool - ] - ); - - assert - (!useAppleSDKLibs) - -> lib.all isBuiltByNixpkgsCompiler ( - with prevStage.darwin; - [ - Libsystem - configd - ] - ); - assert (!useAppleSDKLibs) -> lib.all isFromNixpkgs (with prevStage.darwin; [ CF ]); - assert - useAppleSDKLibs - -> lib.all isFromNixpkgs ( - with prevStage.darwin; - [ - CF - Libsystem - libobjc - ] - ); - assert lib.all isFromNixpkgs ( - with prevStage.darwin; - [ - binutils-unwrapped - dyld - launchd - libclosure - libdispatch - xnu - ] - ); - - assert lib.all isBuiltByNixpkgsCompiler ( - with prevStage.llvmPackages; - [ - clang-unwrapped - libclang - libllvm - llvm - compiler-rt - libcxx - ] - ); - - assert lib.all isBuiltByBootstrapFilesCompiler ( - with prevStage; - [ - autoconf - automake - bison - cmake - cmakeMinimal - cyrus_sasl - db - expat - flex - groff - libedit - libtool - m4 - meson - ninja - openldap - openssh - patchutils - perl - pkg-config.pkg-config - python3 - python3Minimal - scons - serf - sqlite - subversion - sysctl.provider - texinfo - unzip - which - ] - ); + + assert allDeps isBuiltByNixpkgsCompiler [ + (lib.filterAttrs (_: pkg: lib.getName pkg != "pkg-config-wrapper") (stage1Packages prevStage)) # pkg-config is a wrapper + (bintoolsPackages prevStage) + (darwinPackages prevStage) + (llvmLibrariesDeps prevStage) + (llvmLibrariesPackages prevStage) + (llvmToolsDeps prevStage) + (llvmToolsPackages prevStage) + (sdkPackages prevStage) + (sdkDarwinPackages prevStage) + { inherit (prevStage.pkg-config) pkg-config; } + ]; + + assert allDeps isFromNixpkgs [ + (darwinPackagesNoCC prevStage) + (sdkPackagesNoCC prevStage) + ]; let cc = prevStage.llvmPackages.clang; @@ -2269,11 +1114,11 @@ assert bootstrapTools.passthru.isFromBootstrapFiles or false; # sanity check initialPath = ((import ../generic/common-path.nix) { pkgs = prevStage; }); - extraNativeBuildInputs = - lib.optionals localSystem.isAarch64 [ prevStage.updateAutotoolsGnuConfigScriptsHook ] - ++ [ prevStage.darwin.apple_sdk.sdkRoot ]; + extraNativeBuildInputs = lib.optionals localSystem.isAarch64 [ + prevStage.updateAutotoolsGnuConfigScriptsHook + ]; - extraBuildInputs = [ prevStage.darwin.CF ]; + extraBuildInputs = [ prevStage.apple-sdk ]; inherit cc; @@ -2281,69 +1126,76 @@ assert bootstrapTools.passthru.isFromBootstrapFiles or false; # sanity check inherit (prevStage.stdenv) fetchurlBoot; - extraAttrs = - { - inherit bootstrapTools; - libc = prevStage.darwin.Libsystem; - shellPackage = prevStage.bash; - } - // lib.optionalAttrs useAppleSDKLibs { - # This objc4 will be propagated to all builds using the final stdenv, - # and we shouldn't mix different builds, because they would be - # conflicting LLVM modules. Export it here so we can grab it later. - inherit (prevStage.darwin) objc4; - }; + extraAttrs = { + inherit bootstrapTools; + libc = prevStage.darwin.libSystem; + shellPackage = prevStage.bash; + }; disallowedRequisites = [ bootstrapTools.out ]; allowedRequisites = - (with prevStage; [ - bash - bzip2.bin - bzip2.out - cc.expand-response-params - cctools - ld64.out - ld64.lib - libtapi.out - coreutils - darwin.binutils - darwin.binutils.bintools - diffutils - ed - file - findutils - gawk - gettext - gmp.out - gnugrep - gnugrep.pcre2.out - gnumake - gnused - gnutar - gzip - icu.out - libffi.out - libiconv - libunistring.out - libxml2.out - ncurses.dev - ncurses.man - ncurses.out - openbsm - openpam - openssl.out - patch - xar.lib - xz.bin - xz.out - zlib.dev - zlib.out - ]) + ( + with prevStage; + [ + apple-sdk + bash + bzip2.bin + bzip2.out + cc.expand-response-params + cctools + cctools.libtool + coreutils + darwin.binutils + darwin.binutils.bintools + diffutils + ed + file + findutils + gawk + gettext + gmp.out + gnugrep + gnugrep.pcre2.out + gnumake + gnused + gnutar + gzip + ld64.lib + ld64.out + libffi.out + libtapi.out + libunistring.out + libxml2.out + ncurses.dev + ncurses.man + ncurses.out + openbsm + openpam + openssl.out + patch + xar.lib + xcbuild + xcbuild.xcrun + xz.bin + xz.out + zlib.dev + zlib.out + ] + ++ apple-sdk.propagatedBuildInputs + ) ++ lib.optionals localSystem.isAarch64 [ prevStage.updateAutotoolsGnuConfigScriptsHook prevStage.gnu-config ] + ++ lib.optionals localSystem.isx86_64 [ prevStage.darwin.Csu ] + ++ (with prevStage.darwin; [ + libiconv.out + libresolv.out + libsbuf.out + libSystem + locale + ]) ++ (with prevStage.llvmPackages; [ bintools-unwrapped clang-unwrapped @@ -2355,117 +1207,65 @@ assert bootstrapTools.passthru.isFromBootstrapFiles or false; # sanity check lld llvm llvm.lib - ]) - ++ ( - with prevStage.darwin; - [ - CF - Libsystem - dyld - locale - apple_sdk.sdkRoot - ] - ++ lib.optionals useAppleSDKLibs [ objc4 ] - ); + ]); __stdenvImpureHostDeps = commonImpureHostDeps; __extraImpureHostDeps = commonImpureHostDeps; overrides = self: super: - { - inherit (prevStage) - bash - brotli - bzip2 - coreutils - cpio - diffutils - ed - file - findutils - gawk - gettext - gmp - gnugrep - gnumake - gnused - gnutar - gzip - icu - libffi - libiconv - libiconv-darwin - libidn2 - libssh2 - libunistring - libxml2 - libyaml - ncurses - nghttp2 - openbsm - openpam - openssl - patch - pbzx - pcre - python3Minimal - xar - xz - zlib - zstd - ; - - darwin = super.darwin.overrideScope ( - _: superDarwin: - { - inherit (prevStage.darwin) - CF - Libsystem - darwin-stubs - dyld - locale - libobjc - rewrite-tbd - xnu - ; - - apple_sdk = superDarwin.apple_sdk // { - inherit (prevStage.darwin.apple_sdk) sdkRoot; - }; - } - // lib.optionalAttrs (super.stdenv.targetPlatform == localSystem) { - inherit (prevStage.darwin) binutils binutils-unwrapped; - } - ); - } - // lib.optionalAttrs (super.stdenv.targetPlatform == localSystem) { - inherit (prevStage) cctools ld64 libtapi; - inherit (prevStage.llvmPackages) clang llvm; - - # Need to get rid of these when cross-compiling. - llvmPackages = - super.llvmPackages - // ( - let - tools = super.llvmPackages.tools.extend ( - _: _: { - inherit (prevStage.llvmPackages) - clang - clang-unwrapped - libclang - libllvm - llvm - ; - } - ); - libraries = super.llvmPackages.libraries.extend ( - _: _: { inherit (prevStage.llvmPackages) compiler-rt libcxx; } - ); - in - { inherit tools libraries; } // tools // libraries + mergeDisjointAttrs [ + (llvmLibrariesDeps prevStage) + (llvmToolsDeps prevStage) + (sdkPackages prevStage) + (sdkPackagesNoCC prevStage) + { + inherit (prevStage) + diffutils + ed + file + findutils + gawk + gettext + gnumake + gnused + gnutar + gzip + patch + ; + + "apple-sdk_${sdkMajorVersion}" = self.apple-sdk; + + darwin = super.darwin.overrideScope ( + _: _: + sdkDarwinPackages prevStage + // { + inherit (prevStage.darwin) libSystem locale sigtool; + } + // lib.optionalAttrs (super.stdenv.targetPlatform == localSystem) { + inherit (prevStage.darwin) binutils binutils-unwrapped; + } ); - }; + } + (lib.optionalAttrs (super.stdenv.targetPlatform == localSystem) ( + (bintoolsPackages prevStage) + // { + inherit (prevStage.llvmPackages) clang; + # Need to get rid of these when cross-compiling. + "llvmPackages_${lib.versions.major prevStage.llvmPackages.release_version}" = + let + llvmVersion = lib.versions.major prevStage.llvmPackages.release_version; + tools = super."llvmPackages_${llvmVersion}".tools.extend ( + _: _: llvmToolsPackages prevStage // { inherit (prevStage.llvmPackages) clang; } + ); + libraries = super."llvmPackages_${llvmVersion}".libraries.extend ( + _: _: llvmLibrariesPackages prevStage + ); + in + super."llvmPackages_${llvmVersion}" // { inherit tools libraries; } // tools // libraries; + } + )) + ]; }; } ) @@ -2477,11 +1277,8 @@ assert bootstrapTools.passthru.isFromBootstrapFiles or false; # sanity check assert isBuiltByNixpkgsCompiler prevStage.cctools; assert isBuiltByNixpkgsCompiler prevStage.ld64; assert isBuiltByNixpkgsCompiler prevStage.darwin.sigtool; - assert isBuiltByNixpkgsCompiler prevStage.darwin.print-reexports; - assert isBuiltByNixpkgsCompiler prevStage.darwin.rewrite-tbd; - assert isFromNixpkgs prevStage.darwin.CF; - assert isFromNixpkgs prevStage.darwin.Libsystem; + assert isFromNixpkgs prevStage.darwin.libSystem; assert isFromNixpkgs prevStage.darwin.binutils-unwrapped; assert isBuiltByNixpkgsCompiler prevStage.llvmPackages.clang-unwrapped; @@ -2494,6 +1291,9 @@ assert bootstrapTools.passthru.isFromBootstrapFiles or false; # sanity check assert isFromNixpkgs prevStage.binutils-unwrapped.src; assert isBuiltByNixpkgsCompiler prevStage.curl; + # libiconv should be an alias for darwin.libiconv + assert prevStage.libiconv == prevStage.darwin.libiconv; + { inherit (prevStage) config overlays stdenv; } From 9c004ef367a7a3bfaba340453d821be66dfbafcf Mon Sep 17 00:00:00 2001 From: Randy Eckenrode Date: Wed, 2 Oct 2024 19:07:09 -0400 Subject: [PATCH 055/157] darwin.stdenv: use xarMinimal Using xarMinimal avoids pulling e2fsprogs and (eventually) macfuse-stubs into the Darwin stdenv bootstrap. --- pkgs/stdenv/darwin/default.nix | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pkgs/stdenv/darwin/default.nix b/pkgs/stdenv/darwin/default.nix index 1a9c77d73e725..1ae60ab4d8212 100644 --- a/pkgs/stdenv/darwin/default.nix +++ b/pkgs/stdenv/darwin/default.nix @@ -652,6 +652,8 @@ assert bootstrapTools.passthru.isFromBootstrapFiles or false; # sanity check scons = super.scons.override { python3Packages = self.python3.pkgs; }; + xar = super.xarMinimal; + darwin = super.darwin.overrideScope ( selfDarwin: superDarwin: { signingUtils = prevStage.darwin.signingUtils.override { inherit (selfDarwin) sigtool; }; @@ -909,6 +911,8 @@ assert bootstrapTools.passthru.isFromBootstrapFiles or false; # sanity check # Disable tests because they use dejagnu, which fails to run. libffi = super.libffi.override { doCheck = false; }; + xar = super.xarMinimal; + darwin = super.darwin.overrideScope ( selfDarwin: superDarwin: darwinPackages prevStage From b7442b90668d49ac5c3717a5b1cfae0dda4bb334 Mon Sep 17 00:00:00 2001 From: Randy Eckenrode Date: Wed, 21 Aug 2024 07:50:34 -0400 Subject: [PATCH 056/157] 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. --- pkgs/stdenv/adapters.nix | 2 -- pkgs/stdenv/cross/default.nix | 2 +- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/pkgs/stdenv/adapters.nix b/pkgs/stdenv/adapters.nix index 4289bcaeb9918..45d87a6d1f836 100644 --- a/pkgs/stdenv/adapters.nix +++ b/pkgs/stdenv/adapters.nix @@ -137,8 +137,6 @@ rec { # Best effort static binaries. Will still be linked to libSystem, # but more portable than Nix store binaries. makeStaticDarwin = stdenv: stdenv.override (old: { - # extraBuildInputs are dropped in cross.nix, but darwin still needs them - extraBuildInputs = [ pkgs.buildPackages.darwin.CF ]; mkDerivationFromStdenv = withOldMkDerivation old (stdenv: mkDerivationSuper: args: (mkDerivationSuper args).overrideAttrs (prevAttrs: { NIX_CFLAGS_LINK = toString (prevAttrs.NIX_CFLAGS_LINK or "") diff --git a/pkgs/stdenv/cross/default.nix b/pkgs/stdenv/cross/default.nix index 13fb71c214ffc..bf67d2f1a2251 100644 --- a/pkgs/stdenv/cross/default.nix +++ b/pkgs/stdenv/cross/default.nix @@ -75,7 +75,7 @@ in lib.init bootStages ++ [ baseStdenv = stdenvNoCC.override { # Old ones run on wrong platform extraBuildInputs = lib.optionals hostPlatform.isDarwin [ - buildPackages.targetPackages.darwin.apple_sdk.frameworks.CoreFoundation + buildPackages.targetPackages.apple-sdk ]; hasCC = !stdenvNoCC.targetPlatform.isGhcjs; From 4624bd7959a6d1edac44cdca27a91d48065c7319 Mon Sep 17 00:00:00 2001 From: Randy Eckenrode Date: Sat, 21 Sep 2024 10:25:31 -0400 Subject: [PATCH 057/157] darwin.adv_cmds: convert to Meson and use mkAppleDerivation --- .../apple-source-releases/adv_cmds/boot.nix | 101 -------- .../adv_cmds/default.nix | 65 ------ .../adv_cmds/meson.build.in | 220 ++++++++++++++++++ .../adv_cmds/meson.options | 1 + .../adv_cmds/package.nix | 105 +++++++++ .../darwin/apple-source-releases/default.nix | 7 +- .../apple-source-releases/versions.json | 4 + pkgs/top-level/darwin-packages.nix | 2 + 8 files changed, 334 insertions(+), 171 deletions(-) delete mode 100644 pkgs/os-specific/darwin/apple-source-releases/adv_cmds/boot.nix delete mode 100644 pkgs/os-specific/darwin/apple-source-releases/adv_cmds/default.nix create mode 100644 pkgs/os-specific/darwin/apple-source-releases/adv_cmds/meson.build.in create mode 100644 pkgs/os-specific/darwin/apple-source-releases/adv_cmds/meson.options create mode 100644 pkgs/os-specific/darwin/apple-source-releases/adv_cmds/package.nix diff --git a/pkgs/os-specific/darwin/apple-source-releases/adv_cmds/boot.nix b/pkgs/os-specific/darwin/apple-source-releases/adv_cmds/boot.nix deleted file mode 100644 index 7d1066a259150..0000000000000 --- a/pkgs/os-specific/darwin/apple-source-releases/adv_cmds/boot.nix +++ /dev/null @@ -1,101 +0,0 @@ -{ lib, stdenv, buildPackages, appleDerivation, fetchFromGitHub, bsdmake, perl, flex, bison -}: - -# this derivation sucks -# locale data was removed after adv_cmds-118, so our base is that because it's easier than -# replicating the bizarre bsdmake file structure -# -# sadly adv_cmds-118 builds a mklocale and colldef that generate files that our libc can no -# longer understand -# -# the more recent adv_cmds release is used for everything else in this package - -let recentAdvCmds = fetchFromGitHub { - owner = "apple-oss-distributions"; - repo = "adv_cmds"; - rev = "adv_cmds-158"; - hash = "sha256-1qL69pGHIaefooJJ8eT83XGz9+bW7Yg3k+X9fNkMCHw="; -}; - -in appleDerivation { - depsBuildBuild = [ buildPackages.stdenv.cc ]; - nativeBuildInputs = [ bsdmake perl bison flex ]; - buildInputs = [ flex ]; - - patchPhase = '' - substituteInPlace BSDmakefile \ - --replace chgrp true \ - --replace /Developer/Makefiles/bin/compress-man-pages.pl true \ - --replace "ps.tproj" "" --replace "gencat.tproj" "" --replace "md.tproj" "" \ - --replace "tabs.tproj" "" --replace "cap_mkdb.tproj" "" \ - --replace "!= tconf --test TARGET_OS_EMBEDDED" "= NO" - - substituteInPlace Makefile --replace perl true - - substituteInPlace colldef.tproj/scan.l \ - --replace 'static orderpass = 0;' 'static int orderpass = 0;' - - for subproject in colldef mklocale monetdef msgdef numericdef timedef; do - substituteInPlace usr-share-locale.tproj/$subproject/BSDmakefile \ - --replace /usr/share/locale "" \ - --replace '-o ''${BINOWN} -g ''${BINGRP}' "" \ - --replace "rsync -a" "cp -r" - done - ''; - - preBuild = '' - cp -r --no-preserve=all ${recentAdvCmds}/colldef . - - substituteInPlace colldef/scan.l \ - --replace 'static orderpass = 0;' 'static int orderpass = 0;' - - pushd colldef - mv locale/collate.h . - flex -t -8 -i scan.l > scan.c - yacc -d parse.y - clang *.c -o colldef -lfl - popd - mv colldef/colldef colldef.tproj/colldef - - cp -r --no-preserve=all ${recentAdvCmds}/mklocale . - pushd mklocale - flex -t -8 -i lex.l > lex.c - yacc -d yacc.y - clang *.c -o mklocale -lfl - popd - mv mklocale/mklocale mklocale.tproj/mklocale - ''; - - buildPhase = '' - runHook preBuild - - bsdmake -C usr-share-locale.tproj - - ${stdenv.cc.targetPrefix}clang ${recentAdvCmds}/ps/*.c -o ps - ''; - - installPhase = '' - bsdmake -C usr-share-locale.tproj install DESTDIR="$locale/share/locale" - - # need to get rid of runtime dependency on flex - # install -d 0755 $locale/bin - # install -m 0755 colldef.tproj/colldef $locale/bin - # install -m 0755 mklocale.tproj/mklocale $locale/bin - - install -d 0755 $ps/bin - install ps $ps/bin/ps - touch "$out" - ''; - - outputs = [ - "out" - "ps" - "locale" - ]; - setOutputFlags = false; - - meta = { - platforms = lib.platforms.darwin; - maintainers = with lib.maintainers; [ gridaphobe ]; - }; -} diff --git a/pkgs/os-specific/darwin/apple-source-releases/adv_cmds/default.nix b/pkgs/os-specific/darwin/apple-source-releases/adv_cmds/default.nix deleted file mode 100644 index 3ac338d5c619d..0000000000000 --- a/pkgs/os-specific/darwin/apple-source-releases/adv_cmds/default.nix +++ /dev/null @@ -1,65 +0,0 @@ -{ stdenv, lib, appleDerivation, xcbuild, ncurses, libutil, Libc }: - -let - # Libc conflicts with libc++ 16, so provide only the header from it that’s needed to build. - msgcat = stdenv.mkDerivation { - pname = "Libc-msgcat"; - version = lib.getVersion Libc; - - buildCommand = '' - mkdir -p "$out/include" - ln -s ${lib.getDev Libc}/include/msgcat.h "$out/include/" - ''; - }; -in -appleDerivation { - # We can't just run the root build, because https://github.com/facebook/xcbuild/issues/264 - - patchPhase = '' - substituteInPlace adv_cmds.xcodeproj/project.pbxproj \ - --replace '/usr/lib/libtermcap.dylib' 'libncurses.dylib' - substituteInPlace colldef/scan.l \ - --replace 'static orderpass = 0;' 'static int orderpass = 0;' - ''; - - # pkill requires special private headers that are unavailable in - # NixPkgs. These ones are needed: - # - xpc/xpxc.h - # - os/base_private.h - # - _simple.h - # We disable it here for now. TODO: build pkill inside adv_cmds - buildPhase = '' - targets=$(xcodebuild -list \ - | awk '/Targets:/{p=1;print;next} p&&/^\s*$/{p=0};p' \ - | tail -n +2 | sed 's/^[ \t]*//' \ - | grep -v -e Desktop -e Embedded -e mklocale -e pkill -e pgrep -e colldef) - - for i in $targets; do - xcodebuild SYMROOT=$PWD/Products OBJROOT=$PWD/Intermediates -target $i - done - ''; - - # temporary install phase until xcodebuild has "install" support - installPhase = '' - for f in Products/Release/*; do - if [ -f $f ]; then - install -D $f $out/bin/$(basename $f) - fi - done - - mkdir -p $out/System/Library/LaunchDaemons - install fingerd/finger.plist $out/System/Library/LaunchDaemons - - # from variant_links.sh - # ln -s $out/bin/pkill $out/bin/pgrep - # ln -s $out/share/man/man1/pkill.1 $out/share/man/man1/pgrep.1 - ''; - - nativeBuildInputs = [ xcbuild ]; - buildInputs = [ ncurses libutil msgcat ]; - - meta = { - platforms = lib.platforms.darwin; - maintainers = with lib.maintainers; [ matthewbauer ]; - }; -} diff --git a/pkgs/os-specific/darwin/apple-source-releases/adv_cmds/meson.build.in b/pkgs/os-specific/darwin/apple-source-releases/adv_cmds/meson.build.in new file mode 100644 index 0000000000000..3b6159cabe2de --- /dev/null +++ b/pkgs/os-specific/darwin/apple-source-releases/adv_cmds/meson.build.in @@ -0,0 +1,220 @@ +# Build settings based on the upstream Xcode project. +# See: https://github.com/apple-oss-distributions/adv_cmds/blob/main/adv_cmds.xcodeproj/project.pbxproj + +# Project settings +project('adv_cmds', 'c', 'cpp', version : '@version@') + +sdk_version = get_option('sdk_version') + + +# Dependencies +cc = meson.get_compiler('c') +cxx = meson.get_compiler('cpp') + +dbm = cc.find_library('dbm') +ncurses = dependency('ncurses') + + +# Generators +bison_bin = find_program('bison', required : true) +flex_bin = find_program('flex', required : true) + +bison = generator( + bison_bin, + arguments : ['@INPUT@', '--header=@OUTPUT0@', '--output=@OUTPUT1@'], + output : [ '@BASENAME@.tab.h', '@BASENAME@.tab.c'], +) + +flex = generator( + flex_bin, + arguments : ['--header-file=@OUTPUT0@', '--outfile=@OUTPUT1@', '@INPUT@'], + output : ['@BASENAME@.yy.h', '@BASENAME@.yy.c'], +) + + +# Binaries +executable( + 'cap_mkdb', + dependencies : dbm, + install : true, + sources : ['cap_mkdb/cap_mkdb.c'], +) +install_man('cap_mkdb/cap_mkdb.1') + +executable( + 'colldef', + dependencies : dbm, + include_directories : [ + 'colldef', + 'colldef/locale', + ], + install : true, + sources : [ + bison.process('colldef/parse.y'), + flex.process('colldef/scan.l'), + ], +) +install_man('colldef/colldef.1') + +executable( + 'finger', + dependencies : dbm, + install : true, + sources : [ + 'finger/finger.c', + 'finger/lprint.c', + 'finger/net.c', + 'finger/sprint.c', + 'finger/util.c', + ], +) +install_man( + 'finger/finger.1', + 'finger/finger.conf.5' +) + +executable( + 'gencat', + install : true, + sources : [ + 'gencat/gencat.c', + 'gencat/genlib.c', + ], +) +install_man('gencat/gencat.1') + +executable( + 'genwrap', + include_directories : 'genwrap', + install : true, + sources : [ + 'genwrap/genwrap.c', + bison.process('genwrap/genwrap.y'), + flex.process('genwrap/lex.l'), + ], +) +install_data( + 'genwrap/wrapper-head.c', + 'genwrap/wrapper-tail.c', + install_dir : get_option('datadir') + '/genwrap' +) +install_data( + 'genwrap/sample.make', + 'genwrap/sample.rsync', + install_dir : get_option('datadir') + '/genwrap/examples' +) +install_man('genwrap/genwrap.8') + +executable( + 'last', + install : true, + sources : ['last/last.c'], +) +install_man('last/last.1') + +executable( + 'locale', + install : true, + sources : ['locale/locale.cc'], +) +install_man('locale/locale.1') + +# TODO(@reckenrode) Requires Perl. Needs separate packaging. +custom_target( + 'localedef', + command : [ 'cp', '@INPUT@', '@OUTPUT@' ], + install : true, + install_dir : get_option('bindir'), + install_mode : 'r-xr-xr-x', + input : 'localedef/localedef.pl', + output : 'localedef', +) +install_man('localedef/localedef.1') + +executable( + 'lsvfs', + install : true, + sources : ['lsvfs/lsvfs.c'], +) +install_man('lsvfs/lsvfs.1') + +executable( + 'mklocale', + include_directories : 'mklocale', + install : true, + sources : [ + bison.process('mklocale/yacc.y'), + flex.process('mklocale/lex.l'), + ], +) +install_man('mklocale/mklocale.1') + +executable( + 'pkill', + # Requires undocumented, private sysmon.h. + build_by_default : false, + install : false, + sources : ['pkill/pkill.c'], +) +# install_man('pkill/pkill.1') + +executable( + 'ps', + c_args : [ + # Needed for `persona.h` + '-DPRIVATE', + # From bsd/sys/event_private.h + '-Dkqueue_id_t=uint64_t' + ], + install : true, + sources : [ + 'ps/fmt.c', + 'ps/keyword.c', + 'ps/nlist.c', + 'ps/print.c', + 'ps/ps.c', + 'ps/tasks.c', + ], +) +install_man('ps/ps.1') + +executable( + 'stty', + build_by_default : sdk_version.version_compare('>=11.3'), + install : sdk_version.version_compare('>=11.3'), + sources : [ + 'stty/cchar.c', + 'stty/gfmt.c', + 'stty/key.c', + 'stty/modes.c', + 'stty/print.c', + 'stty/stty.c', + 'stty/util.c', + ], +) +if sdk_version.version_compare('>=11.3') + install_man('stty/stty.1') +endif + +executable( + 'tabs', + dependencies : ncurses, + install : true, + sources : ['tabs/tabs.c'], +) +install_man('tabs/tabs.1') + +executable( + 'tty', + install : true, + sources : ['tty/tty.c'], +) +install_man('tty/tty.1') + +executable( + 'whois', + install : true, + sources : ['whois/whois.c'], +) +install_man('whois/whois.1') + diff --git a/pkgs/os-specific/darwin/apple-source-releases/adv_cmds/meson.options b/pkgs/os-specific/darwin/apple-source-releases/adv_cmds/meson.options new file mode 100644 index 0000000000000..8c4ce874c64c5 --- /dev/null +++ b/pkgs/os-specific/darwin/apple-source-releases/adv_cmds/meson.options @@ -0,0 +1 @@ +option('sdk_version', type : 'string') diff --git a/pkgs/os-specific/darwin/apple-source-releases/adv_cmds/package.nix b/pkgs/os-specific/darwin/apple-source-releases/adv_cmds/package.nix new file mode 100644 index 0000000000000..5b190694326d4 --- /dev/null +++ b/pkgs/os-specific/darwin/apple-source-releases/adv_cmds/package.nix @@ -0,0 +1,105 @@ +{ + lib, + apple-sdk, + apple-sdk_11, + bison, + flex, + mkAppleDerivation, + ncurses, + perl, + pkg-config, + stdenvNoCC, +}: + +let + Libc = apple-sdk_11.sourceRelease "Libc"; + libplatform = apple-sdk_11.sourceRelease "libplatform"; + xnu = apple-sdk_11.sourceRelease "xnu"; + + privateHeaders = stdenvNoCC.mkDerivation { + name = "adv_cmds-deps-private-headers"; + + buildCommand = '' + install -D -m644 -t "$out/include" \ + '${libplatform}/private/_simple.h' \ + '${Libc}/nls/FreeBSD/msgcat.h' + + install -D -m644 -t "$out/include/System/sys" \ + '${xnu}/bsd/sys/persona.h' \ + '${xnu}/bsd/sys/proc.h' + ''; + }; +in +mkAppleDerivation { + releaseName = "adv_cmds"; + + outputs = [ + "out" + "locale" + "ps" + "man" + ]; + + xcodeHash = "sha256-cpoHF++eko3NHGJlKnFONKnGkVRD0zI+bg/XLzWtpN8="; + + postPatch = '' + # Meson generators require using @BASENAME@ in the output. + substituteInPlace mklocale/lex.l \ + --replace-fail y.tab.h yacc.tab.h + substituteInPlace genwrap/lex.l \ + --replace-fail y.tab.h genwrap.tab.h + substituteInPlace colldef/scan.l \ + --replace-fail y.tab.h parse.tab.h + + # Fix paths to point to the store + for file in genwrap.c genwrap.8; do + substituteInPlace genwrap/$file \ + --replace-fail '/usr/local' "$out" + done + + substituteInPlace localedef/localedef.pl \ + --replace-fail '/usr/bin/perl' '${lib.getExe perl}' \ + --replace-fail '/usr/bin' "$out/bin" \ + --replace-fail '/usr/share/locale' "$locale/share/locale" + ''; + + env.NIX_CFLAGS_COMPILE = "-I${privateHeaders}/include"; + + buildInputs = [ + # Use the 11.3 SDK because CMake depends on adv_cmds.ps, so it can’t simply be omitted when using an older SDK. + apple-sdk_11 + ncurses + ]; + + nativeBuildInputs = [ + bison + flex + perl + pkg-config + ]; + + mesonFlags = [ + # Even though adv_cmds is built with a newer SDK, the default SDK is still the deployment target. + # Don’t build packages that use newer APIs unnecessarily. + (lib.mesonOption "sdk_version" (lib.getVersion apple-sdk)) + ]; + + postBuild = '' + # Build the locales TODO + ''; + + postInstall = '' + moveToOutput share/locale "$locale" + moveToOutput bin/ps "$ps" + ln -s "$ps/bin/ps" "$out/bin/ps" + mkdir -p "$locale/share/locale" + ''; + + meta = { + description = "Advanced commands package for Darwin"; + license = [ + lib.licenses.apsl10 + lib.licenses.apsl20 + ]; + }; +} diff --git a/pkgs/os-specific/darwin/apple-source-releases/default.nix b/pkgs/os-specific/darwin/apple-source-releases/default.nix index 192dcd8301a30..ab0313cfb0c3d 100644 --- a/pkgs/os-specific/darwin/apple-source-releases/default.nix +++ b/pkgs/os-specific/darwin/apple-source-releases/default.nix @@ -253,15 +253,12 @@ let inherit (pkgs.darwin) bootstrapStdenv xcodeProjectCheckHook; }; - # Only used for bootstrapping. It’s convenient because it was the last version to come with a real makefile. - adv_cmds-boot = applePackage "adv_cmds/boot.nix" "osx-10.5.8" "sha256-/OJLNpATyS31W5nWfJgSVO5itp8j55TRwG57/QLT5Fg=" {}; - in developerToolsPackages_11_3_1 // macosPackages_11_0_1 // { # TODO: shorten this list, we should cut down to a minimum set of bootstrap or necessary packages here. - inherit (adv_cmds-boot) ps locale; + inherit (self.adv_cmds) ps locale; architecture = applePackage "architecture" "osx-10.11.6" "sha256-cUKeMx6mOAxBSRHIdfzsrR65Qv86m7+20XvpKqVfwVI=" {}; AvailabilityVersions = applePackage "AvailabilityVersions" "macos-14.4" "sha256-O9/EOsbK5ZXxh6iDSTwGWWrY5GX/viUwdfG3tdvZwcQ=" {}; bsdmake = applePackage "bsdmake" "dev-tools-3.2.6" "sha256-CW8zP5QZMhWTGp+rhrm8oHE/vSLsRlv1VRAGe1OUDmI=" {}; @@ -311,7 +308,7 @@ developerToolsPackages_11_3_1 // macosPackages_11_0_1 // { else macosPackages_11_0_1.xnu; hfs = applePackage "hfs" "osx-10.12.6" "sha256-eGi18HQFJrU5UHoBOE0LqO5gQ0xOf8+OJuAWQljfKE4=" {}; Librpcsvc = applePackage "Librpcsvc" "osx-10.11.6" "sha256-YHbGws901xONzAbo6sB5zSea4Wp0sgYUJ8YgwVfWxnE=" {}; - adv_cmds = applePackage "adv_cmds" "osx-10.11.6" "sha256-Ztp8ALWcviEpthoiY8ttWzGI8OcsLzsULjlqe8GIzw8=" {}; + adv_cmds = callPackage ./adv_cmds/package.nix { }; basic_cmds = applePackage "basic_cmds" "osx-10.11.6" "sha256-BYPPTg4/7x6RPs0WwwQlkNiZxxArV+7EVe6bM+a/I6Q=" {}; developer_cmds = applePackage "developer_cmds" "osx-10.11.6" "sha256-h0wMVlS6QdRvKOVJ74W9ziHYGApjvnk77AIR6ukYBRo=" {}; diskdev_cmds = applePackage "diskdev_cmds" "osx-10.11.6" "sha256-VX+hcZ7JhOA8EhwLloPlM3Yx79RXp9OYHV9Mi10uw3Q=" { diff --git a/pkgs/os-specific/darwin/apple-source-releases/versions.json b/pkgs/os-specific/darwin/apple-source-releases/versions.json index 2c63c0851048d..1b5d02c095990 100644 --- a/pkgs/os-specific/darwin/apple-source-releases/versions.json +++ b/pkgs/os-specific/darwin/apple-source-releases/versions.json @@ -1,2 +1,6 @@ { + "adv_cmds": { + "hash": "sha256-Ztp8ALWcviEpthoiY8ttWzGI8OcsLzsULjlqe8GIzw8=", + "version": "163" + } } diff --git a/pkgs/top-level/darwin-packages.nix b/pkgs/top-level/darwin-packages.nix index 5317cab970fc1..8c7fa67e5204f 100644 --- a/pkgs/top-level/darwin-packages.nix +++ b/pkgs/top-level/darwin-packages.nix @@ -77,6 +77,8 @@ impure-cmds // appleSourcePackages // stubs // { extraBuildInputs = []; }; + inherit (self.adv_cmds) locale ps; + binutils-unwrapped = callPackage ../os-specific/darwin/binutils { inherit (pkgs) cctools; inherit (pkgs.llvmPackages) clang-unwrapped llvm llvm-manpages; From 78076b3c12fa8f8520325d9e5cb4c2734bae03e7 Mon Sep 17 00:00:00 2001 From: Randy Eckenrode Date: Mon, 2 Sep 2024 19:27:03 -0400 Subject: [PATCH 058/157] darwin.AvailabilityVersions: use mkAppleDerivation --- .../{default.nix => package.nix} | 36 +++++++++++++------ ...t-setting-an-upper-bound-on-versions.patch | 0 .../darwin/apple-source-releases/default.nix | 2 +- .../apple-source-releases/versions.json | 4 +++ 4 files changed, 30 insertions(+), 12 deletions(-) rename pkgs/os-specific/darwin/apple-source-releases/AvailabilityVersions/{default.nix => package.nix} (77%) rename pkgs/os-specific/darwin/apple-source-releases/AvailabilityVersions/{ => patches}/0001-Support-setting-an-upper-bound-on-versions.patch (100%) diff --git a/pkgs/os-specific/darwin/apple-source-releases/AvailabilityVersions/default.nix b/pkgs/os-specific/darwin/apple-source-releases/AvailabilityVersions/package.nix similarity index 77% rename from pkgs/os-specific/darwin/apple-source-releases/AvailabilityVersions/default.nix rename to pkgs/os-specific/darwin/apple-source-releases/AvailabilityVersions/package.nix index c80dd6235e41a..d5737ddd19fd3 100644 --- a/pkgs/os-specific/darwin/apple-source-releases/AvailabilityVersions/default.nix +++ b/pkgs/os-specific/darwin/apple-source-releases/AvailabilityVersions/package.nix @@ -1,16 +1,26 @@ { lib, - stdenvNoCC, - appleDerivation', - gnused, - python3, + apple-sdk, + buildPackages, + mkAppleDerivation, unifdef, }: -appleDerivation' stdenvNoCC { - nativeBuildInputs = [ unifdef ]; +let + inherit (buildPackages) gnused python3; +in +mkAppleDerivation (finalAttrs: { + releaseName = "AvailabilityVersions"; + + patches = [ + # Add support for setting an upper bound, which is needed by the `gen-headers` script. + # It avoids having pre-process the DSL to remove unwanted versions. + ./patches/0001-Support-setting-an-upper-bound-on-versions.patch + ]; - patches = [ ./0001-Support-setting-an-upper-bound-on-versions.patch ]; + noCC = true; + + nativeBuildInputs = [ unifdef ]; buildPhase = '' runHook preBuild @@ -33,7 +43,7 @@ appleDerivation' stdenvNoCC { cp -r availability.dsl templates "$out/share/availability/" substitute availability "$out/libexec/availability" \ - --replace-fail '/usr/bin/env python3' '${lib.getBin python3}/bin/python3' \ + --replace-fail '/usr/bin/env python3' '${lib.getExe python3}' \ --replace-fail 'f"{os.path.abspath(os.path.dirname(sys.argv[0]))}/' "\"$out/share/availability/" chmod a+x "$out/libexec/availability" @@ -61,7 +71,7 @@ appleDerivation' stdenvNoCC { --preprocess "$out/share/availability/templates/\$header_src" "\$dest/include/\$header" done - # `__ENVIRONMENT_OS_VERSION_MIN_REQUIRED__` is only defined by clang 17+, so define it for older versions. + # __ENVIRONMENT_OS_VERSION_MIN_REQUIRED__ is only defined by clang 17+, so define it for older versions. ${lib.getExe gnused} -E '/#ifndef __MAC_OS_X_VERSION_MIN_REQUIRED/{ i#ifndef __ENVIRONMENT_OS_VERSION_MIN_REQUIRED__ i#define __ENVIRONMENT_OS_VERSION_MIN_REQUIRED__ __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ @@ -95,5 +105,9 @@ appleDerivation' stdenvNoCC { runHook postInstall ''; - meta.mainProgram = "gen-headers"; -} + meta = { + description = "Generates Darwin Availability headers"; + mainProgram = "gen-headers"; + platforms = lib.platforms.unix; + }; +}) diff --git a/pkgs/os-specific/darwin/apple-source-releases/AvailabilityVersions/0001-Support-setting-an-upper-bound-on-versions.patch b/pkgs/os-specific/darwin/apple-source-releases/AvailabilityVersions/patches/0001-Support-setting-an-upper-bound-on-versions.patch similarity index 100% rename from pkgs/os-specific/darwin/apple-source-releases/AvailabilityVersions/0001-Support-setting-an-upper-bound-on-versions.patch rename to pkgs/os-specific/darwin/apple-source-releases/AvailabilityVersions/patches/0001-Support-setting-an-upper-bound-on-versions.patch diff --git a/pkgs/os-specific/darwin/apple-source-releases/default.nix b/pkgs/os-specific/darwin/apple-source-releases/default.nix index ab0313cfb0c3d..47e170e0a1420 100644 --- a/pkgs/os-specific/darwin/apple-source-releases/default.nix +++ b/pkgs/os-specific/darwin/apple-source-releases/default.nix @@ -260,7 +260,7 @@ developerToolsPackages_11_3_1 // macosPackages_11_0_1 // { inherit (self.adv_cmds) ps locale; architecture = applePackage "architecture" "osx-10.11.6" "sha256-cUKeMx6mOAxBSRHIdfzsrR65Qv86m7+20XvpKqVfwVI=" {}; - AvailabilityVersions = applePackage "AvailabilityVersions" "macos-14.4" "sha256-O9/EOsbK5ZXxh6iDSTwGWWrY5GX/viUwdfG3tdvZwcQ=" {}; + AvailabilityVersions = callPackage ./AvailabilityVersions/package.nix { }; bsdmake = applePackage "bsdmake" "dev-tools-3.2.6" "sha256-CW8zP5QZMhWTGp+rhrm8oHE/vSLsRlv1VRAGe1OUDmI=" {}; CarbonHeaders = applePackage "CarbonHeaders" "osx-10.6.2" "sha256-UNaHvxzYzEBnYYuoMLqWUVprZa6Wqn/3XleoSCco050=" {}; CommonCrypto = applePackage "CommonCrypto" "osx-10.12.6" "sha256-FLgODBrfv+XsGaAjddncYAm/BIJJYw6LcwX/z7ncKFM=" {}; diff --git a/pkgs/os-specific/darwin/apple-source-releases/versions.json b/pkgs/os-specific/darwin/apple-source-releases/versions.json index 1b5d02c095990..1f50c6ad5dd9b 100644 --- a/pkgs/os-specific/darwin/apple-source-releases/versions.json +++ b/pkgs/os-specific/darwin/apple-source-releases/versions.json @@ -1,4 +1,8 @@ { + "AvailabilityVersions": { + "hash": "sha256-O9/EOsbK5ZXxh6iDSTwGWWrY5GX/viUwdfG3tdvZwcQ=", + "version": "140.1" + }, "adv_cmds": { "hash": "sha256-Ztp8ALWcviEpthoiY8ttWzGI8OcsLzsULjlqe8GIzw8=", "version": "163" From 129a959fad9f305f3e3019b7a428067a3b4cf18d Mon Sep 17 00:00:00 2001 From: Randy Eckenrode Date: Sat, 21 Sep 2024 19:09:51 -0400 Subject: [PATCH 059/157] darwin.AvailabilityVersions: also generate _symbol_aliasing.h --- .../AvailabilityVersions/package.nix | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/pkgs/os-specific/darwin/apple-source-releases/AvailabilityVersions/package.nix b/pkgs/os-specific/darwin/apple-source-releases/AvailabilityVersions/package.nix index d5737ddd19fd3..54b7628a07beb 100644 --- a/pkgs/os-specific/darwin/apple-source-releases/AvailabilityVersions/package.nix +++ b/pkgs/os-specific/darwin/apple-source-releases/AvailabilityVersions/package.nix @@ -8,6 +8,7 @@ let inherit (buildPackages) gnused python3; + xnu = apple-sdk.sourceRelease "xnu"; in mkAppleDerivation (finalAttrs: { releaseName = "AvailabilityVersions"; @@ -47,6 +48,16 @@ mkAppleDerivation (finalAttrs: { --replace-fail 'f"{os.path.abspath(os.path.dirname(sys.argv[0]))}/' "\"$out/share/availability/" chmod a+x "$out/libexec/availability" + substitute ${xnu}/bsd/sys/make_symbol_aliasing.sh "$out/libexec/make_symbol_aliasing.sh" \ + ${ + if lib.versionOlder (lib.getVersion xnu) "6153.11.26" then + ''--replace-fail "\''${SDKROOT}/usr/local/libexec/availability.pl" "$out/libexec/availability" \'' + else + ''--replace-fail "\''${SDKROOT}/\''${DRIVERKITROOT}/usr/local/libexec/availability.pl" "$out/libexec/availability" \'' + } + --replace-fail '--macosx' '--macosx --threshold $SDKROOT' + chmod a+x "$out/libexec/make_symbol_aliasing.sh" + cat <