Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1{
2 lib,
3 stdenv,
4 fetchFromGitHub,
5 cmake,
6 fmt,
7 catch2_3,
8 staticBuild ? stdenv.hostPlatform.isStatic,
9
10 # passthru
11 bear,
12 tiledb,
13 nix-update-script,
14}:
15
16stdenv.mkDerivation (finalAttrs: {
17 pname = "spdlog";
18 version = "1.15.2";
19
20 src = fetchFromGitHub {
21 owner = "gabime";
22 repo = "spdlog";
23 tag = "v${finalAttrs.version}";
24 hash = "sha256-9RhB4GdFjZbCIfMOWWriLAUf9DE/i/+FTXczr0pD0Vg=";
25 };
26
27 nativeBuildInputs = [ cmake ];
28 # Required to build tests, even if they aren't executed
29 buildInputs = [ catch2_3 ];
30 propagatedBuildInputs = [ fmt ];
31
32 cmakeFlags = [
33 (lib.cmakeBool "SPDLOG_BUILD_SHARED" (!staticBuild))
34 (lib.cmakeBool "SPDLOG_BUILD_STATIC" staticBuild)
35 (lib.cmakeBool "SPDLOG_BUILD_EXAMPLE" false)
36 (lib.cmakeBool "SPDLOG_BUILD_BENCH" false)
37 (lib.cmakeBool "SPDLOG_BUILD_TESTS" true)
38 (lib.cmakeBool "SPDLOG_FMT_EXTERNAL" true)
39 ];
40
41 outputs = [
42 "out"
43 "doc"
44 "dev"
45 ];
46
47 postInstall = ''
48 mkdir -p $out/share/doc/spdlog
49 cp -rv ../example $out/share/doc/spdlog
50
51 substituteInPlace $dev/include/spdlog/tweakme.h \
52 --replace-fail \
53 '// #define SPDLOG_FMT_EXTERNAL' \
54 '#define SPDLOG_FMT_EXTERNAL'
55 '';
56
57 doCheck = true;
58
59 passthru = {
60 tests = {
61 inherit bear tiledb;
62 };
63 updateScript = nix-update-script { };
64 };
65
66 meta = {
67 description = "Very fast, header only, C++ logging library";
68 homepage = "https://github.com/gabime/spdlog";
69 changelog = "https://github.com/gabime/spdlog/releases/tag/v${finalAttrs.version}";
70 license = lib.licenses.mit;
71 maintainers = with lib.maintainers; [ obadz ];
72 platforms = lib.platforms.all;
73 };
74})