1{lib, stdenv, fetchurl}:
2
3stdenv.mkDerivation rec {
4 pname = "gperf";
5 version = "3.1";
6
7 src = fetchurl {
8 url = "mirror://gnu/${pname}/${pname}-${version}.tar.gz";
9 sha256 = "1qispg6i508rq8pkajh26cznwimbnj06wq9sd85vg95v8nwld1aq";
10 };
11
12 patches = [
13 # Clang 16 defaults to C++17, which does not allow `register` as a storage class specifier.
14 ./gperf-c++17-register-fix.patch
15 ];
16
17 enableParallelBuilding = true;
18
19 meta = {
20 description = "Perfect hash function generator";
21
22 longDescription = ''
23 GNU gperf is a perfect hash function generator. For a given
24 list of strings, it produces a hash function and hash table, in
25 form of C or C++ code, for looking up a value depending on the
26 input string. The hash function is perfect, which means that
27 the hash table has no collisions, and the hash table lookup
28 needs a single string comparison only.
29
30 GNU gperf is highly customizable. There are options for
31 generating C or C++ code, for emitting switch statements or
32 nested ifs instead of a hash table, and for tuning the algorithm
33 employed by gperf.
34 '';
35
36 license = lib.licenses.gpl3Plus;
37
38 homepage = "https://www.gnu.org/software/gperf/";
39 platforms = lib.platforms.unix;
40 };
41}