# -*- 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
# $Id: Portfile 83385 2011-08-31 01:52:26Z dports@macports.org $

PortSystem 1.0

name                kelbt
version             0.14
categories          lang textproc devel
platforms           darwin
maintainers         hhhh.org:wiml
license             GPL-2+
description         Backtracking LALR(1) parser generator
long_description    Kelbt generates backtracking LALR(1) parsers. \
                    Where traditional LALR(1) parser generators \
                    require static resolution of shift/reduce \
                    conflicts, Kelbt generates parsers that handle \
                    conflicts by backtracking at runtime. Kelbt is \
                    able to generate a parser for any context-free \
                    grammar that is free of hidden left recursion.

homepage            http://www.complang.org/kelbt/
master_sites        ${homepage}
checksums           md5     6eeaaa79e665389d7953361d10815fb5 \
                    sha1    72a2d64a65445da98bf63126203f3a00ea454067 \
                    rmd160  56bf35f1fa3cd76c7e515741532cba01125788e3

# configure does substitution of CXXFLAGS but Makefile uses CFLAGS for some reason
# configure also doesn't substitute LDFLAGS
if {[variant_isset universal]} {
    build.args      CFLAGS="${configure.cxxflags} ${configure.universal_cxxflags}" \
                    LDFLAGS="${configure.universal_ldflags}"
} else {
    build.args      CFLAGS="${configure.cxxflags} ${configure.cxx_archflags}"
    if {[info exists configure.ld_archflags]} {
        build.args-append LDFLAGS="${configure.ld_archflags}"
    } else {
        build.args-append LDFLAGS="${configure.cxx_archflags}"
    }
}

test.run            yes
test.dir            ${worksrcpath}/test
test.target

destroot.destdir    prefix=${destroot}${prefix}

# TODO: Install kelbt.vim as well?
