python3Packages.orjson: Disable failing tests on 32 bit
[NixPkgs.git] / pkgs / development / libraries / spdlog / default.nix
blobb77eb935d4e6bb90b4db461aa454c4fa5144c25f
1 { lib, stdenv, fetchFromGitHub, cmake, fmt_8, fetchpatch
2 , staticBuild ? stdenv.hostPlatform.isStatic
3 }:
5 let
6   generic = { version, sha256 }:
7     stdenv.mkDerivation {
8       pname = "spdlog";
9       inherit version;
11       src = fetchFromGitHub {
12         owner  = "gabime";
13         repo   = "spdlog";
14         rev    = "v${version}";
15         inherit sha256;
16       };
18       # in master post 1.10.0, see https://github.com/gabime/spdlog/issues/2380
19       patches = lib.optional (lib.versionAtLeast version "1.4.1") (fetchpatch {
20         name = "fix-pkg-config.patch";
21         url = "https://github.com/gabime/spdlog/commit/afb69071d5346b84e38fbcb0c8c32eddfef02a55.patch";
22         sha256 = "0cab2bbv8zyfhrhfvcyfwf5p2fddlq5hs2maampn5w18f6jhvk6q";
23       });
25       nativeBuildInputs = [ cmake ];
26       # spdlog <1.3 uses a bundled version of fmt
27       propagatedBuildInputs = lib.optional (lib.versionAtLeast version "1.3") fmt_8;
29       cmakeFlags = [
30         "-DSPDLOG_BUILD_SHARED=${if staticBuild then "OFF" else "ON"}"
31         "-DSPDLOG_BUILD_STATIC=${if staticBuild then "ON" else "OFF"}"
32         "-DSPDLOG_BUILD_EXAMPLE=OFF"
33         "-DSPDLOG_BUILD_BENCH=OFF"
34         "-DSPDLOG_BUILD_TESTS=ON"
35         "-DSPDLOG_FMT_EXTERNAL=ON"
36       ];
38       outputs = [ "out" "doc" ]
39         # spdlog <1.4 is header only, no need to split libraries and headers
40         ++ lib.optional (lib.versionAtLeast version "1.4") "dev";
42       postInstall = ''
43         mkdir -p $out/share/doc/spdlog
44         cp -rv ../example $out/share/doc/spdlog
45       '';
47       doCheck = true;
49       meta = with lib; {
50         description    = "Very fast, header only, C++ logging library";
51         homepage       = "https://github.com/gabime/spdlog";
52         license        = licenses.mit;
53         maintainers    = with maintainers; [ obadz ];
54         platforms      = platforms.all;
55       };
56     };
59   spdlog_1 = generic {
60     version = "1.10.0";
61     sha256 = "sha256-c6s27lQCXKx6S1FhZ/LiKh14GnXMhZtD1doltU4Avws=";
62   };
64   spdlog_0 = generic {
65     version = "0.17.0";
66     sha256 = "112kfh4fbpm5cvrmgbgz4d8s802db91mhyjpg7cwhlywffnzkwr9";
67   };