libserdes: fix build with avro-cpp 1.12.0

Some finagling is required to make the configure scripts cooperate with the required
bump to the minimum C++ standard version. avro-cpp needs at least C++17, but libserdes
is stuck at C++11.
This commit is contained in:
Sergei Zimmerman
2025-01-01 02:00:52 +03:00
parent ba17973634
commit 4e6e0aec95
+17 -3
View File
@@ -4,7 +4,6 @@
fetchFromGitHub,
perl,
which,
boost,
rdkafka,
jansson,
curl,
@@ -35,7 +34,6 @@ stdenv.mkDerivation rec {
];
buildInputs = [
boost
rdkafka
jansson
curl
@@ -43,10 +41,26 @@ stdenv.mkDerivation rec {
avro-cpp
];
makeFlags = [ "GEN_PKG_CONFIG=y" ];
configureFlags = [
# avro-cpp public headers use at least C++17 features, but libserdes configure scripts
# basically cap it at C++11. It's really unfortunate that we have to patch the configure scripts for this,
# but this seems to be the most sensible way.
# - NIX_CFLAGS_COMPILE - fails because of -Werror in compiler checks since --std=... has no effect for C compilers.
# - CXXFLAGS without patching configure.self does nothing, because --std=c++11 is appended to the final flags, overriding
# everything specified manually.
"--CXXFLAGS=${toString [ "--std=c++17" ]}"
];
makeFlags = [
"GEN_PKG_CONFIG=y"
];
postPatch = ''
patchShebangs configure lds-gen.pl
# Don't append the standard to CXXFLAGS, since we want to set it higher for avro-cpp.
substituteInPlace configure.self --replace-fail \
'mkl_mkvar_append CXXFLAGS CXXFLAGS "--std=c++11"' \
":" # Do nothing, we set the standard ourselves.
'';
# Has a configure script but its not Autoconf so steal some bits from multiple-outputs.sh: