# -*- 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 91792 2012-04-10 17:55:57Z jeremyhu@macports.org $

PortSystem                  1.0

name                        gdk-pixbuf2
set my_name                 gdk-pixbuf
version                     2.24.0
revision                    1
epoch                       2
license                     LGPL
set branch                  [join [lrange [split ${version} .] 0 1] .]
categories                  graphics
maintainers                 devans openmaintainer
homepage                    http://www.gtk.org/
platforms                   darwin
distname                    ${my_name}-${version}
use_bzip2                   yes

description                 The gdk-pixbuf-2.0 library

long_description            ${description}, previously bundled with gtk2, is \
                            packaged separately as of gtk2 2.22.

master_sites                gnome:sources/${my_name}/${branch}/ \
                            ftp://ftp.gtk.org/pub/${my_name}/${branch}/

checksums                   rmd160  5cd81ae03cc47878e253855d3b5043f734287187 \
                            sha256  38d2630314e6d91976bffd833236f84fefa440a9038f86dc422820a39f2e3700

depends_build               port:pkgconfig

depends_lib                 path:lib/pkgconfig/glib-2.0.pc:glib2 \
                            port:libpng \
                            port:jasper \
                            port:tiff

pre-activate {
    if { [file exists ${prefix}/lib/pkgconfig/gdk-pixbuf-2.0.pc]
        && ![catch {set vers [lindex [registry_active gtk2] 0]}]
        && [vercmp [lindex $vers 1] 2.22.0] < 0} {
        
        set deactivate_proc registry_deactivate_composite
        if {[info commands registry_deactivate_composite] == {}} {
            set deactivate_proc registry_deactivate
        }
        $deactivate_proc gtk2 "" [list ports_nodepcheck 1]
    }
}

configure.args              --with-libjasper \
                            --enable-introspection=no

test.run                    yes
test.target                 check

post-activate {
        system "${prefix}/bin/gdk-pixbuf-query-loaders --update-cache"
}

livecheck.type              regex
livecheck.url               http://ftp.gnome.org/pub/gnome/sources/${my_name}/${branch}/
livecheck.regex             {LATEST-IS-(\d+(?:\.\d+)*)}
