# $Id: Portfile 62206 2009-12-31 16:02:46Z nox@macports.org $

PortSystem 1.0

name		swig
version		1.3.40
revision    1

categories	devel
maintainers	kevin jwa

description	Tool to wrap C/C++ libraries in high-level languages.
long_description	\
    SWIG is a software development tool that connects programs written in C \
    and C++ with a variety of high-level programming languages. SWIG is \
    primarily used with common scripting languages such as Perl, Python, \
    Tcl/Tk, Ruby, Guile and MzScheme, however the list of supported languages \
    also includes non-scripting languages such as Java and OCAML. SWIG is \
    most commonly used to create high-level interpreted programming \
    environments, user interfaces, and as a tool for testing and \
    prototyping C/C++ software. SWIG may be freely used, distributed, and \
    modified for commercial and noncommercial use.

homepage	http://www.swig.org/
platforms	darwin
master_sites	sourceforge
checksums           md5     2df766c9e03e02811b1ab4bba1c7b9cc \
                    sha1    7e7a426579f2d2d967b731abf062b33aa894fb4e \
                    rmd160  318a59b0ea2b20ca987f7e662e0d7138c869295a


depends_build	port:bison \
    port:gsed

post-patch {
    # The configure script should use GNU sed
    reinplace "s/\[\[:<:\]\]sed\[\[:>:\]\]/gsed/g" ${worksrcpath}/configure
}

foreach lang {python perl5 gcj guile mzscheme ruby php ocaml pike lua chicken allegrocl clisp r tcl csharp octave java} {
    configure.args-append --without-${lang}
}

build.target

set languages   [list typemaps]
set docdir      ${prefix}/share/doc/${name}-${version}

test.run        yes
test.target     check

pre-destroot {
    # This must be evaluated after variants selection.
    destroot.args   lib-languages="[join ${languages}]"
}

post-destroot {
    xinstall -d ${destroot}${docdir}
    xinstall -m 0644 -W ${worksrcpath} ANNOUNCE CHANGES FUTURE LICENSE NEW README \
        TODO ${destroot}${docdir}
}

variant doc description {Install extra documentation} {
    post-destroot {
        xinstall -d ${destroot}${docdir}/html
        eval xinstall -m 0644 [glob ${worksrcpath}/Doc/Manual/*.{css,html,pdf,png}] \
            ${destroot}${docdir}/html
    }
}

livecheck.type      regex
livecheck.url       http://www.swig.org/download.html
livecheck.regex     ${name}-(\\d+(?:\\.\\d+)*)
