# -*- 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 102822 2013-02-09 00:51:24Z jmr@macports.org $

PortSystem      1.0

name            fltk
conflicts       fltk-devel
version         1.3.2
revision        1
categories      aqua devel
license         LGPL
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/${version}/
worksrcdir      ${name}-${version}
distname        ${worksrcdir}-source

checksums           rmd160  5d697cb582cb80a1eca50c35696731eea5591768 \
                    sha256  176044df94f31bd53a5806cf5054ca78b180bf9ae27ce47649608833695ee4a4

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

use_parallel_build  yes

patchfiles      patch-fluid-Makefile.diff \
                patch-src-Makefile.diff

post-patch {
    reinplace "s|/Applications|${applications_dir}/${name}|g" \
        ${worksrcpath}/fluid/Makefile \
        ${worksrcpath}/test/Makefile
    
    # Disable silent rules
    reinplace "/^\\.SILENT:$/d" ${worksrcpath}/makeinclude.in
}

variant universal {}

configure.args  --enable-shared \
                --disable-localjpeg \
                --disable-localzlib \
                --disable-localpng \
                --with-archflags="[get_canonical_archflags]"

post-configure {
    reinplace -E {s|-arch [a-z0-9_]+||g} ${worksrcpath}/fltk-config
}

destroot.target install \
                install-desktop

livecheck.type  regexm
livecheck.url   ${homepage}
livecheck.regex "Stable Release.*?\n.*?VERSION=(\\d+(\\.\\d+)*)'"
