Ticket #22977: Portfile-postgresql92

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

PostgreSQL 9.2 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: $
3
4PortSystem 1.0
5PortGroup select 1.0
6
7name                    postgresql92
8version                 9.2.0
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  a51aa3067b0c3fef27a2faaee5ad97fcfc1ffb9d \
27                    sha256  3731c607df492bbb57f37917b49f57719c0d6f823720426431fff10d82b1fe33
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\\.2\\.\[.0-9\]+)
85#livecheck.url  ${homepage}/developer/beta
86#livecheck.url  ${homepage}/ftp/source/
87#livecheck.regex        (9\\.2\[.0-9\]+\[a-z\]+\[0-9\])
88
89platform darwin 12 {
90    patchfiles-append   postgresql-uuid-ossp.patch
91}
92
93set contrib_blacklist "sepgsql start-scripts"
94set build_contribs ""
95
96post-extract {
97        global contrib_blacklist
98        set contribs [glob -tails -type d -directory ${worksrcpath}/contrib/ *]
99
100        foreach contrib ${contribs} {
101                if {[lsearch ${contrib_blacklist} ${contrib}] < 0} {
102                        append build_contribs ${contrib} " "
103                }
104        }
105}
106
107post-build {
108        foreach contrib ${build_contribs} {
109                system "cd ${worksrcpath}/contrib/${contrib}/ && ${build.cmd}"
110        }
111}
112
113post-destroot {
114        foreach contrib ${build_contribs} {
115                system "echo contrib: \"${contrib}\""
116                system "cd ${worksrcpath}/contrib/${contrib}/ && \
117                        ${destroot.cmd} install ${destroot.destdir} && touch DONE"
118        }
119        system "cd ${destroot}${prefix}/bin && ln -sf ${libdir}/bin/psql psql92"
120        file delete -force ${destroot}${prefix}/share/doc/postgresql \
121                ${destroot}${prefix}/share/man
122
123        reinplace -E "s#-arch\[\[:space:\]\]+\[\[:alnum:\]_\]+##g" \
124            ${destroot}${prefix}/lib/postgresql92/pgxs/src/Makefile.global
125
126        reinplace -E "s#^CFLAGS =#CFLAGS +=#g" \
127            ${destroot}${prefix}/lib/postgresql92/pgxs/src/Makefile.global
128
129        reinplace -E "s#^(\[\[:space:\]\]+)LDFLAGS =#\\1LDFLAGS +=#g" \
130            ${destroot}${prefix}/lib/postgresql92/pgxs/src/Makefile.global
131}
132
133select.group    postgresql
134select.file     ${filespath}/${name}
135
136variant python description {add support for python} {
137        depends_lib-append              port:python27
138        configure.args-append   --with-python
139        configure.python                ${prefix}/bin/python2.7
140}
141
142variant krb5 description {add support for Kerberos 5 authentication} {
143        configure.args-append   --with-krb5
144}
145
146variant perl description {add Perl support} {
147        depends_lib-append                      bin:perl:perl5
148        configure.args-append           --with-perl
149}
150
151variant tcl description {add Tcl support} {
152        depends_lib-append                      port:tcl
153        configure.args-append           --with-tcl --with-tclconfig=${prefix}/lib
154        configure.env-append            TCLSH=${prefix}/bin/tclsh
155}
156
157post-install {
158    ui_msg "\nTo use the postgresql server, install the ${name}-server port"
159}
160