1{ lib, stdenv, fetchurl, zlib, readline, libossp_uuid, openssl }:
2
3let
4
5 common = { version, sha256, psqlSchema } @ args: stdenv.mkDerivation (rec {
6 name = "postgresql-${version}";
7
8 src = fetchurl {
9 url = "mirror://postgresql/source/v${version}/${name}.tar.bz2";
10 inherit sha256;
11 };
12
13 outputs = [ "out" "doc" ];
14
15 buildInputs =
16 [ zlib readline openssl ]
17 ++ lib.optionals (!stdenv.isDarwin) [ libossp_uuid ];
18
19 enableParallelBuilding = true;
20
21 makeFlags = [ "world" ];
22
23 configureFlags =
24 [ "--with-openssl" ]
25 ++ lib.optional (stdenv.isDarwin) "--with-uuid=e2fs"
26 ++ lib.optional (!stdenv.isDarwin) "--with-ossp-uuid";
27
28 patches =
29 [ (if lib.versionAtLeast version "9.4" then ./disable-resolve_symlinks-94.patch else ./disable-resolve_symlinks.patch)
30 ./less-is-more.patch
31 ];
32
33 installTargets = [ "install-world" ];
34
35 LC_ALL = "C";
36
37 postInstall =
38 ''
39 # Prevent a retained dependency on gcc-wrapper.
40 substituteInPlace $out/lib/pgxs/src/Makefile.global --replace ${stdenv.cc}/bin/ld ld
41 '';
42
43 disallowedReferences = [ stdenv.cc ];
44
45 passthru = {
46 inherit readline psqlSchema;
47 };
48
49 meta = with lib; {
50 homepage = http://www.postgresql.org/;
51 description = "A powerful, open source object-relational database system";
52 license = licenses.postgresql;
53 maintainers = [ maintainers.ocharles ];
54 platforms = platforms.unix;
55 hydraPlatforms = platforms.linux;
56 };
57 });
58
59in {
60
61 postgresql91 = common {
62 version = "9.1.20";
63 psqlSchema = "9.1";
64 sha256 = "0dr9hz1a0ax30f6jvnv2rck0zzxgk9x7nh4n1xgshrf26i1nq7kd";
65 };
66
67 postgresql92 = common {
68 version = "9.2.15";
69 psqlSchema = "9.2";
70 sha256 = "0q1yahkfys78crf59avp02ibd0lp3z7h626xchyfi6cqb03livbw";
71 };
72
73 postgresql93 = common {
74 version = "9.3.11";
75 psqlSchema = "9.3";
76 sha256 = "08ba951nfiy516flaw352shj1zslxg4ryx3w5k0adls1r682l8ix";
77 };
78
79 postgresql94 = common {
80 version = "9.4.6";
81 psqlSchema = "9.4";
82 sha256 = "19j0845i195ksg9pvnk3yc2fr62i7ii2bqgbidfjq556056izknb";
83 };
84
85 postgresql95 = common {
86 version = "9.5.1";
87 psqlSchema = "9.5";
88 sha256 = "1ljvijaja5zy4i5b1450drbj8m3fcm3ly1zzaakp75x30s2rsc3b";
89 };
90
91
92}