override zlog with pkgconf data

This commit is contained in:
Rongsong Shen 2025-11-03 17:08:57 +08:00
parent 24b1374875
commit 3eb8b50d88
2 changed files with 55 additions and 0 deletions

View file

@ -8,9 +8,13 @@ let
cedro = cedro;
capnpc = capnpc;
};
zlog_with_pkgconf = callPackage ./pkgs/z/zlog/package.nix {
with_pkgconf = true;
};
in
{
xbuild = xbuild;
capnpc = capnpc;
cedro = cedro;
zlog_with_pkgconf = zlog_with_pkgconf;
}

51
pkgs/z/zlog/package.nix Normal file
View file

@ -0,0 +1,51 @@
{
lib,
stdenv,
fetchFromGitHub,
cmake,
with_pkgconf? false,
}:
let
meta = with lib; {
description = "Reliable, high-performance, thread safe, flexible, clear-model, pure C logging library";
homepage = "https://hardysimpson.github.io/zlog/";
license = lib.licenses.asl20;
maintainers = with lib.maintainers; [ matthiasbeyer ];
mainProgram = "zlog-chk-conf";
platforms = lib.platforms.unix;
};
pname = "zlog";
version = "1.2.18";
in
stdenv.mkDerivation (finalAttrs: {
pname = pname;
version = version;
src = fetchFromGitHub {
owner = "HardySimpson";
repo = "zlog";
tag = finalAttrs.version;
hash = "sha256-79yyOGKgqUR1KI2+ngZd7jfVcz4Dw1IxaYfBJyjsxYc=";
};
nativeBuildInputs = [ cmake ];
postInstall = ''
mkdir -p $out/lib/pkgconfig
cat >$out/lib/pkgconfig/zlog.pc <<EOF
prefix=$out
exec_prefix=\''${prefix}
libdir=$out/lib
includedir=\''${prefix}/include
Name: ${pname}
Description: ${meta.description}
Version: ${version}
Libs: -L\''${libdir} -lzlog
Cflags: -I\''${includedir}
EOF
'';
inherit meta;
})