1{ stdenv
2, lib
3, fetchFromGitHub
4, fetchpatch
5, perl
6, boost
7, rdkafka
8, jansson
9, curl
10, avro-c
11, avro-cpp }:
12
13stdenv.mkDerivation rec {
14 pname = "libserdes";
15 version = "6.2.0";
16
17 src = fetchFromGitHub {
18 owner = "confluentinc";
19 repo = pname;
20 rev = "v${version}";
21 sha256 = "194ras18xw5fcnjgg1isnb24ydx9040ndciniwcbdb7w7wd901gc";
22 };
23
24 outputs = [ "dev" "out" ];
25
26 nativeBuildInputs = [ perl ];
27
28 buildInputs = [ boost rdkafka jansson curl avro-c avro-cpp ];
29
30 makeFlags = [ "GEN_PKG_CONFIG=y" ];
31
32 patches = [
33 # Fix compatibility with Avro master branch
34 (fetchpatch {
35 url = "https://github.com/confluentinc/libserdes/commit/d7a355e712ab63ec77f6722fb5a9e8056e7416a2.patch";
36 sha256 = "14bdx075n4lxah63kp7phld9xqlz3pzs03yf3wbq4nmkgwac10dh";
37 })
38 ];
39
40 postPatch = ''
41 patchShebangs configure lds-gen.pl
42 '';
43
44 # Has a configure script but it’s not Autoconf so steal some bits from multiple-outputs.sh:
45 setOutputFlags = false;
46
47 preConfigure = ''
48 configureFlagsArray+=(
49 "--libdir=''${!outputLib}/lib"
50 "--includedir=''${!outputInclude}/include"
51 )
52 '';
53
54 preInstall = ''
55 installFlagsArray+=("pkgconfigdir=''${!outputDev}/lib/pkgconfig")
56 '';
57
58 # Header files get installed with executable bit for some reason; get rid of it.
59 postInstall = ''
60 chmod -x ''${!outputInclude}/include/libserdes/*.h
61 '';
62
63 meta = with lib; {
64 description = "A schema-based serializer/deserializer C/C++ library with support for Avro and the Confluent Platform Schema Registry";
65 homepage = "https://github.com/confluentinc/libserdes";
66 license = licenses.asl20;
67 maintainers = with maintainers; [ liff ];
68 platforms = platforms.all;
69 };
70}