Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

avro-cpp: 1.11.3 -> 1.12.0, enable tests, libserdes: fix build with avro-cpp 1.12.0 #369338

Merged
merged 4 commits into from
Jan 1, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions pkgs/by-name/av/avro-cpp/0001-get-rid-of-fmt-fetchcontent.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 19059a41b..6e3ae0ad7 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -82,15 +82,7 @@ endif ()
find_package (Boost 1.38 REQUIRED
COMPONENTS filesystem iostreams program_options regex system)

-include(FetchContent)
-FetchContent_Declare(
- fmt
- GIT_REPOSITORY https://github.com/fmtlib/fmt.git
- GIT_TAG 10.2.1
- GIT_PROGRESS TRUE
- USES_TERMINAL_DOWNLOAD TRUE
-)
-FetchContent_MakeAvailable(fmt)
+find_package(fmt REQUIRED)

find_package(Snappy)
if (SNAPPY_FOUND)
35 changes: 19 additions & 16 deletions pkgs/by-name/av/avro-cpp/package.nix
Original file line number Diff line number Diff line change
Expand Up @@ -2,41 +2,44 @@
lib,
stdenv,
fetchurl,
fetchpatch,
cmake,
boost,
python3,
fmt,
versionCheckHook,
}:

stdenv.mkDerivation rec {
pname = "avro-c++";
version = "1.11.3";
version = "1.12.0";

src = fetchurl {
url = "mirror://apache/avro/avro-${version}/cpp/avro-cpp-${version}.tar.gz";
hash = "sha256-+6JCrvd+yBnQdWH8upN1FyGVbejQyujh8vMAtUszG64=";
hash = "sha256-8u33cSanWw7BrRZncr4Fg1HOo9dESL5+LO8gBQwPmKs=";
};

patches = [
# This patch fixes boost compatibility and can be removed when
# upgrading beyond 1.11.3 https://github.com/apache/avro/pull/1920
(fetchpatch {
name = "fix-boost-compatibility.patch";
url = "https://github.com/apache/avro/commit/016323828f147f185d03f50d2223a2f50bfafce1.patch";
hash = "sha256-hP/5J2JzSplMvg8EjEk98Vim8DfTyZ4hZ/WGiVwvM1A=";
})
./0001-get-rid-of-fmt-fetchcontent.patch
];
patchFlags = [ "-p3" ];

nativeBuildInputs = [
cmake
python3
];
buildInputs = [ boost ];

preConfigure = ''
substituteInPlace test/SchemaTests.cc --replace "BOOST_CHECKPOINT" "BOOST_TEST_CHECKPOINT"
substituteInPlace test/buffertest.cc --replace "BOOST_MESSAGE" "BOOST_TEST_MESSAGE"
'';
propagatedBuildInputs = [
boost
fmt
];

doCheck = true;

nativeInstallCheckInputs = [
versionCheckHook
];
doInstallCheck = true;
versionCheckProgram = "${placeholder "out"}/bin/avrogencpp";
versionCheckProgramArg = [ "--version" ];

meta = {
description = "C++ library which implements parts of the Avro Specification";
Expand Down
20 changes: 17 additions & 3 deletions pkgs/by-name/li/libserdes/package.nix
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
fetchFromGitHub,
perl,
which,
boost,
rdkafka,
jansson,
curl,
Expand Down Expand Up @@ -35,18 +34,33 @@ stdenv.mkDerivation rec {
];

buildInputs = [
boost
rdkafka
jansson
curl
avro-c
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 it’s not Autoconf so steal some bits from multiple-outputs.sh:
Expand Down
Loading