From f2d79303957db2f5fe9262913a9b69b436ba25f2 Mon Sep 17 00:00:00 2001 From: Emily Trau Date: Tue, 10 Oct 2023 00:29:01 -0700 Subject: [PATCH] minimal-bootstrap.bash-static: init at 5.2.15 --- .../linux/minimal-bootstrap/bash/2.nix | 11 +-- .../linux/minimal-bootstrap/bash/common.nix | 10 +++ .../linux/minimal-bootstrap/bash/default.nix | 14 +--- .../linux/minimal-bootstrap/bash/static.nix | 75 +++++++++++++++++++ .../linux/minimal-bootstrap/default.nix | 8 +- 5 files changed, 97 insertions(+), 21 deletions(-) create mode 100644 pkgs/os-specific/linux/minimal-bootstrap/bash/common.nix create mode 100644 pkgs/os-specific/linux/minimal-bootstrap/bash/static.nix diff --git a/pkgs/os-specific/linux/minimal-bootstrap/bash/2.nix b/pkgs/os-specific/linux/minimal-bootstrap/bash/2.nix index b569dde98187..9b51f93799d4 100644 --- a/pkgs/os-specific/linux/minimal-bootstrap/bash/2.nix +++ b/pkgs/os-specific/linux/minimal-bootstrap/bash/2.nix @@ -11,6 +11,7 @@ bash_2_05, }: let + inherit (import ./common.nix { inherit lib; }) meta; pname = "bash"; version = "2.05b"; @@ -69,7 +70,7 @@ let in kaem.runCommand "${pname}-${version}" { - inherit pname version; + inherit pname version meta; nativeBuildInputs = [ tinycc.compiler @@ -124,14 +125,6 @@ kaem.runCommand "${pname}-${version}" ${result}/bin/bash --version mkdir ''${out} ''; - - meta = { - description = "GNU Bourne-Again Shell, the de facto standard shell on Linux"; - homepage = "https://www.gnu.org/software/bash"; - license = lib.licenses.gpl3Plus; - teams = [ lib.teams.minimal-bootstrap ]; - platforms = lib.platforms.unix; - }; } '' # Unpack diff --git a/pkgs/os-specific/linux/minimal-bootstrap/bash/common.nix b/pkgs/os-specific/linux/minimal-bootstrap/bash/common.nix new file mode 100644 index 000000000000..5746075ff687 --- /dev/null +++ b/pkgs/os-specific/linux/minimal-bootstrap/bash/common.nix @@ -0,0 +1,10 @@ +{ lib }: +{ + meta = { + description = "GNU Bourne-Again Shell, the de facto standard shell on Linux"; + homepage = "https://www.gnu.org/software/bash"; + license = lib.licenses.gpl3Plus; + teams = [ lib.teams.minimal-bootstrap ]; + platforms = lib.platforms.unix; + }; +} diff --git a/pkgs/os-specific/linux/minimal-bootstrap/bash/default.nix b/pkgs/os-specific/linux/minimal-bootstrap/bash/default.nix index 5dc5bbcd8369..aa414c9479cc 100644 --- a/pkgs/os-specific/linux/minimal-bootstrap/bash/default.nix +++ b/pkgs/os-specific/linux/minimal-bootstrap/bash/default.nix @@ -18,6 +18,7 @@ coreutils, }: let + inherit (import ./common.nix { inherit lib; }) meta; pname = "bash"; version = "5.2.37"; @@ -33,7 +34,7 @@ let in bootBash.runCommand "${pname}-${version}" { - inherit pname version; + inherit pname version meta; nativeBuildInputs = [ coreutils @@ -85,24 +86,15 @@ bootBash.runCommand "${pname}-${version}" } // (removeAttrs env [ "nativeBuildInputs" ]) ); - passthru.tests.get-version = result: bootBash.runCommand "${pname}-get-version-${version}" { } '' ${result}/bin/bash --version mkdir $out ''; - - meta = { - description = "GNU Bourne-Again Shell, the de facto standard shell on Linux"; - homepage = "https://www.gnu.org/software/bash"; - license = lib.licenses.gpl3Plus; - teams = [ lib.teams.minimal-bootstrap ]; - platforms = lib.platforms.unix; - }; } '' - # Unpack + # unpack tar xzf ${src} cd bash-${version} diff --git a/pkgs/os-specific/linux/minimal-bootstrap/bash/static.nix b/pkgs/os-specific/linux/minimal-bootstrap/bash/static.nix new file mode 100644 index 000000000000..dff88a1aee20 --- /dev/null +++ b/pkgs/os-specific/linux/minimal-bootstrap/bash/static.nix @@ -0,0 +1,75 @@ +{ + lib, + buildPlatform, + hostPlatform, + fetchurl, + bash, + gcc, + musl, + binutils, + gnumake, + gnused, + gnugrep, + gawk, + diffutils, + findutils, + gnutar, + gzip, +}: +let + inherit (import ./common.nix { inherit lib; }) meta; + pname = "bash-static"; + version = "5.2.15"; + + src = fetchurl { + url = "mirror://gnu/bash/bash-${version}.tar.gz"; + sha256 = "132qng0jy600mv1fs95ylnlisx2wavkkgpb19c6kmz7lnmjhjwhk"; + }; +in +bash.runCommand "${pname}-${version}" + { + inherit pname version meta; + + nativeBuildInputs = [ + gcc + musl + binutils + gnumake + gnused + gnugrep + gawk + diffutils + findutils + gnutar + gzip + ]; + + passthru.tests.get-version = + result: + bash.runCommand "${pname}-get-version-${version}" { } '' + ${result}/bin/bash --version + mkdir $out + ''; + } + '' + # Unpack + tar xf ${src} + cd bash-${version} + + # Configure + bash ./configure \ + --prefix=$out \ + --build=${buildPlatform.config} \ + --host=${hostPlatform.config} \ + --without-bash-malloc \ + --enable-static-link \ + bash_cv_func_strtoimax=y \ + CC=musl-gcc + + # Build + make -j $NIX_BUILD_CORES + + # Install + make -j $NIX_BUILD_CORES install-strip + rm $out/bin/bashbug + '' diff --git a/pkgs/os-specific/linux/minimal-bootstrap/default.nix b/pkgs/os-specific/linux/minimal-bootstrap/default.nix index 750a841f272b..2720e1d2d4bb 100644 --- a/pkgs/os-specific/linux/minimal-bootstrap/default.nix +++ b/pkgs/os-specific/linux/minimal-bootstrap/default.nix @@ -40,6 +40,12 @@ lib.makeScope gnutar = gnutar-musl; }; + bash-static = callPackage ./bash/static.nix { + gcc = gcc-latest; + gnumake = gnumake-musl; + gnutar = gnutar-latest; + }; + binutils = callPackage ./binutils { tinycc = tinycc-musl; gnumake = gnumake-musl; @@ -359,9 +365,9 @@ lib.makeScope }; inherit (callPackage ./utils.nix { }) derivationWithMeta writeTextFile writeText; - test = kaem.runCommand "minimal-bootstrap-test" { } '' echo ${bash.tests.get-version} + echo ${bash-static.tests.get-version} echo ${bash_2_05.tests.get-version} echo ${binutils.tests.get-version} echo ${binutils-static.tests.get-version}