# -*- 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                global
version             6.6.14
revision            0
checksums           rmd160  4757976b5f60c788ae0153dacadfdff9f16b023e \
                    sha256  f6e7fd0b68aed292e85bb686616baf6551d5c9424adcddca11d808ba318cb320 \
                    size    3012014

categories          devel
maintainers         nomaintainer
description         source code tag system
license             GPL-3+

long_description    GNU GLOBAL is a source code tag system that works the \
                    same way across diverse environments. You can locate a \
                    specified object in the source files and move there \
                    easily. It is useful for hacking a large project \
                    containing many subdirectories, many #ifdef and many \
                    main() functions. It is similar to ctags or etags but \
                    is different from them at the point of independence of \
                    any editor.

homepage            https://www.gnu.org/software/global/
master_sites        gnu

set python_branch   3.12
set python_version  [string map {"." ""} ${python_branch}]
set python_bin      ${prefix}/bin/python${python_branch}

depends_lib         port:libtool \
                    port:ncurses \
                    port:ctags \
                    port:universal-ctags \
                    port:py${python_version}-pygments

# universal-ctags is not universal
universal_variant   no

configure.args      --with-exuberant-ctags=${prefix}/bin/ctags \
                    --with-universal-ctags=${prefix}/bin/uctags \
                    --with-sqlite3

configure.env-append \
                    "PYTHON=${python_bin}"

test.run            yes
test.target         check

post-patch {
    reinplace "1 s|/usr/bin/env python.*|@PYTHON@|g" \
        plugin-factory/pygments_parser.py.in
}

# we always build .so (and not always .la) so let's use .so.
post-destroot {
    reinplace {s,\.la,.so,g} ${destroot}${prefix}/share/gtags/gtags.conf
}

livecheck.type      regex
livecheck.url       https://ftp.gnu.org/gnu/${name}/?C=M&O=D
livecheck.regex     ${name}-(\\d+\\.\\d+(?:\\.\\d+)?)
