Merge pull request #329823 from ExpidusOS/fix/pkgsllvm/elfutils
[NixPkgs.git] / pkgs / by-name / mo / modern-cpp-kafka / package.nix
blobf8db36d613bf8aa4d3569c8c9c4046692259aa2e
1 { lib
2 , stdenv
3 , fetchFromGitHub
4 , fetchpatch
5 , cmake
6 , boost
7 , rdkafka
8 , gtest
9 , rapidjson
12 stdenv.mkDerivation rec {
13   pname = "modern-cpp-kafka";
14   version = "2023.03.07";
16   src = fetchFromGitHub {
17     repo = "modern-cpp-kafka";
18     owner = "morganstanley";
19     rev = "v${version}";
20     hash = "sha256-7hkwM1YbveQpDRqwMZ3MXM88LTwlAT7uB8NL0t409To=";
21   };
23   patches = [
24     (fetchpatch { # https://github.com/morganstanley/modern-cpp-kafka/pull/221
25       name = "fix-avoid-overwriting-library-paths.patch";
26       url = "https://github.com/morganstanley/modern-cpp-kafka/compare/a146d10bcf166f55299c7a55728abaaea52cb0e5...a0b5ec08315759097ce656813be57b2c38d79091.patch";
27       hash = "sha256-UsQcMvJoRTn5kgXhmXOyqfW3n59kGKO596U2WjtdqAY=";
28     })
29     (fetchpatch { # https://github.com/morganstanley/modern-cpp-kafka/pull/222
30       name = "add-pkg-config-cmake-config.patch";
31       url = "https://github.com/morganstanley/modern-cpp-kafka/commit/edc576ab83710412f6201e2bb8de5cb41682ee4a.patch";
32       hash = "sha256-OjoSttnpgEwSZjCVKc888xJb5f1Dulu/rQqoGmqXNM4=";
33     })
34     # Fix gcc-13 build failure:
35     #   https://github.com/morganstanley/modern-cpp-kafka/pull/229
36     (fetchpatch {
37       name = "add-pkg-config-cmake-config.patch";
38       url = "https://github.com/morganstanley/modern-cpp-kafka/commit/236f8f91f5c3ad6e1055a6f55cd3aebd218e1226.patch";
39       hash = "sha256-cy568TQUu08sadq79hDz9jMvDqiDjfr+1cLMxFWGm1Q=";
40     })
41   ];
43   postPatch = ''
44     # Blanket -Werror tends to fail on minor unrelated warnings.
45     # Currently this fixes gcc-13 build failure.
46     substituteInPlace CMakeLists.txt --replace-fail '"-Werror"' ' '
47   '';
49   nativeBuildInputs = [ cmake ];
50   buildInputs = [ boost ];
51   propagatedBuildInputs = [ rdkafka ];
53   cmakeFlags = [
54     "-DLIBRDKAFKA_INCLUDE_DIR=${rdkafka.out}/include"
55     "-DGTEST_LIBRARY_DIR=${gtest.out}/lib"
56     "-DGTEST_INCLUDE_DIR=${gtest.dev}/include"
57     "-DRAPIDJSON_INCLUDE_DIRS=${rapidjson.out}/include"
58     "-DCMAKE_CXX_FLAGS=-Wno-uninitialized"
59   ];
61   checkInputs = [ gtest rapidjson ];
63   meta = with lib; {
64     description = "C++ API for Kafka clients (i.e. KafkaProducer, KafkaConsumer, AdminClient)";
65     homepage = "https://github.com/morganstanley/modern-cpp-kafka";
66     license = licenses.asl20;
67     maintainers = with maintainers; [ ditsuke ];
68     platforms = platforms.unix;
69   };