1
0
Fork 1
mirror of https://github.com/NixOS/nixpkgs.git synced 2025-06-09 09:36:20 +09:00

libcCross: Remove!

We have a long-standing goal of nothing with "cross" in its name. This
gets us much closer!
This commit is contained in:
John Ericson 2025-05-26 01:40:09 -04:00
parent 66576dcd9e
commit 5c1955ff14
12 changed files with 115 additions and 111 deletions

View file

@ -53,7 +53,7 @@ python3.pkgs.buildPythonApplication rec {
pkgsCross.avr.buildPackages.binutils
pkgsCross.avr.buildPackages.binutils.bintools
pkgsCross.avr.buildPackages.gcc
pkgsCross.avr.libcCross
pkgsCross.avr.libc
];
# no tests implemented

View file

@ -14,7 +14,7 @@
libxslt,
libxcrypt,
pkg-config,
glibcCross ? null,
glibc ? null,
pam ? null,
withLibbsd ? lib.meta.availableOn stdenv.hostPlatform libbsd,
libbsd,
@ -24,7 +24,7 @@
let
glibc =
if stdenv.hostPlatform != stdenv.buildPlatform then
glibcCross
glibc
else
assert stdenv.hostPlatform.libc == "glibc";
stdenv.cc.libc;

View file

@ -2,10 +2,9 @@
lib,
stdenv,
pkgs,
targetPackages,
callPackage,
isl_0_20,
libcCross,
threadsCross,
noSysDirs,
lowPrio,
wrapCC,
@ -27,9 +26,15 @@ let
reproducibleBuild = true;
profiledCompiler = false;
libcCross =
if !lib.systems.equals stdenv.targetPlatform stdenv.buildPlatform then args.libcCross else null;
if !lib.systems.equals stdenv.targetPlatform stdenv.buildPlatform then
targetPackages.libc or pkgs.libc
else
null;
threadsCross =
if !lib.systems.equals stdenv.targetPlatform stdenv.buildPlatform then threadsCross else { };
if !lib.systems.equals stdenv.targetPlatform stdenv.buildPlatform then
targetPackages.threads or pkgs.threads
else
{ };
isl = if stdenv.hostPlatform.isDarwin then null else isl_0_20;
# do not allow version skew when cross-building gcc
#

View file

@ -38,7 +38,7 @@
enablePlugin ? (lib.systems.equals stdenv.hostPlatform stdenv.buildPlatform), # Whether to support user-supplied plug-ins
name ? "gcc",
libcCross ? null,
threadsCross ? null, # for MinGW
threadsCross ? { }, # for MinGW
withoutTargetLibc ? false,
flex,
gnused ? null,

View file

