1{ lib
2, stdenv
3, fetchFromGitHub, fetchpatch
4, cmake
5, enableShared ? !stdenv.hostPlatform.isStatic
6
7# tests
8, mpd
9, openimageio
10, fcitx5
11, spdlog
12}:
13
14let
15 generic = { version, sha256, patches ? [ ] }:
16 stdenv.mkDerivation {
17 pname = "fmt";
18 inherit version;
19
20 outputs = [ "out" "dev" ];
21
22 src = fetchFromGitHub {
23 owner = "fmtlib";
24 repo = "fmt";
25 rev = version;
26 inherit sha256;
27 };
28
29 inherit patches;
30
31 nativeBuildInputs = [ cmake ];
32
33 cmakeFlags = [
34 "-DBUILD_SHARED_LIBS=${if enableShared then "ON" else "OFF"}"
35 ];
36
37 doCheck = true;
38
39 passthru.tests = {
40 inherit mpd openimageio fcitx5 spdlog;
41 };
42
43 meta = with lib; {
44 description = "Small, safe and fast formatting library";
45 longDescription = ''
46 fmt (formerly cppformat) is an open-source formatting library. It can be
47 used as a fast and safe alternative to printf and IOStreams.
48 '';
49 homepage = "https://fmt.dev/";
50 changelog = "https://github.com/fmtlib/fmt/blob/${version}/ChangeLog.rst";
51 downloadPage = "https://github.com/fmtlib/fmt/";
52 maintainers = [ maintainers.jdehaas ];
53 license = licenses.mit;
54 platforms = platforms.all;
55 };
56 };
57in
58{
59 fmt_8 = generic {
60 version = "8.1.1";
61 sha256 = "sha256-leb2800CwdZMJRWF5b1Y9ocK0jXpOX/nwo95icDf308=";
62 };
63
64 fmt_9 = generic {
65 version = "9.1.0";
66 sha256 = "sha256-rP6ymyRc7LnKxUXwPpzhHOQvpJkpnRFOt2ctvUNlYI0=";
67 };
68
69 fmt_10 = generic {
70 version = "10.1.1";
71 sha256 = "sha256-H9+1lEaHM12nzXSmo9m8S6527t+97e6necayyjCPm1A=";
72 };
73}