depot/third_party/nixpkgs/pkgs/os-specific/linux/minimal-bootstrap/gnused/default.nix
Default email 5e7c2d6cef Project import generated by Copybara.
GitOrigin-RevId: f99e5f03cc0aa231ab5950a15ed02afec45ed51a
2023-10-09 21:29:22 +02:00

63 lines
1.1 KiB
Nix

{ lib
, buildPlatform
, hostPlatform
, fetchurl
, bash
, gnumake
, tinycc
, gnused
, gnugrep
, gnutar
, gzip
}:
let
inherit (import ./common.nix { inherit lib; }) meta;
pname = "gnused";
# last version that can be bootstrapped with our slightly buggy gnused-mes
version = "4.2";
src = fetchurl {
url = "mirror://gnu/sed/sed-${version}.tar.gz";
hash = "sha256-20XNY/0BDmUFN9ZdXfznaJplJ0UjZgbl5ceCk3Jn2YM=";
};
in
bash.runCommand "${pname}-${version}" {
inherit pname version meta;
nativeBuildInputs = [
gnumake
tinycc.compiler
gnused
gnugrep
gnutar
gzip
];
passthru.tests.get-version = result:
bash.runCommand "${pname}-get-version-${version}" {} ''
${result}/bin/sed --version
mkdir ''${out}
'';
} (''
# Unpack
tar xzf ${src}
cd sed-${version}
# Configure
export CC="tcc -B ${tinycc.libs}/lib"
export LD=tcc
./configure \
--build=${buildPlatform.config} \
--host=${hostPlatform.config} \
--disable-shared \
--disable-nls \
--disable-dependency-tracking \
--prefix=$out
# Build
make AR="tcc -ar"
# Install
make install
'')