2023-08-04 22:07:22 +00:00
|
|
|
{ lib
|
|
|
|
, buildPlatform
|
|
|
|
, hostPlatform
|
|
|
|
, fetchurl
|
|
|
|
, bash
|
2023-10-09 19:29:22 +00:00
|
|
|
, tinycc
|
2023-08-04 22:07:22 +00:00
|
|
|
, gnumake
|
|
|
|
, gnugrep
|
|
|
|
, gnused
|
|
|
|
, gawk
|
|
|
|
, gnutar
|
2023-10-09 19:29:22 +00:00
|
|
|
, xz
|
2023-08-04 22:07:22 +00:00
|
|
|
}:
|
|
|
|
let
|
|
|
|
pname = "diffutils";
|
2023-10-09 19:29:22 +00:00
|
|
|
# last version that can be built by tinycc-musl 0.9.27
|
|
|
|
version = "3.8";
|
2023-08-04 22:07:22 +00:00
|
|
|
|
|
|
|
src = fetchurl {
|
2023-10-09 19:29:22 +00:00
|
|
|
url = "mirror://gnu/diffutils/diffutils-${version}.tar.xz";
|
|
|
|
hash = "sha256-pr3X0bMSZtEcT03mwbdI1GB6sCMa9RiPwlM9CuJDj+w=";
|
2023-08-04 22:07:22 +00:00
|
|
|
};
|
|
|
|
in
|
|
|
|
bash.runCommand "${pname}-${version}" {
|
|
|
|
inherit pname version;
|
|
|
|
|
|
|
|
nativeBuildInputs = [
|
2023-10-09 19:29:22 +00:00
|
|
|
tinycc.compiler
|
2023-08-04 22:07:22 +00:00
|
|
|
gnumake
|
|
|
|
gnused
|
|
|
|
gnugrep
|
|
|
|
gawk
|
|
|
|
gnutar
|
2023-10-09 19:29:22 +00:00
|
|
|
xz
|
2023-08-04 22:07:22 +00:00
|
|
|
];
|
|
|
|
|
|
|
|
passthru.tests.get-version = result:
|
|
|
|
bash.runCommand "${pname}-get-version-${version}" {} ''
|
|
|
|
${result}/bin/diff --version
|
|
|
|
mkdir $out
|
|
|
|
'';
|
|
|
|
|
|
|
|
meta = with lib; {
|
|
|
|
description = "Commands for showing the differences between files (diff, cmp, etc.)";
|
|
|
|
homepage = "https://www.gnu.org/software/diffutils/diffutils.html";
|
|
|
|
license = licenses.gpl3Only;
|
|
|
|
maintainers = teams.minimal-bootstrap.members;
|
|
|
|
platforms = platforms.unix;
|
|
|
|
};
|
|
|
|
} ''
|
|
|
|
# Unpack
|
2023-10-09 19:29:22 +00:00
|
|
|
cp ${src} diffutils.tar.xz
|
|
|
|
unxz diffutils.tar.xz
|
|
|
|
tar xf diffutils.tar
|
|
|
|
rm diffutils.tar
|
2023-08-04 22:07:22 +00:00
|
|
|
cd diffutils-${version}
|
|
|
|
|
|
|
|
# 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
|
|
|
bash ./configure \
|
|
|
|
--prefix=$out \
|
|
|
|
--build=${buildPlatform.config} \
|
|
|
|
--host=${hostPlatform.config}
|
|
|
|
|
|
|
|
# Build
|
2023-10-09 19:29:22 +00:00
|
|
|
make -j $NIX_BUILD_CORES AR="tcc -ar"
|
2023-08-04 22:07:22 +00:00
|
|
|
|
|
|
|
# Install
|
2023-10-09 19:29:22 +00:00
|
|
|
make -j $NIX_BUILD_CORES install
|
2023-08-04 22:07:22 +00:00
|
|
|
''
|