1{ lib
2, stdenv
3, fetchurl
4, postgresql
5, openssl
6, libxcrypt
7, withPam ? stdenv.isLinux
8, pam
9}:
10
11stdenv.mkDerivation rec {
12 pname = "pgpool-II";
13 version = "4.4.2";
14
15 src = fetchurl {
16 url = "https://www.pgpool.net/mediawiki/download.php?f=pgpool-II-${version}.tar.gz";
17 name = "pgpool-II-${version}.tar.gz";
18 sha256 = "sha256-Pmx4jnDwZyx7OMiKbKdvMfN4axJWiZgMwGOrdSylgjQ=";
19 };
20
21 buildInputs = [
22 postgresql
23 openssl
24 libxcrypt
25 ] ++ lib.optional withPam pam;
26
27 configureFlags = [
28 "--sysconfdir=/etc"
29 "--localstatedir=/var"
30 "--with-openssl"
31 ] ++ lib.optional withPam "--with-pam";
32
33 installFlags = [
34 "sysconfdir=\${out}/etc"
35 ];
36
37 patches = lib.optionals (stdenv.isDarwin) [
38 # Build checks for strlcpy being available in the system, but doesn't
39 # actually exclude its own copy from being built
40 ./darwin-strlcpy.patch
41 ];
42
43 enableParallelBuilding = true;
44
45 meta = with lib; {
46 homepage = "http://pgpool.net/mediawiki/index.php";
47 description = "A middleware that works between postgresql servers and postgresql clients";
48 license = licenses.free;
49 platforms = platforms.unix;
50 maintainers = with maintainers; [ ];
51 };
52}