@@ -0,0 +1,31 @@
1+{ stdenv, fetchFromGitHub, cmake, enableShared ? true }:
2+
3+stdenv.mkDerivation rec {
4+ version = "5.2.1";
5+ name = "fmt-${version}";
6+ src = fetchFromGitHub {
7+ owner = "fmtlib";
8+ repo = "fmt";
9+ rev = "${version}";
10+ sha256 = "1cd8yq8va457iir1hlf17ksx11fx2hlb8i4jml8gj1875pizm0pk";
11+ };
12+ nativeBuildInputs = [ cmake ];
13+ doCheck = true;
14+ # preCheckHook ensures the test binaries can find libfmt.so.5
15+ preCheck = if enableShared
16+ then "export LD_LIBRARY_PATH=\"$PWD\""
17+ else "";
18+ cmakeFlags = [ "-DFMT_TEST=yes"
19+ "-DBUILD_SHARED_LIBS=${if enableShared then "ON" else "OFF"}" ];
20+ meta = with stdenv.lib; {
21+ homepage = http://fmtlib.net/;
22+ description = "Small, safe and fast formatting library";
23+ longDescription = ''
24+ fmt (formerly cppformat) is an open-source formatting library. It can be
25+ used as a fast and safe alternative to printf and IOStreams.
26+ '';
27+ maintainers = [ maintainers.jdehaas ];
28+ license = licenses.bsd2;
29+ platforms = platforms.unix;
30+ };
31+}