From 5d403f7f0d34060f1c383a3c95ca012fb44dcae5 Mon Sep 17 00:00:00 2001 From: Emily Trau Date: Mon, 9 Oct 2023 22:16:39 -0700 Subject: [PATCH] minimal-bootstrap.diffutils-static: init at 3.12 --- .../linux/minimal-bootstrap/default.nix | 7 ++ .../minimal-bootstrap/diffutils/static.nix | 80 +++++++++++++++++++ 2 files changed, 87 insertions(+) create mode 100644 pkgs/os-specific/linux/minimal-bootstrap/diffutils/static.nix diff --git a/pkgs/os-specific/linux/minimal-bootstrap/default.nix b/pkgs/os-specific/linux/minimal-bootstrap/default.nix index 94e4a5176154..6e3eef9d712d 100644 --- a/pkgs/os-specific/linux/minimal-bootstrap/default.nix +++ b/pkgs/os-specific/linux/minimal-bootstrap/default.nix @@ -90,6 +90,12 @@ lib.makeScope gnutar = gnutar-musl; }; + diffutils-static = callPackage ./diffutils/static.nix { + gcc = gcc-latest; + gnumake = gnumake-musl; + gnutar = gnutar-latest; + }; + findutils = callPackage ./findutils { tinycc = tinycc-musl; gnumake = gnumake-musl; @@ -329,6 +335,7 @@ lib.makeScope echo ${coreutils-musl.tests.get-version} echo ${coreutils-static.tests.get-version} echo ${diffutils.tests.get-version} + echo ${diffutils-static.tests.get-version} echo ${findutils.tests.get-version} echo ${gawk.tests.get-version} echo ${gawk-mes.tests.get-version} diff --git a/pkgs/os-specific/linux/minimal-bootstrap/diffutils/static.nix b/pkgs/os-specific/linux/minimal-bootstrap/diffutils/static.nix new file mode 100644 index 000000000000..632c02a687d7 --- /dev/null +++ b/pkgs/os-specific/linux/minimal-bootstrap/diffutils/static.nix @@ -0,0 +1,80 @@ +{ + lib, + buildPlatform, + hostPlatform, + fetchurl, + bash, + gcc, + musl, + binutils, + gnumake, + gnused, + gnugrep, + gawk, + diffutils, + findutils, + gnutar, + xz, +}: +let + pname = "diffutils-static"; + version = "3.12"; + + src = fetchurl { + url = "mirror://gnu/diffutils/diffutils-${version}.tar.xz"; + hash = "sha256-fIt/n8hgkUH96pzs6FJJ0whiQ5H/Yd7a9Sj8szdyff0="; + }; +in +bash.runCommand "${pname}-${version}" + { + inherit pname version; + + nativeBuildInputs = [ + gcc + musl + binutils + gnumake + gnused + gnugrep + gawk + diffutils + findutils + gnutar + xz + ]; + + passthru.tests.get-version = + result: + bash.runCommand "${pname}-get-version-${version}" { } '' + ${result}/bin/diff --version + mkdir $out + ''; + + meta = { + description = "Commands for showing the differences between files (diff, cmp, etc.)"; + homepage = "https://www.gnu.org/software/diffutils/diffutils.html"; + license = lib.licenses.gpl3Only; + platforms = lib.platforms.unix; + teams = [ lib.teams.minimal-bootstrap ]; + }; + } + '' + # Unpack + tar xf ${src} + cd diffutils-${version} + + # Configure + bash ./configure \ + --prefix=$out \ + --build=${buildPlatform.config} \ + --host=${hostPlatform.config} \ + CC=musl-gcc \ + CFLAGS=-static \ + ac_cv_path_PR_PROGRAM=pr + + # Build + make -j $NIX_BUILD_CORES + + # Install + make -j $NIX_BUILD_CORES install + ''