# -*- 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

PortSystem          1.0

name                giflib6
version             6.1.3
revision            3

set major           [lindex [split ${version} .] 0]
categories          graphics
maintainers         {mps @Schamschula} openmaintainer
license             MIT
homepage            https://sourceforge.net/projects/giflib
master_sites        sourceforge:project/giflib/giflib-6.x/
distname            giflib-${version}

description         GIF library using patented LZW algorithm
long_description    GIF loading and saving shared library. \
                    Uses the LZW algorithm.

checksums           rmd160  d434e0e75ec04aa0cb2a73f9d6e0fcd251b54922 \
                    sha256  b65b66b99f0424b93525f987386f22fc5efb9da2bfc92ad4a532249aaffbab0e \
                    size    470579

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

patchfiles          patch-Makefile.diff
# MacPorts build is broken, fix that:
patchfiles-append   patch-fix-dylibs.diff

post-patch {
    reinplace "s|%PREFIX%|${prefix}|" ${worksrcpath}/Makefile
}

use_configure       no

use_parallel_build  no

compiler.c_standard 1999

build.args-append   CC=${configure.cc} \
                    OFLAGS="${configure.optflags}"

post-destroot {
    xinstall -d ${destroot}${docdir}
    xinstall -W ${worksrcpath} COPYING history.adoc NEWS README.adoc TODO ${destroot}${docdir}
}

variant doc description "Install HTML documentation" {
    patchfiles-append \
                    patch-Makefile-doc.diff
}

livecheck.regex     giflib-(${major}\\.\[0-9.\]+)${extract.suffix}
