# $Id: Portfile 57453 2009-09-11 08:17:15Z ryandesign@macports.org $

PortSystem                      1.0

name                            libungif
version                         4.1.4
revision                        4
categories                      graphics
maintainers                     ryandesign
platforms                       darwin
homepage                        http://sourceforge.net/projects/giflib/
master_sites                    sourceforge:giflib
use_bzip2                       yes

description                     Tools and library routines for working with \
                                GIF images

long_description                GIF loading and saving shared library \
                                (Saving uses an uncompressed gif algorithm\
                                that does not use LZW compression.)

checksums                       md5     76865bc1bed90ecb5992a1edcc4d6c15 \
                                sha1    af687ffbcfe6afd1d76e33ea8cf27ffb02ed61fc \
                                rmd160  f96782d4e305e393a22acd84317c13dc265a21f3

patchfiles                      patch-gif_lib.h.diff

configure.args                  --without-x

use_parallel_build              yes

set docdir                      ${prefix}/share/doc/${name}-${version}

post-destroot {
    xinstall -d ${destroot}${docdir}
    xinstall -m 0644 -W ${worksrcpath} \
        AUTHORS \
        BUGS \
        COPYING \
        ChangeLog \
        NEWS \
        TODO \
        UNCOMPRESSED_GIF \
        ${destroot}${docdir}
}

variant doc description {Install extra documentation} {
    post-destroot {
        xinstall -d ${destroot}${docdir}/html
        eval xinstall -m 0644 [glob ${worksrcpath}/doc/*.{html,png,txt}] \
            ${destroot}${docdir}/html
    }
}

variant x11 description {Enable X support} {
    use_autoreconf yes
    autoreconf.args -fv
    
    depends_lib-append \
        port:xorg-libsm \
        port:xorg-libX11
    configure.args-delete   --without-x
}

if {[variant_isset universal]} {
    patchfiles-append   patch-ltmain.sh-universal.diff
}

livecheck.regex                 "<title>${name} [lindex [split ${version} .] 0].x ${name}-(\\d+(?:\\.\\d+)*) released .*</title>"
