1{ stdenv, fetchFromGitHub, cmake, jsoncpp, libossp_uuid, zlib, lib
2# optional but of negligible size
3, openssl, brotli, c-ares
4# optional databases
5, sqliteSupport ? true, sqlite
6, postgresSupport ? false, postgresql
7, redisSupport ? false, hiredis
8, mysqlSupport ? false, libmysqlclient, mariadb }:
9
10stdenv.mkDerivation rec {
11 pname = "drogon";
12 version = "1.8.1";
13
14 src = fetchFromGitHub {
15 owner = "drogonframework";
16 repo = "drogon";
17 rev = "v${version}";
18 sha256 = "sha256-XzSJABYuZaYlNL12bi0ykQ1OyNsvB1AQiSTBPWiTNYU=";
19 fetchSubmodules = true;
20 };
21
22 nativeBuildInputs = [ cmake ];
23
24 cmakeFlags = [
25 "-DBUILD_TESTING=${if doInstallCheck then "ON" else "OFF"}"
26 "-DBUILD_EXAMPLES=OFF"
27 ];
28
29 propagatedBuildInputs = [
30 jsoncpp
31 libossp_uuid
32 zlib
33 openssl
34 brotli
35 c-ares
36 ] ++ lib.optional sqliteSupport sqlite
37 ++ lib.optional postgresSupport postgresql
38 ++ lib.optional redisSupport hiredis
39 # drogon uses mariadb for mysql (see https://github.com/drogonframework/drogon/wiki/ENG-02-Installation#Library-Dependencies)
40 ++ lib.optionals mysqlSupport [ libmysqlclient mariadb ];
41
42 patches = [
43 # this part of the test would normally fail because it attempts to configure a CMake project that uses find_package on itself
44 # this patch makes drogon and trantor visible to the test
45 ./fix_find_package.patch
46 ];
47
48 # modifying PATH here makes drogon_ctl visible to the test
49 installCheckPhase = ''
50 cd ..
51 PATH=$PATH:$out/bin bash test.sh
52 '';
53
54 doInstallCheck = true;
55
56 meta = with lib; {
57 homepage = "https://github.com/drogonframework/drogon";
58 description = "C++14/17 based HTTP web application framework";
59 license = licenses.mit;
60 maintainers = with maintainers; [ urlordjames ];
61 platforms = platforms.all;
62 };
63}