Ticket #15463: Portfile

File Portfile, 6.3 KB (added by markd@…, 16 years ago)
Line 
1# $Id: Portfile 35604 2008-03-30 23:25:26Z wsiegrist@apple.com $
2
3PortSystem  1.0
4
5name            postfix
6version         2.5.2
7categories      mail
8maintainers     wms
9description     Fast and robust mail transfer agent
10long_description    Postfix attempts to be fast, easy to administer, and \
11            secure, while at the same time being \
12            sendmail-compatible enough to not upset existing \
13            users. It also offers QMQP and VERP support to let \
14            Postfix act as delivery daemon for ezmlm-idx.
15homepage        http://www.postfix.org/
16platforms       darwin
17checksums       md5 b0965aea4d548d9bd231af7143aa6942 \
18                sha1 6589c590b2e2a955bce5615bde1a86c37c572ce0
19master_sites    http://www.swissrave.ch/mirror/postfix-source/official/ \
20    ftp://ftp.its.cz/MIRRORS/ftp.porcupine.org/mirrors/postfix-release/official/ \
21    ftp://ftp.club-internet.fr/pub/mirrors/ftp.porcupine.org/postfix-release/official/
22
23patchfiles     patch-sys_defs.h patch-mail_params.h patch-postfix-install
24
25post-patch {
26     eval reinplace "s|/etc/|${prefix}/etc/|g" \
27          [glob ${worksrcpath}/man/man1/*] \
28          [glob ${worksrcpath}/man/man5/*] \
29          [glob ${worksrcpath}/man/man8/*]
30
31     reinplace "s|__PREFIX|${prefix}|g" ${worksrcpath}/src/util/sys_defs.h
32     reinplace "s|__PREFIX|${prefix}|g" ${worksrcpath}/src/global/mail_params.h
33
34     reinplace "s|#default_privs|default_privs|g" \
35          ${worksrcpath}/conf/main.cf
36     reinplace "s|/etc/postfix/network_table|${prefix}/etc/postfix/network_table|g" \
37          ${worksrcpath}/conf/main.cf
38     reinplace "s|/etc/postfix/relay_recipients|${prefix}/etc/postfix_relay_recipients|g" \
39          ${worksrcpath}/conf/main.cf
40     reinplace "s|/etc/postfix/header_checks|${prefix}/etc/postfix/header_checks|g" \
41          ${worksrcpath}/conf/main.cf
42     reinplace "s|/bin:/usr/bin|${prefix}/bin:/bin:/usr/bin|g" \
43          ${worksrcpath}/conf/main.cf
44}
45
46set CCARGS  -DNO_PCRE
47set AUXLIBS "-L${prefix}/lib -R${prefix}/lib -L${prefix}/lib"
48set pf_mail_owner "postfix"
49set pf_setgid_group "postdrop"
50
51# Beginning with Mac OS X 10.5, the user 'postfix' changed to '_postfix'
52platform darwin 9 {
53    global pf_mail_owner
54    global pf_setgid_group
55    set pf_mail_owner "_postfix"
56    set pf_setgid_group "_postdrop"
57}
58
59configure {
60    system "make makefiles CCARGS=\"${CCARGS}\" AUXLIBS=\"${AUXLIBS}\""
61}
62
63build.target
64
65startupitem.create      yes
66startupitem.start       "${prefix}/sbin/${name} start"
67startupitem.stop        "${prefix}/sbin/${name} stop"
68
69destroot {
70#    adduser postfix realname=Postfix\ Server
71#    addgroup postdrop
72#    file mkdir ${destroot}${prefix}/etc/postfix
73#    file mkdir ${destroot}${prefix}/share/postfix
74#    xinstall -d -o postfix -g postdrop -m \
75#        710 ${destroot}${prefix}/var/spool/postfix/public
76#    xinstall -d -o postfix -g postdrop -m 730 \
77#        ${destroot}${prefix}/var/spool/postfix/maildrop
78    destroot.keepdirs ${destroot}${prefix}/var/spool/postfix/public \
79        ${destroot}${prefix}/var/spool/postfix/maildrop \
80        ${destroot}${prefix}/var/lib/postfix
81    system "cd ${worksrcpath} && /bin/sh postfix-install -non-interactive \
82        install_root=${destroot} \
83        config_directory=${prefix}/etc/postfix \
84        queue_directory=${prefix}/var/spool/postfix \
85        command_directory=${prefix}/sbin \
86        daemon_directory=${prefix}/libexec/postfix \
87        data_directory=${prefix}/var/lib/postfix \
88        sendmail_path=${prefix}/sbin/sendmail \
89        newaliases_path=${prefix}/bin/newaliases \
90        mailq_path=${prefix}/bin/mailq \
91        etc_directory=${prefix}/etc/postfix \
92        share_directory=${prefix}/share/postfix \
93        manpage_directory=${prefix}/share/man \
94        sample_directory=${prefix}/share/postfix/sample \
95        readme_directory=${prefix}/share/postfix/readme \
96        mail_owner=${pf_mail_owner} \
97        setgid_group=${pf_setgid_group}"
98
99# This makes sure we don't overwrite user /etc files. This now breaks postfix
100# "just working" on fresh installs.
101# YOU MUST MOVE THE SAMPLE FILES TO THE CORRECT NAMESPACE.
102# XXX unsure if this still an issue 07/07/05 yeled@
103
104        file rename ${destroot}${prefix}/etc/postfix/main.cf \
105            ${destroot}${prefix}/etc/postfix/main.cf.sample
106        file rename ${destroot}${prefix}/etc/postfix/master.cf \
107            ${destroot}${prefix}/etc/postfix/master.cf.sample
108        file rename ${destroot}${prefix}/etc/postfix/aliases \
109            ${destroot}${prefix}/etc/postfix/aliases.sample
110}
111
112post-install {
113    # Tell the user about renaming the sample configuration files.
114ui_msg "\n
115To get postfix working, you need to copy the sample configuration
116files and edit them (${prefix}/etc/postfix/*.sample).  You may also
117want to turn off Apple's built-in MTA.  For example, on 10.4:
118
119-Delete or rename /System/Library/LaunchDaemons/org.postfix.master.plist
120-Replace the built-in sendmail file with a symlink to MacPorts' own:
121        sudo mv /usr/sbin/sendmail /usr/sbin/sendmail.org
122        ln -s ${prefix}/sbin/sendmail /usr/sbin/sendmail
123
124NOTE: Apple OS updates could upgrade the built-in Postfix and overwrite the
125      symlink, so the symlink mught have to be recreated.
126\n"
127}
128
129variant pcre description "add pcre support" {
130    set CCARGS      [ldelete ${CCARGS} -DNO_PCRE]
131    set CCARGS      [concat  ${CCARGS} -DHAS_PCRE -I${prefix}/include]
132    set AUXLIBS     [concat ${AUXLIBS} -L${prefix}/lib -lpcre]
133    depends_lib-append  port:pcre
134}
135
136variant tls description "add tls supporti via openssl" {
137    depends_lib-append  port:openssl
138    set CCARGS      [concat ${CCARGS} -DUSE_TLS -DHAS_SSL -I${prefix}/include]
139    set AUXLIBS     [concat ${AUXLIBS} -lssl -lcrypto]
140}
141
142variant sasl description "add sasl support via cyrus-sasl2" {
143    depends_lib-append  port:cyrus-sasl2
144    set CCARGS      [concat ${CCARGS} -DUSE_CYRUS_SASL -DUSE_SASL_AUTH -I${prefix}/include/sasl]
145    set AUXLIBS     [concat ${AUXLIBS} -lsasl2]
146}
147
148variant ldap description "add ldap support via openldap" {
149    depends_lib-append  port:openldap
150    set CCARGS      [concat ${CCARGS} -DHAS_LDAP]
151    set AUXLIBS     [concat ${AUXLIBS} -lldap -llber]
152}
153
154variant mysql5  description "add mysql support via mysql5" {
155    depends_lib-append port:mysql5
156    set CCARGS      [concat ${CCARGS} -DHAS_MYSQL -I${prefix}/include/mysql5/mysql]
157    set AUXLIBS     [concat ${AUXLIBS} -L${prefix}/lib/mysql5/mysql -lmysqlclient -lz -lm]
158}