# -*- 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

# Please keep the ragel and ragel-devel ports as similar as possible.

# Please keep commit-based set-up until next release.
# If updating to a new pre-release commit, add github.tarball_from archive.
# When updating to the next release, switch back to a release tarball from
# the developer's web site.
github.setup        adrian-thurston ragel d4577c924451b331c73c8ed0af04f6efd35ac0b4
version             7.0.4
revision            0
checksums           rmd160  838fb6f2803e7c166f2a98ec4de8eaf9f0c9ad19 \
                    sha256  2208c0e2a4ec575f1e8bf27a0563f0bbf4afb3a28a97bed01c2376f1d75759a0 \
                    size    455645

name                ragel-devel
conflicts           ragel
categories          lang devel
# From the Ragel web site:
# Note: Part of the Ragel output is copied from Ragel source, covered
# by the MIT [...] license. As an exception, you may use the parts of
# Ragel output copied from Ragel source without restriction. The
# remainder of Ragel output is derived from the input and inherits
# the copyright and license of the input file. Use of Ragel makes
# absolutely no requirement about the license of generated code.
license             MIT
maintainers         nomaintainer

description         Ragel is a state machine compiler.

long_description    Ragel compiles executable finite state machines from \
                    regular languages. Ragel targets C, C++ and ASM. Ragel \
                    state machines can not only recognize byte sequences \
                    as regular expression machines do, but can also execute \
                    code at arbitrary points in the recognition of a regular \
                    language.

homepage            http://www.colm.net/open-source/ragel/
dist_subdir         ragel

depends_lib-append  port:colm

depends_test        port:gsed

patchfiles          patch-lafiles.diff

# We are patching configure.ac.
use_autoconf        yes
autoconf.cmd        ./autogen.sh

depends_build-append \
                    port:autoconf \
                    port:automake \
                    port:libtool \
                    port:pkgconfig

configure.args-append \
                    --with-colm=${prefix}

# This should not be necessary. There must be a bug in the configure script
# or in our patch to it. Possibly related:
# Warning: Configuration logfiles contain indications of -Wimplicit-function-declaration; check that features were not accidentally disabled:
#   lfsm: found in adrian-thurston-ragel-d4577c9/config.log
configure.ldflags-append \
                    -lfsm

test.run            yes
test.dir            ${worksrcpath}/test
test.env            PATH=${prefix}/libexec/gnubin:$env(PATH)
test.cmd            ./runtests
test.target

post-destroot {
    set docdir ${prefix}/share/doc/ragel
    xinstall -d -m 0755 ${destroot}${docdir}
    xinstall -m 0644 -W ${worksrcpath} COPYING CREDITS TODO-aapl TODO-ragel \
        ${destroot}${docdir}
}

platform darwin 10 powerpc {
    # Rosetta gets it wrong otherwise
    configure.args-append \
                    --build=powerpc-apple-darwin${os.major}
}
