# -*- 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                Togl-2.0
version             2.0
platforms           darwin
categories          x11
license             permissive
maintainers         {dstrubbe @dstrubbe} openmaintainer
description         A Tcl/Tk widget for OpenGL rendering
long_description    Togl is a Tk widget for OpenGL rendering. Togl was \
                    originally based on OGLTK, written by Benjamin Bederson \
                    at the University of New Mexico.

homepage            http://togl.sourceforge.net/

conflicts           Togl

# Set tclv and md5 checksum to the current MacPorts Tcl port version, though
# port doesn't break if they aren't in sync.
set tclv            8.6.10
master_sites        sourceforge:project/togl/Togl/${version}:togl \
                    sourceforge:project/tcl/Tcl/${tclv}:tcl

dist_subdir         tcltk

distname            Togl${version}
distfiles           ${distname}-src.tar.gz:togl \
                    tcl${tclv}-src.tar.gz:tcl

checksums           ${distname}-src.tar.gz \
                    rmd160  a0124141b824922306af3a1b4ba6ddcf857f6218 \
                    sha256  b7d4a90bbad3aca618d505ee99e7fd8fb04c829f63231dda2360f557ba3f7610 \
                    size    244968 \
                    tcl${tclv}-src.tar.gz \
                    rmd160  e44c76e48b77c825dc6fb7a78ef8f7297106784a \
                    sha256  5196dbf6638e3df8d5c87b5815c8c2b758496eb6f0e41446596c9a4e638d87ed \
                    size    10144235

depends_lib         port:tcl port:tk port:xorg-libXmu port:mesa

configure.args      --mandir=${prefix}/share/man \
                    --with-tcl=${prefix}/lib \
                    --with-tk=${prefix}/lib \
                    --with-tclinclude=${workpath}/tcl${tclv}/generic/
configure.cppflags-append \
                    -I${workpath}/tcl${tclv}/generic \
                    -I${workpath}/tcl${tclv}/unix
configure.ldflags-append \
    -ltclstub8.6

post-destroot {
    move {*}[glob ${destroot}${prefix}/lib/Togl${version}/*] ${destroot}${prefix}/lib/
    delete ${destroot}${prefix}/lib/Togl${version}
    set libpath ${prefix}/lib/libTogl
    system "install_name_tool -id ${libpath}${version}.dylib ${destroot}${libpath}${version}.dylib"
    ln -s libTogl${version}.dylib ${destroot}${libpath}.dylib
}
