1{ lib, stdenv, fetchFromGitHub, cmake, curl, openssl, gitUpdater
2, withCurl ? true, withOpenSSL ? true }:
3
4stdenv.mkDerivation rec {
5 pname = "coost";
6 version = "3.0.0";
7
8 src = fetchFromGitHub {
9 owner = "idealvin";
10 repo = pname;
11 rev = "v${version}";
12 sha256 = "sha256-qpJh1yl0lYYszNHGo5Jkbzal2hnVzg7UUxiyg/Grva8=";
13 };
14
15 postPatch = ''
16 substituteInPlace cmake/coost.pc.in \
17 --replace '$'{exec_prefix}/@CMAKE_INSTALL_LIBDIR@ @CMAKE_INSTALL_FULL_LIBDIR@ \
18 --replace '$'{prefix}/@CMAKE_INSTALL_INCLUDEDIR@ @CMAKE_INSTALL_FULL_INCLUDEDIR@ \
19 '';
20
21 nativeBuildInputs = [ cmake ];
22 buildInputs = lib.optional withCurl curl ++ lib.optional withOpenSSL openssl;
23
24 cmakeFlags = [ "-DBUILD_SHARED_LIBS=ON" ]
25 ++ lib.optional withCurl "-DWITH_LIBCURL=ON"
26 ++ lib.optional withOpenSSL "-DWITH_OPENSSL=ON";
27
28 passthru.updateScript = gitUpdater { };
29
30 meta = with lib; {
31 description = "A tiny boost library in C++11";
32 homepage = "https://github.com/idealvin/coost";
33 license = licenses.mit;
34 maintainers = [];
35 platforms = platforms.unix;
36 };
37}