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