source: trunk/dports/mail/sympa/Portfile @ 58230

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

rewrite mysql5 dependency so mysql5-devel can satisfy it

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 10.9 KB
Line 
1# $Id: Portfile 58230 2009-09-24 16:45:22Z ryandesign@macports.org $
2
3PortSystem      1.0
4
5name                    sympa
6version                 5.4.7
7categories              mail
8maintainers             markd
9platforms               darwin
10
11description             Sympa - Mailing List Manager with LDAP support
12
13long_description        An advanced perl-based mail list manager with a web interface \
14                        that supports LDAP authentication and LDAP extraction of \
15                        list subscribers and owners.
16
17homepage                http://www.sympa.org
18
19master_sites            http://www.sympa.org/distribution/ \
20                        http://www.sympa.org/distribution/old/
21
22checksums               md5 74fb5b0c972919a2813cd6aca2d9224f
23default_variants        +server
24
25patchfiles              patch-configure.in \
26                        patch-Makefile.in \
27                        patch-sympa.generic \
28                        patch-src_alias_manager.pl
29
30depends_lib             path:bin/mysql_config5:mysql5 \
31                        port:apache2 \
32                        port:mod_fcgid \
33                        port:openssl \
34                        port:postfix \
35                        port:p5-libwww-perl \
36                        port:p5-archive-zip \
37                        port:p5-convert-asn1 \
38                        port:p5-pathtools \
39                        port:p5-dbi \
40                        port:p5-dbd-mysql \
41                        port:p5-mailtools \
42                        port:p5-io-stringy \
43                        port:p5-mime-tools \
44                        port:p5-mime-charset \
45                        port:p5-mime-encwords \
46                        port:p5-crypt-openssl-x509 \
47                        port:p5-fcgi \
48                        port:p5-libintl-perl \
49                        port:p5-template-toolkit \
50                        port:p5-crypt-ciphersaber \
51                        port:p5-mhonarc \
52                        port:p5-regexp-common \
53                        port:p5-xml-libxml \
54                        port:p5-io-socket-ssl \
55                        port:p5-soap-lite \
56                        port:p5-perl-ldap \
57                        port:p5-html-format \
58                        port:p5-html-stripscripts-parser
59
60configure.args          --with-bindir=${prefix}/bin/${name} \
61                        --with-sbindir=${prefix}/bin/${name} \
62                        --with-libexecdir=${prefix}/libexec/${name} \
63                        --with-libdir=${prefix}/lib/${name} \
64\
65                        --with-cgidir=${prefix}/share/${name}/cgi-bin \
66                        --with-localedir=${prefix}/share/locale \
67                        --with-scriptdir=${prefix}/share/${name}/script \
68                        --with-sampledir=${prefix}/share/${name}/sample \
69                        --with-docdir=${prefix}/share/doc/${name} \
70                        --with-datadir=${prefix}/share/${name} \
71\
72                        --with-confdir=${prefix}/etc/${name} \
73                        --with-etcdir=${prefix}/etc/${name} \
74                        --with-initdir=${prefix}/share/${name} \
75\
76                        --with-expldir=${prefix}/var/${name}/expl \
77                        --with-piddir=${prefix}/var/${name} \
78                        --with-lockdir=${prefix}/var/${name}/lock \
79                        --with-spooldir=${prefix}/var/${name}/spool \
80\
81                        --with-mandir=${prefix}/man \
82                        --with-perl=${prefix}/bin/perl \
83                        --with-openssl=${prefix}/bin/openssl \
84\
85                        --with-user=www \
86                        --with-group=www \
87                        --with-sendmail_aliases=${prefix}/etc/${name}/sympa_aliases \
88                        --with-virtual_aliases=${prefix}/etc/${name}/sympa_virtual \
89                        --with-newaliases=${prefix}/bin/newaliases \
90                        --with-postmap=${prefix}/sbin/postmap
91
92variant postgresql {
93    depends_lib-append      port:p5-dbd-pg
94    depends_lib-delete      port:p5-dbd-mysql
95}
96
97variant server  {
98# This variant doesn't do anything in this port, it only exists to trigger the server
99# variant in the mysql5 port.
100}
101
102# Create a startupitem to start/stop the server
103    startupitem.create    yes
104    startupitem.start    "${prefix}/share/${name}/sympa"
105    startupitem.stop     "${prefix}/share/${name}/sympa"
106
107
108pre-destroot {
109# Use sympa.generic startup script and fix paths
110        reinplace "s|PATH=/usr/bin:/bin:/usr/sbin:/sbin|PATH=${prefix}/bin:${prefix}/sbin:/usr/bin:/bin:/usr/sbin:/sbin|g" \
111                "${worksrcpath}/src/etc/script/sympa.generic"
112
113        reinplace "s|/dist/sympa/run|${prefix}/var/${name}|g" \
114                "${worksrcpath}/src/etc/script/sympa.generic"
115
116        system "mv ${worksrcpath}/src/etc/script/sympa.generic ${worksrcpath}/src/etc/script/sympa"
117}
118
119post-destroot {
120# Flag wwsympa.fcgi as executable
121        system "chmod ug+x ${destroot}${prefix}/share/sympa/cgi-bin/wwsympa.fcgi"
122# Create empty directories named in sympa.conf & wwsympa.conf not created by Sympa install
123        xinstall -m 755 -d ${destroot}${prefix}/var/${name}/expl
124        xinstall -m 755 -d ${destroot}${prefix}/var/log/${name}
125   # Incoming spool directories
126        xinstall -m 755 -d ${destroot}${prefix}/var/${name}/spool/msg
127        xinstall -m 755 -d ${destroot}${prefix}/var/${name}/spool/bounce
128   # Storage directories
129        xinstall -m 755 -d ${destroot}${prefix}/var/${name}/arc
130        xinstall -m 755 -d ${destroot}${prefix}/var/${name}/bounce
131
132# Create sympa.log and sympa_aliases files
133        system "touch ${destroot}${prefix}/var/log/${name}/${name}.log"
134        system "touch ${destroot}${prefix}/etc/${name}/sympa_aliases"
135        system "chown www:www ${destroot}${prefix}/bin/${name}/*"
136        system "chown www:www ${destroot}${prefix}/etc/${name}/*"
137
138# Fix alias_manager.pl since the alias_wrapper seems not to work
139        reinplace "s|${prefix}/bin/${name}/aliaswrapper|${prefix}/bin/newaliases|g" \
140                "${destroot}${prefix}/bin/${name}/alias_manager.pl"
141
142# Keep these empty directories
143        destroot.keepdirs \
144                ${destroot}${prefix}/var/${name}/expl \
145                ${destroot}${prefix}/var/log/${name} \
146                ${destroot}${prefix}/var/${name}/spool/msg \
147                ${destroot}${prefix}/var/${name}/spool/bounce \
148                ${destroot}${prefix}/var/${name}/arc \
149                ${destroot}${prefix}/var/${name}/bounce
150
151# Fix permissions for arc directory
152        system "chown www:www ${destroot}${prefix}/var/${name}/arc"
153
154# Set sympa.conf variables (this file uses tabs as separators)
155        reinplace "s|#openssl   /usr/local/bin/openssl|openssl  ${prefix}/bin/openssl|g" \
156                "${destroot}${prefix}/etc/sympa/sympa.conf"
157
158        reinplace "s|#db_type   mysql|db_type   mysql|g" \
159                "${destroot}${prefix}/etc/sympa/sympa.conf"
160
161        reinplace "s|#db_name   sympa|db_name   sympa|g" \
162                "${destroot}${prefix}/etc/sympa/sympa.conf"
163
164        reinplace "s|#db_host   localhost|db_host       localhost|g" \
165                "${destroot}${prefix}/etc/sympa/sympa.conf"
166
167        reinplace "s|#db_user   sympa|db_user   sympa|g" \
168                "${destroot}${prefix}/etc/sympa/sympa.conf"
169
170        system "echo 'db_options  mysql_socket=${prefix}/var/run/mysql5/mysqld.sock' >> ${destroot}${prefix}/etc/sympa/sympa.conf"
171
172# Set wwsympa.conf variables
173        reinplace "s|${prefix}/arc|${prefix}/var/${name}/arc|g" \
174                "${destroot}${prefix}/etc/${name}/wwsympa.conf"
175
176        reinplace "s|${prefix}/bounce|${prefix}/var/${name}/bounce|g" \
177                "${destroot}${prefix}/etc/${name}/wwsympa.conf"
178
179        reinplace "s|/usr/bin/mhonarc|${prefix}/bin/mhonarc|g" \
180                "${destroot}${prefix}/etc/${name}/wwsympa.conf"
181
182        reinplace "s|#openssl   /usr/local/bin/openssl|openssl  ${prefix}/bin/openssl|g" \
183                "${destroot}${prefix}/etc/${name}/wwsympa.conf"
184}
185
186post-activate {
187
188# get rid of .turd files created by destroot.keepdirs because they cause problems in Sympa queues
189        system "rm ${prefix}/var/${name}/spool/msg/.turd_sympa"
190        system "rm ${prefix}/var/${name}/spool/bounce/.turd_sympa"
191        system "rm ${prefix}/var/${name}/bounce/.turd_sympa"
192        system "rm ${prefix}/var/${name}/arc/.turd_sympa"
193
194ui_msg "\n **** To complete Sympa installation ****
195
196You must read the documentation at ${prefix}/share/doc/${name}/index.html for full
197Sympa configuration information, however the installation steps are roughly as shown below.
198
199
2001) Setup MySQL and prepare it for Sympa (for PostgreSQL, see documentation)
201   Configure MySQL (new MySQL installs)
202        sudo -u mysql ${prefix}/lib/mysql5/bin/mysql_install_db
203
204   Start MySQL:
205        sudo ${prefix}/share/mysql5/mysql/mysql.server start
206
207   Set MySQL to start at system boot (optional)
208        sudo launchctl load -w /Library/LaunchDaemons/org.macports.mysql5.plist
209
210   Set a MySQL root password:
211        Follow the instructions that were given after you executed 'mysql_install_db' above.
212
213   Create a Sympa MySQL user ...
214        mysql5 -u root -p (login with new root password when prompted)
215        mysql> grant CREATE,INSERT,SELECT,DELETE,UPDATE on sympa.* to sympa@localhost;
216        mysql> grant CREATE,INSERT,SELECT,DELETE,UPDATE on sympa.* to sympa;
217        mysql> quit;
218
219   Create the Sympa database:
220        cat ${prefix}/share/sympa/script/create_db.mysql | mysql5 -u root -p sympa
221
222   Verify Sympa DB:
223        mysql5 -u root -p
224        mysql> use sympa;
225        mysql> show tables;
226        mysql> exit;
227
228   NOTE: MySQL must start before Apache because of wwsympa.fcgi
229
230
2312) Setup Apache 2 & FastCGI
232        cd ${prefix}/apache2/conf
233        sudo cp httpd.conf.sample httpd.conf
234
235   Modify the ${prefix}/apache2/conf/httpd.conf file
236
237   Add directives and ScriptAlias:
238        IPCCommTimeout 120
239        MaxProcessCount 2
240
241        <Location /sympa>
242          SetHandler fcgid-script
243        </Location>
244
245        ScriptAlias /sympa ${prefix}/share/sympa/cgi-bin/wwsympa.fcgi
246
247   Start Apache 2: (Turn off personal web sharing first!)
248        sudo launchctl load -w /Library/LaunchDaemons/org.macports.apache2.plist
249
250
251   NOTE: The Apache user and group must be the same as the file wwsympa.fcgi.
252         Sympa files are owned by user/group 'www' so the apache user and group
253         must be www unless you chown Sympa files to something else.
254
255
2563) Enable Postfix (not covered), setup Sympa robot aliases, & list alias config
257   Robot aliases:
258        sympa: \"| ${prefix}/bin/sympa/queue sympa@mydomain.org\"
259        listmaster: \"| ${prefix}/bin/sympa/queue listmaster@mydomain.org\"
260        bounce+*: \"| ${prefix}/bin/sympa/bouncequeue sympa@mydomain.org\"
261        sympa-request: <sympa administrator's address>
262        sympa-owner: <sympa administrator's address>
263
264   Activate the robot aliases with the command \"sudo newaliases\"
265
266   List alias config: (automatic list aliases)
267   Add these statements to /etc/postfix/main.cf
268        alias_maps = hash:/etc/aliases,hash:${prefix}/etc/${name}/sympa_aliases
269        alias_database = hash:/etc/aliases,hash:${prefix}/etc/${name}/sympa_aliases
270
271   Activate the new configuration with the command \"sudo postfix reload\"
272
273
2744) Edit ${prefix}/etc/sympa/sympa.conf variables
275        domain
276        listmaster
277        email
278        db_password
279        wwsympa_url
280
281
2825) Edit ${prefix}/etc/sympa/wwsympa.conf variables
283        title
284        default_home
285
286
2876) Add a statement to OS X's syslog.conf file to support Sympa log files
288
289        local1.*       ${prefix}/var/log/sympa/sympa.log
290
291
2927) Start the Sympa daemon
293        sudo launchctl load -w /Library/LaunchDaemons/org.macports.sympa.plist
294
295
2968) Have Sympa generate a listmaster password
297        Go to http://localhost/sympa. Click the \"First login ?\" link, then
298        enter the listmaster address you set in the sympa.conf file, and
299        click \"Send me my password\" and retrieve the password in your inbox.
300
301
3029) Login to WWSympa at http://localhost/sympa with the listmaster address
303   and then change the password and setup your lists.
304
305-------------------------------------------------
306File Locations:
307
308Executable files -> ${prefix}/bin/${name}
309CGI directory -> ${prefix}/share/${name}/cgi-bin
310Configuration files -> ${prefix}/etc/${name}
311Sample files -> ${prefix}/share/${name}/sample
312Documentation directory -> ${prefix}/share/doc/${name}
313Expl (also spool/pid/bounce/archive) directories -> ${prefix}/var/${name}
314\n"
315
316}
Note: See TracBrowser for help on using the repository browser.