# -*- 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 92837 2012-05-09 00:51:48Z ryandesign@macports.org $

PortSystem          1.0

name                pike
version             7.6.112
revision            4
categories          lang
platforms           darwin
maintainers         gmx.de:exodusd openmaintainer

description         dynamic programming language

long_description    Pike is a dynamic programming language with a syntax \
                    similar to Java and C. It is simple to learn, does \
                    not require long compilation passes and has powerful \
                    built-in data types allowing simple and really fast \
                    data manipulation.

homepage            http://pike.ida.liu.se/
master_sites        ${homepage}pub/pike/all/${version}/
distname            Pike-v${version}

checksums           md5     3ba03096741d6df839d32a940f4a865c \
                    sha1    211050346d8efc01068e8ea7443f4743116a51be \
                    rmd160  8983d5bc150beabd1796ff8f05df43e5cf36f467

patchfiles          patch-Request.pike

depends_lib         port:bzip2 \
                    port:zlib \
                    port:gmp \
                    port:nettle

variant image description {Images (JPEG, PNG, GIF, TIFF) support for Pike} {
    configure.args-append --with-jpeglib --with-gif --with-tifflib
    depends_lib-append port:jpeg port:tiff port:libpng path:include/gif_lib.h:giflib
}

variant ttf description {TrueType (TTF) support (using FreeType) for Pike} {
    configure.args-append --with-freetype
    depends_lib-append port:freetype
}

variant pcre description {Regular expression support (using PCRE) for Pike} {
    configure.args-append --with-libpcre
    depends_lib-append port:pcre
}

variant gdbm description {GDBM database support for Pike} {
    configure.args-append --with-gdbm
    depends_lib-append port:gdbm
}

variant mysql description {MySQL database support for Pike} {
    configure.args-append --with-mysql
    depends_lib-append lib:libmysqlclient:mysql5
}

variant odbc description {ODBC database support for Pike} {
    configure.args-append --with-odbc
    depends_lib-append port:unixODBC
}

variant postgresql description {Postgres database support for Pike} {
    configure.args-append --with-postgres
    depends_lib-append port:postgresql83
}

variant gtk description {GTK support for Pike} {
    configure.args-append --with-gtk
    depends_lib-append port:gtk2
}

variant opengl description {OpenGL support for Pike} {
    configure.args-append --with-GL --with-GLUT
    depends_lib-append port:mesa
}

#variant perl description {Perl support for Pike} {
#    configure.args-append --with-perl
#    depends_lib-append port:perl5.10
#}

variant sane description {SANE scanner support for Pike} {
    configure.args-append --with-sane
    depends_lib-append port:sane-backends
}

variant sdl description {SDL support for Pike} {
    configure.args-append --with-SDL
    depends_lib-append path:lib/pkgconfig/sdl.pc:libsdl port:libsdl_mixer
}

variant svg description {SVG vector graphics support for Pike} {
    configure.args-append --with-svg
    depends_lib-append port:librsvg
}

variant doc description {Pike documentation} {
    build.target-append doc
}

use_configure       no

configure.args      --without-bundles \
                    --mandir=${prefix}/share/man \
                    --with-include-path=${prefix}/include \
                    --with-lib-path=${prefix}/lib \
                    --with-zlib

pre-build {
    # setup the build.args here, because then the configure.args from the
    # variants will have been assembled:
    build.args      CONFIGUREARGS="${configure.pre_args} ${configure.args}" \
                    INSTALLARGS="--traditional"
}

test.run            yes
test.target         verify

destroot.target     install_nodoc
destroot.destdir    buildroot=${destroot} INSTALLARGS="--traditional"

post-destroot {
    file delete -force ${destroot}${prefix}/bin/pike.syms
    file delete -force ${destroot}${prefix}/doc/pike
    # move manpage to correct location:
    move ${destroot}${prefix}/man/man1/pike.1 \
        ${destroot}${prefix}/share/man/man1/
    # move documentation to correct location:
    xinstall -d ${destroot}${prefix}/share/doc/pike-${version}
    xinstall -W ${worksrcpath} README COPYING COPYRIGHT ANNOUNCE \
        COMMITTERS ${destroot}${prefix}/share/doc/pike-${version}
    if {[variant_isset doc]} {
        move ${worksrcpath}/refdoc/modref \
            ${destroot}${prefix}/share/doc/pike-${version}
        move ${worksrcpath}/refdoc/traditional_manual \
            ${destroot}${prefix}/share/doc/pike-${version}
    }
}
