at 16.09-beta 2.8 kB view raw
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" "lib" "doc" ]; 14 setOutputFlags = false; # $out retains configureFlags :-/ 15 16 buildInputs = 17 [ zlib readline openssl ] 18 ++ lib.optionals (!stdenv.isDarwin) [ libossp_uuid ]; 19 20 enableParallelBuilding = true; 21 22 makeFlags = [ "world" ]; 23 24 configureFlags = [ 25 "--with-openssl" 26 "--sysconfdir=/etc" 27 "--libdir=$(lib)/lib" 28 ] 29 ++ lib.optional (stdenv.isDarwin) "--with-uuid=e2fs" 30 ++ lib.optional (!stdenv.isDarwin) "--with-ossp-uuid"; 31 32 patches = 33 [ (if lib.versionAtLeast version "9.4" then ./disable-resolve_symlinks-94.patch else ./disable-resolve_symlinks.patch) 34 ./less-is-more.patch 35 ./hardcode-pgxs-path.patch 36 ]; 37 38 installTargets = [ "install-world" ]; 39 40 LC_ALL = "C"; 41 42 postConfigure = 43 '' 44 # Hardcode the path to pgxs so pg_config returns the path in $out 45 substituteInPlace "src/bin/pg_config/pg_config.c" --replace HARDCODED_PGXS_PATH $out/lib 46 ''; 47 48 postInstall = 49 '' 50 moveToOutput "lib/pgxs" "$out" # looks strange, but not deleting it 51 moveToOutput "lib/*.a" "$out" 52 moveToOutput "lib/libecpg*" "$out" 53 54 # Prevent a retained dependency on gcc-wrapper. 55 substituteInPlace "$out/lib/pgxs/src/Makefile.global" --replace ${stdenv.cc}/bin/ld ld 56 ''; 57 58 disallowedReferences = [ stdenv.cc ]; 59 60 passthru = { 61 inherit readline psqlSchema; 62 }; 63 64 meta = with lib; { 65 homepage = http://www.postgresql.org/; 66 description = "A powerful, open source object-relational database system"; 67 license = licenses.postgresql; 68 maintainers = [ maintainers.ocharles ]; 69 platforms = platforms.unix; 70 hydraPlatforms = platforms.linux; 71 }; 72 }); 73 74in { 75 76 postgresql91 = common { 77 version = "9.1.23"; 78 psqlSchema = "9.1"; 79 sha256 = "1mgnfm65fspkq62skfy48rjkprnxcfhydw0x3ipp4sdkngl72x3z"; 80 }; 81 82 postgresql92 = common { 83 version = "9.2.18"; 84 psqlSchema = "9.2"; 85 sha256 = "1x1mxbwqvgj9s4y8pb4vv6fmmr36z5zl3b2ggb84ckdfhvakganp"; 86 }; 87 88 postgresql93 = common { 89 version = "9.3.14"; 90 psqlSchema = "9.3"; 91 sha256 = "1783kl0abf9az90mvs08pdh63d33cv2njc1q515zz89bqkqj4hsw"; 92 }; 93 94 postgresql94 = common { 95 version = "9.4.9"; 96 psqlSchema = "9.4"; 97 sha256 = "1jg1l6vrfwhfyqrx07bgcpqxb5zcp8zwm8qd2vcj0k11j0pac861"; 98 }; 99 100 postgresql95 = common { 101 version = "9.5.4"; 102 psqlSchema = "9.5"; 103 sha256 = "1l3fqxlpxgl6nrcd4h6lpi2hsiv56yg83n3xrn704rmdch8mfpng"; 104 }; 105 106 107}