Simplify definitions of libcs

- Used `stdenvNoLibc` directly in the package files instead of
  overriding `stdenv` to it in `all-packages.nix`
- Moved applicable libcs to `pkgs/by-name` (note: not newlib because
  it's also accessible via `newlib-nano`)
This commit is contained in:
Axel Karjalainen 2025-08-05 23:06:31 +03:00
parent 866ad45761
commit 1870d82500
5 changed files with 16 additions and 28 deletions

View File

@ -1,12 +1,12 @@
{
lib,
stdenv,
stdenvNoLibc,
fetchurl,
automake,
autoconf,
}:
stdenv.mkDerivation (finalAttrs: {
stdenvNoLibc.mkDerivation (finalAttrs: {
pname = "avr-libc";
version = "2.2.1";

View File

@ -1,11 +1,17 @@
{
stdenv,
stdenvNoLibc,
lib,
fetchurl,
linuxHeaders ? null,
useBSDCompatHeaders ? true,
}:
let
stdenv' = if stdenv.hostPlatform != stdenv.buildPlatform then stdenvNoLibc else stdenv;
in
let
stdenv = stdenv';
cdefs_h = fetchurl {
name = "sys-cdefs.h";
url = "https://git.alpinelinux.org/aports/plain/main/libc-dev/sys-cdefs.h?id=7ca0ed62d4c0d713d9c7dd5b9a077fba78bce578";

View File

@ -1,7 +1,6 @@
{
stdenv,
stdenvNoLibc,
buildPackages,
fetchFromGitHub,
lib,
firefox-unwrapped,
firefox-esr-unwrapped,
@ -11,7 +10,7 @@ let
pname = "wasilibc";
version = "22-unstable-2024-10-16";
in
stdenv.mkDerivation {
stdenvNoLibc.mkDerivation {
inherit pname version;
src = buildPackages.fetchFromGitHub {

View File

@ -1,5 +1,5 @@
{
stdenv,
stdenvNoLibc,
fetchurl,
buildPackages,
lib,
@ -11,7 +11,7 @@
nanoizeNewlib ? false,
}:
stdenv.mkDerivation (finalAttrs: {
stdenvNoLibc.mkDerivation (finalAttrs: {
pname = "newlib";
version = "4.5.0.20241231";
@ -76,7 +76,7 @@ stdenv.mkDerivation (finalAttrs: {
# "normal" view to the outside world: the binaries in $out will
# execute on `stdenv.hostPlatform`. We then fool newlib's build
# process into doing the right thing.
"--host=${stdenv.targetPlatform.config}"
"--host=${stdenvNoLibc.targetPlatform.config}"
]
++ (
@ -134,8 +134,8 @@ stdenv.mkDerivation (finalAttrs: {
+ ''[ "$(find $out -type f | wc -l)" -gt 0 ] || (echo '$out is empty' 1>&2 && exit 1)'';
passthru = {
incdir = "/${stdenv.targetPlatform.config}/include";
libdir = "/${stdenv.targetPlatform.config}/lib";
incdir = "/${stdenvNoLibc.targetPlatform.config}/include";
libdir = "/${stdenvNoLibc.targetPlatform.config}/lib";
};
meta = with lib; {

View File

@ -6646,10 +6646,6 @@ with pkgs;
h3 = h3_3;
avrlibc = callPackage ../development/misc/avr/libc {
stdenv = stdenvNoLibc;
};
sourceFromHead = callPackage ../build-support/source-from-head-fun.nix { };
jruby = callPackage ../development/interpreters/jruby { };
@ -8005,12 +8001,6 @@ with pkgs;
withGd = true;
};
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.
preLibcHeaders =
let
@ -8082,10 +8072,6 @@ with pkgs;
package = windows.mcfgthreads;
};
wasilibc = callPackage ../development/libraries/wasilibc {
stdenv = stdenvNoLibc;
};
# Only supported on Linux and only on glibc
glibcLocales =
if stdenv.hostPlatform.isLinux && stdenv.hostPlatform.isGnu then
@ -16287,12 +16273,9 @@ with pkgs;
xp-pen-deco-01-v2-driver = libsForQt5.xp-pen-deco-01-v2-driver;
newlib = callPackage ../development/misc/newlib {
stdenv = stdenvNoLibc;
};
newlib = callPackage ../development/misc/newlib { };
newlib-nano = callPackage ../development/misc/newlib {
stdenv = stdenvNoLibc;
nanoizeNewlib = true;
};