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 = "findutils";
17 version = "4.9.0";
18
19 src = fetchurl {
20 url = "mirror://gnu/findutils/findutils-${version}.tar.xz";
21 hash = "sha256-or+4wJ1DZ3DtxZ9Q+kg+eFsWGjt7nVR1c8sIBl/UYv4=";
22 };
23in
24bash.runCommand "${pname}-${version}"
25 {
26 inherit pname version;
27
28 nativeBuildInputs = [
29 tinycc.compiler
30 gnumake
31 gnused
32 gnugrep
33 gawk
34 gnutar
35 xz
36 ];
37
38 passthru.tests.get-version =
39 result:
40 bash.runCommand "${pname}-get-version-${version}" { } ''
41 ${result}/bin/find --version
42 mkdir $out
43 '';
44
45 meta = with lib; {
46 description = "GNU Find Utilities, the basic directory searching utilities of the GNU operating system";
47 homepage = "https://www.gnu.org/software/findutils";
48 license = licenses.gpl3Plus;
49 teams = [ teams.minimal-bootstrap ];
50 platforms = platforms.unix;
51 };
52 }
53 ''
54 # Unpack
55 cp ${src} findutils.tar.xz
56 unxz findutils.tar.xz
57 tar xf findutils.tar
58 rm findutils.tar
59 cd findutils-${version}
60
61 # Patch
62 # configure fails to accurately detect PATH_MAX support
63 sed -i 's/chdir_long/chdir/' gl/lib/save-cwd.c
64
65 # Configure
66 export CC="tcc -B ${tinycc.libs}/lib"
67 export AR="tcc -ar"
68 export LD=tcc
69 bash ./configure \
70 --prefix=$out \
71 --build=${buildPlatform.config} \
72 --host=${hostPlatform.config}
73
74 # Build
75 make -j $NIX_BUILD_CORES
76
77 # Install
78 make -j $NIX_BUILD_CORES install
79 ''