1{ 2 lib, 3 buildPlatform, 4 hostPlatform, 5 fetchurl, 6 bash, 7 tinycc, 8 gnumake, 9 gnugrep, 10 gnused, 11 gawk, 12 gnutar, 13 xz, 14}: 15let 16 pname = "diffutils"; 17 # last version that can be built by tinycc-musl 0.9.27 18 version = "3.8"; 19 20 src = fetchurl { 21 url = "mirror://gnu/diffutils/diffutils-${version}.tar.xz"; 22 hash = "sha256-pr3X0bMSZtEcT03mwbdI1GB6sCMa9RiPwlM9CuJDj+w="; 23 }; 24in 25bash.runCommand "${pname}-${version}" 26 { 27 inherit pname version; 28 29 nativeBuildInputs = [ 30 tinycc.compiler 31 gnumake 32 gnused 33 gnugrep 34 gawk 35 gnutar 36 xz 37 ]; 38 39 passthru.tests.get-version = 40 result: 41 bash.runCommand "${pname}-get-version-${version}" { } '' 42 ${result}/bin/diff --version 43 mkdir $out 44 ''; 45 46 meta = with lib; { 47 description = "Commands for showing the differences between files (diff, cmp, etc.)"; 48 homepage = "https://www.gnu.org/software/diffutils/diffutils.html"; 49 license = licenses.gpl3Only; 50 teams = [ teams.minimal-bootstrap ]; 51 platforms = platforms.unix; 52 }; 53 } 54 '' 55 # Unpack 56 cp ${src} diffutils.tar.xz 57 unxz diffutils.tar.xz 58 tar xf diffutils.tar 59 rm diffutils.tar 60 cd diffutils-${version} 61 62 # Configure 63 export CC="tcc -B ${tinycc.libs}/lib" 64 export LD=tcc 65 bash ./configure \ 66 --prefix=$out \ 67 --build=${buildPlatform.config} \ 68 --host=${hostPlatform.config} 69 70 # Build 71 make -j $NIX_BUILD_CORES AR="tcc -ar" 72 73 # Install 74 make -j $NIX_BUILD_CORES install 75 ''