source: trunk/dports/www/privoxy/Portfile @ 87969

Last change on this file since 87969 was 84392, checked in by mfeiri@…, 8 years ago

privoxy: add workaround for bug #30345

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 6.0 KB
Line 
1# $Id: Portfile 84392 2011-09-25 10:59:07Z mfeiri@macports.org $
2
3PortSystem                      1.0
4name                            privoxy
5version                         3.0.17
6revision                        0
7categories                      www security net
8license                         GPL-2
9maintainers                     nomaintainer
10description                     Advanced filtering web proxy
11long_description \
12        Privoxy is a web proxy with advanced filtering capabilities for \
13        protecting privacy, modifying web page content, managing cookies, \
14        controlling access, and removing ads, banners, pop-ups and other \
15        obnoxious Internet junk. Privoxy has a very flexible configuration and \
16        can be customized to suit individual needs and tastes. Privoxy has \
17        application for both stand-alone systems and multi-user networks.
18
19platforms                       darwin
20
21homepage                        http://www.privoxy.org/
22master_sites            sourceforge:ijbswa
23distname                        ${name}-${version}-stable-src
24
25checksums           md5     9d363d738a3f3d73e774d6dfeafdb15f \
26                    sha1    cadef2eb8ec182278e092322d3d56f225cb69c93 \
27                    rmd160  8e4acc60ca7e7be20a92e1aece92eecedd4d1997
28
29worksrcdir                      ${name}-${version}-stable
30
31depends_lib                     port:pcre port:zlib
32
33set privoxyGroup        privoxy
34set privoxyUser         privoxy
35
36if {[tbool portarchivemode]} {
37    pre-unarchive {
38        addgroup        ${privoxyGroup}
39        adduser         ${privoxyUser} gid=[existsgroup ${privoxyGroup}]
40    }
41}
42pre-configure {
43    if {![tbool portarchivemode]} {
44        addgroup        ${privoxyGroup}
45        adduser         ${privoxyUser} gid=[existsgroup ${privoxyGroup}]
46    }
47    if {[existsuser ${privoxyUser}] != 0 && [existsgroup ${privoxyGroup}] != 0} {
48        configure.args-append --with-user=${privoxyUser} \
49                                                  --with-group=${privoxyGroup}
50    }
51    system "cd ${worksrcpath} && autoheader"
52}
53
54use_autoconf            yes
55configure.args          --sysconfdir=${prefix}/etc/${name} \
56                                        --mandir=${prefix}/share/man \
57                                        --enable-dynamic-pcre \
58                                        --enable-zlib
59
60# work around bug 30345
61post-configure {
62    file delete ${workpath}/.CC_PRINT_OPTIONS
63}
64
65destroot.keepdirs       ${destroot}${prefix}/var/log/privoxy \
66                                        ${destroot}${prefix}/var/run
67
68post-destroot {
69        xinstall -m 755 -d ${destroot}${prefix}/var/run
70        # Install and fixup startup script (if non-Darwin)
71        if {${os.platform} != "darwin"} {
72                xinstall -m 755 -d ${destroot}${prefix}/etc/rc.d
73                xinstall -m 755 -W ${worksrcpath} privoxy-generic.init \
74                        ${destroot}${prefix}/etc/rc.d/privoxy.sh
75
76                system "cd ${destroot}${prefix}/etc/rc.d && patch -p0 < ${filespath}/patch-privoxy.sh.diff"
77                reinplace "s|@@PREFIX@@|${prefix}|g" \
78                        ${destroot}${prefix}/etc/rc.d/privoxy.sh
79                if {[existsuser ${privoxyUser}] != 0} {
80            reinplace "s|@@PRIVOXY_USER@@|${privoxyUser}|g" \
81                ${destroot}${prefix}/etc/rc.d/privoxy.sh
82                } else {
83            reinplace "s|@@PRIVOXY_USER@@|$env(USER)|g" \
84                ${destroot}${prefix}/etc/rc.d/privoxy.sh
85                }
86        }
87        # Rename these so local modifications are not removed on uninstall.
88        # NOTE: Always overwrite default.action and default.filter.
89        foreach privoxyConf {config match-all.action trust user.action user.filter} {
90            if [file exists ${destroot}${prefix}/etc/privoxy/${privoxyConf}] {
91                file rename ${destroot}${prefix}/etc/privoxy/${privoxyConf} \
92                        ${destroot}${prefix}/etc/privoxy/${privoxyConf}.new
93            }
94            # backup config files before fix #23970
95            if {[file exists ${prefix}/etc/privoxy/${privoxyConf}] \
96            && ![file exists ${prefix}/etc/privoxy/${privoxyConf}.new]} {
97                file copy ${prefix}/etc/privoxy/${privoxyConf} \
98                        ${destroot}${prefix}/etc/privoxy/${privoxyConf}.mp_backup
99            }
100        }
101        # Remove the preinstalled log files as, otherwise, a rotation script
102        # will fail when trying to rename and compress due to gzip not liking
103        # multi-linked files (the one in ${prefix} and the one in
104        # ${prefix}/var/db/dports/software/...)
105        eval file delete [glob ${destroot}${prefix}/var/log/privoxy/*]
106        if {[existsuser ${privoxyUser}] != 0 && [existsgroup ${privoxyGroup}] != 0} {
107        # Make sure log directory owned by privoxy user/group
108        file attributes ${destroot}${prefix}/var/log/privoxy \
109            -group ${privoxyGroup} -owner ${privoxyUser}
110        }
111}
112
113post-activate {
114        # Make sure initial log files are present and setup correctly
115        foreach privoxyLog {jarfile logfile} {
116                touch ${prefix}/var/log/privoxy/${privoxyLog}
117                if {[existsuser ${privoxyUser}] != 0 && [existsgroup ${privoxyGroup}] != 0} {
118            file attributes ${prefix}/var/log/privoxy/${privoxyLog} \
119                -group ${privoxyGroup} -owner ${privoxyUser} \
120                -permissions 0660
121                }
122        }
123        foreach privoxyConf {config match-all.action trust user.action user.filter} {
124                if ![file exists ${prefix}/etc/privoxy/${privoxyConf}] {
125                        # restore config files before fix #23970
126                        if [file exists ${prefix}/etc/privoxy/${privoxyConf}.mp_backup] {
127                            file copy ${prefix}/etc/privoxy/${privoxyConf}.mp_backup \
128                                    ${prefix}/etc/privoxy/${privoxyConf}
129                        } else {
130                            file copy ${prefix}/etc/privoxy/${privoxyConf}.new \
131                                    ${prefix}/etc/privoxy/${privoxyConf}
132                        }
133                        if {[existsuser ${privoxyUser}] != 0 && [existsgroup ${privoxyGroup}] != 0} {
134                file attributes ${prefix}/etc/privoxy/${privoxyConf} \
135                    -group ${privoxyGroup} -owner ${privoxyUser} \
136                    -permissions 0660
137                        }
138                }
139        }
140}
141
142platform darwin {
143        startupitem.create                      yes
144        startupitem.name                        Privoxy
145        startupitem.start                       "\[ -f \"${prefix}/etc/privoxy/config\" \] \\"
146        startupitem.start-append        "\t&& ${prefix}/sbin/privoxy \\"
147        startupitem.start-append        "\t\t--pidfile ${prefix}/var/run/privoxy.pid \\"
148        startupitem.start-append        "\t\t--user ${privoxyUser} \\"
149        startupitem.start-append        "\t\t${prefix}/etc/privoxy/config 2>/dev/null"
150        startupitem.stop                        "if \[ -f \"${prefix}/var/run/privoxy.pid\" \]; then"
151        startupitem.stop-append         "\tkill `cat ${prefix}/var/run/privoxy.pid` \\"
152        startupitem.stop-append         "\t\t&& rm -f ${prefix}/var/run/privoxy.pid"
153        startupitem.stop-append         "else"
154        startupitem.stop-append         "\t/usr/bin/killall -SIGUSR1 privoxy 2>/dev/null"
155        startupitem.stop-append         "fi"
156}
157
158livecheck.type          regex
159livecheck.url           http://www.privoxy.org/announce.txt
160livecheck.regex         Announcing Privoxy v.(\[0-9.\]+)
Note: See TracBrowser for help on using the repository browser.