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

name                    porg
version                 0.10
categories              devel
license                 GPL-2+
maintainers             nomaintainer

description             manage software packages installed from source code
long_description        Porg can {*}${description}. After the installation of such packages, \
                        one is usually left with having no idea of what (and where) "it" was \
                        installed, making it diffucult to uninstall the package in the future. \
                        Porg was written to solve this problem in quite a simple fashion.

homepage                https://porg.sourceforge.net/
master_sites            sourceforge:project/${name}

checksums               rmd160  f9bd3ed72324cf0c8668d8ae0333a0813df968e7 \
                        sha256  48f8433193f92097824ed7a72c4babafb29dc2ffe60e7df3635664f59f09cedd \
                        size    506344

depends_build-append    port:pkgconfig

patch.pre_args-replace  -p0 -p1
patchfiles              no-default-porgrc.patch \
                        null-terminate-string-after-strncpy.patch \
                        fix-bash-completion-path.patch \
                        bash-completion-updates.patch

configure.args          --disable-grop \
                        --datadir=${prefix}/share/doc \
                        --with-porg-logdir=${prefix}/var/log/${name}

variant grop description {Install GUI version of porg} {
    depends_lib-append      port:gtkmm3
    patchfiles-append       fix-grop-double-destdir.patch
    configure.args-delete   --disable-grop
}

post-destroot {
    xinstall -m 0644 -W ${worksrcpath} COPYING ${destroot}${prefix}/share/doc/${name}
}

post-activate {
    if {![file exists ${prefix}/etc/${name}rc]} {
        file copy ${prefix}/share/doc/${name}/${name}rc ${prefix}/etc/${name}rc
        reinplace "s|\${prefix}|${prefix}|g" ${prefix}/etc/${name}rc
    }
}
