openxray: 2188-november-2023-rc1 -> 2921-january-2025-rc1 (#375925)
[NixPkgs.git] / pkgs / os-specific / linux / minimal-bootstrap / coreutils / musl.nix
blobb37e94a5f2632742cd04309ffa2d4886444cecf4
2   lib,
3   buildPlatform,
4   hostPlatform,
5   fetchurl,
6   bash,
7   tinycc,
8   gnumake,
9   gnugrep,
10   gnused,
11   gawk,
12   gnutar,
13   gzip,
15 let
16   pname = "bootstrap-coreutils-musl";
17   version = "9.4";
19   src = fetchurl {
20     url = "mirror://gnu/coreutils/coreutils-${version}.tar.gz";
21     hash = "sha256-X2ANkJOXOwr+JTk9m8GMRPIjJlf0yg2V6jHHAutmtzk=";
22   };
24   configureFlags = [
25     "--prefix=${placeholder "out"}"
26     "--build=${buildPlatform.config}"
27     "--host=${hostPlatform.config}"
28     # musl 1.1.x doesn't use 64bit time_t
29     "--disable-year2038"
30     # libstdbuf.so fails in static builds
31     "--enable-no-install-program=stdbuf"
32   ];
34 bash.runCommand "${pname}-${version}"
35   {
36     inherit pname version;
38     nativeBuildInputs = [
39       tinycc.compiler
40       gnumake
41       gnused
42       gnugrep
43       gawk
44       gnutar
45       gzip
46     ];
48     passthru.tests.get-version =
49       result:
50       bash.runCommand "${pname}-get-version-${version}" { } ''
51         ${result}/bin/cat --version
52         mkdir $out
53       '';
55     meta = with lib; {
56       description = "GNU Core Utilities";
57       homepage = "https://www.gnu.org/software/coreutils";
58       license = licenses.gpl3Plus;
59       maintainers = teams.minimal-bootstrap.members;
60       platforms = platforms.unix;
61     };
62   }
63   ''
64     # Unpack
65     tar xzf ${src}
66     cd coreutils-${version}
68     # Configure
69     export CC="tcc -B ${tinycc.libs}/lib"
70     export LD=tcc
71     bash ./configure ${lib.concatStringsSep " " configureFlags}
73     # Build
74     make -j $NIX_BUILD_CORES AR="tcc -ar" MAKEINFO="true"
76     # Install
77     make -j $NIX_BUILD_CORES install MAKEINFO="true"
78   ''