From 43b2d79f7ad725f6976e9e31378377c3ce5855a8 Mon Sep 17 00:00:00 2001 From: Emily Trau Date: Sun, 8 Oct 2023 23:37:56 -0700 Subject: [PATCH] minimal-bootstrap.zlib: init at 1.3.1 --- .../linux/minimal-bootstrap/default.nix | 6 ++ .../linux/minimal-bootstrap/zlib/default.nix | 60 +++++++++++++++++++ 2 files changed, 66 insertions(+) create mode 100644 pkgs/os-specific/linux/minimal-bootstrap/zlib/default.nix diff --git a/pkgs/os-specific/linux/minimal-bootstrap/default.nix b/pkgs/os-specific/linux/minimal-bootstrap/default.nix index c8e502c7b7be..5d56248c3c7d 100644 --- a/pkgs/os-specific/linux/minimal-bootstrap/default.nix +++ b/pkgs/os-specific/linux/minimal-bootstrap/default.nix @@ -249,6 +249,12 @@ lib.makeScope gnutar = gnutar-musl; }; + zlib = callPackage ./zlib { + gcc = gcc-latest; + gnumake = gnumake-musl; + gnutar = gnutar-latest; + }; + inherit (callPackage ./utils.nix { }) derivationWithMeta writeTextFile writeText; test = kaem.runCommand "minimal-bootstrap-test" { } '' diff --git a/pkgs/os-specific/linux/minimal-bootstrap/zlib/default.nix b/pkgs/os-specific/linux/minimal-bootstrap/zlib/default.nix new file mode 100644 index 000000000000..b91645e9c5d4 --- /dev/null +++ b/pkgs/os-specific/linux/minimal-bootstrap/zlib/default.nix @@ -0,0 +1,60 @@ +{ + lib, + fetchurl, + bash, + gcc, + musl, + binutils, + gnumake, + gnused, + gnugrep, + gnutar, + xz, +}: +let + pname = "zlib"; + version = "1.3.1"; + + src = fetchurl { + url = "https://github.com/madler/zlib/releases/download/v${version}/zlib-${version}.tar.xz"; + hash = "sha256-OO+WuN/lENQnB9nHgYd5FHklQRM+GHCEFGO/pz+IPjI="; + }; +in +bash.runCommand "${pname}-${version}" + { + inherit pname version; + + nativeBuildInputs = [ + gcc + musl + binutils + gnumake + gnused + gnugrep + gnutar + xz + ]; + + meta = { + description = "Lossless data-compression library"; + homepage = "https://zlib.net"; + license = lib.licenses.zlib; + platforms = lib.platforms.unix; + teams = [ lib.teams.minimal-bootstrap ]; + }; + } + '' + # Unpack + tar xf ${src} + cd zlib-${version} + + # Configure + export CC=musl-gcc + bash ./configure --prefix=$out + + # Build + make -j $NIX_BUILD_CORES + + # Install + make -j $NIX_BUILD_CORES install + ''