[staging-next] fix pkgsMusl.stdenv without mass-rebuild (#474358)

This commit is contained in:
Yureka
2025-12-29 15:05:29 +00:00
committed by GitHub
5 changed files with 111 additions and 29 deletions
@@ -36,7 +36,9 @@ stdenv.mkDerivation (finalAttrs: {
# TODO: stdenvs setup.sh should be aware of patch directories. Its very
# convenient to keep them in a separate directory but we can defer listing the
# directory until derivation realization to avoid unnecessary Nix evaluations.
patches = lib.filesystem.listFilesRecursive ./patches;
patches =
lib.filesystem.listFilesRecursive ./patches
++ lib.optionals stdenv.hostPlatform.isMusl (lib.filesystem.listFilesRecursive ./musl-patches);
nativeBuildInputs = [
autoreconfHook
@@ -0,0 +1,50 @@
From 776f707b5bb67d4c0c15f981b5a1b6d7f3a9cebc Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Sat, 22 Mar 2025 14:24:57 -0700
Subject: [PATCH 4/5] Fix signatures for getenv/getopt
GCC-15 complains about missing parameters, this gets found
out when using non-glibc ( e.g. musl ) C library
Fixes
lib/fnmatch.c:124:14: error: conflicting types for 'getenv'; have 'char *(void)'
| 124 | extern char *getenv ();
| | ^~~~~~
src/getopt.c: Define parameters of getenv() and getopt().
src/getopt.h: Ditto.
---
Link: https://lists.gnu.org/archive/html/bug-make/2025-03/msg00032.html
src/getopt.c | 2 +-
src/getopt.h | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/getopt.c b/src/getopt.c
index 7a792de8..76251ccb 100644
--- a/src/getopt.c
+++ b/src/getopt.c
@@ -202,7 +202,7 @@ static char *posixly_correct;
whose names are inconsistent. */
#ifndef getenv
-extern char *getenv ();
+extern char *getenv (const char *);
#endif
static char *
diff --git a/src/getopt.h b/src/getopt.h
index df18ceeb..d8bb2263 100644
--- a/src/getopt.h
+++ b/src/getopt.h
@@ -102,7 +102,7 @@ struct option
errors, only prototype getopt for the GNU C library. */
extern int getopt (int argc, char *const *argv, const char *shortopts);
#else /* not __GNU_LIBRARY__ */
-extern int getopt ();
+extern int getopt (int, char * const*, const char *);
#endif /* __GNU_LIBRARY__ */
extern int getopt_long (int argc, char *const *argv, const char *shortopts,
const struct option *longopts, int *longind);
--
2.51.2
@@ -0,0 +1,34 @@
From a4169ae60a7cb2c2bc788daa2c91441cc807acbc Mon Sep 17 00:00:00 2001
From: Yureka <yuka@yuka.dev>
Date: Mon, 22 Dec 2025 20:53:31 +0100
Subject: [PATCH 5/5] Fix signatures for getenv/getopt
As the previous commit, this fixes GCC-15 complaining about mismatching
definitions with non-glibc (musl) C library.
Fixes
lib/fnmatch.c:124:14: error: conflicting types for 'getenv'; have 'char *(void)'
| 124 | extern char *getenv ();
| | ^~~~~~
lib/fnmatch.c: Define parameters of getenv()
---
lib/fnmatch.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/fnmatch.c b/lib/fnmatch.c
index 01da376b..cb1c856b 100644
--- a/lib/fnmatch.c
+++ b/lib/fnmatch.c
@@ -121,7 +121,7 @@ USA. */
whose names are inconsistent. */
# if !defined _LIBC && !defined getenv
-extern char *getenv ();
+extern char *getenv (const char *);
# endif
# ifndef errno
--
2.51.2
@@ -1,25 +1,21 @@
# Autogenerated by maintainers/scripts/bootstrap-files/refresh-tarballs.bash as:
# $ ./refresh-tarballs.bash --targets=aarch64-unknown-linux-musl
#
# Files came from this Hydra build:
#
# https://hydra.nixos.org/build/246470544
#
# …which used nixpkgs revision dd5621df6dcb90122b50da5ec31c411a0de3e538
# to instantiate:
#
# /nix/store/g480ass2vjmakaq03z7k2j95xnxh206a-stdenv-bootstrap-tools.drv
#
# …and then built:
#
# /nix/store/95lm0y33dayag4542s8bi83s31bw68dr-stdenv-bootstrap-tools
#
# Metadata:
# - nixpkgs revision: 8c29968b3a942f2903f90797f9623737c215737c
# - hydra build: https://hydra.nixos.org/job/nixpkgs/trunk/stdenvBootstrapTools.aarch64-unknown-linux-musl.build/latest
# - resolved hydra build: https://hydra.nixos.org/build/315356516
# - instantiated derivation: /nix/store/zd9i77gp51l3chdkfyqhffzfnmbmf02y-stdenv-bootstrap-tools.drv
# - output directory: /nix/store/c3qpy1mlcrqklpak5lkgdy0l0kbsndl1-stdenv-bootstrap-tools
# - build time: Mon, 01 Dec 2025 18:29:46 +0000
{
bootstrapTools = import <nix/fetchurl.nix> {
url = "http://tarballs.nixos.org/stdenv/aarch64-unknown-linux-musl/8c29968b3a942f2903f90797f9623737c215737c/bootstrap-tools.tar.xz";
hash = "sha256-nw/PFVwYZG9oPuQSf760VSwKzHKKZA3r+XqDr8HLytg=";
};
busybox = import <nix/fetchurl.nix> {
url = "http://tarballs.nixos.org/stdenv/aarch64-unknown-linux-musl/dd5621df6dcb90122b50da5ec31c411a0de3e538/busybox";
sha256 = "sha256-WuOaun7U5enbOy8SuuCo6G1fbGwsO16jhy/oM8K0lAs=";
url = "http://tarballs.nixos.org/stdenv/aarch64-unknown-linux-musl/8c29968b3a942f2903f90797f9623737c215737c/busybox";
hash = "sha256-ASctUeTLD/TC6aZHX9xuRsmlacwCDxt9zsb/gy6Ia1g=";
executable = true;
};
bootstrapTools = import <nix/fetchurl.nix> {
url = "http://tarballs.nixos.org/stdenv/aarch64-unknown-linux-musl/dd5621df6dcb90122b50da5ec31c411a0de3e538/bootstrap-tools.tar.xz";
hash = "sha256-ZY9IMOmx1VOn6uoFDpdJbTnPX59TEkrVCzWNtjQ8/QE=";
};
}
@@ -2,20 +2,20 @@
# $ ./refresh-tarballs.bash --targets=x86_64-unknown-linux-musl
#
# Metadata:
# - nixpkgs revision: 125cefd4cf8f857e5ff1aceaef9230ba578a033d
# - nixpkgs revision: 8c29968b3a942f2903f90797f9623737c215737c
# - hydra build: https://hydra.nixos.org/job/nixpkgs/trunk/stdenvBootstrapTools.x86_64-unknown-linux-musl.build/latest
# - resolved hydra build: https://hydra.nixos.org/build/247890807
# - instantiated derivation: /nix/store/gqri9n85rsf2983r6m8lkz0h69k4n7xi-stdenv-bootstrap-tools.drv
# - output directory: /nix/store/b0x0qcbf1gsp50jzw52sbbgdp3jlwcjf-stdenv-bootstrap-tools
# - build time: Fri, 26 Jan 2024 22:09:22 +0000
# - resolved hydra build: https://hydra.nixos.org/build/315356522
# - instantiated derivation: /nix/store/783rl6mlrc2wpp9apclcvc8x7vwi842s-stdenv-bootstrap-tools.drv
# - output directory: /nix/store/f881dxkvjal4vflnznfbz7g6pn4q0c56-stdenv-bootstrap-tools
# - build time: Mon, 01 Dec 2025 18:29:47 +0000
{
bootstrapTools = import <nix/fetchurl.nix> {
url = "http://tarballs.nixos.org/stdenv/x86_64-unknown-linux-musl/125cefd4cf8f857e5ff1aceaef9230ba578a033d/bootstrap-tools.tar.xz";
hash = "sha256-t0W2MR7UwtPyYEGcRo9UOuXfaP4uUZKZXEmYGcBOuOA=";
url = "http://tarballs.nixos.org/stdenv/x86_64-unknown-linux-musl/8c29968b3a942f2903f90797f9623737c215737c/bootstrap-tools.tar.xz";
hash = "sha256-WwA4q0JNEdnSAhTwcPGIrwuOha33T0aRG7tR/YgA7L4=";
};
busybox = import <nix/fetchurl.nix> {
url = "http://tarballs.nixos.org/stdenv/x86_64-unknown-linux-musl/125cefd4cf8f857e5ff1aceaef9230ba578a033d/busybox";
hash = "sha256-0U2r3EU61oqhs+oyzFABIFTCVqXOWSP0qEtnyHwjzm0=";
url = "http://tarballs.nixos.org/stdenv/x86_64-unknown-linux-musl/8c29968b3a942f2903f90797f9623737c215737c/busybox";
hash = "sha256-XJTiB2U3KkP31G5s68Ho7wQY5yz72CZkLSarR+56zKw=";
executable = true;
};
}