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