Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at python-updates 81 lines 1.8 kB view raw
1{ 2 lib, 3 stdenv, 4 fetchFromGitHub, 5 zlib, 6 zstd, 7 openssl, 8 curl, 9 cyrus_sasl, 10 cmake, 11 ninja, 12 pkg-config, 13 deterministic-host-uname, 14}: 15 16stdenv.mkDerivation (finalAttrs: { 17 pname = "rdkafka"; 18 version = "2.11.0"; 19 20 src = fetchFromGitHub { 21 owner = "confluentinc"; 22 repo = "librdkafka"; 23 tag = "v${finalAttrs.version}"; 24 sha256 = "sha256-37lCQ+CFeTRQwL6FCl79RSGw+nRKr0DeuXob9CjiVnk="; 25 }; 26 27 outputs = [ 28 "out" 29 "dev" 30 ]; 31 32 nativeBuildInputs = [ 33 cmake 34 ninja 35 pkg-config 36 # cross: build system uses uname to determine host system 37 deterministic-host-uname 38 ]; 39 40 buildInputs = [ 41 zlib 42 zstd 43 openssl 44 curl 45 cyrus_sasl 46 ]; 47 48 # examples and tests don't build on darwin statically 49 cmakeFlags = [ 50 (lib.cmakeBool "RDKAFKA_BUILD_STATIC" stdenv.hostPlatform.isStatic) 51 (lib.cmakeBool "RDKAFKA_BUILD_TESTS" ( 52 !stdenv.hostPlatform.isDarwin && !stdenv.hostPlatform.isStatic 53 )) 54 (lib.cmakeBool "RDKAFKA_BUILD_EXAMPLES" ( 55 !stdenv.hostPlatform.isDarwin && !stdenv.hostPlatform.isStatic 56 )) 57 (lib.cmakeFeature "CMAKE_C_FLAGS" "-Wno-error=strict-overflow") 58 ]; 59 60 postPatch = '' 61 patchShebangs . 62 ''; 63 64 postFixup = lib.optionalString stdenv.hostPlatform.isStatic '' 65 # rdkafka changes the library names for static libraries but users in pkgsStatic aren't likely to be aware of this 66 # make sure the libraries are findable with both names 67 for pc in rdkafka{,++}; do 68 ln -s $dev/lib/pkgconfig/$pc{-static,}.pc 69 done 70 ''; 71 72 enableParallelBuilding = true; 73 74 meta = with lib; { 75 description = "Apache Kafka C/C++ client library"; 76 homepage = "https://github.com/confluentinc/librdkafka"; 77 license = licenses.bsd2; 78 platforms = platforms.linux ++ platforms.darwin; 79 maintainers = with maintainers; [ commandodev ]; 80 }; 81})