# -*- 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
PortGroup           github 1.0

set udate           20120925
github.setup        dhmunro yorick-gl 1.1.0.git${udate} gl_
# Change github.tarball_from to 'releases' or 'archive' next update
github.tarball_from tarball
fetch.type          git
git.branch          03b553ac53ff6b4cc377faea6af1bcd9a2c6648f

license             BSD
categories          science yorick
maintainers         {thibaut @paumard} openmaintainer
description         OpenGL 3D graphics support for the Yorick language
long_description    This is a compiled add-on for yorick (an interpreted \
                    computer language specialized for numerical and \
                    scientific problems). Yorick-gl adds support for OpenGL \
                    3D graphics.
homepage            http://maumae.net/yorick/doc/plugins.php

depends_lib         port:yorick \
                    port:mesa

universal_variant   no

configure.cmd       ${prefix}/bin/yorick
configure.pre_args  {}
configure.args      -batch make.i

post-configure {
    set MakeglFD [open "$worksrcpath/Makegl" "w"]
    puts $MakeglFD "PKG_I=\$(YISO_PKG_I) \$(YGL_PKG_I)"
    puts $MakeglFD "OBJS=\$(YISO_OBJS) \$(YGL_OBJS)"
    puts $MakeglFD "OGLXW=oglx.o"
    puts $MakeglFD "D_MESA_PIXMAPS="
    puts $MakeglFD "PKG_DEPLIBS=-lGL -lXext -lX11"
    puts $MakeglFD "PKG_CFLAGS="
    puts $MakeglFD "PKG_LDFLAGS="
    puts $MakeglFD "PKG_I_START=yiso3d.i yorgl.i"
    puts $MakeglFD "PKG_I_EXTRA=\$(YISO_I) \$(YGL_I)"
    close $MakeglFD
}

build.args-append   CC=${configure.cc} \
                    Y_CFLAGS="${configure.cppflags} ${configure.cflags}" \
                    Y_LDFLAGS="${configure.ldflags}" \
                    COPTS_DEFAULT=""