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

name                cableswig
epoch               1
version             4.0
categories          devel
platforms           darwin
maintainers         nomaintainer

description         Create wrappers to interpreted languages
long_description    CableSwig is used to create interfaces (i.e. \
                    'wrappers') to interpreted languages such as Tcl \
                    and Python. It was created to produce wrappers for \
                    ITK because the toolkit uses C++ structures that \
                    SWIG cannot parse (deeply nested template \
                    instantiations). CableSwig is a combination tool \
                    that uses GCC_XML as the C++ parser. The input \
                    files are Cable style input files. The XML \
                    produced from the Cable/GCC_XML input files are \
                    then parsed and fed into a modified version of \
                    SWIG. SWIG is a software development tool that \
                    connects programs written in C and C++ with \
                    a variety of high-level programming languages. It \
                    is used to generate the language bindings to the \
                    target language. Currently, Tcl and Python are \
                    supported.
homepage            http://www.itk.org/ITK/resources/CableSwig.html

depends_build-append    port:bison \
                        port:gawk \
                        port:gmake

fetch.type              git
git.url                 git://itk.org/CableSwig.git
git.branch              ITK-${version}

worksrcdir              CableSwig

patchfiles              no-windows-compilers.patch

cmake.out_of_source     yes

configure.cflags-append -std=c90
configure.args-append   -DBISON_YACC:FILEPATH=${prefix}/bin/bison \
                        -DBUILD_TESTING:BOOL=OFF \
                        -DCMAKE_SKIP_RPATH:BOOL=OFF \
                        -DCSWIG_USE_SYSTEM_GCCXML:BOOL=OFF \
                        -DSWIG_BUILD_EXAMPLES:BOOL=OFF

build.type              gnu

variant examples description "Provide examples" {
    configure.args-replace  -DSWIG_BUILD_EXAMPLES:BOOL=OFF \
                            -DSWIG_BUILD_EXAMPLES:BOOL=ON
}

variant testing description "Provide testing" {
    configure.args-replace  -DBUILD_TESTING:BOOL=OFF \
                            -DBUILD_TESTING:BOOL=ON
}

variant gccxml description "Use MacPorts' GCC-XML" {
    depends_lib-append      port:gccxml
    configure.args-replace  -DCSWIG_USE_SYSTEM_GCCXML:BOOL=OFF \
                            -DCSWIG_USE_SYSTEM_GCCXML:BOOL=ON
}