diff --git a/pkgs/os-specific/linux/minimal-bootstrap/bash/default.nix b/pkgs/os-specific/linux/minimal-bootstrap/bash/default.nix index 9c9682fdf9d5..dea5ad9f017f 100644 --- a/pkgs/os-specific/linux/minimal-bootstrap/bash/default.nix +++ b/pkgs/os-specific/linux/minimal-bootstrap/bash/default.nix @@ -95,4 +95,5 @@ bootBash.runCommand "${pname}-${version}" { # Install make install + ln -s bash $out/bin/sh '' diff --git a/pkgs/os-specific/linux/minimal-bootstrap/default.nix b/pkgs/os-specific/linux/minimal-bootstrap/default.nix index 2a10a3395ba7..b8807eec0902 100644 --- a/pkgs/os-specific/linux/minimal-bootstrap/default.nix +++ b/pkgs/os-specific/linux/minimal-bootstrap/default.nix @@ -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} diff --git a/pkgs/os-specific/linux/minimal-bootstrap/gawk/common.nix b/pkgs/os-specific/linux/minimal-bootstrap/gawk/common.nix new file mode 100644 index 000000000000..d95c66d86337 --- /dev/null +++ b/pkgs/os-specific/linux/minimal-bootstrap/gawk/common.nix @@ -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; + }; +} diff --git a/pkgs/os-specific/linux/minimal-bootstrap/gawk/default.nix b/pkgs/os-specific/linux/minimal-bootstrap/gawk/default.nix index d840a204416d..935414f21760 100644 --- a/pkgs/os-specific/linux/minimal-bootstrap/gawk/default.nix +++ b/pkgs/os-specific/linux/minimal-bootstrap/gawk/default.nix @@ -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 diff --git a/pkgs/os-specific/linux/minimal-bootstrap/gawk/mes.nix b/pkgs/os-specific/linux/minimal-bootstrap/gawk/mes.nix new file mode 100644 index 000000000000..c14399309306 --- /dev/null +++ b/pkgs/os-specific/linux/minimal-bootstrap/gawk/mes.nix @@ -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 +''