# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:et:sw=4:ts=4:sts=4
# $Id: Portfile 56100 2009-08-24 07:01:14Z ryandesign@macports.org $

PortSystem 1.0

name            glui
version			2.36
revision		1
categories      x11
maintainers     mcalhoun
description     A GLUT-based C++ user interface library.
long_description \
    GLUI is a GLUT-based C++ user interface library \
    which provides controls such as buttons, checkboxes, radio buttons, and spinners to OpenGL applications.
homepage        http://glui.sourceforge.net/
master_sites    sourceforge:glui
extract.suffix  .tgz
worksrcdir      ${name}-${version}/src
platforms       darwin
checksums \
    md5 9e8d506af9a9428dac09e8cd7bda7c1e \
    sha1 00e6a4a8a331ccfde951966526c63b0f37c7d8f3 \
    rmd160 f39fe98e3e215816b0af2089ab7ac460df5701b8

patchfiles-append patch-makefile.diff patch-glui.diff patch-glui_filebrowser.diff

configure.ldflags -framework GLUT -framework OpenGL

use_configure    no

post-configure {
    reinplace "s|__CONFIGURE_CXX__|${configure.cxx}|" ${worksrcpath}/makefile
    reinplace "s|__CONFIGURE_CXXFLAGS__|${configure.cxxflags}|" ${worksrcpath}/makefile
    reinplace "s|__CONFIGURE_LDFLAGS__|${configure.ldflags}|" ${worksrcpath}/makefile
    reinplace "s|__CONFIGURE_CPPFLAGS__|${configure.cppflags}|" ${worksrcpath}/makefile
}

destroot {
    xinstall -m 644 ${worksrcpath}/include/GL/glui.h ${destroot}${prefix}/include
    xinstall -m 644 ${worksrcpath}/lib/libglui.a ${destroot}${prefix}/lib
    xinstall -m 755 ${worksrcpath}/bin/ppm2array ${destroot}${prefix}/bin
}

post-destroot {
    xinstall -d -m 755 ${destroot}${prefix}/share/doc/${name}
    xinstall -m 644 ${worksrcpath}/doc/glui_manual.pdf ${destroot}${prefix}/share/doc/${name}
    xinstall -d -m 755 ${destroot}${prefix}/share/doc/${name}/examples
    eval xinstall -m 644 [glob ${worksrcpath}/example/example*.cpp] ${destroot}${prefix}/share/doc/${name}/examples
    eval xinstall -m 755 [glob ${worksrcpath}/bin/example*] ${destroot}${prefix}/share/doc/${name}/examples
}

livecheck.distname Source
