Ticket #18218: Portfile

File Portfile, 8.2 KB (added by compconsultant@…, 16 years ago)
Line 
1# $Id$
2
3PortSystem      1.0
4
5name                            qmail-spamcontrol
6version                         2.5.19
7revision                        0
8categories                      mail
9maintainers                     yahoo.com:compconsultant
10platforms                       darwin
11
12description                     Qmail, enhanced Spamcontrol version
13
14long_description                Robust, popular mail system.
15
16extract.mkdir                   yes
17
18universal_variant               no
19
20variant relaymailfrom description {Relay based on sender email, not a good idea} {}
21variant noreqbrackets description {Do not require brackets in SMTP addresses} {}
22variant noverp description {Do not alow VERP addresses for recipients} {}
23variant moreipme description {Patch to account for certain NAT or load balance situations} {}
24variant bigtodo description {May make very large installations more efficient} {}
25
26homepage                        http://www.fehcom.de/qmail/spamcontrol.html
27
28master_sites                    http://www.fehcom.de/qmail/spamcontrol/:spamcontrol \
29                                http://cr.yp.to/software/:qmail \
30                                http://qmail.site2nd.org/:qmail \
31                                http://qmail-mirror.jms1.net/:qmail \
32                                http://www.qmail.org/:qmail \
33
34distfiles                       qmail-1.03.tar.gz:qmail \
35                                spamcontrol-2519_tgz.bin:spamcontrol \
36
37checksums                       qmail-1.03.tar.gz \
38                                        md5 622f65f982e380dbe86e6574f3abcb7c \
39                                        sha1 18fb960481291a0503e93a94df3f6094edb7f27a \
40                                        rmd160 b851f273f1d365d38efd949b1efcf35768ffa30f \
41                                spamcontrol-2519_tgz.bin \
42                                        md5 acca46cc48d8b5cfa9eb3de4d3fc90ad \
43                                        sha1 b259183cb9afd7a574ad598cb2399af5002226ec \
44                                        rmd160 8374835ade0656145ba15eded23c6f8ce0a1b936 \
45
46worksrcdir              qmail-1.03
47
48patchfiles              patch-dns.c.diff \
49                        patch-strerr_sys.c.diff \
50                        patch-qmail-lspawn.c.diff \
51                        patch-qmail-rspawn.c.diff \
52                        patch-qmail.c.diff \
53                        patch-Makefile.diff
54
55configure.cflags        -O2 -include /usr/include/errno.h -c
56build.target            setup-patch
57destroot.cmd            ./install-destroot
58
59pre-fetch {
60        if {${os.platform} == "darwin" && ${os.major} == "6"} {
61                return -code error "${name} requires Mac OS X 10.3 or newer."
62        }
63}
64
65post-extract {
66
67        # Merge Spamcontrol source with Qmail source
68        foreach file [glob ${worksrcpath}/qmail-1.03/*] {
69                file rename ${file} ${worksrcpath}/
70        }
71        file delete ${worksrcpath}/qmail-1.03
72
73        # Create an install file to install into destroot since
74        # destroot is not supported by qmail
75        file copy ${worksrcpath}/conf-qmail ${worksrcpath}/conf-destroot
76        reinplace "s|/var/qmail|${destroot}${prefix}/var/qmail|g" \
77                ${worksrcpath}/conf-destroot
78        file copy ${worksrcpath}/install.c ${worksrcpath}/install-destroot.c
79
80        # Change live install dir to reflect the prefix
81        reinplace "s|/var/qmail|${prefix}/var/qmail|g" \
82                ${worksrcpath}/conf-qmail
83}
84
85pre-patch {
86                # Apply Spamcontrol patches
87                foreach file [glob ${worksrcpath}/*.patch] {
88                        system "patch -d ${worksrcpath} -p2 <${file}"
89                }
90}
91
92post-patch {
93
94                # Handle the variants, disable via source code define change
95                foreach file [glob ${worksrcpath}/*c] {
96                        if {![variant_isset relaymailfrom]} {
97                                reinplace "s|^#define RELAYMAILFROM|\/* #define RELAYMAILFROM *\/|g" \
98                                        ${file}
99                        }
100                        if {[variant_isset noreqbrackets]} {
101                                reinplace "s|^#define REQBRACKETS|\/* #define REQBRACKETS *\/|g" \
102                                        ${file}
103                        }
104                        if {[variant_isset noverp]} {
105                                reinplace "s|^#define VERP|\/* #define VERP *\/|g" \
106                                        ${file}
107                        }
108                        if {![variant_isset moreipme]} {
109                                reinplace "s|^#define MOREIPME|\/* #define MOREIPME *\/|g" \
110                                        ${file}
111                        }
112                        if {![variant_isset bigtodo]} {
113                                reinplace "s|^#define BIGTODO|\/* #define BIGTODO *\/|g" \
114                                        ${file}
115                        }
116                }
117}
118
119configure {
120
121        # The qmail users and groups are required before compilation
122        addgroup qmail gid=2107
123        addgroup nofiles gid=2108
124        adduser alias uid=7790 gid=[existsgroup nofiles] realname=Qmail-alias-user home=${prefix}/var/qmail shell=/usr/bin/true
125        adduser qmaild uid=7791 gid=[existsgroup nofiles] realname=Qmail-SMTP-user home=${prefix}/var/qmail shell=/usr/bin/true
126        adduser qmaill uid=7792 gid=[existsgroup nofiles] realname=Qmail-log-user home=${prefix}/var/qmail shell=/usr/bin/true
127        adduser qmailp uid=7793 gid=[existsgroup nofiles] realname=Qmail-password-user home=${prefix}/var/qmail shell=/usr/bin/true
128        adduser qmailq uid=7794 gid=[existsgroup qmail] realname=Qmail-queue-user home=${prefix}/var/qmail shell=/usr/bin/true
129        adduser qmailr uid=7795 gid=[existsgroup qmail] realname=Qmail-remote-user home=${prefix}/var/qmail shell=/usr/bin/true
130        adduser qmails uid=7796 gid=[existsgroup qmail] realname=Qmail-send-user home=${prefix}/var/qmail shell=/usr/bin/true
131}
132
133pre-destroot {
134        # A whole lot of keepdirs, Qmail creates lots of required, empty directories
135        destroot.keepdirs \
136                ${destroot}${prefix}/var/log/qmail/smtpd \
137                ${destroot}${prefix}/var/qmail/control \
138                ${destroot}${prefix}/var/qmail/users \
139                ${destroot}${prefix}/var/qmail/queue/pid \
140                ${destroot}${prefix}/var/qmail/queue/bounce
141        if {![variant_isset bigtodo]} {
142                destroot.keepdirs-append \
143                        ${destroot}${prefix}/var/qmail/queue/todo \
144                        ${destroot}${prefix}/var/qmail/queue/intd
145        }
146       
147        for {set i 0} {$i <= 22} {incr i} {
148                destroot.keepdirs-append \
149                        ${destroot}${prefix}/var/qmail/queue/info/${i} \
150                        ${destroot}${prefix}/var/qmail/queue/remote/${i} \
151                        ${destroot}${prefix}/var/qmail/queue/local/${i} \
152                        ${destroot}${prefix}/var/qmail/queue/mess/${i}
153                if {[variant_isset bigtodo]} {
154                        destroot.keepdirs-append \
155                                ${destroot}${prefix}/var/qmail/queue/todo/${i} \
156                                ${destroot}${prefix}/var/qmail/queue/intd/${i}
157                }
158        }
159}
160
161post-destroot {
162        # Minimal requirements per Qmail install doc
163        touch ${destroot}${prefix}/var/qmail/alias/.qmail-postmaster
164        touch ${destroot}${prefix}/var/qmail/alias/.qmail-mailer-daemon
165        touch ${destroot}${prefix}/var/qmail/alias/.qmail-root
166
167        # Create the log directories
168        xinstall -d -o qmaill ${destroot}${prefix}/var/log/qmail/smtpd
169
170        # Copy example files
171        xinstall -d ${destroot}${prefix}/var/qmail/samples
172        xinstall -m 644 -W ${filespath} README.txt ${destroot}${prefix}/var/qmail/samples
173        foreach file {run qmailctl qmail-send-run qmail-send-log-run qmail-smtpd-run qmail-smtpd-log-run} {
174                xinstall -W ${filespath} ${file}.in ${destroot}${prefix}/var/qmail/samples/${file}
175                reinplace "s%@PREFIX@%${prefix}%g" ${destroot}${prefix}/var/qmail/samples/${file}
176        }
177       
178        # Additional Spamcontrol files
179        xinstall -d ${destroot}${prefix}/var/qmail/scripts
180        foreach file {qmail-alias2recipients qmail-users2recipients qmail-pwd2recipients qmail-vpopmail2recipients} {
181                xinstall -W ${worksrcpath} ${file} ${destroot}${prefix}/var/qmail/scripts
182        }
183        foreach file {conf-spamcontrol ucspi-ssl-0.70_ucspitls-0.4.patch_ clamav-0.90.1_output.patch_ Makefile.djbdns badmailfrom badmimetypes badloadertypes badrcptto INSTALL.spamcontrol HISTORY.spamcontrol FILES.spamcontrol LICENSE.spamcontrol TODO.spamcontrol LOGGING.spamcontrol SMTPREPLY.spamcontrol PROPOSAL.mav install_spamcontrol.sh} {
184                xinstall -m 644 -W ${worksrcpath} ${file} ${destroot}${prefix}/var/qmail/doc
185        }
186        foreach file [glob -directory ${worksrcpath} README* RELEASE*] {
187                xinstall -m 644 ${file} ${destroot}${prefix}/var/qmail/doc
188        }
189
190        # User must run this
191        xinstall -W ${worksrcpath} config-fast ${destroot}${prefix}/var/qmail/scripts/config-fast
192
193        # Per Qmail install doc
194        xinstall ${destroot}${prefix}/var/qmail/boot/home ${destroot}${prefix}/var/qmail/rc.sample
195}
196
197post-install {
198ui_msg "\n
199To control qmail, the daemontools and ucspi-tcp ports are highly recommended.
200A good reference for setting up qmail is http://www.lifewithqmail.org/ .
201This port includes some sample files based on the Life with Qmail web site.
202They can be found in ${prefix}/var/qmail/samples .
203Also look at http://www.fehcom.de/qmail/spamcontrol.html for further info.
204The fehcom site has docs for all the stuff added to the base qmail software.
205There are numerous configuration options to qmail. Please read all the docs!
206******************************
207NEW INSTALLS ONLY
208For now, you must run ${prefix}/var/qmail/scripts/config-fast your.domain.name
209to set up some files for your mail server. your.domain.name should point
210to this machine you are installing qmail on.
211******************************
212\n"
213}
214
215post-activate {
216
217        # Remove the turd files, it is not know if they cause a problem but
218        # people have recommended not having them there.
219        system "cd ${prefix}/var/qmail; find . -name .turd_${name} -delete"
220}
221
222livecheck.check                 regex
223livecheck.regex                 {SPAMCONTROL\sVersion\s([0-9.]+)}