2023-05-10 07:03:00 +00:00
|
|
|
|
# This file contains the standard build environment for Darwin. It is based on LLVM and is patterned
|
|
|
|
|
# after the Linux stdenv. It shares similar goals to the Linux standard environment in that the
|
|
|
|
|
# resulting environment should be built purely and not contain any references to it.
|
|
|
|
|
#
|
|
|
|
|
# For more on the design of the stdenv and updating it, see `README.md`.
|
|
|
|
|
#
|
|
|
|
|
# See also the top comments of the Linux stdenv `../linux/default.nix` for a good overview of
|
|
|
|
|
# the bootstrap process and working with it.
|
|
|
|
|
|
2024-08-11 18:04:21 +00:00
|
|
|
|
{
|
|
|
|
|
lib,
|
|
|
|
|
localSystem,
|
|
|
|
|
crossSystem,
|
|
|
|
|
config,
|
|
|
|
|
overlays,
|
|
|
|
|
crossOverlays ? [ ],
|
2021-06-02 04:25:56 +00:00
|
|
|
|
# Allow passing in bootstrap files directly so we can test the stdenv bootstrap process when changing the bootstrap tools
|
2024-06-05 04:19:38 +00:00
|
|
|
|
bootstrapFiles ? (config.replaceBootstrapFiles or lib.id) (
|
2024-08-11 18:04:21 +00:00
|
|
|
|
if localSystem.isAarch64 then
|
|
|
|
|
import ./bootstrap-files/aarch64-apple-darwin.nix
|
|
|
|
|
else
|
2024-06-05 04:19:38 +00:00
|
|
|
|
import ./bootstrap-files/x86_64-apple-darwin.nix
|
|
|
|
|
),
|
2015-06-18 17:03:32 +00:00
|
|
|
|
}:
|
|
|
|
|
|
2018-12-05 03:06:46 +00:00
|
|
|
|
assert crossSystem == localSystem;
|
2016-11-30 23:51:13 +00:00
|
|
|
|
|
2015-06-18 17:03:32 +00:00
|
|
|
|
let
|
2021-01-24 22:51:12 +00:00
|
|
|
|
inherit (localSystem) system;
|
2016-12-24 18:55:11 +00:00
|
|
|
|
|
2024-09-25 01:43:34 +00:00
|
|
|
|
sdkMajorVersion =
|
|
|
|
|
let
|
|
|
|
|
inherit (localSystem) darwinSdkVersion;
|
|
|
|
|
in
|
|
|
|
|
if lib.versionOlder darwinSdkVersion "11" then
|
|
|
|
|
lib.versions.majorMinor darwinSdkVersion
|
|
|
|
|
else
|
|
|
|
|
lib.versions.major darwinSdkVersion;
|
2020-11-19 08:28:20 +00:00
|
|
|
|
|
2017-11-14 15:36:04 +00:00
|
|
|
|
commonImpureHostDeps = [
|
|
|
|
|
"/bin/sh"
|
|
|
|
|
"/usr/lib/libSystem.B.dylib"
|
2017-11-14 20:13:31 +00:00
|
|
|
|
"/usr/lib/system/libunc.dylib" # This dependency is "hidden", so our scanning code doesn't pick it up
|
2017-11-14 15:36:04 +00:00
|
|
|
|
];
|
2020-11-19 08:28:20 +00:00
|
|
|
|
|
2023-05-10 07:03:00 +00:00
|
|
|
|
isFromNixpkgs = pkg: !(isFromBootstrapFiles pkg);
|
2024-08-11 18:04:21 +00:00
|
|
|
|
isFromBootstrapFiles = pkg: pkg.passthru.isFromBootstrapFiles or false;
|
|
|
|
|
isBuiltByNixpkgsCompiler = pkg: isFromNixpkgs pkg && isFromNixpkgs pkg.stdenv.cc.cc;
|
|
|
|
|
isBuiltByBootstrapFilesCompiler = pkg: isFromNixpkgs pkg && isFromBootstrapFiles pkg.stdenv.cc.cc;
|
2023-05-10 07:03:00 +00:00
|
|
|
|
|
2024-09-25 01:43:34 +00:00
|
|
|
|
# Dependencies in dependency sets should be mutually exclusive.
|
|
|
|
|
mergeDisjointAttrs = lib.foldl' lib.attrsets.unionOfDisjoint { };
|
|
|
|
|
|
2023-07-26 01:25:46 +00:00
|
|
|
|
commonPreHook = ''
|
2020-01-13 16:46:11 +00:00
|
|
|
|
export NIX_ENFORCE_NO_NATIVE=''${NIX_ENFORCE_NO_NATIVE-1}
|
|
|
|
|
export NIX_ENFORCE_PURITY=''${NIX_ENFORCE_PURITY-1}
|
2015-06-18 17:03:32 +00:00
|
|
|
|
export NIX_IGNORE_LD_THROUGH_GCC=1
|
|
|
|
|
'';
|
|
|
|
|
|
2024-08-11 18:04:21 +00:00
|
|
|
|
bootstrapTools =
|
|
|
|
|
derivation (
|
|
|
|
|
{
|
|
|
|
|
inherit system;
|
2015-06-18 17:03:32 +00:00
|
|
|
|
|
2024-08-11 18:04:21 +00:00
|
|
|
|
name = "bootstrap-tools";
|
|
|
|
|
builder = "${bootstrapFiles.unpack}/bin/bash";
|
2015-06-18 17:03:32 +00:00
|
|
|
|
|
2024-08-11 18:04:21 +00:00
|
|
|
|
args = [
|
|
|
|
|
"${bootstrapFiles.unpack}/bootstrap-tools-unpack.sh"
|
|
|
|
|
bootstrapFiles.bootstrapTools
|
|
|
|
|
];
|
2024-03-20 16:28:21 +00:00
|
|
|
|
|
2024-08-11 18:04:21 +00:00
|
|
|
|
PATH = lib.makeBinPath [
|
|
|
|
|
(placeholder "out")
|
|
|
|
|
bootstrapFiles.unpack
|
|
|
|
|
];
|
2015-06-18 17:03:32 +00:00
|
|
|
|
|
2024-08-11 18:04:21 +00:00
|
|
|
|
__impureHostDeps = commonImpureHostDeps;
|
|
|
|
|
}
|
|
|
|
|
// lib.optionalAttrs config.contentAddressedByDefault {
|
|
|
|
|
__contentAddressed = true;
|
|
|
|
|
outputHashAlgo = "sha256";
|
|
|
|
|
outputHashMode = "recursive";
|
|
|
|
|
}
|
|
|
|
|
)
|
|
|
|
|
// {
|
|
|
|
|
passthru.isFromBootstrapFiles = true;
|
|
|
|
|
};
|
2018-02-25 22:03:40 +00:00
|
|
|
|
|
2024-08-11 18:04:21 +00:00
|
|
|
|
stageFun =
|
|
|
|
|
prevStage:
|
|
|
|
|
{
|
|
|
|
|
name,
|
|
|
|
|
overrides ? (self: super: { }),
|
|
|
|
|
extraNativeBuildInputs ? [ ],
|
|
|
|
|
extraPreHook ? "",
|
|
|
|
|
}:
|
2017-08-26 15:43:30 +00:00
|
|
|
|
|
2023-05-10 07:03:00 +00:00
|
|
|
|
let
|
2024-08-11 18:04:21 +00:00
|
|
|
|
cc =
|
|
|
|
|
if prevStage.llvmPackages.clang-unwrapped == null then
|
|
|
|
|
null
|
|
|
|
|
else
|
2024-09-25 01:43:34 +00:00
|
|
|
|
prevStage.wrapCCWith {
|
2024-08-11 18:04:21 +00:00
|
|
|
|
name = "${name}-clang-wrapper";
|
|
|
|
|
|
|
|
|
|
nativeTools = false;
|
|
|
|
|
nativeLibc = false;
|
|
|
|
|
|
|
|
|
|
expand-response-params = lib.optionalString (
|
|
|
|
|
prevStage.stdenv.hasCC or false && prevStage.stdenv.cc != "/dev/null"
|
|
|
|
|
) prevStage.expand-response-params;
|
|
|
|
|
|
|
|
|
|
extraPackages = [ prevStage.llvmPackages.compiler-rt ];
|
|
|
|
|
|
|
|
|
|
extraBuildCommands =
|
|
|
|
|
let
|
2024-09-25 01:43:34 +00:00
|
|
|
|
inherit (prevStage.llvmPackages) clang-unwrapped compiler-rt;
|
2024-08-11 18:04:21 +00:00
|
|
|
|
in
|
|
|
|
|
''
|
|
|
|
|
function clangResourceRootIncludePath() {
|
|
|
|
|
clangLib="$1/lib/clang"
|
|
|
|
|
if (( $(ls "$clangLib" | wc -l) > 1 )); then
|
|
|
|
|
echo "Multiple LLVM versions were found at "$clangLib", but there must only be one used when building the stdenv." >&2
|
|
|
|
|
exit 1
|
|
|
|
|
fi
|
|
|
|
|
echo "$clangLib/$(ls -1 "$clangLib")/include"
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
rsrc="$out/resource-root"
|
|
|
|
|
mkdir "$rsrc"
|
|
|
|
|
ln -s "$(clangResourceRootIncludePath "${clang-unwrapped.lib}")" "$rsrc"
|
|
|
|
|
ln -s "${compiler-rt.out}/lib" "$rsrc/lib"
|
|
|
|
|
ln -s "${compiler-rt.out}/share" "$rsrc/share"
|
|
|
|
|
echo "-resource-dir=$rsrc" >> $out/nix-support/cc-cflags
|
|
|
|
|
'';
|
2017-08-26 15:43:30 +00:00
|
|
|
|
|
2024-08-11 18:04:21 +00:00
|
|
|
|
cc = prevStage.llvmPackages.clang-unwrapped;
|
|
|
|
|
bintools = prevStage.darwin.binutils;
|
2018-02-25 22:03:40 +00:00
|
|
|
|
|
2024-08-11 18:04:21 +00:00
|
|
|
|
isClang = true;
|
2024-09-25 01:43:34 +00:00
|
|
|
|
libc = prevStage.darwin.libSystem;
|
2024-08-11 18:04:21 +00:00
|
|
|
|
inherit (prevStage.llvmPackages) libcxx;
|
2020-11-19 08:28:20 +00:00
|
|
|
|
|
2024-08-11 18:04:21 +00:00
|
|
|
|
inherit lib;
|
|
|
|
|
inherit (prevStage) coreutils gnugrep;
|
2020-11-19 08:28:20 +00:00
|
|
|
|
|
2024-08-11 18:04:21 +00:00
|
|
|
|
stdenvNoCC = prevStage.ccWrapperStdenv;
|
|
|
|
|
runtimeShell = prevStage.ccWrapperStdenv.shell;
|
|
|
|
|
};
|
2023-05-10 07:03:00 +00:00
|
|
|
|
|
2023-07-09 17:00:13 +00:00
|
|
|
|
bash = prevStage.bash or bootstrapTools;
|
|
|
|
|
|
2023-05-10 07:03:00 +00:00
|
|
|
|
thisStdenv = import ../generic {
|
|
|
|
|
name = "${name}-stdenv-darwin";
|
2015-06-18 17:03:32 +00:00
|
|
|
|
|
2017-07-06 01:47:48 +00:00
|
|
|
|
buildPlatform = localSystem;
|
|
|
|
|
hostPlatform = localSystem;
|
|
|
|
|
targetPlatform = localSystem;
|
|
|
|
|
|
2024-02-04 18:07:09 +00:00
|
|
|
|
inherit config;
|
2015-06-18 17:03:32 +00:00
|
|
|
|
|
2024-09-25 01:43:34 +00:00
|
|
|
|
extraBuildInputs = [ prevStage.apple-sdk ];
|
|
|
|
|
inherit extraNativeBuildInputs;
|
2023-05-10 07:03:00 +00:00
|
|
|
|
|
2024-08-11 18:04:21 +00:00
|
|
|
|
preHook =
|
|
|
|
|
lib.optionalString (!isBuiltByNixpkgsCompiler bash) ''
|
|
|
|
|
# Don't patch #!/interpreter because it leads to retained
|
|
|
|
|
# dependencies on the bootstrapTools in the final stdenv.
|
|
|
|
|
dontPatchShebangs=1
|
|
|
|
|
''
|
|
|
|
|
+ ''
|
|
|
|
|
${commonPreHook}
|
|
|
|
|
${extraPreHook}
|
|
|
|
|
''
|
|
|
|
|
+ lib.optionalString (prevStage.darwin ? locale) ''
|
|
|
|
|
export PATH_LOCALE=${prevStage.darwin.locale}/share/locale
|
|
|
|
|
'';
|
2023-05-10 07:03:00 +00:00
|
|
|
|
|
2023-07-09 17:00:13 +00:00
|
|
|
|
shell = bash + "/bin/bash";
|
2024-08-11 18:04:21 +00:00
|
|
|
|
initialPath = [
|
|
|
|
|
bash
|
|
|
|
|
bootstrapTools
|
|
|
|
|
];
|
2017-05-22 01:37:16 +00:00
|
|
|
|
|
2015-06-18 17:03:32 +00:00
|
|
|
|
fetchurlBoot = import ../../build-support/fetchurl {
|
2018-02-17 18:44:43 +00:00
|
|
|
|
inherit lib;
|
2023-05-10 07:03:00 +00:00
|
|
|
|
stdenvNoCC = prevStage.ccWrapperStdenv or thisStdenv;
|
2018-01-09 23:38:19 +00:00
|
|
|
|
curl = bootstrapTools;
|
2015-06-18 17:03:32 +00:00
|
|
|
|
};
|
|
|
|
|
|
2023-05-10 07:03:00 +00:00
|
|
|
|
inherit cc;
|
|
|
|
|
|
2015-06-18 17:03:32 +00:00
|
|
|
|
# The stdenvs themselves don't use mkDerivation, so I need to specify this here
|
2017-11-14 15:36:04 +00:00
|
|
|
|
__stdenvImpureHostDeps = commonImpureHostDeps;
|
|
|
|
|
__extraImpureHostDeps = commonImpureHostDeps;
|
2015-06-18 17:03:32 +00:00
|
|
|
|
|
2024-03-17 20:44:56 +00:00
|
|
|
|
# Using the bootstrap tools curl for fetchers allows the stdenv bootstrap to avoid
|
|
|
|
|
# having a dependency on curl, allowing curl to be updated without triggering a
|
|
|
|
|
# new stdenv bootstrap on Darwin.
|
2024-08-11 18:04:21 +00:00
|
|
|
|
overrides =
|
|
|
|
|
self: super:
|
|
|
|
|
(overrides self super)
|
|
|
|
|
// {
|
|
|
|
|
fetchurl = thisStdenv.fetchurlBoot;
|
|
|
|
|
fetchpatch = super.fetchpatch.override { inherit (self) fetchurl; };
|
|
|
|
|
fetchzip = super.fetchzip.override { inherit (self) fetchurl; };
|
|
|
|
|
};
|
2015-06-18 17:03:32 +00:00
|
|
|
|
};
|
|
|
|
|
|
2021-06-02 04:25:56 +00:00
|
|
|
|
in
|
|
|
|
|
{
|
2016-12-24 18:55:11 +00:00
|
|
|
|
inherit config overlays;
|
2016-12-16 13:22:02 +00:00
|
|
|
|
stdenv = thisStdenv;
|
|
|
|
|
};
|
2024-09-25 01:43:34 +00:00
|
|
|
|
|
|
|
|
|
# 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
|
2024-10-10 23:24:52 +00:00
|
|
|
|
bmake
|
2024-09-25 01:43:34 +00:00
|
|
|
|
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
|
|
|
|
|
;
|
|
|
|
|
};
|
|
|
|
|
|
2024-10-11 21:32:36 +00:00
|
|
|
|
darwinPackages = prevStage: { inherit (prevStage.darwin) sigtool; };
|
2024-09-25 01:43:34 +00:00
|
|
|
|
darwinPackagesNoCC = prevStage: {
|
2024-10-11 21:32:36 +00:00
|
|
|
|
inherit (prevStage.darwin)
|
|
|
|
|
binutils
|
|
|
|
|
binutils-unwrapped
|
|
|
|
|
libSystem
|
|
|
|
|
locale
|
|
|
|
|
;
|
2024-09-25 01:43:34 +00:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
# 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; };
|
|
|
|
|
|
2023-05-10 07:03:00 +00:00
|
|
|
|
in
|
2024-08-11 18:04:21 +00:00
|
|
|
|
assert bootstrapTools.passthru.isFromBootstrapFiles or false; # sanity check
|
2023-05-10 07:03:00 +00:00
|
|
|
|
[
|
2024-08-11 18:04:21 +00:00
|
|
|
|
(
|
|
|
|
|
{ }:
|
|
|
|
|
{
|
|
|
|
|
__raw = true;
|
2015-06-18 17:03:32 +00:00
|
|
|
|
|
2024-09-25 01:43:34 +00:00
|
|
|
|
apple-sdk = null;
|
|
|
|
|
|
|
|
|
|
cctools = null;
|
|
|
|
|
ld64 = null;
|
2023-05-10 07:03:00 +00:00
|
|
|
|
|
2024-08-11 18:04:21 +00:00
|
|
|
|
coreutils = null;
|
|
|
|
|
gnugrep = null;
|
2024-06-25 04:01:25 +00:00
|
|
|
|
|
2024-08-11 18:04:21 +00:00
|
|
|
|
pbzx = null;
|
|
|
|
|
cpio = null;
|
2024-07-01 22:33:24 +00:00
|
|
|
|
|
2024-09-25 01:43:34 +00:00
|
|
|
|
jq = null;
|
|
|
|
|
|
2024-08-11 18:04:21 +00:00
|
|
|
|
darwin = {
|
|
|
|
|
binutils = null;
|
|
|
|
|
binutils-unwrapped = null;
|
2024-09-25 01:43:34 +00:00
|
|
|
|
libSystem = null;
|
2024-08-11 18:04:21 +00:00
|
|
|
|
sigtool = null;
|
2024-07-01 22:33:24 +00:00
|
|
|
|
};
|
|
|
|
|
|
2024-08-11 18:04:21 +00:00
|
|
|
|
llvmPackages = {
|
|
|
|
|
clang-unwrapped = null;
|
|
|
|
|
compiler-rt = null;
|
2024-09-25 01:43:34 +00:00
|
|
|
|
libcxx = null;
|
|
|
|
|
libllvm = null;
|
2024-07-01 22:33:24 +00:00
|
|
|
|
};
|
2024-08-11 18:04:21 +00:00
|
|
|
|
}
|
|
|
|
|
)
|
2024-07-01 22:33:24 +00:00
|
|
|
|
|
2024-08-11 18:04:21 +00:00
|
|
|
|
# Create a stage with the bootstrap tools. This will be used to build the subsequent stages and
|
|
|
|
|
# build up the standard environment.
|
|
|
|
|
#
|
|
|
|
|
# Note: Each stage depends only on the the packages in `prevStage`. If a package is not to be
|
|
|
|
|
# rebuilt, it should be passed through by inheriting it.
|
|
|
|
|
(
|
|
|
|
|
prevStage:
|
|
|
|
|
stageFun prevStage {
|
|
|
|
|
name = "bootstrap-stage0";
|
2020-11-19 08:28:20 +00:00
|
|
|
|
|
2024-08-11 18:04:21 +00:00
|
|
|
|
overrides = self: super: {
|
|
|
|
|
# We thread stage0's stdenv through under this name so downstream stages
|
|
|
|
|
# can use it for wrapping gcc too. This way, downstream stages don't need
|
|
|
|
|
# to refer to this stage directly, which violates the principle that each
|
|
|
|
|
# stage should only access the stage that came before it.
|
|
|
|
|
ccWrapperStdenv = self.stdenv;
|
|
|
|
|
|
|
|
|
|
bash = bootstrapTools // {
|
|
|
|
|
shellPath = "/bin/bash";
|
|
|
|
|
};
|
2020-11-19 08:28:20 +00:00
|
|
|
|
|
2024-08-11 18:04:21 +00:00
|
|
|
|
coreutils = bootstrapTools;
|
|
|
|
|
cpio = bootstrapTools;
|
|
|
|
|
gnugrep = bootstrapTools;
|
|
|
|
|
pbzx = bootstrapTools;
|
2024-07-01 22:33:24 +00:00
|
|
|
|
|
2024-09-25 01:43:34 +00:00
|
|
|
|
jq = null;
|
2024-07-01 22:33:24 +00:00
|
|
|
|
|
2024-09-25 01:43:34 +00:00
|
|
|
|
cctools = bootstrapTools // {
|
|
|
|
|
libtool = bootstrapTools;
|
|
|
|
|
targetPrefix = "";
|
|
|
|
|
version = "boot";
|
2024-08-11 18:04:21 +00:00
|
|
|
|
};
|
2024-06-25 04:01:25 +00:00
|
|
|
|
|
2024-08-11 18:04:21 +00:00
|
|
|
|
ld64 = bootstrapTools // {
|
|
|
|
|
targetPrefix = "";
|
|
|
|
|
version = "boot";
|
2023-05-10 07:03:00 +00:00
|
|
|
|
};
|
2020-11-19 08:28:20 +00:00
|
|
|
|
|
2024-08-11 18:04:21 +00:00
|
|
|
|
darwin = super.darwin.overrideScope (
|
2024-09-25 01:43:34 +00:00
|
|
|
|
selfDarwin: superDarwin: {
|
2024-08-11 18:04:21 +00:00
|
|
|
|
binutils = super.wrapBintoolsWith {
|
|
|
|
|
name = "bootstrap-stage0-binutils-wrapper";
|
2023-05-10 07:03:00 +00:00
|
|
|
|
|
2024-08-11 18:04:21 +00:00
|
|
|
|
nativeTools = false;
|
|
|
|
|
nativeLibc = false;
|
2020-12-16 04:59:18 +00:00
|
|
|
|
|
2024-08-11 18:04:21 +00:00
|
|
|
|
expand-response-params = "";
|
2024-09-25 01:43:34 +00:00
|
|
|
|
libc = selfDarwin.libSystem;
|
2020-12-16 04:59:18 +00:00
|
|
|
|
|
2024-08-11 18:04:21 +00:00
|
|
|
|
inherit lib;
|
|
|
|
|
inherit (self) stdenvNoCC coreutils gnugrep;
|
|
|
|
|
runtimeShell = self.stdenvNoCC.shell;
|
2020-12-16 04:59:18 +00:00
|
|
|
|
|
2024-08-11 18:04:21 +00:00
|
|
|
|
bintools = selfDarwin.binutils-unwrapped;
|
2020-12-16 04:59:18 +00:00
|
|
|
|
|
2024-08-11 18:04:21 +00:00
|
|
|
|
# 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
|
2020-12-16 04:59:18 +00:00
|
|
|
|
|
2024-08-11 18:04:21 +00:00
|
|
|
|
export signingUtils=${selfDarwin.signingUtils}
|
2020-12-16 04:59:18 +00:00
|
|
|
|
|
2024-08-11 18:04:21 +00:00
|
|
|
|
wrap \
|
|
|
|
|
install_name_tool ${../../build-support/bintools-wrapper/darwin-install_name_tool-wrapper.sh} \
|
|
|
|
|
"${selfDarwin.binutils-unwrapped}/bin/install_name_tool"
|
|
|
|
|
|
|
|
|
|
wrap \
|
|
|
|
|
strip ${../../build-support/bintools-wrapper/darwin-strip-wrapper.sh} \
|
|
|
|
|
"${selfDarwin.binutils-unwrapped}/bin/strip"
|
2023-05-10 07:03:00 +00:00
|
|
|
|
'';
|
|
|
|
|
};
|
2024-08-11 18:04:21 +00:00
|
|
|
|
|
|
|
|
|
binutils-unwrapped =
|
2024-09-25 01:43:34 +00:00
|
|
|
|
(superDarwin.binutils-unwrapped.override { enableManpages = false; }).overrideAttrs
|
|
|
|
|
(old: {
|
|
|
|
|
version = "boot";
|
|
|
|
|
passthru = (old.passthru or { }) // {
|
|
|
|
|
isFromBootstrapFiles = true;
|
|
|
|
|
};
|
|
|
|
|
});
|
2024-08-11 18:04:21 +00:00
|
|
|
|
|
|
|
|
|
locale = self.stdenv.mkDerivation {
|
|
|
|
|
name = "bootstrap-stage0-locale";
|
2023-05-10 07:03:00 +00:00
|
|
|
|
buildCommand = ''
|
2024-08-11 18:04:21 +00:00
|
|
|
|
mkdir -p $out/share/locale
|
2023-05-10 07:03:00 +00:00
|
|
|
|
'';
|
|
|
|
|
};
|
2024-08-11 18:04:21 +00:00
|
|
|
|
|
|
|
|
|
sigtool = bootstrapTools;
|
|
|
|
|
}
|
|
|
|
|
);
|
2020-07-31 14:03:51 +00:00
|
|
|
|
|
2024-08-11 18:04:21 +00:00
|
|
|
|
llvmPackages =
|
|
|
|
|
super.llvmPackages
|
|
|
|
|
// (
|
|
|
|
|
let
|
|
|
|
|
tools = super.llvmPackages.tools.extend (
|
|
|
|
|
selfTools: _: {
|
|
|
|
|
libclang = self.stdenv.mkDerivation {
|
|
|
|
|
name = "bootstrap-stage0-clang";
|
|
|
|
|
version = "boot";
|
|
|
|
|
outputs = [
|
|
|
|
|
"out"
|
|
|
|
|
"lib"
|
|
|
|
|
];
|
|
|
|
|
buildCommand = ''
|
|
|
|
|
mkdir -p $out/lib
|
|
|
|
|
ln -s $out $lib
|
|
|
|
|
ln -s ${bootstrapTools}/bin $out/bin
|
|
|
|
|
ln -s ${bootstrapTools}/lib/clang $out/lib
|
|
|
|
|
ln -s ${bootstrapTools}/include $out
|
|
|
|
|
'';
|
|
|
|
|
passthru = {
|
|
|
|
|
isFromBootstrapFiles = true;
|
|
|
|
|
hardeningUnsupportedFlags = [
|
|
|
|
|
"fortify3"
|
|
|
|
|
"shadowstack"
|
|
|
|
|
"stackclashprotection"
|
|
|
|
|
"zerocallusedregs"
|
|
|
|
|
];
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
libllvm = self.stdenv.mkDerivation {
|
|
|
|
|
name = "bootstrap-stage0-llvm";
|
|
|
|
|
outputs = [
|
|
|
|
|
"out"
|
|
|
|
|
"lib"
|
|
|
|
|
];
|
|
|
|
|
buildCommand = ''
|
|
|
|
|
mkdir -p $out/bin $out/lib
|
|
|
|
|
ln -s $out $lib
|
|
|
|
|
for tool in ${toString super.darwin.binutils-unwrapped.llvm_cmds}; do
|
|
|
|
|
cctoolsTool=''${tool//-/_}
|
|
|
|
|
toolsrc="${bootstrapTools}/bin/$cctoolsTool"
|
|
|
|
|
if [ -e "$toolsrc" ]; then
|
|
|
|
|
ln -s "$toolsrc" $out/bin/llvm-$tool
|
|
|
|
|
fi
|
|
|
|
|
done
|
|
|
|
|
ln -s ${bootstrapTools}/bin/dsymutil $out/bin/dsymutil
|
|
|
|
|
ln -s ${bootstrapTools}/lib/libLLVM* $out/lib
|
|
|
|
|
'';
|
|
|
|
|
passthru.isFromBootstrapFiles = true;
|
|
|
|
|
};
|
2024-09-25 01:43:34 +00:00
|
|
|
|
lld = self.stdenv.mkDerivation {
|
|
|
|
|
name = "bootstrap-stage0-lld";
|
|
|
|
|
buildCommand = "";
|
|
|
|
|
passthru = {
|
|
|
|
|
isLLVM = true;
|
|
|
|
|
isFromBootstrapFiles = true;
|
|
|
|
|
};
|
|
|
|
|
};
|
2024-08-11 18:04:21 +00:00
|
|
|
|
}
|
|
|
|
|
);
|
|
|
|
|
libraries = super.llvmPackages.libraries.extend (
|
|
|
|
|
_: _: {
|
2024-09-25 01:43:34 +00:00
|
|
|
|
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;
|
|
|
|
|
};
|
2024-08-11 18:04:21 +00:00
|
|
|
|
libcxx = self.stdenv.mkDerivation {
|
|
|
|
|
name = "bootstrap-stage0-libcxx";
|
|
|
|
|
buildCommand = ''
|
|
|
|
|
mkdir -p $out/lib $out/include
|
|
|
|
|
ln -s ${bootstrapTools}/lib/libc++.dylib $out/lib
|
|
|
|
|
ln -s ${bootstrapTools}/include/c++ $out/include
|
|
|
|
|
'';
|
|
|
|
|
passthru = {
|
|
|
|
|
isLLVM = true;
|
|
|
|
|
isFromBootstrapFiles = true;
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
);
|
|
|
|
|
in
|
|
|
|
|
{ inherit tools libraries; } // tools // libraries
|
|
|
|
|
);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
extraPreHook = ''
|
|
|
|
|
stripDebugFlags="-S" # llvm-strip does not support "-p" for Mach-O
|
|
|
|
|
'';
|
|
|
|
|
}
|
|
|
|
|
)
|
2023-05-10 07:03:00 +00:00
|
|
|
|
|
2024-06-25 04:01:25 +00:00
|
|
|
|
# This stage is primarily responsible for setting up versions of certain dependencies needed
|
|
|
|
|
# by the rest of the build process. This stage also builds CF and Libsystem to simplify assertions
|
|
|
|
|
# and assumptions for later by making sure both packages are present on x86_64-darwin and aarch64-darwin.
|
2024-08-11 18:04:21 +00:00
|
|
|
|
(
|
|
|
|
|
prevStage:
|
2023-05-10 07:03:00 +00:00
|
|
|
|
# previous stage0 stdenv:
|
2024-09-25 01:43:34 +00:00
|
|
|
|
assert allDeps isFromBootstrapFiles [
|
|
|
|
|
(llvmToolsPackages prevStage)
|
|
|
|
|
(llvmLibrariesPackages prevStage)
|
|
|
|
|
{
|
2024-08-11 18:04:21 +00:00
|
|
|
|
inherit (prevStage)
|
2024-09-25 01:43:34 +00:00
|
|
|
|
bash
|
2024-08-11 18:04:21 +00:00
|
|
|
|
cctools
|
|
|
|
|
coreutils
|
2024-09-25 01:43:34 +00:00
|
|
|
|
cpio
|
2024-08-11 18:04:21 +00:00
|
|
|
|
gnugrep
|
|
|
|
|
ld64
|
2024-09-25 01:43:34 +00:00
|
|
|
|
pbzx
|
2024-08-11 18:04:21 +00:00
|
|
|
|
;
|
2024-09-25 01:43:34 +00:00
|
|
|
|
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;
|
2024-08-11 18:04:21 +00:00
|
|
|
|
|
|
|
|
|
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;
|
2024-09-25 01:43:34 +00:00
|
|
|
|
|
|
|
|
|
# Use libiconvReal with gettext to break an infinite recursion.
|
|
|
|
|
gettext = super.gettext.override { libiconv = super.libiconvReal; };
|
2023-05-10 07:03:00 +00:00
|
|
|
|
|
2024-08-11 18:04:21 +00:00
|
|
|
|
# Disable tests because they use dejagnu, which fails to run.
|
|
|
|
|
libffi = super.libffi.override { doCheck = false; };
|
2023-05-10 07:03:00 +00:00
|
|
|
|
|
2024-08-11 18:04:21 +00:00
|
|
|
|
# Avoid pulling in a full python and its extra dependencies for the llvm/clang builds.
|
|
|
|
|
libxml2 = super.libxml2.override { pythonSupport = false; };
|
2023-05-10 07:03:00 +00:00
|
|
|
|
|
2024-09-25 01:43:34 +00:00
|
|
|
|
# Avoid pulling in openldap just to run Meson’s tests.
|
|
|
|
|
meson = super.meson.overrideAttrs { doInstallCheck = false; };
|
2024-08-11 18:04:21 +00:00
|
|
|
|
ninja = super.ninja.override { buildDocs = false; };
|
2023-05-10 07:03:00 +00:00
|
|
|
|
|
2024-09-25 01:43:34 +00:00
|
|
|
|
# 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;
|
2024-10-03 11:47:30 +00:00
|
|
|
|
# Workaround for ld64 crashes on x86_64-darwin. Remove after 11.0 is made the default.
|
|
|
|
|
inherit (prevStage) apple-sdk_11;
|
2024-09-25 01:43:34 +00:00
|
|
|
|
};
|
2023-05-10 07:03:00 +00:00
|
|
|
|
|
2024-09-25 01:43:34 +00:00
|
|
|
|
scons = super.scons.override { python3Packages = self.python3.pkgs; };
|
2024-07-21 01:32:38 +00:00
|
|
|
|
|
2024-10-02 23:07:09 +00:00
|
|
|
|
xar = super.xarMinimal;
|
|
|
|
|
|
2024-08-11 18:04:21 +00:00
|
|
|
|
darwin = super.darwin.overrideScope (
|
|
|
|
|
selfDarwin: superDarwin: {
|
|
|
|
|
signingUtils = prevStage.darwin.signingUtils.override { inherit (selfDarwin) sigtool; };
|
2015-06-18 17:03:32 +00:00
|
|
|
|
|
2024-08-11 18:04:21 +00:00
|
|
|
|
postLinkSignHook = prevStage.darwin.postLinkSignHook.override { inherit (selfDarwin) sigtool; };
|
2023-07-08 09:44:20 +00:00
|
|
|
|
|
2024-09-25 01:43:34 +00:00
|
|
|
|
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
|
2024-08-11 18:04:21 +00:00
|
|
|
|
binutils = superDarwin.binutils.override {
|
|
|
|
|
inherit (self) coreutils;
|
|
|
|
|
bintools = selfDarwin.binutils-unwrapped;
|
2024-09-25 01:43:34 +00:00
|
|
|
|
libc = selfDarwin.libSystem;
|
2024-07-01 22:33:24 +00:00
|
|
|
|
|
2024-09-25 01:43:34 +00:00
|
|
|
|
# Bootstrap tools cctools needs the hook and wrappers to make sure things are signed properly.
|
2024-08-11 18:04:21 +00:00
|
|
|
|
# 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
|
2024-07-01 22:33:24 +00:00
|
|
|
|
|
2024-08-11 18:04:21 +00:00
|
|
|
|
export signingUtils=${selfDarwin.signingUtils}
|
2024-07-01 22:33:24 +00:00
|
|
|
|
|
2024-08-11 18:04:21 +00:00
|
|
|
|
wrap \
|
|
|
|
|
install_name_tool ${../../build-support/bintools-wrapper/darwin-install_name_tool-wrapper.sh} \
|
|
|
|
|
"${selfDarwin.binutils-unwrapped}/bin/install_name_tool"
|
2024-07-01 22:33:24 +00:00
|
|
|
|
|
2024-08-11 18:04:21 +00:00
|
|
|
|
wrap \
|
|
|
|
|
strip ${../../build-support/bintools-wrapper/darwin-strip-wrapper.sh} \
|
|
|
|
|
"${selfDarwin.binutils-unwrapped}/bin/strip"
|
|
|
|
|
'';
|
|
|
|
|
};
|
2020-07-31 14:03:51 +00:00
|
|
|
|
|
2024-08-11 18:04:21 +00:00
|
|
|
|
# Avoid building unnecessary Python dependencies due to building LLVM manpages.
|
|
|
|
|
binutils-unwrapped = superDarwin.binutils-unwrapped.override {
|
|
|
|
|
inherit (self) cctools ld64;
|
|
|
|
|
enableManpages = false;
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
);
|
2015-06-18 17:03:32 +00:00
|
|
|
|
|
2024-08-11 18:04:21 +00:00
|
|
|
|
llvmPackages =
|
2024-09-25 01:43:34 +00:00
|
|
|
|
let
|
|
|
|
|
tools = super.llvmPackages.tools.extend (_: _: llvmToolsPackages prevStage);
|
|
|
|
|
libraries = super.llvmPackages.libraries.extend (_: _: llvmLibrariesPackages prevStage);
|
|
|
|
|
in
|
|
|
|
|
super.llvmPackages // { inherit tools libraries; } // tools // libraries;
|
2024-08-11 18:04:21 +00:00
|
|
|
|
};
|
2020-11-19 08:28:20 +00:00
|
|
|
|
|
2024-08-11 18:04:21 +00:00
|
|
|
|
extraNativeBuildInputs = lib.optionals localSystem.isAarch64 [
|
|
|
|
|
prevStage.updateAutotoolsGnuConfigScriptsHook
|
|
|
|
|
prevStage.gnu-config
|
|
|
|
|
];
|
2023-05-10 07:03:00 +00:00
|
|
|
|
|
2024-08-11 18:04:21 +00:00
|
|
|
|
extraPreHook = ''
|
|
|
|
|
stripDebugFlags="-S" # llvm-strip does not support "-p" for Mach-O
|
|
|
|
|
'';
|
|
|
|
|
}
|
|
|
|
|
)
|
2023-05-10 07:03:00 +00:00
|
|
|
|
|
|
|
|
|
# First rebuild of LLVM. While this LLVM is linked to a bunch of junk from the bootstrap tools,
|
2024-09-25 01:43:34 +00:00
|
|
|
|
# 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.
|
2024-08-11 18:04:21 +00:00
|
|
|
|
(
|
|
|
|
|
prevStage:
|
2024-09-25 01:43:34 +00:00
|
|
|
|
# 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)
|
|
|
|
|
];
|
2023-05-10 07:03:00 +00:00
|
|
|
|
|
|
|
|
|
stageFun prevStage {
|
2024-08-11 18:04:21 +00:00
|
|
|
|
name = "bootstrap-stage-xclang";
|
2024-06-25 04:01:25 +00:00
|
|
|
|
|
2024-09-25 01:43:34 +00:00
|
|
|
|
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;
|
2020-07-31 14:03:51 +00:00
|
|
|
|
|
2024-09-25 01:43:34 +00:00
|
|
|
|
# Disable ld64’s install check phase because the required LTO libraries are not built yet.
|
|
|
|
|
ld64 = super.ld64.overrideAttrs { doInstallCheck = false; };
|
2020-07-31 14:03:51 +00:00
|
|
|
|
|
2024-09-25 01:43:34 +00:00
|
|
|
|
darwin = super.darwin.overrideScope (
|
|
|
|
|
selfDarwin: superDarwin:
|
|
|
|
|
darwinPackages prevStage
|
|
|
|
|
// sdkDarwinPackages prevStage
|
|
|
|
|
// {
|
|
|
|
|
inherit (prevStage.darwin) libSystem;
|
|
|
|
|
binutils-unwrapped = superDarwin.binutils-unwrapped.override { enableManpages = false; };
|
|
|
|
|
}
|
|
|
|
|
);
|
2024-08-11 18:04:21 +00:00
|
|
|
|
}
|
2024-09-25 01:43:34 +00:00
|
|
|
|
];
|
2020-11-19 08:28:20 +00:00
|
|
|
|
|
2024-08-11 18:04:21 +00:00
|
|
|
|
extraNativeBuildInputs = lib.optionals localSystem.isAarch64 [
|
|
|
|
|
prevStage.updateAutotoolsGnuConfigScriptsHook
|
|
|
|
|
prevStage.gnu-config
|
|
|
|
|
];
|
2023-05-10 07:03:00 +00:00
|
|
|
|
|
2024-08-11 18:04:21 +00:00
|
|
|
|
extraPreHook = ''
|
|
|
|
|
stripDebugFlags="-S" # llvm-strip does not support "-p" for Mach-O
|
|
|
|
|
'';
|
|
|
|
|
}
|
|
|
|
|
)
|
2023-05-10 07:03:00 +00:00
|
|
|
|
|
2024-09-25 01:43:34 +00:00
|
|
|
|
# This stage rebuilds the SDK. It also rebuilds bash, which will be needed in later stages
|
2023-07-09 17:00:13 +00:00
|
|
|
|
# to use in patched shebangs (e.g., to make sure `icu-config` uses bash from nixpkgs).
|
2024-08-11 18:04:21 +00:00
|
|
|
|
(
|
|
|
|
|
prevStage:
|
2023-05-10 07:03:00 +00:00
|
|
|
|
# previous stage-xclang stdenv:
|
2024-09-25 01:43:34 +00:00
|
|
|
|
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)
|
|
|
|
|
];
|
2023-05-10 07:03:00 +00:00
|
|
|
|
|
|
|
|
|
stageFun prevStage {
|
2024-08-11 18:04:21 +00:00
|
|
|
|
name = "bootstrap-stage2";
|
2023-05-10 07:03:00 +00:00
|
|
|
|
|
2024-09-25 01:43:34 +00:00
|
|
|
|
overrides =
|
|
|
|
|
self: super:
|
|
|
|
|
mergeDisjointAttrs [
|
|
|
|
|
(stage1Packages prevStage)
|
|
|
|
|
(disallowedPackages prevStage)
|
|
|
|
|
(bintoolsPackages prevStage)
|
|
|
|
|
(llvmLibrariesDeps prevStage)
|
|
|
|
|
(llvmToolsDeps prevStage)
|
|
|
|
|
{
|
|
|
|
|
inherit (prevStage) ccWrapperStdenv;
|
2024-08-11 18:04:21 +00:00
|
|
|
|
|
2024-09-25 01:43:34 +00:00
|
|
|
|
# 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; };
|
2023-05-10 07:03:00 +00:00
|
|
|
|
|
2024-09-25 01:43:34 +00:00
|
|
|
|
# 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; };
|
2024-08-11 18:04:21 +00:00
|
|
|
|
};
|
2023-05-10 07:03:00 +00:00
|
|
|
|
|
2024-09-25 01:43:34 +00:00
|
|
|
|
darwin = super.darwin.overrideScope (
|
|
|
|
|
selfDarwin: superDarwin:
|
|
|
|
|
darwinPackages prevStage
|
2024-08-11 18:04:21 +00:00
|
|
|
|
// {
|
2024-09-25 01:43:34 +00:00
|
|
|
|
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;
|
2024-08-11 18:04:21 +00:00
|
|
|
|
};
|
2024-09-25 01:43:34 +00:00
|
|
|
|
}
|
|
|
|
|
);
|
2015-06-18 17:03:32 +00:00
|
|
|
|
|
2024-09-25 01:43:34 +00:00
|
|
|
|
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;
|
|
|
|
|
}
|
|
|
|
|
];
|
2023-05-10 07:03:00 +00:00
|
|
|
|
|
2024-08-11 18:04:21 +00:00
|
|
|
|
extraNativeBuildInputs = lib.optionals localSystem.isAarch64 [
|
|
|
|
|
prevStage.updateAutotoolsGnuConfigScriptsHook
|
|
|
|
|
prevStage.gnu-config
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
extraPreHook = ''
|
|
|
|
|
stripDebugFlags="-S" # llvm-strip does not support "-p" for Mach-O
|
|
|
|
|
'';
|
|
|
|
|
}
|
|
|
|
|
)
|
2023-05-10 07:03:00 +00:00
|
|
|
|
|
|
|
|
|
# Rebuild LLVM with LLVM. This stage also rebuilds certain dependencies needed by LLVM.
|
2024-09-25 01:43:34 +00:00
|
|
|
|
# The SDK (but not its other inputs) is also rebuilt this stage to pick up the rebuilt cctools for `libtool`.
|
2024-08-11 18:04:21 +00:00
|
|
|
|
(
|
|
|
|
|
prevStage:
|
2024-07-01 22:15:55 +00:00
|
|
|
|
# previous stage2 stdenv:
|
2024-09-25 01:43:34 +00:00
|
|
|
|
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)
|
|
|
|
|
];
|
2023-05-10 07:03:00 +00:00
|
|
|
|
|
|
|
|
|
stageFun prevStage {
|
2024-08-11 18:04:21 +00:00
|
|
|
|
name = "bootstrap-stage3";
|
2023-05-10 07:03:00 +00:00
|
|
|
|
|
2024-09-25 01:43:34 +00:00
|
|
|
|
overrides =
|
|
|
|
|
self: super:
|
|
|
|
|
mergeDisjointAttrs [
|
|
|
|
|
(stage1Packages prevStage)
|
|
|
|
|
(disallowedPackages prevStage)
|
|
|
|
|
(llvmLibrariesDeps prevStage)
|
|
|
|
|
(sdkPackages prevStage)
|
|
|
|
|
{
|
|
|
|
|
inherit (prevStage) ccWrapperStdenv;
|
2024-08-11 18:04:21 +00:00
|
|
|
|
|
2024-09-25 01:43:34 +00:00
|
|
|
|
# Disable tests because they use dejagnu, which fails to run.
|
|
|
|
|
libffi = super.libffi.override { doCheck = false; };
|
2024-08-11 18:04:21 +00:00
|
|
|
|
|
2024-10-02 23:07:09 +00:00
|
|
|
|
xar = super.xarMinimal;
|
|
|
|
|
|
2024-09-25 01:43:34 +00:00
|
|
|
|
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; };
|
|
|
|
|
}
|
|
|
|
|
);
|
|
|
|
|
};
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
);
|
2024-08-11 18:04:21 +00:00
|
|
|
|
|
2024-09-25 01:43:34 +00:00
|
|
|
|
llvmPackages =
|
|
|
|
|
let
|
|
|
|
|
libraries = super.llvmPackages.libraries.extend (_: _: llvmLibrariesPackages prevStage);
|
|
|
|
|
in
|
|
|
|
|
super.llvmPackages // { inherit libraries; } // libraries;
|
2024-08-11 18:04:21 +00:00
|
|
|
|
}
|
2024-09-25 01:43:34 +00:00
|
|
|
|
];
|
2020-11-19 08:28:20 +00:00
|
|
|
|
|
2024-08-11 18:04:21 +00:00
|
|
|
|
extraNativeBuildInputs = lib.optionals localSystem.isAarch64 [
|
|
|
|
|
prevStage.updateAutotoolsGnuConfigScriptsHook
|
|
|
|
|
prevStage.gnu-config
|
|
|
|
|
];
|
2023-05-10 07:03:00 +00:00
|
|
|
|
|
2024-08-11 18:04:21 +00:00
|
|
|
|
extraPreHook = ''
|
|
|
|
|
stripDebugFlags="-S" # llvm-strip does not support "-p" for Mach-O
|
|
|
|
|
'';
|
|
|
|
|
}
|
|
|
|
|
)
|
2023-05-10 07:03:00 +00:00
|
|
|
|
|
|
|
|
|
# Construct a standard environment with the new clang. Also use the new compiler to rebuild
|
|
|
|
|
# everything that will be part of the final stdenv and isn’t required by it, CF, or Libsystem.
|
2024-08-11 18:04:21 +00:00
|
|
|
|
(
|
|
|
|
|
prevStage:
|
2023-05-10 07:03:00 +00:00
|
|
|
|
# previous stage3 stdenv:
|
2024-09-25 01:43:34 +00:00
|
|
|
|
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)
|
|
|
|
|
];
|
2024-02-04 18:07:09 +00:00
|
|
|
|
|
2024-08-11 18:04:21 +00:00
|
|
|
|
stageFun prevStage {
|
|
|
|
|
name = "bootstrap-stage4";
|
2023-05-10 07:03:00 +00:00
|
|
|
|
|
2024-09-25 01:43:34 +00:00
|
|
|
|
overrides =
|
|
|
|
|
self: super:
|
|
|
|
|
mergeDisjointAttrs [
|
|
|
|
|
(bintoolsPackages prevStage)
|
|
|
|
|
(disallowedPackages prevStage)
|
|
|
|
|
(llvmLibrariesDeps prevStage)
|
|
|
|
|
(llvmToolsDeps prevStage)
|
|
|
|
|
(sdkPackages prevStage)
|
|
|
|
|
(sdkPackagesNoCC prevStage)
|
|
|
|
|
{
|
|
|
|
|
inherit (prevStage) ccWrapperStdenv;
|
2023-05-10 07:03:00 +00:00
|
|
|
|
|
2024-09-25 01:43:34 +00:00
|
|
|
|
# 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;
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
);
|
2023-05-10 07:03:00 +00:00
|
|
|
|
|
2024-09-25 01:43:34 +00:00
|
|
|
|
llvmPackages =
|
|
|
|
|
let
|
|
|
|
|
tools = super.llvmPackages.tools.extend (
|
|
|
|
|
_: _:
|
|
|
|
|
llvmToolsPackages prevStage
|
|
|
|
|
// {
|
|
|
|
|
libcxxClang = super.wrapCCWith rec {
|
|
|
|
|
nativeTools = false;
|
|
|
|
|
nativeLibc = false;
|
2023-05-10 07:03:00 +00:00
|
|
|
|
|
2024-09-25 01:43:34 +00:00
|
|
|
|
inherit (prevStage) expand-response-params;
|
2023-05-10 07:03:00 +00:00
|
|
|
|
|
2024-09-25 01:43:34 +00:00
|
|
|
|
extraPackages = [ self.llvmPackages.compiler-rt ];
|
2023-05-10 07:03:00 +00:00
|
|
|
|
|
2024-09-25 01:43:34 +00:00
|
|
|
|
extraBuildCommands = ''
|
2024-08-11 18:04:21 +00:00
|
|
|
|
rsrc="$out/resource-root"
|
|
|
|
|
mkdir "$rsrc"
|
2024-09-25 01:43:34 +00:00
|
|
|
|
ln -s "${cc.lib}/lib/clang/${lib.versions.major (lib.getVersion cc)}/include" "$rsrc"
|
2024-08-11 18:04:21 +00:00
|
|
|
|
echo "-resource-dir=$rsrc" >> $out/nix-support/cc-cflags
|
2024-09-25 01:43:34 +00:00
|
|
|
|
ln -s "${prevStage.llvmPackages.compiler-rt.out}/lib" "$rsrc/lib"
|
|
|
|
|
ln -s "${prevStage.llvmPackages.compiler-rt.out}/share" "$rsrc/share"
|
2024-08-11 18:04:21 +00:00
|
|
|
|
'';
|
|
|
|
|
|
2024-09-25 01:43:34 +00:00
|
|
|
|
cc = self.llvmPackages.clang-unwrapped;
|
|
|
|
|
bintools = self.darwin.binutils;
|
2024-08-11 18:04:21 +00:00
|
|
|
|
|
2024-09-25 01:43:34 +00:00
|
|
|
|
isClang = true;
|
|
|
|
|
libc = self.darwin.libSystem;
|
|
|
|
|
inherit (self.llvmPackages) libcxx;
|
2024-08-11 18:04:21 +00:00
|
|
|
|
|
2024-09-25 01:43:34 +00:00
|
|
|
|
inherit lib;
|
|
|
|
|
inherit (self)
|
|
|
|
|
stdenvNoCC
|
|
|
|
|
coreutils
|
|
|
|
|
gnugrep
|
|
|
|
|
runtimeShell
|
|
|
|
|
;
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
);
|
|
|
|
|
libraries = super.llvmPackages.libraries.extend (_: _: llvmLibrariesPackages prevStage);
|
|
|
|
|
in
|
|
|
|
|
super.llvmPackages // { inherit tools libraries; } // tools // libraries;
|
|
|
|
|
}
|
|
|
|
|
];
|
2018-02-25 22:03:40 +00:00
|
|
|
|
|
2024-08-11 18:04:21 +00:00
|
|
|
|
extraNativeBuildInputs = lib.optionals localSystem.isAarch64 [
|
|
|
|
|
prevStage.updateAutotoolsGnuConfigScriptsHook
|
|
|
|
|
prevStage.gnu-config
|
|
|
|
|
];
|
2023-05-10 07:03:00 +00:00
|
|
|
|
|
2024-08-11 18:04:21 +00:00
|
|
|
|
extraPreHook = ''
|
|
|
|
|
stripDebugFlags="-S" # llvm-strip does not support "-p" for Mach-O
|
|
|
|
|
'';
|
|
|
|
|
}
|
|
|
|
|
)
|
2023-05-10 07:03:00 +00:00
|
|
|
|
|
|
|
|
|
# Construct the final stdenv. The version of LLVM provided should match the one defined in
|
|
|
|
|
# `all-packages.nix` for Darwin. Nothing should depend on the bootstrap tools or originate from
|
|
|
|
|
# the bootstrap tools.
|
|
|
|
|
#
|
|
|
|
|
# When updating the Darwin stdenv, make sure that the result has no dependency (`nix-store -qR`)
|
|
|
|
|
# on `bootstrapTools` or the binutils built in stage 1.
|
2024-08-11 18:04:21 +00:00
|
|
|
|
(
|
|
|
|
|
prevStage:
|
2023-05-10 07:03:00 +00:00
|
|
|
|
# previous stage4 stdenv:
|
2024-09-25 01:43:34 +00:00
|
|
|
|
|
|
|
|
|
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)
|
|
|
|
|
];
|
2023-05-10 07:03:00 +00:00
|
|
|
|
|
2024-08-11 18:04:21 +00:00
|
|
|
|
let
|
|
|
|
|
cc = prevStage.llvmPackages.clang;
|
|
|
|
|
in
|
|
|
|
|
{
|
|
|
|
|
inherit config overlays;
|
|
|
|
|
stdenv = import ../generic {
|
|
|
|
|
name = "stdenv-darwin";
|
|
|
|
|
|
|
|
|
|
buildPlatform = localSystem;
|
|
|
|
|
hostPlatform = localSystem;
|
|
|
|
|
targetPlatform = localSystem;
|
|
|
|
|
|
|
|
|
|
inherit config;
|
2023-05-10 07:03:00 +00:00
|
|
|
|
|
2024-08-11 18:04:21 +00:00
|
|
|
|
preHook = ''
|
|
|
|
|
${commonPreHook}
|
|
|
|
|
stripDebugFlags="-S" # llvm-strip does not support "-p" for Mach-O
|
|
|
|
|
export PATH_LOCALE=${prevStage.darwin.locale}/share/locale
|
|
|
|
|
'';
|
|
|
|
|
|
|
|
|
|
initialPath = ((import ../generic/common-path.nix) { pkgs = prevStage; });
|
|
|
|
|
|
2024-09-25 01:43:34 +00:00
|
|
|
|
extraNativeBuildInputs = lib.optionals localSystem.isAarch64 [
|
|
|
|
|
prevStage.updateAutotoolsGnuConfigScriptsHook
|
|
|
|
|
];
|
2024-08-11 18:04:21 +00:00
|
|
|
|
|
2024-09-25 01:43:34 +00:00
|
|
|
|
extraBuildInputs = [ prevStage.apple-sdk ];
|
2024-08-11 18:04:21 +00:00
|
|
|
|
|
|
|
|
|
inherit cc;
|
2024-02-04 18:07:09 +00:00
|
|
|
|
|
2024-08-11 18:04:21 +00:00
|
|
|
|
shell = cc.shell;
|
|
|
|
|
|
|
|
|
|
inherit (prevStage.stdenv) fetchurlBoot;
|
|
|
|
|
|
2024-09-25 01:43:34 +00:00
|
|
|
|
extraAttrs = {
|
|
|
|
|
inherit bootstrapTools;
|
|
|
|
|
libc = prevStage.darwin.libSystem;
|
|
|
|
|
shellPackage = prevStage.bash;
|
|
|
|
|
};
|
2016-01-04 02:47:09 +00:00
|
|
|
|
|
2024-08-11 18:04:21 +00:00
|
|
|
|
disallowedRequisites = [ bootstrapTools.out ];
|
|
|
|
|
|
|
|
|
|
allowedRequisites =
|
2024-09-25 01:43:34 +00:00
|
|
|
|
(
|
|
|
|
|
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
|
|
|
|
|
)
|
2024-08-11 18:04:21 +00:00
|
|
|
|
++ lib.optionals localSystem.isAarch64 [
|
|
|
|
|
prevStage.updateAutotoolsGnuConfigScriptsHook
|
|
|
|
|
prevStage.gnu-config
|
|
|
|
|
]
|
2024-09-25 01:43:34 +00:00
|
|
|
|
++ lib.optionals localSystem.isx86_64 [ prevStage.darwin.Csu ]
|
|
|
|
|
++ (with prevStage.darwin; [
|
|
|
|
|
libiconv.out
|
|
|
|
|
libresolv.out
|
|
|
|
|
libsbuf.out
|
|
|
|
|
libSystem
|
|
|
|
|
locale
|
|
|
|
|
])
|
2024-08-11 18:04:21 +00:00
|
|
|
|
++ (with prevStage.llvmPackages; [
|
|
|
|
|
bintools-unwrapped
|
|
|
|
|
clang-unwrapped
|
|
|
|
|
clang-unwrapped.lib
|
|
|
|
|
compiler-rt
|
|
|
|
|
compiler-rt.dev
|
|
|
|
|
libcxx
|
|
|
|
|
libcxx.dev
|
|
|
|
|
lld
|
|
|
|
|
llvm
|
|
|
|
|
llvm.lib
|
2024-09-25 01:43:34 +00:00
|
|
|
|
]);
|
2024-08-11 18:04:21 +00:00
|
|
|
|
|
|
|
|
|
__stdenvImpureHostDeps = commonImpureHostDeps;
|
|
|
|
|
__extraImpureHostDeps = commonImpureHostDeps;
|
|
|
|
|
|
|
|
|
|
overrides =
|
|
|
|
|
self: super:
|
2024-09-25 01:43:34 +00:00
|
|
|
|
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;
|
|
|
|
|
}
|
2024-08-11 18:04:21 +00:00
|
|
|
|
);
|
2024-09-25 01:43:34 +00:00
|
|
|
|
}
|
|
|
|
|
(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;
|
|
|
|
|
}
|
|
|
|
|
))
|
|
|
|
|
];
|
2023-05-10 07:03:00 +00:00
|
|
|
|
};
|
2024-08-11 18:04:21 +00:00
|
|
|
|
}
|
|
|
|
|
)
|
2023-05-10 07:03:00 +00:00
|
|
|
|
|
2024-07-01 22:33:24 +00:00
|
|
|
|
# This "no-op" stage is just a place to put the assertions about the final stage.
|
2024-08-11 18:04:21 +00:00
|
|
|
|
(
|
|
|
|
|
prevStage:
|
2023-05-10 07:03:00 +00:00
|
|
|
|
# previous final stage stdenv:
|
2024-07-01 22:33:24 +00:00
|
|
|
|
assert isBuiltByNixpkgsCompiler prevStage.cctools;
|
|
|
|
|
assert isBuiltByNixpkgsCompiler prevStage.ld64;
|
2023-05-10 07:03:00 +00:00
|
|
|
|
assert isBuiltByNixpkgsCompiler prevStage.darwin.sigtool;
|
|
|
|
|
|
2024-09-25 01:43:34 +00:00
|
|
|
|
assert isFromNixpkgs prevStage.darwin.libSystem;
|
2024-08-11 18:04:21 +00:00
|
|
|
|
assert isFromNixpkgs prevStage.darwin.binutils-unwrapped;
|
2023-05-10 07:03:00 +00:00
|
|
|
|
|
|
|
|
|
assert isBuiltByNixpkgsCompiler prevStage.llvmPackages.clang-unwrapped;
|
|
|
|
|
assert isBuiltByNixpkgsCompiler prevStage.llvmPackages.libllvm;
|
|
|
|
|
assert isBuiltByNixpkgsCompiler prevStage.llvmPackages.libcxx;
|
|
|
|
|
assert isBuiltByNixpkgsCompiler prevStage.llvmPackages.compiler-rt;
|
2024-06-25 04:02:21 +00:00
|
|
|
|
|
|
|
|
|
# Make sure these evaluate since they were disabled explicitly in the bootstrap.
|
|
|
|
|
assert isBuiltByNixpkgsCompiler prevStage.binutils-unwrapped;
|
2024-08-11 18:04:21 +00:00
|
|
|
|
assert isFromNixpkgs prevStage.binutils-unwrapped.src;
|
2024-04-14 13:20:26 +00:00
|
|
|
|
assert isBuiltByNixpkgsCompiler prevStage.curl;
|
2024-06-25 04:02:21 +00:00
|
|
|
|
|
2024-09-25 01:43:34 +00:00
|
|
|
|
# libiconv should be an alias for darwin.libiconv
|
|
|
|
|
assert prevStage.libiconv == prevStage.darwin.libiconv;
|
|
|
|
|
|
2024-08-11 18:04:21 +00:00
|
|
|
|
{
|
|
|
|
|
inherit (prevStage) config overlays stdenv;
|
|
|
|
|
}
|
|
|
|
|
)
|
2023-05-10 07:03:00 +00:00
|
|
|
|
]
|