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

Last change on this file since 107246 was 107246, checked in by jmr@…, 6 years ago

postfix: update to 2.10.1

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 9.7 KB
Line 
1# $Id: Portfile 107246 2013-06-24 05:37:47Z jmr@macports.org $
2
3PortSystem  1.0
4
5name            postfix
6version         2.10.1
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 b288bf24cadcf2ccf3306a395bad084ba23e3683 \
19                sha256 2e85a62e97418bbb022b4d4433098a7f25adc7dc707c37d9984db2c2f314b1c1
20
21master_sites    http://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://mirror.dejanseo.com.au/postfix-release/
28
29patchfiles      patch-sys_defs.h patch-mail_params.h patch-postfix-install \
30                patch-makedefs
31
32post-patch {
33     eval 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
41     reinplace "s|ls |/bin/ls |g" \
42          ${worksrcpath}/conf/postfix-script
43
44# Set main.cf default values
45     reinplace "s|#default_privs|default_privs|g" \
46          ${worksrcpath}/conf/main.cf
47     reinplace "s|/etc/postfix/network_table|${prefix}/etc/postfix/network_table|g" \
48          ${worksrcpath}/conf/main.cf
49     reinplace "s|/etc/postfix/relay_recipients|${prefix}/etc/postfix_relay_recipients|g" \
50          ${worksrcpath}/conf/main.cf
51     reinplace "s|/etc/postfix/header_checks|${prefix}/etc/postfix/header_checks|g" \
52          ${worksrcpath}/conf/main.cf
53     reinplace "s|PATH=/bin:/usr/bin|PATH=${prefix}/bin:/bin:/usr/bin|g" \
54          ${worksrcpath}/conf/main.cf
55}
56
57set CCARGS  [list -DNO_PCRE]
58set AUXLIBS [list "-L${prefix}/lib" "-R${prefix}/lib" "-L${prefix}/lib"]
59if {[variant_isset universal]} {
60    set CCARGS [concat ${CCARGS} ${configure.universal_cflags}]
61    set AUXLIBS [concat ${AUXLIBS} ${configure.universal_ldflags}]
62} else {
63    set CCARGS [concat ${CCARGS} ${configure.cc_archflags}]
64    set AUXLIBS [concat ${AUXLIBS} ${configure.ld_archflags}]
65}
66set pf_mail_owner "_postfix"
67set pf_setgid_group "_postdrop"
68set config_files [list main.cf master.cf access aliases canonical generic \
69                  header_checks relocated transport virtual]
70
71# Beginning with Mac OS X 10.5, the user 'postfix' changed to '_postfix'
72platform darwin 8 {
73    set pf_mail_owner "postfix"
74    set pf_setgid_group "postdrop"
75}
76
77if {${os.major} >= 10 && ${os.platform} == "darwin"} {
78    lappend AUXLIBS -lresolv
79}
80
81configure {
82    system "cd ${worksrcpath} && ${build.cmd} makefiles CC='${configure.cc}' \
83        OPT='${configure.optflags}' CCARGS='${CCARGS}' AUXLIBS='${AUXLIBS}'"
84}
85
86build.target
87
88startupitem.create      yes
89startupitem.start       "${prefix}/sbin/${name} start"
90startupitem.stop        "${prefix}/sbin/${name} stop"
91
92destroot {
93    destroot.keepdirs ${destroot}${prefix}/var/spool/postfix/public \
94        ${destroot}${prefix}/var/spool/postfix/maildrop \
95        ${destroot}${prefix}/var/lib/postfix
96    system "cd ${worksrcpath} && /bin/sh postfix-install -non-interactive \
97        install_root=${destroot} \
98        config_directory=${prefix}/etc/postfix \
99        queue_directory=${prefix}/var/spool/postfix \
100        command_directory=${prefix}/sbin \
101        daemon_directory=${prefix}/libexec/postfix \
102        data_directory=${prefix}/var/lib/postfix \
103        sendmail_path=${prefix}/sbin/sendmail \
104        newaliases_path=${prefix}/bin/newaliases \
105        mailq_path=${prefix}/bin/mailq \
106        etc_directory=${prefix}/etc/postfix \
107        share_directory=${prefix}/share/postfix \
108        manpage_directory=${prefix}/share/man \
109        sample_directory=${prefix}/share/postfix/sample \
110        readme_directory=${prefix}/share/postfix/readme \
111        mail_owner=${pf_mail_owner} \
112        setgid_group=${pf_setgid_group}"
113
114        # This makes sure we don't overwrite user cf files.
115        foreach f $config_files {
116            move ${destroot}${prefix}/etc/postfix/${f} \
117                 ${destroot}${prefix}/etc/postfix/${f}.sample
118        }
119
120        if {[geteuid] == 0} {
121            system "chown -R ${pf_mail_owner} \
122                '${destroot}${prefix}/var/spool/postfix/public' \
123                '${destroot}${prefix}/var/lib/postfix'"
124        }
125}
126
127pre-install {
128        if {[geteuid] != 0} {
129            ui_msg "Insufficient privileges to chown files; you'll need to do this manually:"
130            ui_msg "sudo chown -R ${pf_mail_owner} ${prefix}/var/spool/postfix/public ${prefix}/var/lib/postfix"
131        }
132}
133
134post-activate {
135    foreach f $config_files {
136        if {![file exists ${prefix}/etc/postfix/${f}]} {
137            copy ${prefix}/etc/postfix/${f}.sample \
138                 ${prefix}/etc/postfix/${f}
139        }
140    }
141}
142
143# Tell the user about renaming the sample configuration files.
144notes "
145To get postfix working, you need to edit the configuration files\
146(${prefix}/etc/postfix/*). You may also want to turn off Apple's built-in MTA.\
147For example:
148
149sudo launchctl unload -w /System/Library/LaunchDaemons/org.postfix.master.plist
150"
151
152variant pcre description "add pcre support" {
153    set CCARGS      [ldelete ${CCARGS} -DNO_PCRE]
154    lappend CCARGS  -DHAS_PCRE "-I${prefix}/include"
155    lappend AUXLIBS "-L${prefix}/lib" -lpcre
156    depends_lib-append  port:pcre
157}
158
159variant tls description "add tls support via openssl" {
160    depends_lib-append  port:openssl
161    lappend CCARGS  -DUSE_TLS -DHAS_SSL "-I${prefix}/include"
162    lappend AUXLIBS -lssl -lcrypto
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 ldap description "add ldap support via openldap" {
172    depends_lib-append  port:openldap
173    lappend CCARGS  -DHAS_LDAP
174    lappend AUXLIBS -lldap -llber
175}
176
177# Keep the mysql5 variant until the mysql5 port is replaced_by mysql51 port.
178variant mysql5  conflicts mysql51 mysql55 mariadb percona description "add MySQL support via mysql5" {
179    depends_lib-append path:bin/mysql_config5:mysql5
180    lappend CCARGS  -DHAS_MYSQL "-I${prefix}/include/mysql5/mysql"
181    lappend AUXLIBS "-L${prefix}/lib/mysql5/mysql" -lmysqlclient -lz -lm
182}
183
184variant mysql51 conflicts mysql5 mysql55 mariadb percona description "add MySQL support via mysql51" {
185    depends_lib-append port:mysql51
186    lappend CCARGS  -DHAS_MYSQL "-I${prefix}/include/mysql51/mysql"
187    lappend AUXLIBS "-L${prefix}/lib/mysql51/mysql" -lmysqlclient -lz -lm
188}
189
190variant mysql55 conflicts mysql5 mysql51 mariadb percona description "add MySQL support via mysql55" {
191    depends_lib-append port:mysql55
192    lappend CCARGS  -DHAS_MYSQL "-I${prefix}/include/mysql55/mysql"
193    lappend AUXLIBS "-L${prefix}/lib/mysql55/mysql" -lmysqlclient -lz -lm
194}
195
196variant mariadb conflicts mysql5 mysql51 mysql55 percona description "add MySQL support via mariadb" {
197    depends_lib-append port:mariadb
198    lappend CCARGS  -DHAS_MYSQL "-I${prefix}/include/mariadb/mysql"
199    lappend AUXLIBS "-L${prefix}/lib/mariadb/mysql" -lmysqlclient -lz -lm
200}
201
202variant percona conflicts mysql5 mysql51 mysql55 mariadb description "add MySQL support via percona" {
203    depends_lib-append port:percona
204    lappend CCARGS  -DHAS_MYSQL "-I${prefix}/include/percona/mysql"
205    lappend AUXLIBS "-L${prefix}/lib/percona/mysql" -lmysqlclient -lz -lm
206}
207
208variant postgresql83 conflicts postgresql84 postgresql90 postgresql91 postgresql92 description "add postgresql support via postgresql83" {
209    depends_lib-append port:postgresql83
210    lappend CCARGS  -DHAS_PGSQL "-I${prefix}/include/postgresql83"
211    lappend AUXLIBS "-L${prefix}/lib/postgresql83" -lpq
212}
213
214variant postgresql84 conflicts postgresql83 postgresql90 postgresql91 postgresql92 description "add postgresql support via postgresql84" {
215    depends_lib-append port:postgresql84
216    lappend CCARGS  -DHAS_PGSQL "-I${prefix}/include/postgresql84"
217    lappend AUXLIBS "-L${prefix}/lib/postgresql84" -lpq
218}
219
220variant postgresql90 conflicts postgresql83 postgresql84 postgresql91 postgresql92 description "add postgresql support via postgresql90" {
221    depends_lib-append port:postgresql90
222    lappend CCARGS  -DHAS_PGSQL "-I${prefix}/include/postgresql90"
223    lappend AUXLIBS "-L${prefix}/lib/postgresql90" -lpq
224}
225
226variant postgresql91 conflicts postgresql83 postgresql84 postgresql90 postgresql92 description "add postgresql support via postgresql91" {
227    depends_lib-append port:postgresql91
228    lappend CCARGS  -DHAS_PGSQL "-I${prefix}/include/postgresql91"
229    lappend AUXLIBS "-L${prefix}/lib/postgresql91" -lpq
230}
231
232variant postgresql92 conflicts postgresql83 postgresql84 postgresql90 postgresql91 description "add postgresql support via postgresql92" {
233    depends_lib-append port:postgresql92
234    lappend CCARGS  -DHAS_PGSQL "-I${prefix}/include/postgresql92"
235    lappend AUXLIBS "-L${prefix}/lib/postgresql92" -lpq
236}
237
238variant dovecot_sasl description "add Dovecot SASL support" {
239    lappend CCARGS  -DUSE_SASL_AUTH -DDEF_SERVER_SASL_TYPE="dovecot"
240}
241
242livecheck.type  regex
243livecheck.url   ftp://ftp.porcupine.org/mirrors/postfix-release/official/
244livecheck.regex ${name}-(\[0-9.\]+)${extract.suffix}
Note: See TracBrowser for help on using the repository browser.