add tiny log & unity-test

This commit is contained in:
Rongsong Shen 2025-11-04 15:20:57 +08:00
parent 3eb8b50d88
commit 09101274fc
3 changed files with 81 additions and 0 deletions

View file

@ -11,10 +11,12 @@ let
zlog_with_pkgconf = callPackage ./pkgs/z/zlog/package.nix {
with_pkgconf = true;
};
tinylog = callPackage ./pkgs/t/tinylog/package.nix {};
in
{
xbuild = xbuild;
capnpc = capnpc;
cedro = cedro;
zlog_with_pkgconf = zlog_with_pkgconf;
tinylog = tinylog;
}

View file

@ -0,0 +1,51 @@
{
lib,
stdenv,
fetchFromGitHub,
cmake,
with_pkgconf? false,
}:
let
meta = with lib; {
description = "Tinylog is a lightweight C-language high performance log component for UNIX environment, It is high performance, asynchronized, thread-safe and process-safe log library for C/C++.";
homepage = "https://github.com/pymumu/tinylog";
license = lib.licenses.mit;
# maintainers = with lib.maintainers; [ matthiasbeyer ];
# mainProgram = "zlog-chk-conf";
platforms = lib.platforms.unix;
};
pname = "tlog";
version = "1.0.0";
in
stdenv.mkDerivation (finalAttrs: {
pname = pname;
version = version;
src = fetchFromGitHub {
owner = "shen390s";
repo = "tinylog";
rev = "master";
hash = "sha256-hyr9enK/ClO1v6dlGKTBKUvlXX5f166+CS0RyvYBRWI=";
};
nativeBuildInputs = [ cmake ];
postInstall = ''
mkdir -p $out/lib/pkgconfig
cat >$out/lib/pkgconfig/tinylog.pc <<EOF
prefix=$out
exec_prefix=\''${prefix}
libdir=$out/lib
includedir=\''${prefix}/include
Name: ${pname}
Description: ${meta.description}
Version: ${version}
Libs: -L\''${libdir} -ltlog
Cflags: -I\''${includedir}
EOF
'';
inherit meta;
})

View file

@ -0,0 +1,28 @@
{
lib,
stdenv,
fetchFromGitHub,
cmake,
}:
stdenv.mkDerivation (finalAttrs: {
pname = "unity-test";
version = "2.6.1";
src = fetchFromGitHub {
owner = "ThrowTheSwitch";
repo = "Unity";
tag = "v${finalAttrs.version}";
hash = "sha256-g0ubq7RxGQmL1R6vz9RIGJpVWYsgrZhsTWSrL1ySEug=";
};
nativeBuildInputs = [ cmake ];
doCheck = true;
meta = {
description = "Unity Unit Testing Framework";
homepage = "https://www.throwtheswitch.org/unity";
license = lib.licenses.mit;
maintainers = [ lib.maintainers.i01011001 ];
};
})