biome: 1.9.2 -> 1.9.3
[NixPkgs.git] / pkgs / tools / misc / findutils / default.nix
blob239aa98b04e043a61b318efcda7b75e9b24326f8
1 { lib, stdenv, fetchurl
2 , updateAutotoolsGnuConfigScriptsHook
3 , coreutils
4 }:
6 # Note: this package is used for bootstrapping fetchurl, and thus
7 # cannot use fetchpatch! All mutable patches (generated by GitHub or
8 # cgit) that are needed here should be included directly in Nixpkgs as
9 # files.
11 stdenv.mkDerivation rec {
12   pname = "findutils";
13   version = "4.10.0";
15   src = fetchurl {
16     url = "mirror://gnu/findutils/findutils-${version}.tar.xz";
17     sha256 = "sha256-E4fgtn/yR9Kr3pmPkN+/cMFJE5Glnd/suK5ph4nwpPU=";
18   };
20   postPatch = ''
21     substituteInPlace xargs/xargs.c --replace 'char default_cmd[] = "echo";' 'char default_cmd[] = "${coreutils}/bin/echo";'
22   '';
24   patches = [ ./no-install-statedir.patch ];
26   nativeBuildInputs = [ updateAutotoolsGnuConfigScriptsHook ];
27   buildInputs = [ coreutils ]; # bin/updatedb script needs to call sort
29   # Since glibc-2.25 the i686 tests hang reliably right after test-sleep.
30   doCheck
31     =  !stdenv.hostPlatform.isDarwin
32     && !stdenv.hostPlatform.isFreeBSD
33     && !(stdenv.hostPlatform.libc == "glibc" && stdenv.hostPlatform.isi686)
34     && (stdenv.hostPlatform.libc != "musl")
35     && stdenv.hostPlatform == stdenv.buildPlatform;
37   outputs = [ "out" "info" "locate"];
39   configureFlags = [
40     # "sort" need not be on the PATH as a run-time dep, so we need to tell
41     # configure where it is. Covers the cross and native case alike.
42     "SORT=${coreutils}/bin/sort"
43     "--localstatedir=/var/cache"
44   ];
46   CFLAGS = lib.optionals stdenv.hostPlatform.isDarwin [
47     # TODO: Revisit upstream issue https://savannah.gnu.org/bugs/?59972
48     # https://github.com/Homebrew/homebrew-core/pull/69761#issuecomment-770268478
49     "-D__nonnull\\(params\\)="
50   ];
52   postInstall = ''
53     moveToOutput bin/locate $locate
54     moveToOutput bin/updatedb $locate
55   '';
57   # can't move man pages in postInstall because the multi-output hook will move them back to $out
58   postFixup = ''
59     moveToOutput share/man/man5 $locate
60     moveToOutput share/man/man1/locate.1.gz $locate
61     moveToOutput share/man/man1/updatedb.1.gz $locate
62   '';
64   enableParallelBuilding = true;
66   # bionic libc is super weird and has issues with fortify outside of its own libc, check this comment:
67   # https://github.com/NixOS/nixpkgs/pull/192630#discussion_r978985593
68   # or you can check libc/include/sys/cdefs.h in bionic source code
69   hardeningDisable = lib.optional (stdenv.hostPlatform.libc == "bionic") "fortify";
71   meta = {
72     homepage = "https://www.gnu.org/software/findutils/";
73     description = "GNU Find Utilities, the basic directory searching utilities of the GNU operating system";
75     longDescription = ''
76       The GNU Find Utilities are the basic directory searching
77       utilities of the GNU operating system.  These programs are
78       typically used in conjunction with other programs to provide
79       modular and powerful directory search and file locating
80       capabilities to other commands.
82       The tools supplied with this package are:
84           * find - search for files in a directory hierarchy;
85           * xargs - build and execute command lines from standard input.
87       The following are available in the locate output:
89           * locate - list files in databases that match a pattern;
90           * updatedb - update a file name database;
91     '';
93     platforms = lib.platforms.all;
95     license = lib.licenses.gpl3Plus;
97     mainProgram = "find";
98   };