# -*- Mode: Tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:filetype=tcl:et:sw=4:ts=4:sts=4
# $Id: Portfile 91761 2012-04-09 23:34:12Z macsforever2000@macports.org $

PortSystem      1.0

name            fltk-devel
conflicts       fltk
version         1.3.x-r9327
categories      aqua devel
platforms       macosx
maintainers     nomaintainer
description     Fast Light Tool Kit
license         LPGL-2

long_description \
    FLTK (pronounced fulltick) \
    is a cross-platform C++ GUI toolkit for UNIX/Linux (X11), \
    Microsoft Windows, and Mac OS X. \
    FLTK provides modern GUI functionality without the bloat \
    and supports 3D graphics via OpenGL and \
    its built-in GLUT emulation. \
    \
    FLTK is designed to be small and modular enough to be \
    statically linked, but works fine as a shared library. \
    FLTK also includes an excellent UI builder called FLUID \
    that can be used to create applications in minutes.

homepage        http://www.fltk.org/
master_sites    http://ftp.easysw.com/pub/fltk/snapshots/
distname        fltk-${version}
use_bzip2       yes

checksums           rmd160  2e36d429588e2c4456a8546c240e94d46e5704b5 \
                    sha256  22ef47cd25c3f77e038dd4832ab5d3020baf123fa7e0b02fca8f9a39463b4684

depends_lib     port:jpeg \
                port:libpng \
                port:zlib

use_parallel_build  yes

post-patch {
    # set .app directory
    reinplace "s|/Applications|${applications_dir}/fltk|g" \
        ${worksrcpath}/fluid/Makefile \
        ${worksrcpath}/test/Makefile
}

# FIXME: Workaround a project bug
# http://llvm.org/bugs/show_bug.cgi?id=10338
if {${configure.compiler}=="clang"} {
    configure.compiler  llvm-gcc-4.2
}

pre-configure {
    configure.args-append --with-archflags=\"[get_canonical_archflags]\"

    configure.universal_cflags ${configure.cflags}
    configure.universal_cppflags ${configure.cppflags}
    configure.universal_cxxflags ${configure.cxxflags}
    configure.universal_ldflags ${configure.ldflags}
}

configure.cppflags
configure.ldflags

configure.args-append   \
    --enable-shared     \
    --disable-localjpeg \
    --disable-localzlib \
    --disable-localpng

destroot.target install \
                install-desktop

livecheck.type  regexm
livecheck.url   ${homepage}
livecheck.regex "Snapshots:.*VERSION=(1\\.3\\.x-r\\d+)'"
