# -*- 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 80038 2011-07-03 10:59:43Z ryandesign@macports.org $

PortSystem                      1.0

name                            libungif
version                         4.1.4
set major                       [lindex [split ${version} .] 0]
revision                        4
categories                      graphics
maintainers                     ryandesign
platforms                       darwin
homepage                        http://sourceforge.net/projects/giflib/
master_sites                    sourceforge:project/giflib/${name}%20${major}.x/${name}-${version}
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.type                  sourceforge
livecheck.regex                 /${name}-(\[0-9.\]+)${extract.suffix}
