mirror of
https://github.com/NixOS/nixpkgs.git
synced 2026-08-30 20:24:43 +00:00
82 lines
1.5 KiB
Nix
82 lines
1.5 KiB
Nix
{
|
|
lib,
|
|
buildPlatform,
|
|
hostPlatform,
|
|
fetchurl,
|
|
bash,
|
|
gcc,
|
|
binutils,
|
|
gnumake,
|
|
gnused,
|
|
gnugrep,
|
|
gawk,
|
|
diffutils,
|
|
findutils,
|
|
gnutar,
|
|
gzip,
|
|
linux-headers,
|
|
}:
|
|
let
|
|
inherit (import ./common.nix { inherit lib; }) meta;
|
|
pname = "coreutils-static";
|
|
version = "9.11";
|
|
|
|
src = fetchurl {
|
|
url = "mirror://gnu/coreutils/coreutils-${version}.tar.gz";
|
|
hash = "sha256-IDO4owScBr/0mp486nK99Gg7zQy+uXUhHdVtuvi3Nq4=";
|
|
};
|
|
|
|
configureFlags = [
|
|
"--prefix=${placeholder "out"}"
|
|
"--build=${buildPlatform.config}"
|
|
"--host=${hostPlatform.config}"
|
|
"--disable-dependency-tracking"
|
|
"--disable-nls"
|
|
# libstdbuf.so fails in static builds
|
|
"--enable-no-install-program=stdbuf"
|
|
"--enable-single-binary=symlinks"
|
|
"CFLAGS=\"-I${linux-headers}/include\""
|
|
];
|
|
in
|
|
bash.runCommand "${pname}-${version}"
|
|
{
|
|
inherit pname version meta;
|
|
|
|
nativeBuildInputs = [
|
|
gcc
|
|
binutils
|
|
gnumake
|
|
gnused
|
|
gnugrep
|
|
gawk
|
|
diffutils
|
|
findutils
|
|
gnutar
|
|
gzip
|
|
];
|
|
|
|
passthru.tests.get-version =
|
|
result:
|
|
bash.runCommand "${pname}-get-version-${version}" { } ''
|
|
${result}/bin/coreutils --version
|
|
mkdir $out
|
|
'';
|
|
}
|
|
''
|
|
# Unpack
|
|
tar xzf ${src}
|
|
cd coreutils-${version}
|
|
|
|
# Configure
|
|
bash ./configure ${lib.concatStringsSep " " configureFlags}
|
|
|
|
# Build
|
|
make -j $NIX_BUILD_CORES
|
|
|
|
# Install
|
|
make -j $NIX_BUILD_CORES install-strip
|
|
|
|
# Remove documentation not needed in the bootstrap chain.
|
|
rm -rf $out/share
|
|
''
|