2023-05-24 13:37:59 +00:00
|
|
|
{ lib
|
|
|
|
, buildPlatform
|
|
|
|
, hostPlatform
|
|
|
|
, fetchurl
|
|
|
|
, bash
|
|
|
|
, tinycc
|
|
|
|
, gnumake
|
|
|
|
, gnugrep
|
2023-10-09 19:29:22 +00:00
|
|
|
, gnused
|
|
|
|
, gnutar
|
|
|
|
, gzip
|
|
|
|
, bootGawk
|
2023-05-24 13:37:59 +00:00
|
|
|
}:
|
|
|
|
let
|
2023-10-09 19:29:22 +00:00
|
|
|
inherit (import ./common.nix { inherit lib; }) meta;
|
2023-05-24 13:37:59 +00:00
|
|
|
pname = "gawk";
|
2023-10-09 19:29:22 +00:00
|
|
|
version = "5.2.2";
|
2023-05-24 13:37:59 +00:00
|
|
|
|
|
|
|
src = fetchurl {
|
|
|
|
url = "mirror://gnu/gawk/gawk-${version}.tar.gz";
|
2023-10-09 19:29:22 +00:00
|
|
|
hash = "sha256-lFrvfM/xAfILIqEIArwAXplKsrjqPnJMwaGXxi9B9lA=";
|
2023-05-24 13:37:59 +00:00
|
|
|
};
|
|
|
|
in
|
|
|
|
bash.runCommand "${pname}-${version}" {
|
2023-10-09 19:29:22 +00:00
|
|
|
inherit pname version meta;
|
2023-05-24 13:37:59 +00:00
|
|
|
|
|
|
|
nativeBuildInputs = [
|
|
|
|
tinycc.compiler
|
|
|
|
gnumake
|
|
|
|
gnused
|
|
|
|
gnugrep
|
2023-10-09 19:29:22 +00:00
|
|
|
gnutar
|
|
|
|
gzip
|
|
|
|
bootGawk
|
2023-05-24 13:37:59 +00:00
|
|
|
];
|
|
|
|
|
|
|
|
passthru.tests.get-version = result:
|
|
|
|
bash.runCommand "${pname}-get-version-${version}" {} ''
|
|
|
|
${result}/bin/awk --version
|
|
|
|
mkdir $out
|
|
|
|
'';
|
|
|
|
} ''
|
|
|
|
# Unpack
|
2023-10-09 19:29:22 +00:00
|
|
|
tar xzf ${src}
|
2023-05-24 13:37:59 +00:00
|
|
|
cd gawk-${version}
|
|
|
|
|
|
|
|
# Configure
|
2023-07-15 17:15:38 +00:00
|
|
|
export CC="tcc -B ${tinycc.libs}/lib"
|
2023-10-09 19:29:22 +00:00
|
|
|
export AR="tcc -ar"
|
|
|
|
export LD=tcc
|
2023-05-24 13:37:59 +00:00
|
|
|
bash ./configure \
|
2023-10-09 19:29:22 +00:00
|
|
|
--prefix=$out \
|
2023-05-24 13:37:59 +00:00
|
|
|
--build=${buildPlatform.config} \
|
2023-10-09 19:29:22 +00:00
|
|
|
--host=${hostPlatform.config}
|
2023-05-24 13:37:59 +00:00
|
|
|
|
|
|
|
# Build
|
2023-10-09 19:29:22 +00:00
|
|
|
make -j $NIX_BUILD_CORES
|
2023-05-24 13:37:59 +00:00
|
|
|
|
|
|
|
# Install
|
2023-10-09 19:29:22 +00:00
|
|
|
make -j $NIX_BUILD_CORES install
|
2023-05-24 13:37:59 +00:00
|
|
|
''
|