# -*- 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 78488 2011-05-09 12:19:53Z ryandesign@macports.org $

PortSystem      1.0

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

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       sha1    098cfd9b6c5f2b9856f60fd5efbab10350accef7 \
                rmd160  4c94a4792de127fc53dfb72584e00dd5825df14b

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
}

pre-configure {
    if {[variant_isset universal]} {
        set archflags ${configure.universal_cflags}
    } else {
        set archflags ${configure.cc_archflags}
    }
    configure.args-append --with-archflags=\"${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+)'"
