1{ cmake
2, fetchFromGitHub
3, fetchpatch
4, sqlite
5, postgresql
6, boost
7, darwin
8, lib, stdenv
9}:
10let
11 inherit (darwin.apple_sdk_11_0.frameworks) Kerberos;
12in
13stdenv.mkDerivation rec {
14 pname = "soci";
15 version = "4.0.2";
16
17 src = fetchFromGitHub {
18 owner = "SOCI";
19 repo = pname;
20 rev = "v${version}";
21 sha256 = "sha256-NE0ApbX8HG2VAQ9cg9+kX3kJQ4PR1XvWL9BlT8NphmE=";
22 };
23
24 patches = [
25 (fetchpatch {
26 name = "fix-backend-search-path.patch";
27 url = "https://github.com/SOCI/soci/commit/56c93afc467bdba8ffbe68739eea76059ea62f7a.patch";
28 sha256 = "sha256-nC/39pn3Cv5e65GgIfF3l64/AbCsfZHPUPIWETZFZAY=";
29 })
30 ];
31
32 # Do not build static libraries
33 cmakeFlags = [ "-DSOCI_STATIC=OFF" "-DCMAKE_CXX_STANDARD=11" "-DSOCI_TESTS=off" ];
34
35 nativeBuildInputs = [ cmake ];
36 buildInputs = [
37 sqlite
38 postgresql
39 boost
40 ] ++ lib.optionals stdenv.isDarwin [
41 Kerberos
42 ];
43
44 meta = with lib; {
45 description = "Database access library for C++";
46 homepage = "https://soci.sourceforge.net/";
47 license = licenses.boost;
48 platforms = platforms.all;
49 maintainers = with maintainers; [ jluttine ];
50 };
51}