source: trunk/dports/www/privoxy/Portfile

Last change on this file was 127037, checked in by ryandesign@…, 3 years ago

privoxy: use system's -W argument where applicable

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