diff options
author | John Ericson <John.Ericson@Obsidian.Systems> | 2024-06-18 12:38:21 -0400 |
---|---|---|
committer | John Ericson <John.Ericson@Obsidian.Systems> | 2024-06-18 17:04:16 -0400 |
commit | 51f1ecaa59a3b7c182b24e71a3176c83d6cd601e (patch) | |
tree | f1969e427ec1da0b7de0cd8fd964a61242c63d78 | |
parent | 4bd76beac0eee70381663d2ef0e84aa2ae2ac29d (diff) |
Clean up cross bootstrapping
For a long time, we've had `crossLibcStdenv`, `*Cross` libc attributes,
and `*bsdCross` pre-libc package sets. This was always bad because
having "cross" things is "not declarative": the naming doesn't reflect
what packages *need* but rather how we *provide* something. This is
ugly, and creates needless friction between cross and native building.
Now, almost all of these `*Cross` attributes are gone: just these are
kept:
- Glibc's and Musl's are kept, because those packages are widely used
and I didn't want to risk changing the native builds of those at this
time.
- generic `libcCross`, `theadsCross`, and friends, because these relate
to the convolulted GCC bootstrap which still needs to be redone.
The BSD and obscure Linux or freestnanding libcs have conversely all
been made to use a new `stdenvNoLibc`, which is like the old
`crossLibcStdenv` except:
1. It usable for native and cross alike
2. It named according to what it *is* ("a standard environment without
libc but with a C compiler"), rather than some non-compositional
jargon ("the stdenv used for building libc when cross compiling",
yuck).
I should have done this change long ago, but I was stymied because of
"infinite recursions". The problem was that in too many cases we are
overriding `stdenv` to *remove* things we don't need, and this risks
cyles since those more minimal stdenvs are used to build things in the
more maximal stdenvs.
The solution is to pass `stage.nix` `stdenvNoCC`, so we can override to
*build up* rather than *tear down*. For now, the full `stdenv` is also
passed, so I don't need to change the native bootstraps, but I can see
this changing as we make things more uniform and clean those up.
Finally, the BSDs also had to be cleaned up, since they have a few
pre-libc dependencies, demanding a systematic approach. I realized what
rhelmot did in 61202561d92cf1cd74532fcbd8b9d6662c5bc57b (specify what
packages just need `stdenvNoLibc`) is definitely the right approach for
this, and adjusted NetBSD and OpenBSD to likewise use it.
25 files changed, 177 insertions, 171 deletions
diff --git a/pkgs/build-support/bintools-wrapper/default.nix b/pkgs/build-support/bintools-wrapper/default.nix index 2a1fe1344e20..2d75330f1c9e 100644 --- a/pkgs/build-support/bintools-wrapper/default.nix +++ b/pkgs/build-support/bintools-wrapper/default.nix @@ -10,15 +10,15 @@ , stdenvNoCC , runtimeShell , bintools ? null, libc ? null, coreutils ? null, gnugrep ? null -, netbsd ? null, netbsdCross ? null +, netbsd ? null , sharedLibraryLoader ? if libc == null then null else if stdenvNoCC.targetPlatform.isNetBSD then - if !(targetPackages ? netbsdCross) then + if !(targetPackages ? netbsd) then netbsd.ld_elf_so - else if libc != targetPackages.netbsdCross.headers then - targetPackages.netbsdCross.ld_elf_so + else if libc != targetPackages.netbsd.headers then + targetPackages.netbsd.ld_elf_so else null else diff --git a/pkgs/by-name/uc/uclibc-ng/package.nix b/pkgs/by-name/uc/uclibc-ng/package.nix index aee6f6f015f1..fb3e76c58b98 100644 --- a/pkgs/by-name/uc/uclibc-ng/package.nix +++ b/pkgs/by-name/uc/uclibc-ng/package.nix @@ -1,5 +1,5 @@ { lib -, stdenv +, stdenvNoLibc , buildPackages , fetchurl , gitUpdater @@ -9,6 +9,7 @@ }: let + stdenv = stdenvNoLibc; isCross = (stdenv.buildPlatform != stdenv.hostPlatform); configParser = '' function parseconfig { diff --git a/pkgs/development/misc/or1k/newlib.nix b/pkgs/development/misc/or1k/newlib.nix index 92829896a27c..127d84a82ea2 100644 --- a/pkgs/development/misc/or1k/newlib.nix +++ b/pkgs/development/misc/or1k/newlib.nix @@ -1,6 +1,6 @@ -{ stdenv, texinfo, flex, bison, fetchFromGitHub, crossLibcStdenv, buildPackages }: +{ stdenv, texinfo, flex, bison, fetchFromGitHub, stdenvNoLibc, buildPackages }: -crossLibcStdenv.mkDerivation { +stdenvNoLibc.mkDerivation { name = "newlib"; src = fetchFromGitHub { owner = "openrisc"; diff --git a/pkgs/development/misc/vc4/newlib.nix b/pkgs/development/misc/vc4/newlib.nix index e1a8b2eeaa6a..48efd317d4c2 100644 --- a/pkgs/development/misc/vc4/newlib.nix +++ b/pkgs/development/misc/vc4/newlib.nix @@ -1,6 +1,6 @@ -{ stdenv, texinfo, flex, bison, fetchFromGitHub, crossLibcStdenv, buildPackages }: +{ stdenv, texinfo, flex, bison, fetchFromGitHub, stdenvNoLibc, buildPackages }: -crossLibcStdenv.mkDerivation { +stdenvNoLibc.mkDerivation { name = "newlib"; src = fetchFromGitHub { owner = "itszor"; diff --git a/pkgs/os-specific/bsd/freebsd/default.nix b/pkgs/os-specific/bsd/freebsd/default.nix index e56c70c1d32d..cfe6080b020a 100644 --- a/pkgs/os-specific/bsd/freebsd/default.nix +++ b/pkgs/os-specific/bsd/freebsd/default.nix @@ -3,7 +3,6 @@ makeScopeWithSplicing', generateSplicesForMkScope, callPackage, - crossLibcStdenv, attributePathToSplice ? [ "freebsd" ], branch ? "release/14.0.0", }: @@ -24,41 +23,30 @@ let Branches can be selected by overriding the `branch` attribute on the freebsd package set. ''; - # `./package-set.nix` should never know the name of the package set we - # are constructing; just this function is allowed to know that. This - # is why we: - # - # - do the splicing for cross compilation here - # - # - construct the *anonymized* `buildFreebsd` attribute to be passed - # to `./package-set.nix`. - callFreeBSDWithAttrs = - extraArgs: - let - # we do not include the branch in the splice here because the branch - # parameter to this file will only ever take on one value - more values - # are provided through overrides. - otherSplices = generateSplicesForMkScope attributePathToSplice; - in - makeScopeWithSplicing' { - inherit otherSplices; - f = - self: - { - inherit branch; - } - // callPackage ./package-set.nix ( - { - sourceData = versions.${self.branch} or (throw (badBranchError self.branch)); - versionData = self.sourceData.version; - buildFreebsd = otherSplices.selfBuildHost; - patchesRoot = ./patches + "/${self.versionData.revision}"; - } - // extraArgs - ) self; - }; + # we do not include the branch in the splice here because the branch + # parameter to this file will only ever take on one value - more values + # are provided through overrides. + otherSplices = generateSplicesForMkScope attributePathToSplice; in -{ - freebsd = callFreeBSDWithAttrs { }; - freebsdCross = callFreeBSDWithAttrs { stdenv = crossLibcStdenv; }; +# `./package-set.nix` should never know the name of the package set we +# are constructing; just this function is allowed to know that. This +# is why we: +# +# - do the splicing for cross compilation here +# +# - construct the *anonymized* `buildFreebsd` attribute to be passed +# to `./package-set.nix`. +makeScopeWithSplicing' { + inherit otherSplices; + f = + self: + { + inherit branch; + } + // callPackage ./package-set.nix ({ + sourceData = versions.${self.branch} or (throw (badBranchError self.branch)); + versionData = self.sourceData.version; + buildFreebsd = otherSplices.selfBuildHost; + patchesRoot = ./patches + "/${self.versionData.revision}"; + }) self; } diff --git a/pkgs/os-specific/bsd/freebsd/pkgs/mkDerivation.nix b/pkgs/os-specific/bsd/freebsd/pkgs/mkDerivation.nix index 12f2c9407e3c..2f5fb441feaa 100644 --- a/pkgs/os-specific/bsd/freebsd/pkgs/mkDerivation.nix +++ b/pkgs/os-specific/bsd/freebsd/pkgs/mkDerivation.nix @@ -2,7 +2,7 @@ lib, stdenv, stdenvNoCC, - stdenvNoLibs, + stdenvNoLibc, overrideCC, buildPackages, versionData, @@ -28,7 +28,7 @@ lib.makeOverridable ( if attrs.noCC or false then stdenvNoCC else if attrs.noLibc or false then - stdenvNoLibs + stdenvNoLibc else if attrs.noLibcxx or false then overrideCC stdenv buildPackages.llvmPackages.clangNoLibcxx else @@ -58,12 +58,9 @@ lib.makeOverridable ( HOST_SH = stdenv'.shell; - # Since STRIP below is the flag - STRIPBIN = "${stdenv.cc.bintools.targetPrefix}strip"; - makeFlags = [ "STRIP=-s" # flag to install, not command - ] ++ lib.optional (!stdenv.hostPlatform.isFreeBSD) "MK_WERROR=no"; + ] ++ lib.optional (!stdenv'.hostPlatform.isFreeBSD) "MK_WERROR=no"; # amd64 not x86_64 for this on unlike NetBSD MACHINE_ARCH = freebsd-lib.mkBsdArch stdenv'; @@ -91,6 +88,9 @@ lib.makeOverridable ( // lib.optionalAttrs stdenv'.hasCC { # TODO should CC wrapper set this? CPP = "${stdenv'.cc.targetPrefix}cpp"; + + # Since STRIP below is the flag + STRIPBIN = "${stdenv'.cc.bintools.targetPrefix}strip"; } // lib.optionalAttrs stdenv'.isDarwin { MKRELRO = "no"; } // lib.optionalAttrs (stdenv'.cc.isClang or false) { diff --git a/pkgs/os-specific/bsd/netbsd/default.nix b/pkgs/os-specific/bsd/netbsd/default.nix index 5f5ec212f269..7440666b4d79 100644 --- a/pkgs/os-specific/bsd/netbsd/default.nix +++ b/pkgs/os-specific/bsd/netbsd/default.nix @@ -1,5 +1,4 @@ { - stdenv, lib, stdenvNoCC, makeScopeWithSplicing', @@ -21,7 +20,9 @@ makeScopeWithSplicing' { defaultMakeFlags = [ "MKSOFTFLOAT=${ - if stdenv.hostPlatform.gcc.float or (stdenv.hostPlatform.parsed.abi.float or "hard") == "soft" then + if + stdenvNoCC.hostPlatform.gcc.float or (stdenvNoCC.hostPlatform.parsed.abi.float or "hard") == "soft" + then "yes" else "no" @@ -36,7 +37,6 @@ makeScopeWithSplicing' { # because of the splices. mkDerivation = self.callPackage ./pkgs/mkDerivation.nix { - inherit stdenv stdenvNoCC; inherit (buildPackages.netbsd) netbsdSetupHook makeMinimal @@ -129,7 +129,7 @@ makeScopeWithSplicing' { libpthread-headers = self.callPackage ./pkgs/libpthread/headers.nix { }; csu = self.callPackage ./pkgs/csu.nix { - inherit (self) headers sys ld_elf_so; + inherit (self) headers sys-headers ld_elf_so; inherit (buildPackages.netbsd) netbsdSetupHook makeMinimal diff --git a/pkgs/os-specific/bsd/netbsd/pkgs/csu.nix b/pkgs/os-specific/bsd/netbsd/pkgs/csu.nix index a0d7ca419c1c..ea78f338c533 100644 --- a/pkgs/os-specific/bsd/netbsd/pkgs/csu.nix +++ b/pkgs/os-specific/bsd/netbsd/pkgs/csu.nix @@ -16,11 +16,12 @@ statHook, rsync, headers, - sys, + sys-headers, ld_elf_so, }: mkDerivation { + noLibc = true; path = "lib/csu"; meta.platforms = lib.platforms.netbsd; nativeBuildInputs = [ @@ -41,7 +42,7 @@ mkDerivation { ]; buildInputs = [ headers ]; extraPaths = [ - sys.path + sys-headers.path ld_elf_so.path ]; } diff --git a/pkgs/os-specific/bsd/netbsd/pkgs/include.nix b/pkgs/os-specific/bsd/netbsd/pkgs/include.nix index 6df34b96095e..a43a93847b23 100644 --- a/pkgs/os-specific/bsd/netbsd/pkgs/include.nix +++ b/pkgs/os-specific/bsd/netbsd/pkgs/include.nix @@ -15,6 +15,7 @@ }: mkDerivation { + noLibc = true; path = "include"; nativeBuildInputs = [ bsdSetupHook diff --git a/pkgs/os-specific/bsd/netbsd/pkgs/ld_elf_so.nix b/pkgs/os-specific/bsd/netbsd/pkgs/ld_elf_so.nix index 7f25ce097ff0..4116312b9625 100644 --- a/pkgs/os-specific/bsd/netbsd/pkgs/ld_elf_so.nix +++ b/pkgs/os-specific/bsd/netbsd/pkgs/ld_elf_so.nix @@ -6,6 +6,7 @@ }: mkDerivation { + noLibc = true; path = "libexec/ld.elf_so"; meta.platforms = lib.platforms.netbsd; LIBC_PIC = "${libc}/lib/libc_pic.a"; diff --git a/pkgs/os-specific/bsd/netbsd/pkgs/libc.nix b/pkgs/os-specific/bsd/netbsd/pkgs/libc.nix index cf71857776d8..d6b14445acd4 100644 --- a/pkgs/os-specific/bsd/netbsd/pkgs/libc.nix +++ b/pkgs/os-specific/bsd/netbsd/pkgs/libc.nix @@ -24,6 +24,7 @@ }: mkDerivation { + noLibc = true; path = "lib/libc"; USE_FORT = "yes"; MKPROFILE = "no"; @@ -94,5 +95,8 @@ mkDerivation { make -C $BSDSRCDIR/lib/libcrypt $makeFlags make -C $BSDSRCDIR/lib/libcrypt $makeFlags install ''; - inherit (librt) postPatch; + postPatch = '' + sed -i 's,/usr\(/include/sys/syscall.h\),${headers}\1,g' \ + $BSDSRCDIR/lib/{libc,librt}/sys/Makefile.inc + ''; } diff --git a/pkgs/os-specific/bsd/netbsd/pkgs/librt.nix b/pkgs/os-specific/bsd/netbsd/pkgs/librt.nix index 4e4bf0bc5ac4..87cd3092f1b1 100644 --- a/pkgs/os-specific/bsd/netbsd/pkgs/librt.nix +++ b/pkgs/os-specific/bsd/netbsd/pkgs/librt.nix @@ -9,8 +9,5 @@ mkDerivation { path = "lib/librt"; meta.platforms = lib.platforms.netbsd; extraPaths = [ libc.path ] ++ libc.extraPaths; - postPatch = '' - sed -i 's,/usr\(/include/sys/syscall.h\),${headers}\1,g' \ - $BSDSRCDIR/lib/{libc,librt}/sys/Makefile.inc - ''; + inherit (libc) postPatch; } diff --git a/pkgs/os-specific/bsd/netbsd/pkgs/mkDerivation.nix b/pkgs/os-specific/bsd/netbsd/pkgs/mkDerivation.nix index f4f103087587..5fb082e9d17f 100644 --- a/pkgs/os-specific/bsd/netbsd/pkgs/mkDerivation.nix +++ b/pkgs/os-specific/bsd/netbsd/pkgs/mkDerivation.nix @@ -2,7 +2,7 @@ lib, stdenv, stdenvNoCC, - crossLibcStdenv, + stdenvNoLibc, runCommand, rsync, source, @@ -23,7 +23,13 @@ lib.makeOverridable ( attrs: let - stdenv' = if attrs.noCC or false then stdenvNoCC else stdenv; + stdenv' = + if attrs.noCC or false then + stdenvNoCC + else if attrs.noLibc or false then + stdenvNoLibc + else + stdenv; in stdenv'.mkDerivation ( rec { diff --git a/pkgs/os-specific/bsd/openbsd/default.nix b/pkgs/os-specific/bsd/openbsd/default.nix index 00dba195b92f..bfc88f097865 100644 --- a/pkgs/os-specific/bsd/openbsd/default.nix +++ b/pkgs/os-specific/bsd/openbsd/default.nix @@ -1,16 +1,17 @@ { - stdenv, lib, - stdenvNoCC, makeScopeWithSplicing', generateSplicesForMkScope, - pkgs, buildPackages, - netbsd, }: -makeScopeWithSplicing' { +let otherSplices = generateSplicesForMkScope "openbsd"; + buildOpenbsd = otherSplices.selfBuildHost; +in + +makeScopeWithSplicing' { + inherit otherSplices; f = ( self: lib.packagesFromDirectoryRecursive { @@ -19,8 +20,8 @@ makeScopeWithSplicing' { } // { libc = self.callPackage ./pkgs/libc/package.nix { - inherit (self) csu include lorder; - inherit (buildPackages.openbsd) makeMinimal; + inherit (self) csu include; + inherit (buildOpenbsd) makeMinimal; inherit (buildPackages.netbsd) install gencat @@ -30,16 +31,16 @@ makeScopeWithSplicing' { }; makeMinimal = buildPackages.netbsd.makeMinimal.override { inherit (self) make-rules; }; mkDerivation = self.callPackage ./pkgs/mkDerivation.nix { - inherit stdenv; inherit (buildPackages.netbsd) install; + inherit (buildPackages.buildPackages) rsync; }; include = self.callPackage ./pkgs/include/package.nix { - inherit (buildPackages.openbsd) makeMinimal; + inherit (buildOpenbsd) makeMinimal; inherit (buildPackages.netbsd) install rpcgen mtree; }; csu = self.callPackage ./pkgs/csu.nix { inherit (self) include; - inherit (buildPackages.openbsd) makeMinimal; + inherit (buildOpenbsd) makeMinimal; inherit (buildPackages.netbsd) install; }; make-rules = self.callPackage ./pkgs/make-rules/package.nix { }; diff --git a/pkgs/os-specific/bsd/openbsd/pkgs/csu.nix b/pkgs/os-specific/bsd/openbsd/pkgs/csu.nix index a2b2153a729b..03a718042568 100644 --- a/pkgs/os-specific/bsd/openbsd/pkgs/csu.nix +++ b/pkgs/os-specific/bsd/openbsd/pkgs/csu.nix @@ -9,6 +9,7 @@ }: mkDerivation { + noLibc = true; path = "lib/csu"; nativeBuildInputs = [ bsdSetupHook diff --git a/pkgs/os-specific/bsd/openbsd/pkgs/libc/package.nix b/pkgs/os-specific/bsd/openbsd/pkgs/libc/package.nix index cf233c827840..03fd256eee9d 100644 --- a/pkgs/os-specific/bsd/openbsd/pkgs/libc/package.nix +++ b/pkgs/os-specific/bsd/openbsd/pkgs/libc/package.nix @@ -1,6 +1,6 @@ { lib, - stdenv, + stdenvNoLibc, mkDerivation, bsdSetupHook, openbsdSetupHook, @@ -10,7 +10,6 @@ byacc, gencat, rpcgen, - lorder, csu, include, ctags, @@ -19,7 +18,8 @@ fetchpatch, }: -mkDerivation rec { +mkDerivation { + noLibc = true; pname = "libc"; path = "lib/libc"; extraPaths = [ @@ -53,7 +53,6 @@ mkDerivation rec { gencat rpcgen ctags - lorder tsort ]; @@ -69,7 +68,9 @@ mkDerivation rec { # Suppress lld >= 16 undefined version errors # https://github.com/freebsd/freebsd-src/commit/2ba84b4bcdd6012e8cfbf8a0d060a4438623a638 - env.NIX_LDFLAGS = lib.optionalString (stdenv.hostPlatform.linker == "lld") "--undefined-version"; + env.NIX_LDFLAGS = lib.optionalString ( + stdenvNoLibc.hostPlatform.linker == "lld" + ) "--undefined-version"; makeFlags = [ "STRIP=-s" # flag to install, not command diff --git a/pkgs/os-specific/bsd/openbsd/pkgs/lorder.nix b/pkgs/os-specific/bsd/openbsd/pkgs/lorder.nix index 25ff1fcbd14f..c923a8431768 100644 --- a/pkgs/os-specific/bsd/openbsd/pkgs/lorder.nix +++ b/pkgs/os-specific/bsd/openbsd/pkgs/lorder.nix @@ -8,6 +8,7 @@ }: mkDerivation { + noCC = true; path = "usr.bin/lorder"; nativeBuildInputs = [ bsdSetupHook diff --git a/pkgs/os-specific/bsd/openbsd/pkgs/make-rules/package.nix b/pkgs/os-specific/bsd/openbsd/pkgs/make-rules/package.nix index 1e7c705c0dfd..fefa1136eb76 100644 --- a/pkgs/os-specific/bsd/openbsd/pkgs/make-rules/package.nix +++ b/pkgs/os-specific/bsd/openbsd/pkgs/make-rules/package.nix @@ -2,7 +2,6 @@ fetchpatch, lib, mkDerivation, - stdenv, }: mkDerivation { diff --git a/pkgs/os-specific/bsd/openbsd/pkgs/mkDerivation.nix b/pkgs/os-specific/bsd/openbsd/pkgs/mkDerivation.nix index 6c5bc5cd1719..931e45a5939b 100644 --- a/pkgs/os-specific/bsd/openbsd/pkgs/mkDerivation.nix +++ b/pkgs/os-specific/bsd/openbsd/pkgs/mkDerivation.nix @@ -2,6 +2,7 @@ lib, stdenv, stdenvNoCC, + stdenvNoLibc, runCommand, rsync, source, @@ -14,7 +15,13 @@ lib.makeOverridable ( attrs: let - stdenv' = if attrs.noCC or false then stdenvNoCC else stdenv; + stdenv' = + if attrs.noCC or false then + stdenvNoCC + else if attrs.noLibc or false then + stdenvNoLibc + else + stdenv; in stdenv'.mkDerivation ( rec { @@ -43,9 +50,6 @@ lib.makeOverridable ( HOST_SH = stdenv'.shell; - # Since STRIP below is the flag - STRIPBIN = "${stdenv.cc.bintools.targetPrefix}strip"; - makeFlags = [ "STRIP=-s" # flag to install, not command "-B" @@ -81,6 +85,9 @@ lib.makeOverridable ( // lib.optionalAttrs stdenv'.hasCC { # TODO should CC wrapper set this? CPP = "${stdenv'.cc.targetPrefix}cpp"; + + # Since STRIP below is the flag + STRIPBIN = "${stdenv'.cc.bintools.targetPrefix}strip"; } // lib.optionalAttrs (attrs.headersOnly or false) { installPhase = "includesPhase"; diff --git a/pkgs/os-specific/windows/default.nix b/pkgs/os-specific/windows/default.nix index 234abcde1611..7b9bbcc52f79 100644 --- a/pkgs/os-specific/windows/default.nix +++ b/pkgs/os-specific/windows/default.nix @@ -1,5 +1,5 @@ { lib, stdenv, buildPackages -, newScope, overrideCC, crossLibcStdenv, libcCross +, newScope, overrideCC, stdenvNoLibc, libcCross }: lib.makeScope newScope (self: with self; { @@ -14,11 +14,11 @@ lib.makeScope newScope (self: with self; { mingw_runtime = mingwrt; mingw_w64 = callPackage ./mingw-w64 { - stdenv = crossLibcStdenv; + stdenv = stdenvNoLibc; }; # FIXME untested with llvmPackages_16 was using llvmPackages_8 - crossThreadsStdenv = overrideCC crossLibcStdenv + crossThreadsStdenv = overrideCC stdenvNoLibc (if stdenv.hostPlatform.useLLVM or false then buildPackages.llvmPackages.clangNoLibcxx else buildPackages.gccWithoutTargetLibc.override (old: { diff --git a/pkgs/stdenv/adapters.nix b/pkgs/stdenv/adapters.nix index 2304b3289b7e..6a8b07b633ef 100644 --- a/pkgs/stdenv/adapters.nix +++ b/pkgs/stdenv/adapters.nix @@ -32,7 +32,11 @@ rec { # Override the compiler in stdenv for specific packages. - overrideCC = stdenv: cc: stdenv.override { allowedRequisites = null; cc = cc; }; + overrideCC = stdenv: cc: stdenv.override { + allowedRequisites = null; + cc = cc; + hasCC = cc != null; + }; # Add some arbitrary packages to buildInputs for specific packages. diff --git a/pkgs/stdenv/cross/default.nix b/pkgs/stdenv/cross/default.nix index 1cbbfeb6d202..de7ae432f360 100644 --- a/pkgs/stdenv/cross/default.nix +++ b/pkgs/stdenv/cross/default.nix @@ -41,25 +41,43 @@ in lib.init bootStages ++ [ if crossSystem.isStatic then buildPackages.stdenvAdapters.makeStatic else lib.id; + stdenvNoCC = adaptStdenv (buildPackages.stdenv.override (old: rec { + buildPlatform = localSystem; + hostPlatform = crossSystem; + targetPlatform = crossSystem; + + # Prior overrides are surely not valid as packages built with this run on + # a different platform, and so are disabled. + overrides = _: _: {}; + extraBuildInputs = [ ]; # Old ones run on wrong platform + allowedRequisites = null; + + cc = null; + hasCC = false; + + extraNativeBuildInputs = old.extraNativeBuildInputs + ++ lib.optionals + (hostPlatform.isLinux && !buildPlatform.isLinux) + [ buildPackages.patchelf ] + ++ lib.optional + (let f = p: !p.isx86 || builtins.elem p.libc [ "musl" "wasilibc" "relibc" ] || p.isiOS || p.isGenode; + in f hostPlatform && !(f buildPlatform) ) + buildPackages.updateAutotoolsGnuConfigScriptsHook + ; + })); in { inherit config; overlays = overlays ++ crossOverlays; selfBuild = false; + inherit stdenvNoCC; stdenv = let - baseStdenv = adaptStdenv (buildPackages.stdenv.override (old: rec { - buildPlatform = localSystem; - hostPlatform = crossSystem; - targetPlatform = crossSystem; - - # Prior overrides are surely not valid as packages built with this run on - # a different platform, and so are disabled. - overrides = _: _: {}; + inherit (stdenvNoCC) hostPlatform targetPlatform; + baseStdenv = stdenvNoCC.override { extraBuildInputs = [ ] # Old ones run on wrong platform ++ lib.optionals hostPlatform.isDarwin [ buildPackages.targetPackages.darwin.apple_sdk.frameworks.CoreFoundation ] ; - allowedRequisites = null; - hasCC = !targetPlatform.isGhcjs; + hasCC = !stdenvNoCC.targetPlatform.isGhcjs; cc = if crossSystem.useiOSPrebuilt or false then buildPackages.darwin.iosSdkPkgs.clang @@ -77,16 +95,7 @@ in lib.init bootStages ++ [ then buildPackages.llvmPackages.clang else buildPackages.gcc; - extraNativeBuildInputs = old.extraNativeBuildInputs - ++ lib.optionals - (hostPlatform.isLinux && !buildPlatform.isLinux) - [ buildPackages.patchelf ] - ++ lib.optional - (let f = p: !p.isx86 || builtins.elem p.libc [ "musl" "wasilibc" "relibc" ] || p.isiOS || p.isGenode; - in f hostPlatform && !(f buildPlatform) ) - buildPackages.updateAutotoolsGnuConfigScriptsHook - ; - })); + }; in if config ? replaceCrossStdenv then config.replaceCrossStdenv { inherit buildPackages baseStdenv; } else baseStdenv; }) diff --git a/pkgs/top-level/aliases.nix b/pkgs/top-level/aliases.nix index 9a3eefd2d184..e576abd64125 100644 --- a/pkgs/top-level/aliases.nix +++ b/pkgs/top-level/aliases.nix @@ -97,6 +97,7 @@ mapAliases ({ auditBlasHook = throw "'auditBlasHook' has been removed since it never worked"; # Added 2024-04-02 authy = throw "'authy' has been removed since it reached end of life"; # Added 2024-04-19 avldrums-lv2 = x42-avldrums; # Added 2020-03-29 + avrlibcCross = avrlibc; # Added 2024-06-18 awesome-4-0 = awesome; # Added 2022-05-05 aws-env = throw "aws-env has been removed as the upstream project was unmaintained"; # Added 2024-06-11 @@ -197,6 +198,7 @@ mapAliases ({ cope = throw "'cope' has been removed, as it is broken in nixpkgs since it was added, and fixing it is not trivial"; # Added 2024-04-12 cpp-ipfs-api = cpp-ipfs-http-client; # Project has been renamed. Added 2022-05-15 crispyDoom = crispy-doom; # Added 2023-05-01 + crossLibcStdenv = stdenvNoLibc; # Added 2024-06-18 cryptowatch-desktop = throw "Cryptowatch Desktop was sunset on September 30th 2023 and has been removed from nixpkgs"; # Added 2023-12-22 clash = throw "'clash' has been removed, upstream gone. Consider using 'mihomo' instead."; # added 2023-11-10 clasp = clingo; # added 2022-12-22 @@ -874,6 +876,7 @@ mapAliases ({ mpd_clientlib = libmpdclient; # Added 2021-02-11 mpdevil = plattenalbum; # Added 2024-05-22 mpg321 = throw "'mpg321' has been removed due to it being unmaintained by upstream. Consider using mpg123 instead."; # Added 2024-05-10 + msp430NewlibCross = msp430Newlib; # Added 2024-06-18 mumble_git = throw "'mumble_git' has been renamed to/replaced by 'pkgs.mumble'"; # Converted to throw 2023-09-10 murmur_git = throw "'murmur_git' has been renamed to/replaced by 'pkgs.murmur'"; # Converted to throw 2023-09-10 mutt-with-sidebar = mutt; # Added 2022-09-17 @@ -907,6 +910,8 @@ mapAliases ({ nagiosPluginsOfficial = monitoring-plugins; neochat = libsForQt5.kdeGear.neochat; # added 2022-05-10 neoload = throw "'neoload' has been removed as it is broken and unmaintained"; # Added 2024-03-02 + newlibCross = newlib; # Added 2024-06-18 + newlib-nanoCross = newlib-nano; # Added 2024-06-18 nitrokey-udev-rules = libnitrokey; # Added 2023-03-25 nix-direnv-flakes = nix-direnv; nix-repl = throw ( @@ -1333,6 +1338,8 @@ mapAliases ({ uade123 = uade; # Added 2022-07-30 uberwriter = apostrophe; # Added 2020-04-23 ubootBeagleboneBlack = ubootAmx335xEVM; # Added 2020-01-21 + uclibc = uclibc-ng; # Added 2022-06-16 + uclibcCross = uclibc-ng; # Added 2022-06-16 ue4 = throw "ue4 has been removed, because the package was broken for years"; # Added 2023-11-22 uhd3_5 = throw "uhd3_5 has been removed, because it was no longer needed"; # Added 2023-10-07 uhhyou.lv2 = throw "'uhhyou.lv2' has been removed, upstream gone"; # Added 2023-06-21 @@ -1470,6 +1477,10 @@ mapAliases ({ inherit (stdenv.hostPlatform) system; # Added 2021-10-22 inherit (stdenv) buildPlatform hostPlatform targetPlatform; # Added 2023-01-09 + freebsdCross = freebsd; # Added 20 |