Merge pull request #121654 from Ericson2314/darwin-cross-prep
treewide: Do a number of no-op cleanups for cross and darwin
This commit is contained in:
commit
8e84cafcd9
7 changed files with 111 additions and 83 deletions
|
@ -219,16 +219,17 @@ rec {
|
|||
|
||||
/* Like the above, but aims to support cross compilation. It's still ugly, but
|
||||
hopefully it helps a little bit. */
|
||||
makeScopeWithSplicing = splicePackages: newScope: otherSplices: keep: f:
|
||||
makeScopeWithSplicing = splicePackages: newScope: otherSplices: keep: extra: f:
|
||||
let
|
||||
spliced = splicePackages {
|
||||
spliced0 = splicePackages {
|
||||
pkgsBuildBuild = otherSplices.selfBuildBuild;
|
||||
pkgsBuildHost = otherSplices.selfBuildHost;
|
||||
pkgsBuildTarget = otherSplices.selfBuildTarget;
|
||||
pkgsHostHost = otherSplices.selfHostHost;
|
||||
pkgsHostTarget = self; # Not `otherSplices.selfHostTarget`;
|
||||
pkgsTargetTarget = otherSplices.selfTargetTarget;
|
||||
} // keep self;
|
||||
};
|
||||
spliced = extra spliced0 // spliced0 // keep self;
|
||||
self = f self // {
|
||||
newScope = scope: newScope (spliced // scope);
|
||||
callPackage = newScope spliced; # == self.newScope {};
|
||||
|
@ -239,6 +240,7 @@ rec {
|
|||
newScope
|
||||
otherSplices
|
||||
keep
|
||||
extra
|
||||
(lib.fixedPoints.extends g f);
|
||||
packages = f;
|
||||
};
|
||||
|
|
|
@ -69,6 +69,7 @@ with pkgs;
|
|||
recursivePthLoader
|
||||
;
|
||||
};
|
||||
extra = _: {};
|
||||
optionalExtensions = cond: as: if cond then as else [];
|
||||
python2Extension = import ../../../top-level/python2-packages.nix;
|
||||
extensions = lib.composeManyExtensions ((optionalExtensions (!self.isPy3k) [python2Extension]) ++ [ overrides ]);
|
||||
|
@ -77,6 +78,7 @@ with pkgs;
|
|||
pkgs.newScope
|
||||
otherSplices
|
||||
keep
|
||||
extra
|
||||
(lib.extends extensions pythonPackagesFun))
|
||||
{
|
||||
overrides = packageOverrides;
|
||||
|
|
|
@ -1,9 +1,6 @@
|
|||
{ lib, stdenv, fetchurl, fetchzip, pkgs }:
|
||||
{ lib, stdenv, stdenvNoCC, fetchurl, fetchzip, pkgs }:
|
||||
|
||||
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'; };
|
||||
|
||||
# This attrset can in theory be computed automatically, but for that to work nicely we need
|
||||
# import-from-derivation to work properly. Currently it's rather ugly when we try to bootstrap
|
||||
# a stdenv out of something like this. With some care we can probably get rid of this, but for
|
||||
|
@ -190,17 +187,6 @@ let
|
|||
}) // (attrs.meta or {});
|
||||
});
|
||||
|
||||
applePackage' = namePath: version: sdkName: sha256: let
|
||||
pname = builtins.head (lib.splitString "/" namePath);
|
||||
appleDerivation = appleDerivation' pname version sdkName sha256;
|
||||
callPackage = pkgs.newScope (packages // pkgs.darwin // { inherit appleDerivation; });
|
||||
in callPackage (./. + "/${namePath}");
|
||||
|
||||
applePackage = namePath: sdkName: sha256: let
|
||||
pname = builtins.head (lib.splitString "/" namePath);
|
||||
version = versions.${sdkName}.${pname};
|
||||
in applePackage' namePath version sdkName sha256;
|
||||
|
||||
IOKitSpecs = {
|
||||
IOAudioFamily = fetchApple "osx-10.10.5" "0ggq7za3iq8g02j16rj67prqhrw828jsw3ah3bxq8a1cvr55aqnq";
|
||||
IOFireWireFamily = fetchApple "osx-10.10.5" "059qa1m668kwvchl90cqcx35b31zaqdg61zi11y1imn5s389y2g1";
|
||||
|
@ -225,11 +211,35 @@ let
|
|||
|
||||
IOKitSrcs = lib.mapAttrs (name: value: if lib.isFunction value then value name else value) IOKitSpecs;
|
||||
|
||||
in
|
||||
|
||||
# darwin package set
|
||||
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'; };
|
||||
|
||||
applePackage' = namePath: version: sdkName: sha256:
|
||||
let
|
||||
pname = builtins.head (lib.splitString "/" namePath);
|
||||
appleDerivation = appleDerivation' pname version sdkName sha256;
|
||||
callPackage = self.newScope { inherit appleDerivation; };
|
||||
in callPackage (./. + "/${namePath}");
|
||||
|
||||
applePackage = namePath: sdkName: sha256: let
|
||||
pname = builtins.head (lib.splitString "/" namePath);
|
||||
version = versions.${sdkName}.${pname};
|
||||
in applePackage' namePath version sdkName sha256;
|
||||
|
||||
# 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" "102ssayxbg9wb35mdmhswbnw0bg7js3pfd8fcbic83c5q3bqa6c6" {};
|
||||
|
||||
# TODO: shorten this list, we should cut down to a minimum set of bootstrap or necessary packages here.
|
||||
stubPackages = {
|
||||
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;
|
||||
architecture = applePackage "architecture" "osx-10.11.6" "1pbpjcd7is69hn8y29i98ci0byik826if8gnp824ha92h90w0fq3" {};
|
||||
bsdmake = applePackage "bsdmake" "dev-tools-3.2.6" "11a9kkhz5bfgi1i8kpdkis78lhc6b5vxmhd598fcdgra1jw4iac2" {};
|
||||
|
@ -290,7 +300,4 @@ let
|
|||
# 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" "1nv0dczf67dhk17hscx52izgdcyacgyy12ag0jh6nl5hmfzsn8yy" {};
|
||||
};
|
||||
|
||||
packages = developerToolsPackages_11_3_1 // macosPackages_11_0_1 // stubPackages;
|
||||
in packages
|
||||
}
|
||||
|
|
|
@ -176,13 +176,13 @@ in rec {
|
|||
'';
|
||||
};
|
||||
|
||||
darwin = super.darwin // {
|
||||
darwin = super.darwin.overrideScope (selfDarwin: superDarwin: {
|
||||
Libsystem = stdenv.mkDerivation {
|
||||
name = "bootstrap-stage0-Libsystem";
|
||||
buildCommand = ''
|
||||
mkdir -p $out
|
||||
|
||||
cp -r ${self.darwin.darwin-stubs}/usr/lib $out/lib
|
||||
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
|
||||
|
||||
|
@ -201,7 +201,7 @@ in rec {
|
|||
'';
|
||||
};
|
||||
|
||||
darwin-stubs = super.darwin.darwin-stubs.override { inherit (self) stdenv fetchurl; };
|
||||
darwin-stubs = superDarwin.darwin-stubs.override { inherit (self) stdenv fetchurl; };
|
||||
|
||||
dyld = {
|
||||
name = "bootstrap-stage0-dyld";
|
||||
|
@ -220,10 +220,10 @@ in rec {
|
|||
nativeTools = false;
|
||||
nativeLibc = false;
|
||||
inherit (self) buildPackages coreutils gnugrep;
|
||||
libc = self.pkgs.darwin.Libsystem;
|
||||
libc = selfDarwin.Libsystem;
|
||||
bintools = { name = "bootstrap-stage0-binutils"; outPath = bootstrapTools; };
|
||||
};
|
||||
};
|
||||
});
|
||||
|
||||
llvmPackages_7 = {
|
||||
clang-unwrapped = stdenv.mkDerivation {
|
||||
|
@ -291,12 +291,12 @@ in rec {
|
|||
});
|
||||
in { inherit tools libraries; } // tools // libraries);
|
||||
|
||||
darwin = super.darwin // {
|
||||
darwin = super.darwin.overrideScope (selfDarwin: _: {
|
||||
binutils = darwin.binutils.override {
|
||||
coreutils = self.coreutils;
|
||||
libc = self.darwin.Libsystem;
|
||||
libc = selfDarwin.Libsystem;
|
||||
};
|
||||
};
|
||||
});
|
||||
};
|
||||
in with prevStage; stageFun 1 prevStage {
|
||||
extraPreHook = "export NIX_CFLAGS_COMPILE+=\" -F${bootstrapTools}/Library/Frameworks\"";
|
||||
|
@ -337,11 +337,11 @@ in rec {
|
|||
});
|
||||
in { inherit tools libraries; } // tools // libraries);
|
||||
|
||||
darwin = super.darwin // {
|
||||
darwin = super.darwin.overrideScope (_: _: {
|
||||
inherit (darwin)
|
||||
binutils dyld Libsystem xnu configd ICU libdispatch libclosure
|
||||
launchd CF darwin-stubs;
|
||||
};
|
||||
});
|
||||
};
|
||||
in with prevStage; stageFun 2 prevStage {
|
||||
extraPreHook = ''
|
||||
|
@ -382,11 +382,11 @@ in rec {
|
|||
});
|
||||
in { inherit libraries; } // libraries);
|
||||
|
||||
darwin = super.darwin // {
|
||||
darwin = super.darwin.overrideScope (_: _: {
|
||||
inherit (darwin)
|
||||
dyld Libsystem xnu configd libdispatch libclosure launchd libiconv
|
||||
locale darwin-stubs;
|
||||
};
|
||||
});
|
||||
};
|
||||
in with prevStage; stageFun 3 prevStage {
|
||||
shell = "${pkgs.bash}/bin/bash";
|
||||
|
@ -442,14 +442,14 @@ in rec {
|
|||
});
|
||||
in { inherit tools libraries; } // tools // libraries);
|
||||
|
||||
darwin = super.darwin // rec {
|
||||
darwin = super.darwin.overrideScope (_: superDarwin: {
|
||||
inherit (darwin) dyld Libsystem libiconv locale darwin-stubs;
|
||||
|
||||
CF = super.darwin.CF.override {
|
||||
CF = superDarwin.CF.override {
|
||||
inherit libxml2;
|
||||
python3 = prevStage.python3;
|
||||
};
|
||||
};
|
||||
});
|
||||
};
|
||||
in with prevStage; stageFun 4 prevStage {
|
||||
shell = "${pkgs.bash}/bin/bash";
|
||||
|
@ -480,11 +480,11 @@ in rec {
|
|||
});
|
||||
in { inherit tools libraries; } // tools // libraries);
|
||||
|
||||
darwin = super.darwin // {
|
||||
darwin = super.darwin.overrideScope (_: _: {
|
||||
inherit (darwin) dyld ICU Libsystem libiconv;
|
||||
} // lib.optionalAttrs (super.stdenv.targetPlatform == localSystem) {
|
||||
inherit (darwin) binutils binutils-unwrapped cctools;
|
||||
};
|
||||
});
|
||||
} // lib.optionalAttrs (super.stdenv.targetPlatform == localSystem) {
|
||||
# Need to get rid of these when cross-compiling.
|
||||
inherit binutils binutils-unwrapped;
|
||||
|
@ -537,14 +537,14 @@ in rec {
|
|||
]);
|
||||
|
||||
overrides = lib.composeExtensions persistent (self: super: {
|
||||
darwin = super.darwin.overrideScope (_: superDarwin: {
|
||||
inherit (prevStage.darwin) CF darwin-stubs;
|
||||
xnu = superDarwin.xnu.override { inherit (prevStage) python3; };
|
||||
});
|
||||
} // lib.optionalAttrs (super.stdenv.targetPlatform == localSystem) {
|
||||
clang = cc;
|
||||
llvmPackages = super.llvmPackages // { clang = cc; };
|
||||
inherit cc;
|
||||
|
||||
darwin = super.darwin // {
|
||||
inherit (prevStage.darwin) CF darwin-stubs;
|
||||
xnu = super.darwin.xnu.override { inherit (prevStage) python3; };
|
||||
};
|
||||
});
|
||||
};
|
||||
|
||||
|
|
|
@ -10395,15 +10395,7 @@ in
|
|||
# The GCC used to build libc for the target platform. Normal gccs will be
|
||||
# built with, and use, that cross-compiled libc.
|
||||
gccCrossStageStatic = assert stdenv.targetPlatform != stdenv.hostPlatform; let
|
||||
libcCross1 =
|
||||
if stdenv.targetPlatform.libc == "msvcrt" then targetPackages.windows.mingw_w64_headers
|
||||
else if stdenv.targetPlatform.libc == "libSystem" then darwin.xcode
|
||||
else if stdenv.targetPlatform.libc == "nblibc" then netbsd.headers
|
||||
else null;
|
||||
binutils1 = wrapBintoolsWith {
|
||||
bintools = binutils-unwrapped;
|
||||
libc = libcCross1;
|
||||
};
|
||||
libcCross1 = binutilsNoLibc.libc;
|
||||
in wrapCCWith {
|
||||
cc = gccFun {
|
||||
# copy-pasted
|
||||
|
@ -10416,10 +10408,10 @@ in
|
|||
crossStageStatic = true;
|
||||
langCC = false;
|
||||
libcCross = libcCross1;
|
||||
targetPackages.stdenv.cc.bintools = binutils1;
|
||||
targetPackages.stdenv.cc.bintools = binutilsNoLibc;
|
||||
enableShared = false;
|
||||
};
|
||||
bintools = binutils1;
|
||||
bintools = binutilsNoLibc;
|
||||
libc = libcCross1;
|
||||
extraPackages = [];
|
||||
};
|
||||
|
@ -12532,6 +12524,14 @@ in
|
|||
gold = false;
|
||||
};
|
||||
});
|
||||
binutilsNoLibc = wrapBintoolsWith {
|
||||
bintools = binutils-unwrapped;
|
||||
libc =
|
||||
/**/ if stdenv.targetPlatform.libc == "msvcrt" then targetPackages.windows.mingw_w64_headers
|
||||
else if stdenv.targetPlatform.libc == "libSystem" then darwin.xcode
|
||||
else if stdenv.targetPlatform.libc == "nblibc" then targetPackages.netbsdCross.headers
|
||||
else null;
|
||||
};
|
||||
|
||||
bison = callPackage ../development/tools/parsing/bison { };
|
||||
|
||||
|
|
|
@ -1,27 +1,44 @@
|
|||
{ buildPackages, pkgs, targetPackages
|
||||
, darwin, stdenv, callPackage, callPackages, newScope
|
||||
{ lib
|
||||
, buildPackages, pkgs, targetPackages
|
||||
, pkgsBuildBuild, pkgsBuildHost, pkgsBuildTarget, pkgsHostHost, pkgsTargetTarget
|
||||
, stdenv, splicePackages, newScope
|
||||
}:
|
||||
|
||||
let
|
||||
apple-source-releases = callPackage ../os-specific/darwin/apple-source-releases { };
|
||||
otherSplices = {
|
||||
selfBuildBuild = pkgsBuildBuild.darwin;
|
||||
selfBuildHost = pkgsBuildHost.darwin;
|
||||
selfBuildTarget = pkgsBuildTarget.darwin;
|
||||
selfHostHost = pkgsHostHost.darwin;
|
||||
selfTargetTarget = pkgsTargetTarget.darwin or {}; # might be missing
|
||||
};
|
||||
|
||||
impure-cmds = callPackage ../os-specific/darwin/impure-cmds { };
|
||||
in
|
||||
|
||||
(impure-cmds // apple-source-releases // {
|
||||
lib.makeScopeWithSplicing splicePackages newScope otherSplices (_: {}) (spliced: spliced.apple_sdk.frameworks) (self: let
|
||||
inherit (self) mkDerivation callPackage;
|
||||
|
||||
callPackage = newScope (darwin.apple_sdk.frameworks // darwin);
|
||||
# Must use pkgs.callPackage to avoid infinite recursion.
|
||||
|
||||
apple-source-releases = pkgs.callPackage ../os-specific/darwin/apple-source-releases { } self;
|
||||
|
||||
impure-cmds = pkgs.callPackage ../os-specific/darwin/impure-cmds { };
|
||||
|
||||
apple_sdk = pkgs.callPackage ../os-specific/darwin/apple-sdk {
|
||||
inherit (buildPackages.darwin) print-reexports;
|
||||
inherit (self) darwin-stubs;
|
||||
};
|
||||
in
|
||||
|
||||
impure-cmds // apple-source-releases // {
|
||||
|
||||
inherit apple_sdk;
|
||||
|
||||
stdenvNoCF = stdenv.override {
|
||||
extraBuildInputs = [];
|
||||
};
|
||||
|
||||
apple_sdk = callPackage ../os-specific/darwin/apple-sdk {
|
||||
inherit (darwin) darwin-stubs print-reexports;
|
||||
};
|
||||
|
||||
binutils-unwrapped = callPackage ../os-specific/darwin/binutils {
|
||||
inherit (darwin) cctools;
|
||||
inherit (pkgs) binutils-unwrapped;
|
||||
inherit (pkgs.llvmPackages_7) llvm clang-unwrapped;
|
||||
};
|
||||
|
@ -31,17 +48,21 @@ in
|
|||
if stdenv.targetPlatform != stdenv.hostPlatform
|
||||
then pkgs.libcCross
|
||||
else pkgs.stdenv.cc.libc;
|
||||
bintools = darwin.binutils-unwrapped;
|
||||
bintools = self.binutils-unwrapped;
|
||||
};
|
||||
|
||||
binutilsNoLibc = pkgs.wrapBintoolsWith {
|
||||
libc = null;
|
||||
bintools = self.binutils-unwrapped;
|
||||
};
|
||||
|
||||
cctools = callPackage ../os-specific/darwin/cctools/port.nix {
|
||||
inherit (darwin) libobjc maloader libtapi;
|
||||
stdenv = if stdenv.isDarwin then stdenv else pkgs.libcxxStdenv;
|
||||
libcxxabi = pkgs.libcxxabi;
|
||||
};
|
||||
|
||||
# TODO: remove alias.
|
||||
cf-private = darwin.apple_sdk.frameworks.CoreFoundation;
|
||||
cf-private = self.apple_sdk.frameworks.CoreFoundation;
|
||||
|
||||
DarwinTools = callPackage ../os-specific/darwin/DarwinTools { };
|
||||
|
||||
|
@ -50,15 +71,13 @@ in
|
|||
print-reexports = callPackage ../os-specific/darwin/apple-sdk/print-reexports { };
|
||||
|
||||
maloader = callPackage ../os-specific/darwin/maloader {
|
||||
inherit (darwin) opencflite;
|
||||
};
|
||||
|
||||
insert_dylib = callPackage ../os-specific/darwin/insert_dylib { };
|
||||
|
||||
iosSdkPkgs = darwin.callPackage ../os-specific/darwin/xcode/sdk-pkgs.nix {
|
||||
iosSdkPkgs = callPackage ../os-specific/darwin/xcode/sdk-pkgs.nix {
|
||||
buildIosSdk = buildPackages.darwin.iosSdkPkgs.sdk;
|
||||
targetIosSdkPkgs = targetPackages.darwin.iosSdkPkgs;
|
||||
xcode = darwin.xcode;
|
||||
inherit (pkgs.llvmPackages) clang-unwrapped;
|
||||
};
|
||||
|
||||
|
@ -70,13 +89,13 @@ in
|
|||
|
||||
opencflite = callPackage ../os-specific/darwin/opencflite { };
|
||||
|
||||
stubs = callPackages ../os-specific/darwin/stubs { };
|
||||
stubs = pkgs.callPackages ../os-specific/darwin/stubs { };
|
||||
|
||||
trash = darwin.callPackage ../os-specific/darwin/trash { };
|
||||
trash = callPackage ../os-specific/darwin/trash { };
|
||||
|
||||
usr-include = callPackage ../os-specific/darwin/usr-include { };
|
||||
|
||||
inherit (callPackages ../os-specific/darwin/xcode { })
|
||||
inherit (pkgs.callPackages ../os-specific/darwin/xcode { })
|
||||
xcode_8_1 xcode_8_2
|
||||
xcode_9_1 xcode_9_2 xcode_9_4 xcode_9_4_1
|
||||
xcode_10_2 xcode_10_2_1 xcode_10_3
|
||||
|
@ -85,10 +104,10 @@ in
|
|||
|
||||
CoreSymbolication = callPackage ../os-specific/darwin/CoreSymbolication { };
|
||||
|
||||
CF = callPackage ../os-specific/darwin/swift-corelibs/corefoundation.nix { inherit (darwin) objc4 ICU; };
|
||||
CF = callPackage ../os-specific/darwin/swift-corelibs/corefoundation.nix { };
|
||||
|
||||
# As the name says, this is broken, but I don't want to lose it since it's a direction we want to go in
|
||||
# libdispatch-broken = callPackage ../os-specific/darwin/swift-corelibs/libdispatch.nix { inherit (darwin) apple_sdk_sierra xnu; };
|
||||
# libdispatch-broken = callPackage ../os-specific/darwin/swift-corelibs/libdispatch.nix { };
|
||||
|
||||
darling = callPackage ../os-specific/darwin/darling/default.nix { };
|
||||
|
||||
|
@ -96,8 +115,6 @@ in
|
|||
|
||||
ios-deploy = callPackage ../os-specific/darwin/ios-deploy {};
|
||||
|
||||
discrete-scroll = callPackage ../os-specific/darwin/discrete-scroll {
|
||||
inherit (darwin.apple_sdk.frameworks) Cocoa;
|
||||
};
|
||||
discrete-scroll = callPackage ../os-specific/darwin/discrete-scroll { };
|
||||
|
||||
})
|
||||
|
|
|
@ -25,7 +25,7 @@ self: super: let
|
|||
}; in stdenv // {
|
||||
mkDerivation = args: stdenv.mkDerivation (args // {
|
||||
NIX_CFLAGS_LINK = toString (args.NIX_CFLAGS_LINK or "")
|
||||
+ optionalString stdenv.cc.isGNU " -static-libgcc";
|
||||
+ optionalString (stdenv_.cc.isGNU or false) " -static-libgcc";
|
||||
nativeBuildInputs = (args.nativeBuildInputs or []) ++ [ (makeSetupHook {
|
||||
substitutions = {
|
||||
libsystem = "${stdenv.cc.libc}/lib/libSystem.B.dylib";
|
||||
|
|
Loading…
Reference in a new issue