Ticket #29825: Portfile.2

File Portfile.2, 3.7 KB (added by BjarneDMat, 13 years ago)

BjarneDM suggestion for a Portfile

Line 
1# -*- coding: utf-8; mode: tcl; tab-width: 4; truncate-lines: t; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:et:sw=4:ts=4:sts=4
2# $Id$
3
4PortSystem          1.0
5name                mod_security2
6version             2.6.0
7categories          www security
8platforms           darwin
9maintainers         mathiesen.info:macintosh pixilla
10description         Apache 2 intrusion detection and prevention engine for web applications
11long_description    ModSecurity is an open source intrusion detection and \
12                    prevention engine for web applications. It operates \
13                    embedded into the web server, acting as a powerful \
14                    umbrella - shielding applications from attacks.
15homepage            http://www.modsecurity.org
16master_sites        sourceforge:mod-security
17distname            modsecurity-apache_${version}
18worksrcdir          ${distname}
19
20set apachever       apache2
21set confFile        ${prefix}/${apachever}/conf/extra/httpd-modsecurity2.conf
22
23checksums           sha1    280061a6cb49c955d7371b9526193f68a12ae2ac \
24                    rmd160  a9d34e17d80007f394087da5bd92c6047f48d343
25
26depends_build       port:libxml2 \
27                    port:pcre \
28                    port:curl \
29                    port:apr \
30                    port:apr-util \
31                    port:lua
32depends_lib         port:${apachever}
33
34configure.args      --with-apxs=${prefix}/${apachever}/bin/apxs \
35                    --with-pcre=${prefix}/bin/pcre-config \
36                    --with-apr=${prefix}/bin/apr-1-config \
37                    --with-apu=${prefix}/bin/apu-1-config \
38                    --with-curl=${prefix}/bin/curl-config \
39                    --with-libxml=${prefix} \
40                    --with-lua=${prefix}
41
42destroot.violate_mtree yes
43
44post-destroot {
45    xinstall -d -m 755  ${destroot}${prefix}/${apachever}/modules
46    xinstall -m 644 -W  ${worksrcpath}/apache2/.libs mod_security2.so \
47                        ${destroot}${prefix}/${apachever}/modules
48    xinstall -m 755 -W  ${worksrcpath}/mlogc mlogc mlogc-batch-load.pl \
49                        ${destroot}${prefix}/bin
50    xinstall -m 755 -W  ${worksrcpath}/tools rules-updater.pl \
51                        ${destroot}${prefix}/bin
52    xinstall -m 755 -W  ${worksrcpath}/mlogc mlogc-default.conf \
53                        ${destroot}${prefix}/etc
54
55    xinstall -d -m 755  ${destroot}${prefix}/share/doc/${name}
56    xinstall -m 644 -W  ${worksrcpath} CHANGES LICENSE NOTICE README.TXT \
57                        modsecurity.conf-recommended \
58                        ${destroot}${prefix}/share/doc/${name}
59    xinstall -m 644 -W  ${worksrcpath}/ext README \
60                        ${destroot}${prefix}/share/doc/${name}
61    xinstall -m 644 [glob ${worksrcpath}/doc/*] \
62                        ${destroot}${prefix}/share/doc/${name}
63
64    if { ![ file exists ${prefix}/${apachever}/conf/extra/httpd-modsecurity2.conf ] } {
65        set xmllib      [ exec find ${prefix}/lib -type f -iname "libxml2*.dylib" ]
66        set lualib      [ exec find ${prefix}/lib -type f -iname "liblua*.dylib" ]
67
68        exec sed -n -E -e "1,/default rule-set/p" \
69            ${filespath}/httpd-modsecurity2.conf >  ${confFile}
70        exec cat ${worksrcpath}/modsecurity.conf-recommended >> ${confFile}
71        exec sed -n -E -e "/default rule-set/,/IfDefine/p" | sed -E -e "1,1d" \
72            ${filespath}/httpd-modsecurity2.conf >> ${confFile}
73
74        reinplace   "s|XMLLIB|${xmllib}|" ${prefix}/${apachever}/conf/extra/httpd-modsecurity2.conf
75        reinplace   "s|LUALIB|${lualib}|" ${prefix}/${apachever}/conf/extra/httpd-modsecurity2.conf
76    }
77}
78
79notes "
80To enable mod_security2 either:
81    1) remove the two IfDefine lines from the conf-file
82    2) add -D ModSecurity2 to the apachectl start item
83"