@ -8,7 +8,7 @@
mailcap,
buildPackages,
pkgsBuildTarget,
threadsCross,
targetPackages,
testers,
skopeo,
buildGo123Module,
@ -42,7 +42,7 @@ stdenv.mkDerivation (finalAttrs: {
depsBuildTarget = lib.optional isCross targetCC;
depsTargetTarget = lib.optional stdenv.targetPlatform.isWindows threadsCross.package;
depsTargetTarget = lib.optional stdenv.targetPlatform.isWindows targetPackages.threads.package;
postPatch = ''
patchShebangs .

View file

@ -8,7 +8,7 @@
mailcap,
buildPackages,
pkgsBuildTarget,
threadsCross,
targetPackages,
testers,
skopeo,
buildGo124Module,
@ -42,7 +42,7 @@ stdenv.mkDerivation (finalAttrs: {
depsBuildTarget = lib.optional isCross targetCC;
depsTargetTarget = lib.optional stdenv.targetPlatform.isWindows threadsCross.package;
depsTargetTarget = lib.optional stdenv.targetPlatform.isWindows targetPackages.threads.package;
postPatch = ''
patchShebangs .

View file

@ -2,9 +2,9 @@
lowPrio,
newScope,
pkgs,
targetPackages,
lib,
stdenv,
preLibcCrossHeaders,
libxcrypt,
substitute,
replaceVars,
@ -255,7 +255,7 @@ let
bintoolsNoLibc = wrapBintoolsWith {
bintools = tools.bintools-unwrapped;
libc = preLibcCrossHeaders;
libc = targetPackages.preLibcHeaders;
};
bintools = wrapBintoolsWith { bintools = tools.bintools-unwrapped; };

View file

@ -2,10 +2,10 @@
lib,
stdenv,
buildPackages,
pkgs,
newScope,
overrideCC,
stdenvNoLibc,
libcCross,
}:
lib.makeScope newScope (
@ -31,9 +31,9 @@ lib.makeScope newScope (
else
buildPackages.gccWithoutTargetLibc.override (old: {
bintools = old.bintools.override {
libc = libcCross;
libc = pkgs.libc;
};
libc = libcCross;
libc = pkgs.libc;
})
);

View file

@ -320,7 +320,6 @@ mapAliases {
autoadb = throw "'autoadb' has been removed due to lack of maintenance upstream"; # Added 2025-01-25
avldrums-lv2 = throw "'avldrums-lv2' has been renamed to/replaced by 'x42-avldrums'"; # Converted to throw 2024-10-17
avr-sim = throw "'avr-sim' has been removed as it was broken and unmaintained. Possible alternatives are 'simavr', SimulAVR and AVRStudio."; # Added 2025-05-31
avrlibcCross = avrlibc; # Added 2024-09-06
axmldec = throw "'axmldec' has been removed as it was broken and unmaintained for 8 years"; # Added 2025-05-17
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
@ -1955,7 +1954,6 @@ mapAliases {
ubootBeagleboneBlack = throw "'ubootBeagleboneBlack' has been renamed to/replaced by 'ubootAmx335xEVM'"; # Converted to throw 2024-10-17
ubuntu_font_family = ubuntu-classic; # Added 2024-02-19
uclibc = uclibc-ng; # Added 2022-06-16
uclibcCross = uclibc-ng; # Added 2022-06-16
unicap = "'unicap' has been removed because it is unmaintained"; # Added 2025-05-17
unicorn-emu = throw "'unicorn-emu' has been renamed to/replaced by 'unicorn'"; # Converted to throw 2024-10-17
uniffi-bindgen = throw "uniffi-bindgen has been removed since upstream no longer provides a standalone package for the CLI";

View file

@ -5175,7 +5175,7 @@ with pkgs;
gccWithoutTargetLibc =
assert stdenv.targetPlatform != stdenv.hostPlatform;
let
libcCross1 = binutilsNoLibc.libc;
libc1 = binutilsNoLibc.libc;
in
wrapCCWith {
cc = gccFun {
@ -5190,7 +5190,7 @@ with pkgs;
withoutTargetLibc = true;
langCC = false;
libcCross = libcCross1;
libcCross = libc1;
targetPackages.stdenv.cc.bintools = binutilsNoLibc;
enableShared =
stdenv.targetPlatform.hasSharedLibraries
@ -5201,7 +5201,7 @@ with pkgs;
&& !(stdenv.targetPlatform.useLLVM or false);
};
bintools = binutilsNoLibc;
libc = libcCross1;
libc = libc1;
extraPackages = [ ];
};
@ -6142,7 +6142,7 @@ with pkgs;
libcxx ? null,
extraPackages ? lib.optional (
cc.isGNU or false && stdenv.targetPlatform.isMinGW
) threadsCross.package,
) targetPackages.threads.package,
nixSupport ? { },
...
}@extraArgs:
@ -6182,7 +6182,7 @@ with pkgs;
wrapBintoolsWith =
{
bintools,
libc ? if stdenv.targetPlatform != stdenv.hostPlatform then libcCross else stdenv.cc.libc,
libc ? if stdenv.targetPlatform != stdenv.hostPlatform then targetPackages.libc else stdenv.cc.libc,
...
}@extraArgs:
callPackage ../build-support/bintools-wrapper (
@ -7001,7 +7001,7 @@ with pkgs;
});
binutilsNoLibc = wrapBintoolsWith {
bintools = binutils-unwrapped;
libc = preLibcCrossHeaders;
libc = targetPackages.preLibcHeaders;
};
libbfd = callPackage ../development/tools/misc/binutils/libbfd.nix { };
@ -7055,7 +7055,7 @@ with pkgs;
null;
bintoolsNoLibc = wrapBintoolsWith {
bintools = bintools-unwrapped;
libc = preLibcCrossHeaders;
libc = targetPackages.preLibcHeaders;
};
bintools = wrapBintoolsWith {
bintools = bintools-unwrapped;
@ -8155,9 +8155,21 @@ with pkgs;
withMinecraftPatch = true;
};
glibc = callPackage ../development/libraries/glibc {
stdenv = gccStdenv; # doesn't compile without gcc
};
glibc = callPackage ../development/libraries/glibc (
if stdenv.hostPlatform != stdenv.buildPlatform then
{
stdenv = gccCrossLibcStdenv; # doesn't compile without gcc
libgcc = callPackage ../development/libraries/gcc/libgcc {
gcc = gccCrossLibcStdenv.cc;
glibc = glibc.override { libgcc = null; };
stdenvNoLibs = gccCrossLibcStdenv;
};
}
else
{
stdenv = gccStdenv; # doesn't compile without gcc
}
);
mtrace = callPackage ../development/libraries/glibc/mtrace.nix { };
@ -8168,96 +8180,85 @@ with pkgs;
withGd = true;
};
# Being redundant to avoid cycles on boot. TODO: find a better way
glibcCross = callPackage ../development/libraries/glibc {
stdenv = gccCrossLibcStdenv; # doesn't compile without gcc
libgcc = callPackage ../development/libraries/gcc/libgcc {
gcc = gccCrossLibcStdenv.cc;
glibc = glibcCross.override { libgcc = null; };
stdenvNoLibs = gccCrossLibcStdenv;
};
};
muslCross = musl.override {
stdenv = stdenvNoLibc;
};
musl = callPackage ../by-name/mu/musl/package.nix (
lib.optionalAttrs (stdenv.hostPlatform != stdenv.buildPlatform) {
stdenv = stdenvNoLibc;
}
);
# These are used when building compiler-rt / libgcc, prior to building libc.
preLibcCrossHeaders =
preLibcHeaders =
let
inherit (stdenv.targetPlatform) libc;
inherit (stdenv.hostPlatform) libc;
in
if stdenv.targetPlatform.isMinGW then
targetPackages.windows.mingw_w64_headers or windows.mingw_w64_headers
if stdenv.hostPlatform.isMinGW then
windows.mingw_w64_headers or fallback
else if libc == "nblibc" then
targetPackages.netbsd.headers or netbsd.headers
netbsd.headers
else
null;
# We can choose:
libcCrossChooser =
name:
# libc is hackily often used from the previous stage. This `or`
# hack fixes the hack, *sigh*.
if name == null then
null
else if name == "glibc" then
targetPackages.glibcCross or glibcCross
else if name == "bionic" then
targetPackages.bionic or bionic
else if name == "uclibc" then
targetPackages.uclibc or uclibc
else if name == "avrlibc" then
targetPackages.avrlibc or avrlibc
else if name == "newlib" && stdenv.targetPlatform.isMsp430 then
targetPackages.msp430Newlib or msp430Newlib
else if name == "newlib" && stdenv.targetPlatform.isVc4 then
targetPackages.vc4-newlib or vc4-newlib
else if name == "newlib" && stdenv.targetPlatform.isOr1k then
targetPackages.or1k-newlib or or1k-newlib
else if name == "newlib" then
targetPackages.newlib or newlib
else if name == "newlib-nano" then
targetPackages.newlib-nano or newlib-nano
else if name == "musl" then
targetPackages.muslCross or muslCross
else if name == "msvcrt" then
targetPackages.windows.mingw_w64 or windows.mingw_w64
else if name == "ucrt" then
targetPackages.windows.mingw_w64 or windows.mingw_w64
else if name == "libSystem" then
if stdenv.targetPlatform.useiOSPrebuilt then
targetPackages.darwin.iosSdkPkgs.libraries or darwin.iosSdkPkgs.libraries
libc =
if stdenv.hostPlatform == stdenv.buildPlatform then
# TODO get rid of this branch after the native boostrap is reworked
stdenv.cc.libc
else
let
inherit (stdenv.hostPlatform) libc;
# libc is hackily often used from the previous stage. This `or`
# hack fixes the hack, *sigh*.
in
if libc == null then
null
else if libc == "glibc" then
glibc
else if libc == "bionic" then
bionic
else if libc == "uclibc" then
uclibc
else if libc == "avrlibc" then
avrlibc
else if libc == "newlib" && stdenv.hostPlatform.isMsp430 then
msp430Newlib
else if libc == "newlib" && stdenv.hostPlatform.isVc4 then
vc4-newlib
else if libc == "newlib" && stdenv.hostPlatform.isOr1k then
or1k-newlib
else if libc == "newlib" then
newlib
else if libc == "newlib-nano" then
newlib-nano
else if libc == "musl" then
musl
else if libc == "msvcrt" then
windows.mingw_w64
else if libc == "ucrt" then
windows.mingw_w64
else if libc == "libSystem" then
if stdenv.hostPlatform.useiOSPrebuilt then darwin.iosSdkPkgs.libraries else darwin.libSystem
else if libc == "fblibc" then
freebsd.libc
else if libc == "oblibc" then
openbsd.libc
else if libc == "nblibc" then
netbsd.libc
else if libc == "wasilibc" then
wasilibc
else if libc == "relibc" then
relibc
else if name == "llvm" then
llvmPackages_20.libc
else
targetPackages.darwin.libSystem or darwin.libSystem
else if name == "fblibc" then
targetPackages.freebsd.libc or freebsd.libc
else if name == "oblibc" then
targetPackages.openbsd.libc or openbsd.libc
else if name == "nblibc" then
targetPackages.netbsd.libc or netbsd.libc
else if name == "wasilibc" then
targetPackages.wasilibc or wasilibc
else if name == "relibc" then
targetPackages.relibc or relibc
else if name == "llvm" then
targetPackages.llvmPackages_20.libc or llvmPackages_20.libc
else
throw "Unknown libc ${name}";
throw "Unknown libc ${libc}";
libcCross =
if stdenv.targetPlatform == stdenv.buildPlatform then
null
else
libcCrossChooser stdenv.targetPlatform.libc;
threadsCross =
lib.optionalAttrs (stdenv.targetPlatform.isMinGW && !(stdenv.targetPlatform.useLLVM or false))
threads =
lib.optionalAttrs (stdenv.hostPlatform.isMinGW && !(stdenv.hostPlatform.useLLVM or false))
{
# other possible values: win32 or posix
model = "mcf";
# For win32 or posix set this to null
package = targetPackages.windows.mcfgthreads or windows.mcfgthreads;
package = windows.mcfgthreads;
};
wasilibc = callPackage ../development/libraries/wasilibc {
@ -8775,7 +8776,7 @@ with pkgs;
"fblibc"
]
then
libcIconv (if stdenv.hostPlatform != stdenv.buildPlatform then libcCross else stdenv.cc.libc)
libcIconv (if stdenv.hostPlatform != stdenv.buildPlatform then libc else stdenv.cc.libc)
else if stdenv.hostPlatform.isDarwin then
darwin.libiconv
else
@ -9582,7 +9583,7 @@ with pkgs;
simavr = callPackage ../development/tools/simavr {
avrgcc = pkgsCross.avr.buildPackages.gcc;
avrlibc = pkgsCross.avr.libcCross;
avrlibc = pkgsCross.avr.libc;
};
simpleitk = callPackage ../development/libraries/simpleitk { lua = lua5_4; };

View file

@ -6,7 +6,6 @@
generateSplicesForMkScope,
makeScopeWithSplicing',
stdenv,
preLibcCrossHeaders,
config,
}:
@ -57,7 +56,8 @@ makeScopeWithSplicing' {
};
binutils = pkgs.wrapBintoolsWith {
libc = if stdenv.targetPlatform != stdenv.hostPlatform then pkgs.libcCross else pkgs.stdenv.cc.libc;
libc =
if stdenv.targetPlatform != stdenv.hostPlatform then targetPackages.libc else pkgs.stdenv.cc.libc;
bintools = self.binutils-unwrapped;
};
@ -88,7 +88,7 @@ makeScopeWithSplicing' {
};
binutilsNoLibc = pkgs.wrapBintoolsWith {
libc = preLibcCrossHeaders;
libc = targetPackages.preLibcHeaders;
bintools = self.binutils-unwrapped;
};

View file

@ -71,13 +71,13 @@ let
embedded = {
buildPackages.binutils = nativePlatforms;
buildPackages.gcc = nativePlatforms;
libcCross = nativePlatforms;
libc = nativePlatforms;
};
common = {
buildPackages.binutils = nativePlatforms;
gmp = nativePlatforms;
libcCross = nativePlatforms;
libc = nativePlatforms;
nix = nativePlatforms;
nixVersions.git = nativePlatforms;
mesa = nativePlatforms;