# -*- 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        tree-sitter-grammars tree-sitter-markdown 0.5.3 v
revision            0
epoch               1
categories          devel
license             MIT
maintainers         {amake @amake} openmaintainer
description         A set of tree-sitter parsers for Markdown
long_description    {*}${description}
checksums           rmd160  f3dba82f10baaed2f2e3cb134f0f62f652fd1d42 \
                    sha256  df845b1ab7c7c163ec57d7fa17170c92b04be199bddab02523636efec5224ab6 \
                    size    422303
github.tarball_from archive

# The way upstream addressed the issue is wrong. Fix the install name again.
patchfiles-append   patch-common.mak

post-patch {
    reinplace "s,@PREFIX@,${prefix}," ${worksrcpath}/common/common.mak
}

# cc1: error: unrecognized command line option "-std=c11"
compiler.c_standard 2011

build {
    system -W ${worksrcpath} "CC=${configure.cc} make all"
}

destroot {
    xinstall -d ${destroot}${prefix}/lib/pkgconfig
    xinstall -m 0644 -W ${worksrcpath}/tree-sitter-markdown libtree-sitter-markdown.a ${destroot}${prefix}/lib
    xinstall -m 0644 -W ${worksrcpath}/tree-sitter-markdown libtree-sitter-markdown.dylib ${destroot}${prefix}/lib
    xinstall -m 0644 -W ${worksrcpath}/tree-sitter-markdown tree-sitter-markdown.pc ${destroot}${prefix}/lib/pkgconfig
    xinstall -m 0644 -W ${worksrcpath}/tree-sitter-markdown-inline libtree-sitter-markdown-inline.a ${destroot}${prefix}/lib
    xinstall -m 0644 -W ${worksrcpath}/tree-sitter-markdown-inline libtree-sitter-markdown-inline.dylib ${destroot}${prefix}/lib
    xinstall -m 0644 -W ${worksrcpath}/tree-sitter-markdown-inline tree-sitter-markdown-inline.pc ${destroot}${prefix}/lib/pkgconfig
}

github.livecheck.branch  split_parser
