# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=tcl:et:sw=4:ts=4:sts=4
# $Id: Portfile 119059 2014-04-15 23:16:04Z devans@macports.org $

PortSystem      1.0

name            gimp
version         2.8.10
license         none
set branch      [join [lrange [split ${version} .] 0 1] .]
categories      graphics
maintainers     devans
homepage        http://www.gimp.org/
platforms       darwin
supported_archs noarch

description     GIMP - Batteries Included
long_description \
                This is a META port for the GNU Image Manipulation Program (GIMP) \
                which includes support for icns, JP2000 and RAW formats, \
                content-aware rescaling, Gutenprint and scanner frontends and, \
                optionally, an animation tool (the GIMP Animation Package) \
                and an image processing and scientific visualization tool \
                (GREYC's Magic Image Converter).

depends_lib     port:icns-gimp \
                port:gimp-jp2 \
                port:gimp-lqr-plugin \
                port:gtk-nodoka-engine \
                port:gutenprint \
                port:ufraw \
                port:xsane

platform macosx {
    depends_lib-append  port:gimp-app
    #
    # these use the deprecated QuickDraw API that is not available
    # in a 64-bit version - ticket #21391
    #
    # if +quartz is set, remove ufraw which uses CMFlattenProfile if gtk2 is
    # built with Quartz support and is also not available in a 64-bit version
    # ticket #23675
    #
    if {${os.platform} eq "darwin"} {
        if { ![string match *64* $build_arch] } {
            depends_lib-append  port:macclipboard-gimp \
                                port:macfile-gimp
        } else {
            if {[variant_isset quartz]} {
                depends_lib-delete port:ufraw
            }
        }
    }
}

distfiles
use_bzip2       yes
use_configure   no
build           {}

destroot {
    xinstall -d ${destroot}${prefix}/share/gimp/2.0/themes/Nodoka
    ln -s ${prefix}/share/themes/Nodoka/gtk-2.0/gtkrc ${destroot}${prefix}/share/gimp/2.0/themes/Nodoka
}

variant gmic description "Include GREYC's Magic Image Converter (G'MIC)." {
    depends_lib-append  port:gmic
}

variant animation description "Include the GIMP Animation Package (gimp-gap)." {
    depends_lib-append  path:lib/gimp/2.0/plug-ins/gap_plugins:gimp-gap-devel
}

variant quartz {}

livecheck.type  regex
livecheck.url   http://ftp.gtk.org/pub/gimp/v${branch}/
livecheck.regex "gimp-(${branch}(?:\\.\\d+)*)${extract.suffix}"
