2023-05-24 13:37:59 +00:00
|
|
|
{ lib
|
2023-08-04 22:07:22 +00:00
|
|
|
, buildPlatform
|
|
|
|
, hostPlatform
|
2023-05-24 13:37:59 +00:00
|
|
|
, fetchurl
|
|
|
|
, bash
|
|
|
|
, gnumake
|
2023-10-09 19:29:22 +00:00
|
|
|
, tinycc
|
|
|
|
, gnused
|
|
|
|
, gnugrep
|
|
|
|
, gnutar
|
|
|
|
, gzip
|
2023-05-24 13:37:59 +00:00
|
|
|
}:
|
2023-10-09 19:29:22 +00:00
|
|
|
|
2023-05-24 13:37:59 +00:00
|
|
|
let
|
2023-10-09 19:29:22 +00:00
|
|
|
inherit (import ./common.nix { inherit lib; }) meta;
|
|
|
|
pname = "gnused";
|
|
|
|
# last version that can be bootstrapped with our slightly buggy gnused-mes
|
|
|
|
version = "4.2";
|
2023-05-24 13:37:59 +00:00
|
|
|
|
|
|
|
src = fetchurl {
|
|
|
|
url = "mirror://gnu/sed/sed-${version}.tar.gz";
|
2023-10-09 19:29:22 +00:00
|
|
|
hash = "sha256-20XNY/0BDmUFN9ZdXfznaJplJ0UjZgbl5ceCk3Jn2YM=";
|
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 = [
|
|
|
|
gnumake
|
2023-08-04 22:07:22 +00:00
|
|
|
tinycc.compiler
|
|
|
|
gnused
|
|
|
|
gnugrep
|
2023-10-09 19:29:22 +00:00
|
|
|
gnutar
|
|
|
|
gzip
|
2023-05-24 13:37:59 +00:00
|
|
|
];
|
|
|
|
|
|
|
|
passthru.tests.get-version = result:
|
|
|
|
bash.runCommand "${pname}-get-version-${version}" {} ''
|
|
|
|
${result}/bin/sed --version
|
|
|
|
mkdir ''${out}
|
|
|
|
'';
|
2023-08-04 22:07:22 +00:00
|
|
|
} (''
|
2023-05-24 13:37:59 +00:00
|
|
|
# Unpack
|
2023-10-09 19:29:22 +00:00
|
|
|
tar xzf ${src}
|
2023-05-24 13:37:59 +00:00
|
|
|
cd sed-${version}
|
|
|
|
|
2023-08-04 22:07:22 +00:00
|
|
|
# Configure
|
2023-10-09 19:29:22 +00:00
|
|
|
export CC="tcc -B ${tinycc.libs}/lib"
|
|
|
|
export LD=tcc
|
2023-08-04 22:07:22 +00:00
|
|
|
./configure \
|
|
|
|
--build=${buildPlatform.config} \
|
|
|
|
--host=${hostPlatform.config} \
|
|
|
|
--disable-shared \
|
|
|
|
--disable-nls \
|
|
|
|
--disable-dependency-tracking \
|
|
|
|
--prefix=$out
|
|
|
|
|
|
|
|
# Build
|
2023-10-09 19:29:22 +00:00
|
|
|
make AR="tcc -ar"
|
2023-08-04 22:07:22 +00:00
|
|
|
|
2023-05-24 13:37:59 +00:00
|
|
|
# Install
|
2023-10-09 19:29:22 +00:00
|
|
|
make install
|
2023-08-04 22:07:22 +00:00
|
|
|
'')
|