# -*- 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.15
revision            0
checksums           rmd160  be833a586e8db24fd9ca1d1df6798a256e3128f8 \
                    sha256  cf0937cb3ed521b2ab1acfa7aff45103040b860bb642c4c2f094ac3a3fe86024 \
                    size    3023804

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.14
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+)?)
