Unverified Commit 8c8b03ba authored by John Ericson's avatar John Ericson Committed by GitHub
Browse files

Merge pull request #233389 from emilytrau/minimal-gawk

minimal-bootstrap.gawk: init at 3.0.6
parents f4520c5e dcc1dea7
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -15,6 +15,11 @@ lib.makeScope

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

    gawk = callPackage ./gawk {
      bash = bash_2_05;
      tinycc = tinycc-mes;
    };

    gnugrep = callPackage ./gnugrep {
      bash = bash_2_05;
      tinycc = tinycc-mes;
@@ -45,6 +50,7 @@ lib.makeScope

    test = kaem.runCommand "minimal-bootstrap-test" {} ''
      echo ${bash_2_05.tests.get-version}
      echo ${gawk.tests.get-version}
      echo ${gnugrep.tests.get-version}
      echo ${gnused.tests.get-version}
      echo ${mes.compiler.tests.get-version}
+77 −0
Original line number Diff line number Diff line
{ lib
, buildPlatform
, hostPlatform
, fetchurl
, bash
, tinycc
, gnumake
, gnupatch
, gnused
, gnugrep
}:
let
  pname = "gawk";
  # >=3.1.x is incompatible with mes-libc
  version = "3.0.6";

  src = fetchurl {
    url = "mirror://gnu/gawk/gawk-${version}.tar.gz";
    sha256 = "1z4bibjm7ldvjwq3hmyifyb429rs2d9bdwkvs0r171vv1khpdwmb";
  };

  patches = [
    # for reproducibility don't generate date stamp
    ./no-stamp.patch
  ];
in
bash.runCommand "${pname}-${version}" {
  inherit pname version;

  nativeBuildInputs = [
    tinycc.compiler
    gnumake
    gnupatch
    gnused
    gnugrep
  ];

  passthru.tests.get-version = result:
    bash.runCommand "${pname}-get-version-${version}" {} ''
      ${result}/bin/awk --version
      mkdir $out
    '';

  meta = with lib; {
    description = "GNU implementation of the Awk programming language";
    homepage = "https://www.gnu.org/software/gawk";
    license = licenses.gpl3Plus;
    maintainers = teams.minimal-bootstrap.members;
    platforms = platforms.unix;
  };
} ''
  # Unpack
  ungz --file ${src} --output gawk.tar
  untar --file gawk.tar
  rm gawk.tar
  cd gawk-${version}

  # Patch
  ${lib.concatMapStringsSep "\n" (f: "patch -Np0 -i ${f}") patches}

  # Configure
  export CC="tcc -static -B ${tinycc.libs}/lib"
  export ac_cv_func_getpgrp_void=yes
  export ac_cv_func_tzset=yes
  bash ./configure \
    --build=${buildPlatform.config} \
    --host=${hostPlatform.config} \
    --disable-nls \
    --prefix=$out

  # Build
  make gawk

  # Install
  install -D gawk $out/bin/gawk
  ln -s gawk $out/bin/awk
''
+10 −0
Original line number Diff line number Diff line
--- configure
+++ configure
@@ -3676,7 +3676,6 @@ cat >> $CONFIG_STATUS <<EOF
 
 EOF
 cat >> $CONFIG_STATUS <<\EOF
-date > stamp-h
 exit 0
 EOF
 chmod +x $CONFIG_STATUS