Commit e336b7c7 authored by Emily Trau's avatar Emily Trau Committed by dish
Browse files

minimal-bootstrap.gnused-static: init at 4.9

parent bac6125f
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -189,6 +189,12 @@ lib.makeScope
        tinycc = tinycc-bootstrappable;
      };

      gnused-static = callPackage ./gnused/static.nix {
        gcc = gcc-latest;
        gnumake = gnumake-musl;
        gnutar = gnutar-latest;
      };

      gnutar = callPackage ./gnutar/mes.nix {
        bash = bash_2_05;
        tinycc = tinycc-mes;
@@ -337,6 +343,7 @@ lib.makeScope
        echo ${gnum4.tests.get-version}
        echo ${gnused.tests.get-version}
        echo ${gnused-mes.tests.get-version}
        echo ${gnused-static.tests.get-version}
        echo ${gnutar.tests.get-version}
        echo ${gnutar-latest.tests.get-version}
        echo ${gnutar-musl.tests.get-version}
+72 −0
Original line number Diff line number Diff line
{
  lib,
  buildPlatform,
  hostPlatform,
  fetchurl,
  bash,
  gcc,
  musl,
  binutils,
  gnumake,
  gnused,
  gnugrep,
  gawk,
  diffutils,
  findutils,
  gnutar,
  xz,
}:
let
  inherit (import ./common.nix { inherit lib; }) meta;
  pname = "gnused-static";
  version = "4.9";

  src = fetchurl {
    url = "mirror://gnu/sed/sed-${version}.tar.xz";
    hash = "sha256-biJrcy4c1zlGStaGK9Ghq6QteYKSLaelNRljHSSXUYE=";
  };
in
bash.runCommand "${pname}-${version}"
  {
    inherit pname version meta;

    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/sed --version
        mkdir $out
      '';
  }
  ''
    # Unpack
    tar xf ${src}
    cd sed-${version}

    # Configure
    bash ./configure \
      --prefix=$out \
      --build=${buildPlatform.config} \
      --host=${hostPlatform.config} \
      CC=musl-gcc \
      CFLAGS=-static

    # Build
    make -j $NIX_BUILD_CORES

    # Install
    make -j $NIX_BUILD_CORES install
  ''