# -*- 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

PortSystem              1.0
PortGroup               github 1.0

github.setup            tinyproxy tinyproxy 1.11.3
revision                0
categories              net www
maintainers             {makr @mohd-akram} openmaintainer
license                 GPL-2+

description             fast, lightweight HTTP proxy

long_description        tinyproxy is a lightweight HTTP proxy. Designed from \
                        the ground up to be fast and yet small, it is an ideal \
                        solution for sites where a full-featured HTTP proxy is \
                        required, but the system resources required to run a \
                        more demanding HTTP proxy are unavailable.

homepage                https://tinyproxy.github.io
github.tarball_from     releases
use_xz                  yes

checksums               rmd160  599754d08913853c5560afb554ac14cad61b5497 \
                        sha256  f05644fdf1211ba13754a354bebed909b5b39371b12cce8563c46929a75bedf6 \
                        size    185212

depends_build-append    port:perl5 \
                        port:gperf

patchfiles              patch-configure.diff

set conf_dir            ${prefix}/etc/${name}
set log_dir             ${prefix}/var/log/${name}
set run_dir             ${prefix}/var/run/${name}
set doc_dir             ${prefix}/share/doc/${name}

destroot.keepdirs       ${destroot}${conf_dir} \
                        ${destroot}${log_dir} \
                        ${destroot}${run_dir}

post-destroot {
    xinstall -d -o nobody -g nobody ${destroot}${log_dir}
    move ${destroot}${conf_dir}/tinyproxy.conf ${destroot}${doc_dir}
}

post-activate {
    if {![file exists ${conf_dir}/tinyproxy.conf]} {
        copy ${doc_dir}/tinyproxy.conf ${conf_dir}/
    }
}

startupitem.create      yes
startupitem.netchange   yes
startupitem.executable  ${prefix}/bin/tinyproxy -d
