# -*- 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 108401 2013-07-22 19:10:44Z michaelld@macports.org $

PortSystem      1.0

name            fltk-devel
conflicts       fltk
version         1.3.x-r9949
categories      aqua devel
license         LGPL
platforms       macosx
maintainers     michaelld openmaintainer
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://fltk.org/pub/fltk/snapshots/
distname        fltk-${version}
use_bzip2       yes

checksums       rmd160  50a12b5a2c994125b8b5636e03e76444fa822524 \
                sha256  56546ce68cbedd09757df86dedf257eb3340d5271f78c1556b55cd2e92ac4fd3

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}/fltk|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 "Snapshots:.*\n.*v(1\\.3\\.x-r\\d+)"
