# -*- 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 77597 2011-04-06 00:41:22Z blb@macports.org $

PortSystem              1.0

name                    libgsf
version                 1.14.20
license                 LGPL-2.1
set branch              [join [lrange [split $version .] 0 1] .]
maintainers             nomaintainer
categories              gnome
platforms               darwin

description \
    An I/O abstraction library for dealing with file formats

long_description \
    libgsf aims to provide an efficient extensible \
    i/o abstraction for dealing with different \
    structured file formats.

homepage                http://www.gnome.org/
master_sites            gnome:sources/$name/$branch/

use_bzip2               yes

checksums               sha1    d172b454c1b98f9c111df11e000b1ced050bdac9 \
                        rmd160  10477305a883681273b9f680d56484c6d289cc5d

depends_build           port:pkgconfig \
                        port:gconf \
                        port:intltool

depends_lib             port:libbonobo \
                        port:bzip2 \
                        port:gettext \
                        path:lib/pkgconfig/glib-2.0.pc:glib2 \
                        port:libxml2 \
                        port:zlib \
                        port:gnome-vfs

configure.args          --without-python \
                        --disable-schemas-install

post-destroot {
    set docdir ${prefix}/share/doc/${name}
    xinstall -d ${destroot}${docdir}
    xinstall -m 644 -W ${worksrcpath} AUTHORS COPYING COPYING.LIB NEWS README \
        ${destroot}${docdir}
}

post-activate {
    if {![variant_isset no_gnome]} {
        system "\
            export GCONF_CONFIG_SOURCE=`gconftool-2 --get-default-source` && \
            gconftool-2 --makefile-install-rule \
            ${prefix}/etc/gconf/schemas/*.schemas"
    }
}

variant no_gnome description "Disable GNOME support" {
    post-patch {
        reinplace {/^manpage_DATA/s/gsf-office-thumbnailer\.1//} \
            ${worksrcpath}/doc/Makefile.in
    }

    depends_build-delete \
        port:gconf

    depends_lib-delete \
        port:gnome-vfs \
        port:libbonobo

    configure.args-append \
        --without-bonobo \
        --without-gnome-vfs \
        GCONFTOOL=no
}

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