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

name                        gvemod-crayola
version                     0.4
revision                    1
categories                  science graphics x11
maintainers                 {raphael @raphael-st} openmaintainer
description                 An interactive tool for colouring faces \
                            of geometric objects within Geomview
long_description            This is the Crayola emodule, an interactive \
                            tool for colouring faces of geometric objects \
                            within Geomview. emodules are kind of plugins \
                            which extend the functionality of Geomview (an \
                            interactive 3d viewing program).
homepage                    http://www.geomview.org/
license                     LGPL-2+
platforms                   darwin
master_sites                sourceforge:project/geomview/${name}:current \
                            sourceforge:project/geomview/${name}/0.2:old

use_bzip2                   yes

distfiles                   ${distname}${extract.suffix}:current \
                            ${name}-0.2.tar.bz2:old

checksums                   ${distname}${extract.suffix} \
                                rmd160  685734aa2e81d6f05a90bba6c29483f93e5a77e5 \
                                sha256  e9c5f313364e9e2b5c581d1ceaa2d515b90a3b8b9bfc39bd230cdcdc97f7f6de \
                                size    279808 \
                            ${name}-0.2.tar.bz2 \
                                rmd160  657afa170e4dad3b6b187af2a0c1554467d2a18e \
                                sha256  692319800717b634bcaab9cb127d3de328150fb0d0b3001860bd2ab214c68564 \
                                size    255949

depends_lib                 port:geomview \
                            port:tk

# Use the Tcl script from version 0.2 and delete the "Crayola" binary.
# See https://trac.macports.org/ticket/57441#comment:10
# Work around for case-insensitivity "Crayola" script <-> "crayola" final binary
post-extract {
    delete ${worksrcpath}/src/Crayola
    move ${workpath}/${name}-0.2/src/Crayola ${worksrcpath}/src/Crayola.tc
    reinplace "s|module_tcl_DATA = Crayola|module_tcl_DATA = Crayola.tc|" \
        ${worksrcpath}/src/Makefile.in
}

configure.cppflags-append   -DUSE_INTERP_RESULT

post-destroot {
    move ${destroot}${prefix}/libexec/geomview/tcl/Crayola.tc \
        ${destroot}${prefix}/libexec/geomview/tcl/Crayola

    set docdir ${destroot}${prefix}/share/doc/${name}
    xinstall -d ${docdir}
    xinstall -m 644 -W ${worksrcpath} \
        AUTHORS \
        COPYING \
        ChangeLog \
        NEWS \
        README \
        ${docdir}
}
platform darwin 9 {
    configure.ldflags-append \
        -Wl,-dylib_file,/System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGL.dylib:\
        /System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGL.dylib
}

livecheck.url               http://sourceforge.net/projects/geomview/files/${name}/
livecheck.type              regex
livecheck.regex             ${name}-(\[0-9.\]+)${extract.suffix}
