# $Id: Portfile 70018 2010-07-26 21:37:12Z snc@macports.org $

PortSystem          1.0

name                uagen
version             1.0.7
revision            1
categories          mail
platforms           darwin
maintainers         nomaintainer
description         A Firefox-User-Agent generator for Privoxy and Mozilla \
                    browsers
long_description    uagen generates a fake Firefox User-Agent and writes it \
                    into a Privoxy action file as parameter for Privoxy's \
                    hide-user-agent action. Operating system, architecture, \
                    platform, language and build date are randomized. \
                    The generated language is also used as parameter for the \
                    hide-accept-language action which is understood by \
                    Privoxy since version 3.0.5 beta. Additionally the \
                    User-Agent can be written into prefs.js files which are \
                    used by many Mozilla browsers.

homepage            http://www.fabiankeil.de/sourcecode/uagen/
master_sites        ${homepage}
checksums           md5 264afeb70c91c0728cb9c807205dc819 \
                    sha1 875440c42b63f34f46bc773e7ed88556f5b3e0e5 \
                    rmd160 3a058c05c455c038b60f0fe43d29a9a617e45f82
# Unversioned download!
distname            ${name}

# Copy the fetched uagen.pl script to ${worksrcpath}. Drop the extension so it
# can be installed with xinstall in destroot.
extract.suffix      .pl
extract.mkdir       yes
extract {
    copy ${distpath}/${distfiles} ${worksrcpath}/uagen
}

use_configure       no

build {
    reinplace "s|/usr|${prefix}|g" ${worksrcpath}/uagen
    # Use paths in ${prefix} for uagen.
    reinplace -E "s|(/var/log/uagen.log)|${prefix}\\1|" \
        ${worksrcpath}/uagen
    reinplace -E "s|(/etc/privoxy/user-agent.action)|${prefix}\\1|" \
        ${worksrcpath}/uagen
}

destroot {
    xinstall ${worksrcpath}/uagen ${destroot}${prefix}/bin
}

universal_variant   no

livecheck.type      regex
livecheck.url       ${master_sites}uagen.pl
livecheck.regex     "'uagen (\\d+(?:\\.\\d+)*)'"
