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