about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/libraries/fmt/default.nix
blob: 4c439717bacd90ebd9bddee89a3467bbd8ada703 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
{ lib
, stdenv
, fetchFromGitHub, fetchpatch
, cmake
, enableShared ? !stdenv.hostPlatform.isStatic

# tests
, mpd
, openimageio
, fcitx5
, spdlog
}:

let
  generic = { version, sha256, patches ? [ ] }:
    stdenv.mkDerivation {
      pname = "fmt";
      inherit version;

      outputs = [ "out" "dev" ];

      src = fetchFromGitHub {
        owner = "fmtlib";
        repo = "fmt";
        rev = version;
        inherit sha256;
      };

      inherit patches;

      nativeBuildInputs = [ cmake ];

      cmakeFlags = [
        "-DBUILD_SHARED_LIBS=${if enableShared then "ON" else "OFF"}"
      ];

      doCheck = true;

      passthru.tests = {
        inherit mpd openimageio fcitx5 spdlog;
      };

      meta = with lib; {
        description = "Small, safe and fast formatting library";
        longDescription = ''
          fmt (formerly cppformat) is an open-source formatting library. It can be
          used as a fast and safe alternative to printf and IOStreams.
        '';
        homepage = "https://fmt.dev/";
        changelog = "https://github.com/fmtlib/fmt/blob/${version}/ChangeLog.rst";
        downloadPage = "https://github.com/fmtlib/fmt/";
        maintainers = [ maintainers.jdehaas ];
        license = licenses.mit;
        platforms = platforms.all;
      };
    };
in
{
  fmt_8 = generic {
    version = "8.1.1";
    sha256 = "sha256-leb2800CwdZMJRWF5b1Y9ocK0jXpOX/nwo95icDf308=";
  };

  fmt_9 = generic {
    version = "9.1.0";
    sha256 = "sha256-rP6ymyRc7LnKxUXwPpzhHOQvpJkpnRFOt2ctvUNlYI0=";
  };

  fmt_10 = generic {
    version = "10.0.0";
    sha256 = "sha256-sVY2TVPS/Zx32p5XIYR6ghqN4kOZexzH7Cr+y8sZXK8=";
    patches = [
      # fixes a test failure on pkgsMusl.fmt
      (fetchpatch {
        url = "https://github.com/fmtlib/fmt/commit/eaa6307691a9edb9e2f2eacf70500fc6989b416c.diff";
        hash = "sha256-PydnmOn/o9DexBViFGUUAO9KFjVS6CN8GVDHcl/+K8g=";
      })
    ];
  };
}