gperf_3_0: fix build with clang 16

* Apply the patch used for gperf 3.1 in 58f559cdb0de5c88f75b397f9ed7229bec898034; and
* Include `string.h` unconditionally in `lib/getopt.c`.
This commit is contained in:
Randy Eckenrode 2023-07-16 12:10:49 -06:00
parent dba6d77ad2
commit b9a010e213
No known key found for this signature in database
GPG Key ID: 64C1CD4EC2A600D9

View File

@ -10,7 +10,18 @@ stdenv.mkDerivation rec {
};
nativeBuildInputs = [ autoreconfHook ];
patches = [ ./gperf-ar-fix.patch ];
patches = [
./gperf-ar-fix.patch
# Clang 16 defaults to C++17, which does not allow `register` as a storage class specifier.
./gperf-c++17-register-fix.patch
];
# Replace the conditional inclusion of `string.h` on VMS with unconditional inclusion on all
# platforms. Otherwise, clang 16 fails to build gperf due to use of undeclared library functions.
postPatch = ''
sed '/#ifdef VMS/{N;N;N;N;N;s/.*/#include <string.h>/}' -i lib/getopt.c
'';
meta = {
description = "Perfect hash function generator";