feat: gawk-boot
This commit is contained in:
parent
3a6d4526a6
commit
dcbe11025b
|
@ -23,6 +23,7 @@ in {
|
|||
./gnutar
|
||||
./gzip
|
||||
./musl
|
||||
./gawk
|
||||
];
|
||||
|
||||
config = {
|
||||
|
@ -49,6 +50,7 @@ in {
|
|||
stage1-musl-boot = stage1.musl.boot.package;
|
||||
stage1-tinycc-musl = stage1.tinycc.musl.compiler.package;
|
||||
stage1-tinycc-musl-libs = stage1.tinycc.musl.libs.package;
|
||||
stage1-gawk-boot = stage1.gawk.boot.package;
|
||||
};
|
||||
|
||||
extras = {
|
||||
|
|
87
foundation/src/stages/stage1/gawk/boot.nix
Normal file
87
foundation/src/stages/stage1/gawk/boot.nix
Normal file
|
@ -0,0 +1,87 @@
|
|||
{
|
||||
lib,
|
||||
config,
|
||||
}: let
|
||||
cfg = config.aux.foundation.stages.stage1.gawk.boot;
|
||||
|
||||
platform = config.aux.platform;
|
||||
builders = config.aux.foundation.builders;
|
||||
|
||||
stage1 = config.aux.foundation.stages.stage1;
|
||||
in {
|
||||
options.aux.foundation.stages.stage1.gawk.boot = {
|
||||
package = lib.options.create {
|
||||
type = lib.types.package;
|
||||
description = "The package to use for gnutar-boot.";
|
||||
};
|
||||
|
||||
version = lib.options.create {
|
||||
type = lib.types.string;
|
||||
description = "Version of the package.";
|
||||
};
|
||||
|
||||
src = lib.options.create {
|
||||
type = lib.types.package;
|
||||
description = "Source for the package.";
|
||||
};
|
||||
};
|
||||
|
||||
config = {
|
||||
aux.foundation.stages.stage1.gawk.boot = {
|
||||
version = "3.0.6";
|
||||
|
||||
src = builtins.fetchurl {
|
||||
url = "https://ftpmirror.gnu.org/gawk/gawk-${cfg.version}.tar.gz";
|
||||
sha256 = "1z4bibjm7ldvjwq3hmyifyb429rs2d9bdwkvs0r171vv1khpdwmb";
|
||||
};
|
||||
|
||||
package = let
|
||||
patches = [
|
||||
# for reproducibility don't generate date stamp
|
||||
./patches/no-stamp.patch
|
||||
];
|
||||
in
|
||||
builders.bash.boot.build {
|
||||
name = "gawk-boot-${cfg.version}";
|
||||
|
||||
meta = stage1.gawk.meta;
|
||||
|
||||
deps.build.host = [
|
||||
stage1.tinycc.mes.compiler.package
|
||||
stage1.gnumake.package
|
||||
stage1.gnused.boot.package
|
||||
stage1.gnugrep.package
|
||||
stage1.gnupatch.package
|
||||
];
|
||||
|
||||
script = ''
|
||||
# Unpack
|
||||
ungz --file ${cfg.src} --output gawk.tar
|
||||
untar --file gawk.tar
|
||||
rm gawk.tar
|
||||
cd gawk-${cfg.version}
|
||||
|
||||
# Patch
|
||||
${lib.strings.concatMapSep "\n" (file: "patch -Np0 -i ${file}") patches}
|
||||
|
||||
# Configure
|
||||
export CC="tcc -B ${stage1.tinycc.mes.libs.package}/lib"
|
||||
export ac_cv_func_getpgrp_void=yes
|
||||
export ac_cv_func_tzset=yes
|
||||
bash ./configure \
|
||||
--build=${platform.build} \
|
||||
--host=${platform.host} \
|
||||
--disable-nls \
|
||||
--prefix=$out
|
||||
|
||||
# Build
|
||||
make gawk
|
||||
|
||||
# Install
|
||||
install -D gawk $out/bin/gawk
|
||||
ln -s gawk $out/bin/awk
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
49
foundation/src/stages/stage1/gawk/default.nix
Normal file
49
foundation/src/stages/stage1/gawk/default.nix
Normal file
|
@ -0,0 +1,49 @@
|
|||
{
|
||||
lib,
|
||||
config,
|
||||
}: let
|
||||
cfg = config.aux.foundation.stages.stage1.gawk;
|
||||
|
||||
builders = config.aux.foundation.builders;
|
||||
|
||||
stage1 = config.aux.foundation.stages.gawk;
|
||||
in {
|
||||
includes = [
|
||||
./boot.nix
|
||||
];
|
||||
|
||||
options.aux.foundation.stages.stage1.gawk = {
|
||||
meta = {
|
||||
description = lib.options.create {
|
||||
type = lib.types.string;
|
||||
description = "Description for the package.";
|
||||
default.value = "GNU implementation of the Awk programming language";
|
||||
};
|
||||
|
||||
homepage = lib.options.create {
|
||||
type = lib.types.string;
|
||||
description = "Homepage for the package.";
|
||||
default.value = "https://www.gnu.org/software/gawk";
|
||||
};
|
||||
|
||||
license = lib.options.create {
|
||||
# TODO: Add a proper type for licenses.
|
||||
type = lib.types.attrs.any;
|
||||
description = "License for the package.";
|
||||
default.value = lib.licenses.gpl3Plus;
|
||||
};
|
||||
|
||||
platforms = lib.options.create {
|
||||
type = lib.types.list.of lib.types.string;
|
||||
description = "Platforms the package supports.";
|
||||
default.value = ["x86_64-linux" "aarch64-linux" "i686-linux"];
|
||||
};
|
||||
|
||||
mainProgram = lib.options.create {
|
||||
type = lib.types.string;
|
||||
description = "The main program of the package.";
|
||||
default.value = "awk";
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
11
foundation/src/stages/stage1/gawk/patches/no-stamp.patch
Normal file
11
foundation/src/stages/stage1/gawk/patches/no-stamp.patch
Normal file
|
@ -0,0 +1,11 @@
|
|||
--- 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
|
||||
|
Loading…
Reference in a new issue