nixpkgs-suyu/pkgs/development/libraries/libserdes/default.nix
2023-12-31 11:37:53 +02:00

70 lines
1.8 KiB
Nix
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

{ stdenv
, lib
, fetchFromGitHub
, perl
, which
, boost
, rdkafka
, jansson
, curl
, avro-c
, avro-cpp
, nix-update-script }:
stdenv.mkDerivation rec {
pname = "libserdes";
version = "7.5.3";
src = fetchFromGitHub {
owner = "confluentinc";
repo = pname;
rev = "v${version}";
hash = "sha256-rg4SWa9nIDT6JrnnCDwdiFE1cvpUn0HWHn+bPkXMHQ4=";
};
outputs = [ "dev" "out" ];
nativeBuildInputs = [ perl which ];
buildInputs = [ boost rdkafka jansson curl avro-c avro-cpp ];
makeFlags = [ "GEN_PKG_CONFIG=y" ];
postPatch = ''
patchShebangs configure lds-gen.pl
'' + lib.optionalString (stdenv.cc.libcxx != null) ''
# fix for https://github.com/NixOS/nixpkgs/issues/166205
# llvm12+ isn't adding libc++abi
substituteInPlace src-cpp/Makefile \
--replace "LIBS += -lstdc++" "LIBS += -lc++ -l${stdenv.cc.libcxx.cxxabi.libName}"
'';
# Has a configure script but its not Autoconf so steal some bits from multiple-outputs.sh:
setOutputFlags = false;
preConfigure = ''
configureFlagsArray+=(
"--libdir=''${!outputLib}/lib"
"--includedir=''${!outputInclude}/include"
)
'';
preInstall = ''
installFlagsArray+=("pkgconfigdir=''${!outputDev}/lib/pkgconfig")
'';
# Header files get installed with executable bit for some reason; get rid of it.
postInstall = ''
chmod -x ''${!outputInclude}/include/libserdes/*.h
'';
passthru.updateScript = nix-update-script { };
meta = with lib; {
description = "A schema-based serializer/deserializer C/C++ library with support for Avro and the Confluent Platform Schema Registry";
homepage = "https://github.com/confluentinc/libserdes";
license = licenses.asl20;
maintainers = with maintainers; [ liff ];
platforms = platforms.all;
};
}