# -*- 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
PortGroup           tree_sitter 1.0

github.setup        rizinorg rizin-grammar-c 0.5 rizin-v
github.tarball_from archive
revision            0

description         A tree-sitter parser for C (rizinorg fork of tree-sitter-c)
long_description    {*}${description}

categories          devel
license             MIT
maintainers         {i0ntempest @i0ntempest} openmaintainer

checksums           rmd160  3c16b61fcc265b076862cf82614a4091f2b2cd3c \
                    sha256  082636c83b8dd508db7e73ab25d258564120c09098ffccf5d583416a1d0a7e67 \
                    size    248588

worksrcdir          ${worksrcdir}/src

# parser.c: error: ‘for’ loop initial declaration used outside C99 mode
configure.cflags-append -std=c99

post-destroot {
    set outfile [open ${destroot}${prefix}/lib/pkgconfig/${name}.pc w]
    puts ${outfile} "prefix=${prefix}"
    puts ${outfile} "libdir=\${prefix}/lib"
    puts ${outfile} "includedir=\${prefix}/include"
    puts ${outfile} ""
    puts ${outfile} "Name: ${name}"
    puts ${outfile} "Description: ${description}"
    puts ${outfile} "URL: ${homepage}"
    puts ${outfile} "Version: ${version}"
    puts ${outfile} "Libs: -L\${libdir} -ltree-sitter-${name}"
    puts ${outfile} "Cflags: -I\${includedir}"
    close ${outfile}
}
