source: trunk/dports/mail/postfix/Portfile

Last change on this file was 153481, checked in by jmr@…, 14 months ago

postfix: update to 3.1.3

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