# -*- 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                gdchart
version             0.11.5
revision            8
categories          graphics
maintainers         nomaintainer
description         Easy to use C API, high performance library.
long_description    Create charts and graphs in PNG, GIF and WBMP format.
homepage            http://www.fred.net/brv/chart/
platforms           darwin
master_sites        http://www.fred.net/brv/chart/
distname            ${name}${version}dev

checksums           md5 a4af7bc927d8b88934da56fce10a7a3c \
                    sha1 c23e1cd233c38ac007b57420c20a5fa7fa206841 \
                    rmd160 be9b11eb446738d9e30d78e8ce73b8a418b1f520
use_parallel_build  no

depends_build       port:libpng \
                    port:zlib \
                    port:gd2 \
                    path:include/turbojpeg.h:libjpeg-turbo \
                    port:freetype

set CFLAGS ${configure.cflags}

post-patch {
    # Use prefix
    reinplace s:/usr/local:${prefix}: ${worksrcpath}/Makefile
}

use_configure       no

build.args \
    CC=${configure.cc} \
    GD_LIB=libgd.dylib

pre-build {
    build.args-append \
        CFLAGS="${CFLAGS}"
}

destroot.args \
    PREFIX_INC=${destroot}${prefix}/include \
    PREFIX_LIB=${destroot}${prefix}/lib

post-destroot {
    set docdir ${prefix}/share/doc/${name}
    xinstall -d ${destroot}${docdir}
    xinstall -m 644 ${worksrcpath}/README.txt ${destroot}${docdir}
}

variant universal {
    append CFLAGS " ${configure.universal_cflags}"

    post-patch {
        # Use libtool instead of ar
        reinplace "s:ar cr:libtool -o:" \
            ${worksrcpath}/Makefile
    }
}

livecheck.type      regex
livecheck.url       ${homepage}dev011x.htm
livecheck.regex     {gdchart([0-9.]+)dev.tar.gz}
