Merge pull request #254671 from emilytrau/minimal-gawk-glibc

minimal-bootstrap.gawk: upgrade to 4.1.4
This commit is contained in:
John Ericson 2023-09-12 21:50:31 -07:00 committed by GitHub
commit 6e5ff33c09
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 125 additions and 36 deletions

View File

@ -95,4 +95,5 @@ bootBash.runCommand "${pname}-${version}" {
# Install
make install
ln -s bash $out/bin/sh
''

View File

@ -19,6 +19,7 @@ lib.makeScope
bootBash = bash_2_05;
gcc = gcc2;
glibc = glibc22;
gawk = gawk-mes;
};
binutils = callPackage ./binutils {
@ -27,11 +28,13 @@ lib.makeScope
binutils = binutils-mes;
glibc = glibc22;
sed = heirloom.sed;
gawk = gawk-mes;
};
binutils-mes = callPackage ./binutils {
bash = bash_2_05;
tinycc = tinycc-mes;
sed = heirloom.sed;
gawk = gawk-mes;
mesBootstrap = true;
};
@ -46,18 +49,27 @@ lib.makeScope
bash = bash_2_05;
gcc = gcc2;
glibc = glibc22;
gawk = gawk-mes;
};
findutils = callPackage ./findutils {
bash = bash_2_05;
gcc = gcc2;
glibc = glibc22;
gawk = gawk-mes;
};
gawk-mes = callPackage ./gawk/mes.nix {
bash = bash_2_05;
tinycc = tinycc-mes;
gnused = gnused-mes;
};
gawk = callPackage ./gawk {
bash = bash_2_05;
tinycc = tinycc-mes;
gnused = gnused-mes;
gcc = gcc2;
glibc = glibc22;
bootGawk = gawk-mes;
};
gcc2 = callPackage ./gcc/2.nix {
@ -76,11 +88,13 @@ lib.makeScope
gcc46 = callPackage ./gcc/4.6.nix {
gcc = gcc2;
glibc = glibc22;
gawk = gawk-mes;
};
inherit (callPackage ./glibc {
bash = bash_2_05;
gnused = gnused-mes;
gawk = gawk-mes;
}) glibc22;
gnugrep = callPackage ./gnugrep {
@ -140,6 +154,7 @@ lib.makeScope
xz = callPackage ./xz {
bash = bash_2_05;
tinycc = tinycc-mes;
gawk = gawk-mes;
inherit (heirloom) sed;
};
@ -153,6 +168,7 @@ lib.makeScope
echo ${bzip2.tests.get-version}
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}

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

@ -3,36 +3,41 @@
, hostPlatform
, fetchurl
, bash
, tinycc
, gcc
, glibc
, binutils
, linux-headers
, gnumake
, gnupatch
, gnused
, gnugrep
, gnused
, gnutar
, gzip
, bootGawk
}:
let
inherit (import ./common.nix { inherit lib; }) meta;
pname = "gawk";
# >=3.1.x is incompatible with mes-libc
version = "3.0.6";
# >= 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 = "1z4bibjm7ldvjwq3hmyifyb429rs2d9bdwkvs0r171vv1khpdwmb";
sha256 = "0dadjkpyyizmyd0l098qps8lb39r0vrz3xl3hwz2cmjs5c70h0wc";
};
patches = [
# for reproducibility don't generate date stamp
./no-stamp.patch
];
in
bash.runCommand "${pname}-${version}" {
inherit pname version;
inherit pname version meta;
nativeBuildInputs = [
tinycc.compiler
gcc
binutils
gnumake
gnupatch
gnused
gnugrep
gnutar
gzip
bootGawk
];
passthru.tests.get-version = result:
@ -40,33 +45,19 @@ 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
untar --file gawk.tar
rm gawk.tar
tar xzf ${src}
cd gawk-${version}
# Patch
${lib.concatMapStringsSep "\n" (f: "patch -Np0 -i ${f}") patches}
# Configure
export CC="tcc -B ${tinycc.libs}/lib"
export ac_cv_func_getpgrp_void=yes
export ac_cv_func_tzset=yes
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} \
--disable-nls \
--prefix=$out
--host=${hostPlatform.config}
# Build
make gawk

View File

@ -0,0 +1,70 @@
{ lib
, buildPlatform
, hostPlatform
, fetchurl
, bash
, tinycc
, gnumake
, gnupatch
, gnused
, gnugrep
}:
let
inherit (import ./common.nix { inherit lib; }) meta;
pname = "gawk-mes";
# >=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 meta;
nativeBuildInputs = [
tinycc.compiler
gnumake
gnupatch
gnused
gnugrep
];
passthru.tests.get-version = result:
bash.runCommand "${pname}-get-version-${version}" {} ''
${result}/bin/awk --version
mkdir $out
'';
} ''
# 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 -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
''