source: trunk/dports/mail/postfix/Portfile @ 135232

Last change on this file since 135232 was 135232, checked in by ryandesign@…, 5 years ago

icu: update to 55.1

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 10.2 KB
Line 
1# $Id: Portfile 135232 2015-04-20 00:15:39Z ryandesign@macports.org $
2
3PortSystem  1.0
4
5name            postfix
6version         3.0.1
7revision        1
8categories      mail
9license         IBMPL-1
10maintainers     jmr openmaintainer
11description     Fast and robust mail transfer agent
12long_description    Postfix attempts to be fast, easy to administer, and \
13            secure, while at the same time being \
14            sendmail-compatible enough to not upset existing \
15            users. It also offers QMQP and VERP support to let \
16            Postfix act as delivery daemon for ezmlm-idx.
17homepage        http://www.postfix.org/
18platforms       darwin
19checksums       rmd160 e29196be6255f884fd2606d8d4c32e84dea1666c \
20                sha256 cd2bd6447fe3368bb1a39f482f8dd1eec87c63067a0eb75f9aec8e4eadd21328
21
22master_sites    http://archive.mgm51.com/mirrors/postfix-source/official/ \
23                http://de.postfix.org/ftpmirror/official/ \
24                ftp://ftp.its.cz/MIRRORS/ftp.porcupine.org/mirrors/postfix-release/official/ \
25                ftp://ftp.cuhk.edu.hk/pub/packages/mail-server/postfix/official/ \
26                http://mirror.postfix.jp/postfix-release/official/ \
27                http://postfix.bbnx.net/source/official/ \
28                http://cdn.postfix.johnriley.me/mirrors/postfix-release/official/
29
30patchfiles      patch-sys_defs.h patch-mail_params.h patch-postfix-install \
31                patch-makedefs patch-postfix-script
32
33post-patch {
34     reinplace "s|/etc/|${prefix}/etc/|g" \
35          {*}[glob ${worksrcpath}/man/man1/*] \
36          {*}[glob ${worksrcpath}/man/man5/*] \
37          {*}[glob ${worksrcpath}/man/man8/*]
38
39     reinplace "s|__PREFIX|${prefix}|g" ${worksrcpath}/src/util/sys_defs.h \
40                                        ${worksrcpath}/src/global/mail_params.h \
41                                        ${worksrcpath}/makedefs
42
43# Set main.cf default values
44     reinplace "s|#default_privs|default_privs|g" \
45          ${worksrcpath}/conf/main.cf
46     reinplace "s|/etc/postfix/network_table|${prefix}/etc/postfix/network_table|g" \
47          ${worksrcpath}/conf/main.cf
48     reinplace "s|/etc/postfix/relay_recipients|${prefix}/etc/postfix_relay_recipients|g" \
49          ${worksrcpath}/conf/main.cf
50     reinplace "s|/etc/postfix/header_checks|${prefix}/etc/postfix/header_checks|g" \
51          ${worksrcpath}/conf/main.cf
52     reinplace "s|PATH=/bin:/usr/bin|PATH=${prefix}/bin:/bin:/usr/bin|g" \
53          ${worksrcpath}/conf/main.cf
54}
55
56set CCARGS  [list -DNO_EAI -DNO_PCRE]
57set AUXLIBS [list -L${prefix}/lib]
58if {[variant_isset universal]} {
59    set CCARGS [concat ${CCARGS} ${configure.universal_cflags}]
60    set AUXLIBS [concat ${AUXLIBS} ${configure.universal_ldflags}]
61} else {
62    set CCARGS [concat ${CCARGS} ${configure.cc_archflags}]
63    set AUXLIBS [concat ${AUXLIBS} ${configure.ld_archflags}]
64}
65set pf_mail_owner _postfix
66set pf_setgid_group _postdrop
67set config_files [list main.cf master.cf access aliases canonical generic \
68                  header_checks relocated transport virtual]
69
70# Beginning with Mac OS X 10.5, the user 'postfix' changed to '_postfix'
71platform darwin 8 {
72    set pf_mail_owner postfix
73    set pf_setgid_group postdrop
74}
75
76configure {
77    system -W ${worksrcpath} "${build.cmd} makefiles CC='${configure.cc}' \
78        OPT='${configure.optflags}' CCARGS='${CCARGS}' AUXLIBS='${AUXLIBS}'"
79}
80
81build.target
82
83startupitem.create      yes
84startupitem.start       "${prefix}/sbin/${name} start"
85startupitem.stop        "${prefix}/sbin/${name} stop"
86
87destroot {
88    destroot.keepdirs ${destroot}${prefix}/var/spool/postfix/public \
89        ${destroot}${prefix}/var/spool/postfix/maildrop \
90        ${destroot}${prefix}/var/lib/postfix
91    system -W ${worksrcpath} "/bin/sh postfix-install -non-interactive \
92        install_root=${destroot} \
93        config_directory=${prefix}/etc/postfix \
94        queue_directory=${prefix}/var/spool/postfix \
95        command_directory=${prefix}/sbin \
96        daemon_directory=${prefix}/libexec/postfix \
97        data_directory=${prefix}/var/lib/postfix \
98        sendmail_path=${prefix}/sbin/sendmail \
99        newaliases_path=${prefix}/bin/newaliases \
100        mailq_path=${prefix}/bin/mailq \
101        etc_directory=${prefix}/etc/postfix \
102        share_directory=${prefix}/share/postfix \
103        shlib_directory=${prefix}/lib/postfix \
104        manpage_directory=${prefix}/share/man \
105        sample_directory=${prefix}/share/postfix/sample \
106        readme_directory=${prefix}/share/postfix/readme \
107        mail_owner=${pf_mail_owner} \
108        setgid_group=${pf_setgid_group}"
109
110        # This makes sure we don't overwrite user cf files.
111        foreach f $config_files {
112            move ${destroot}${prefix}/etc/postfix/${f} \
113                 ${destroot}${prefix}/etc/postfix/${f}.sample
114        }
115
116        if {[geteuid] == 0} {
117            system "chown -R ${pf_mail_owner} \
118                '${destroot}${prefix}/var/spool/postfix/public' \
119                '${destroot}${prefix}/var/lib/postfix'"
120        }
121}
122
123pre-install {
124        if {[geteuid] != 0} {
125            ui_msg "Insufficient privileges to chown files; you'll need to do this manually:"
126            ui_msg "sudo chown -R ${pf_mail_owner} ${prefix}/var/spool/postfix/public ${prefix}/var/lib/postfix"
127        }
128}
129
130post-activate {
131    foreach f $config_files {
132        if {![file exists ${prefix}/etc/postfix/${f}]} {
133            copy ${prefix}/etc/postfix/${f}.sample \
134                 ${prefix}/etc/postfix/${f}
135        }
136    }
137}
138
139# Tell the user about renaming the sample configuration files.
140notes "
141To get postfix working, you need to edit the configuration files\
142(${prefix}/etc/postfix/*). You may also want to turn off Apple's built-in MTA.\
143For example:
144
145sudo launchctl unload -w /System/Library/LaunchDaemons/org.postfix.master.plist
146"
147
148variant dovecot_sasl description "add Dovecot SASL support" {
149    lappend CCARGS  -DUSE_SASL_AUTH -DDEF_SERVER_SASL_TYPE="dovecot"
150}
151
152variant ldap description "add ldap support via openldap" {
153    depends_lib-append  port:openldap
154    lappend CCARGS  -DHAS_LDAP
155    lappend AUXLIBS -lldap -llber
156}
157
158variant pcre description "add pcre support" {
159    set CCARGS      [ldelete ${CCARGS} -DNO_PCRE]
160    lappend CCARGS  -DHAS_PCRE -I${prefix}/include
161    lappend AUXLIBS -lpcre
162    depends_lib-append  port:pcre
163}
164
165variant sasl description "add sasl support via cyrus-sasl2" {
166    depends_lib-append  port:cyrus-sasl2
167    lappend CCARGS  -DUSE_CYRUS_SASL -DUSE_SASL_AUTH -I${prefix}/include/sasl
168    lappend AUXLIBS -lsasl2
169}
170
171variant smtputf8 description "add support for UTF-8 email addresses and headers (EAI) via icu" {
172    depends_lib-append port:icu
173    set CCARGS      [ldelete ${CCARGS} -DNO_EAI]
174    lappend CCARGS  -I${prefix}/include
175}
176
177variant tls description "add tls support via openssl" {
178    depends_lib-append  port:openssl
179    lappend CCARGS  -DUSE_TLS -DHAS_SSL -I${prefix}/include
180    lappend AUXLIBS -lssl -lcrypto
181}
182
183# Keep the mysql5 variant until the mysql5 port is replaced_by mysql51 port.
184variant mysql5  conflicts mysql51 mysql55 mysql56 mariadb percona description "add MySQL support via mysql5" {
185    depends_lib-append path:bin/mysql_config5:mysql5
186    lappend CCARGS  -DHAS_MYSQL -I${prefix}/include/mysql5/mysql
187    lappend AUXLIBS -L${prefix}/lib/mysql5/mysql -lmysqlclient -lz -lm
188}
189
190variant mysql51 conflicts mysql5 mysql55 mysql56 mariadb percona description "add MySQL support via mysql51" {
191    depends_lib-append port:mysql51
192    lappend CCARGS  -DHAS_MYSQL -I${prefix}/include/mysql51/mysql
193    lappend AUXLIBS -L${prefix}/lib/mysql51/mysql -lmysqlclient -lz -lm
194}
195
196variant mysql55 conflicts mysql5 mysql51 mysql56 mariadb percona description "add MySQL support via mysql55" {
197    depends_lib-append port:mysql55
198    lappend CCARGS  -DHAS_MYSQL -I${prefix}/include/mysql55/mysql
199    lappend AUXLIBS -L${prefix}/lib/mysql55/mysql -lmysqlclient -lz -lm
200}
201
202variant mysql56 conflicts mysql5 mysql51 mysql55 mariadb percona description "add MySQL support via mysql56" {
203    depends_lib-append port:mysql56
204    lappend CCARGS  -DHAS_MYSQL -I${prefix}/include/mysql56/mysql
205    lappend AUXLIBS -L${prefix}/lib/mysql56/mysql -lmysqlclient -lz -lm
206}
207
208variant mariadb conflicts mysql5 mysql51 mysql55 mysql56 percona description "add MySQL support via mariadb" {
209    depends_lib-append port:mariadb
210    lappend CCARGS  -DHAS_MYSQL -I${prefix}/include/mariadb/mysql
211    lappend AUXLIBS -L${prefix}/lib/mariadb/mysql -lmysqlclient -lz -lm
212}
213
214variant percona conflicts mysql5 mysql51 mysql55 mysql56 mariadb description "add MySQL support via percona" {
215    depends_lib-append port:percona
216    lappend CCARGS  -DHAS_MYSQL -I${prefix}/include/percona/mysql
217    lappend AUXLIBS -L${prefix}/lib/percona/mysql -lmysqlclient -lz -lm
218}
219
220variant postgresql83 conflicts postgresql84 postgresql90 postgresql91 postgresql92 description "add postgresql support via postgresql83" {
221    depends_lib-append port:postgresql83
222    lappend CCARGS  -DHAS_PGSQL -I${prefix}/include/postgresql83
223    lappend AUXLIBS -L${prefix}/lib/postgresql83 -lpq
224}
225
226variant postgresql84 conflicts postgresql83 postgresql90 postgresql91 postgresql92 description "add postgresql support via postgresql84" {
227    depends_lib-append port:postgresql84
228    lappend CCARGS  -DHAS_PGSQL -I${prefix}/include/postgresql84
229    lappend AUXLIBS -L${prefix}/lib/postgresql84 -lpq
230}
231
232variant postgresql90 conflicts postgresql83 postgresql84 postgresql91 postgresql92 description "add postgresql support via postgresql90" {
233    depends_lib-append port:postgresql90
234    lappend CCARGS  -DHAS_PGSQL -I${prefix}/include/postgresql90
235    lappend AUXLIBS -L${prefix}/lib/postgresql90 -lpq
236}
237
238variant postgresql91 conflicts postgresql83 postgresql84 postgresql90 postgresql92 description "add postgresql support via postgresql91" {
239    depends_lib-append port:postgresql91
240    lappend CCARGS  -DHAS_PGSQL -I${prefix}/include/postgresql91
241    lappend AUXLIBS -L${prefix}/lib/postgresql91 -lpq
242}
243
244variant postgresql92 conflicts postgresql83 postgresql84 postgresql90 postgresql91 description "add postgresql support via postgresql92" {
245    depends_lib-append port:postgresql92
246    lappend CCARGS  -DHAS_PGSQL -I${prefix}/include/postgresql92
247    lappend AUXLIBS -L${prefix}/lib/postgresql92 -lpq
248}
249
250livecheck.type  regex
251livecheck.url   ftp://ftp.porcupine.org/mirrors/postfix-release/official/
252livecheck.regex ${name}-(\[0-9.\]+)${extract.suffix}
Note: See TracBrowser for help on using the repository browser.