minimal-bootstrap.gawk: init at 4.1.4

This commit is contained in:
Emily Trau 2023-09-11 21:44:03 -07:00
parent 04a90698aa
commit 5a3d1bcb12
4 changed files with 90 additions and 10 deletions

View file

@ -65,6 +65,13 @@ lib.makeScope
gnused = gnused-mes;
};
gawk = callPackage ./gawk {
bash = bash_2_05;
gcc = gcc2;
glibc = glibc22;
bootGawk = gawk-mes;
};
gcc2 = callPackage ./gcc/2.nix {
bash = bash_2_05;
gcc = gcc2-mes;
@ -162,6 +169,7 @@ lib.makeScope
echo ${diffutils.tests.get-version}
echo ${findutils.tests.get-version}
echo ${gawk-mes.tests.get-version}
echo ${gawk.tests.get-version}
echo ${gcc2.tests.get-version}
echo ${gcc2-mes.tests.get-version}
echo ${gcc46.tests.get-version}

View file

@ -0,0 +1,11 @@
{ lib }:
{
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;
};
}

View file

@ -0,0 +1,68 @@
{ lib
, buildPlatform
, hostPlatform
, fetchurl
, bash
, gcc
, glibc
, binutils
, linux-headers
, gnumake
, gnugrep
, gnused
, gnutar
, gzip
, bootGawk
}:
let
inherit (import ./common.nix { inherit lib; }) meta;
pname = "gawk";
# >= 4.2.0 fails to cleanly build. may be worth investigating in the future.
# for now this version is sufficient to build glibc 2.16
version = "4.1.4";
src = fetchurl {
url = "mirror://gnu/gawk/gawk-${version}.tar.gz";
sha256 = "0dadjkpyyizmyd0l098qps8lb39r0vrz3xl3hwz2cmjs5c70h0wc";
};
in
bash.runCommand "${pname}-${version}" {
inherit pname version meta;
nativeBuildInputs = [
gcc
binutils
gnumake
gnused
gnugrep
gnutar
gzip
bootGawk
];
passthru.tests.get-version = result:
bash.runCommand "${pname}-get-version-${version}" {} ''
${result}/bin/awk --version
mkdir $out
'';
} ''
# Unpack
tar xzf ${src}
cd gawk-${version}
# Configure
export C_INCLUDE_PATH="${glibc}/include:${linux-headers}/include"
export LIBRARY_PATH="${glibc}/lib"
export LIBS="-lc -lnss_files -lnss_dns -lresolv"
bash ./configure \
--prefix=$out \
--build=${buildPlatform.config} \
--host=${hostPlatform.config}
# Build
make gawk
# Install
install -D gawk $out/bin/gawk
ln -s gawk $out/bin/awk
''

View file

@ -10,7 +10,8 @@
, gnugrep
}:
let
pname = "gawk";
inherit (import ./common.nix { inherit lib; }) meta;
pname = "gawk-mes";
# >=3.1.x is incompatible with mes-libc
version = "3.0.6";
@ -25,7 +26,7 @@ let
];
in
bash.runCommand "${pname}-${version}" {
inherit pname version;
inherit pname version meta;
nativeBuildInputs = [
tinycc.compiler
@ -40,14 +41,6 @@ bash.runCommand "${pname}-${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