# -*- 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.2
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  3efd1c88c6bb5fd1ddca46b9ffe0a0d566e0cb45 \
                        sha256  6a126880706691c987e2957b1c99b522efb1964a75eb767af4b30aac0b88a26a \
                        size    185864

depends_build-append    port:asciidoc \
                        port:libxml2

configure.args          --disable-regexcheck \
                        --disable-silent-rules

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

variant xtinyproxy description {Enable X-Tinyproxy header support} {
    configure.args-append   --enable-xtinyproxy
}

variant filter description {Enable URL filtering} {
    configure.args-append   --enable-filter
}

variant upstream description {Enable upstream proxying} {
    configure.args-append   --enable-upstream
}

variant transparent description {Enable transparent proxying} {
    configure.args-append   --enable-transparent
}

variant reverse description {Enable reverse proxying} {
    configure.args-append   --enable-reverse
}

default_variants        +xtinyproxy +filter +upstream +transparent +reverse
