Ticket #22977: Portfile-postgresql91

File Portfile-postgresql91, 4.6 KB (added by dark.panda+macports@…, 12 years ago)

PostgreSQL 9.1 Portfile with contrib module whitelist

Line 
1# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=tcl:et:sw=4:ts=4:sts=4
2# $Id: Portfile 96689 2012-08-17 15:56:49Z jwa@macports.org $
3
4PortSystem 1.0
5PortGroup select 1.0
6
7name                    postgresql91
8version                 9.1.5
9
10categories              databases
11platforms               darwin
12maintainers             mww jwa
13license                 Permissive
14description             The most advanced open-source database available anywhere.
15long_description PostgreSQL is Object-Relational Database Management System. \
16                                It supports almost all SQL constructs, including transactions, \
17                                subselects, and user-defined types and functions. Write-ahead \
18                                logging means increased performance while retaining data \
19                                integrity.
20
21homepage                http://www.postgresql.org/
22master_sites            http://ftp3.de.postgresql.org/pub/Mirrors/ftp.postgresql.org/source/v${version}/ \
23                        postgresql:source/v${version}/
24distname                postgresql-${version}
25
26checksums           rmd160  c6f1e4da05d7c325acc1321f94da654a52fc2c1a \
27                    sha256  0b889c132426fc68d8c2eb1bf112bf99cc653e9c95b5f4bbebc55cd9a8d6ce44
28
29use_bzip2               yes
30
31depends_lib             port:readline port:openssl port:zlib port:libxml2 port:libxslt port:ossp-uuid
32depends_build           port:bison
33depends_run             port:postgresql_select
34
35worksrcdir              postgresql-${version}
36
37patchfiles              src_pl_plpython_Makefile.patch
38
39set libdir              ${prefix}/lib/${name}
40configure.args  --sysconfdir=${prefix}/etc/${name} \
41                                --bindir=${libdir}/bin \
42                                --libdir=${libdir} \
43                                --includedir=${prefix}/include/${name} \
44                                --datadir=${prefix}/share/${name} \
45                                --mandir=${prefix}/share/man \
46                                --with-includes=${prefix}/include \
47                                --with-libraries=${prefix}/lib \
48                                --with-openssl \
49                                --with-bonjour \
50                                --with-readline \
51                                --with-zlib \
52                                --with-libxml \
53                                --with-libxslt \
54                                --enable-thread-safety \
55                                --enable-integer-datetimes \
56                                --with-ossp-uuid
57configure.cppflags-append       -I${prefix}/include/ossp
58
59# building psql with clang causes segfault on query; see #31717
60if {${configure.compiler} == "clang" && [vercmp ${xcodeversion} 4.4] < 0} {
61    configure.compiler llvm-gcc-4.2
62}
63
64if {[variant_isset universal]} {
65    configure.cflags-append     -DAC_APPLE_UNIVERSAL_BUILD
66    post-configure {
67        system "cd ${worksrcpath}/src/include \
68                && ed - pg_config.h < ${filespath}/pg_config.h.ed \
69                && touch stamp-h"
70        system "cd ${worksrcpath}/src/interfaces/ecpg/include \
71                && ed - ecpg_config.h < ${filespath}/ecpg_config.h.ed \
72                && touch stamp-h"
73    }
74}
75
76build.type              gnu
77build.target
78
79test.run                yes
80test.target             check
81
82livecheck.type  regex
83livecheck.url   ${homepage}
84livecheck.regex (9\\.1\\.\[.0-9\]+)
85
86platform darwin 12 {
87    patchfiles-append   postgresql-uuid-ossp.patch
88}
89
90set contrib_blacklist "sepgsql start-scripts"
91set build_contribs ""
92
93post-extract {
94        global contrib_blacklist
95        set contribs [glob -tails -type d -directory ${worksrcpath}/contrib/ *]
96
97        foreach contrib ${contribs} {
98                if {[lsearch ${contrib_blacklist} ${contrib}] < 0} {
99                        append build_contribs ${contrib} " "
100                }
101        }
102}
103
104post-build {
105        foreach contrib ${build_contribs} {
106                system "cd ${worksrcpath}/contrib/${contrib}/ && ${build.cmd}"
107        }
108}
109
110post-destroot {
111        foreach contrib ${build_contribs} {
112                system "echo contrib: \"${contrib}\""
113                system "cd ${worksrcpath}/contrib/${contrib}/ && \
114                        ${destroot.cmd} install ${destroot.destdir} && touch DONE"
115        }
116        system "cd ${destroot}${prefix}/bin && ln -sf ${libdir}/bin/psql psql91"
117        file delete -force ${destroot}${prefix}/share/doc/postgresql \
118                ${destroot}${prefix}/share/man
119
120        reinplace -E "s#-arch\[\[:space:\]\]+\[\[:alnum:\]_\]+##g" \
121            ${destroot}${prefix}/lib/postgresql91/pgxs/src/Makefile.global
122
123        reinplace -E "s#^CFLAGS =#CFLAGS +=#g" \
124            ${destroot}${prefix}/lib/postgresql91/pgxs/src/Makefile.global
125
126        reinplace -E "s#^(\[\[:space:\]\]+)LDFLAGS =#\\1LDFLAGS +=#g" \
127            ${destroot}${prefix}/lib/postgresql91/pgxs/src/Makefile.global
128}
129
130select.group    postgresql
131select.file     ${filespath}/${name}
132
133variant python description {add support for python} {
134        depends_lib-append              port:python27
135        configure.args-append   --with-python
136        configure.python                ${prefix}/bin/python2.7
137}
138
139variant krb5 description {add support for Kerberos 5 authentication} {
140        configure.args-append   --with-krb5
141}
142
143variant perl description {add Perl support} {
144        depends_lib-append                      bin:perl:perl5
145        configure.args-append           --with-perl
146}
147
148variant tcl description {add Tcl support} {
149        depends_lib-append                      port:tcl
150        configure.args-append           --with-tcl --with-tclconfig=${prefix}/lib
151        configure.env-append            TCLSH=${prefix}/bin/tclsh
152}
153
154post-install {
155    ui_msg "\nTo use the postgresql server, install the ${name}-server port"
156}
157