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

minimal-bootstrap.gnupatch-static: init at 2.8

parent 12fbd92c
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -195,6 +195,12 @@ lib.makeScope

      gnupatch = callPackage ./gnupatch { tinycc = tinycc-mes; };

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

      gnused = callPackage ./gnused {
        bash = bash_2_05;
        tinycc = tinycc-musl;
@@ -362,6 +368,7 @@ lib.makeScope
        echo ${gnum4.tests.get-version}
        echo ${gnumake-musl.tests.get-version}
        echo ${gnumake-static.tests.get-version}
        echo ${gnupatch-static.tests.get-version}
        echo ${gnused.tests.get-version}
        echo ${gnused-mes.tests.get-version}
        echo ${gnused-static.tests.get-version}
+80 −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
  pname = "gnupatch-static";
  version = "2.8";

  src = fetchurl {
    url = "mirror://gnu/patch/patch-${version}.tar.xz";
    hash = "sha256-+Hzuae7CtPy/YKOWsDCtaqNBXxkqpffuhMrV4R9/WuM=";
  };
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/patch --version
        mkdir $out
      '';

    meta = {
      description = "GNU Patch, a program to apply differences to files";
      homepage = "https://www.gnu.org/software/patch";
      license = lib.licenses.gpl3Plus;
      mainProgram = "patch";
      platforms = lib.platforms.unix;
      teams = [ lib.teams.minimal-bootstrap ];
    };
  }
  ''
    # Unpack
    tar xf ${src}
    cd patch-${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
  ''