# $Id: Portfile,v 1.2 2006/07/16 06:24:20 yves Exp $

PortSystem    1.0
name          fltk
version       1.1.6
categories    x11
maintainers   darwinports@opendarwin.org
description   Fast Light Tool Kit
homepage      http://www.fltk.org/
platforms     darwin

long_description FLTK (pronounced fulltick) \
    is a cross-platform C++ GUI toolkit for UNIX/Linux (X11), \
    Microsoft Windows, and MacOS 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.

master_sites   sourceforge

use_bzip2      yes
distfiles      ${name}-${version}-source${extract.suffix}
checksums      md5 95d340977d13edea12e98d787a668b32

depends_lib    lib:libX11.6:XFree86 port:jpeg \
               port:libpng port:Xft2 port:zlib

patchfiles     patch-fltk-config.in patch-makeinclude.in
post-patch {
    reinplace "s|Carbon.H|Carbon.h|g" \
        ${worksrcpath}/src/Fl_Menu.cxx \
        ${worksrcpath}/src/Fl_Preferences.cxx
}

configure.env  LDFLAGS="-L${prefix}/lib" \
               CFLAGS="-I${prefix}/include" \
               CPPFLAGS="-I${prefix}/include"

configure.args --enable-xft --enable-shared \
               --mandir=${prefix}/share/man \
               --with-x

variant darwin {
    patchfiles-append patch-configure
}

variant macosx {
    patchfiles-append patch-fluid-Makefile
    post-install {
        ui_msg "
==============================================================
You need to do 
'sudo fltk-config --post /Applications/DarwinPorts/fltk/fluid'
before using fluid
=============================================================="
    }
}