# -*- 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 91223 2012-03-26 08:46:40Z and.damore@macports.org $
PortSystem 1.0

name                lua-luahpdf
version             1.1
revision            1
license             MIT
categories          devel
platforms           darwin
maintainers         and.damore openmaintainer
description         Lua module that lets you programmatically create PDF files
long_description    \
        LuaHPDF is a Lua module that lets you programmatically create PDF files using \
        Lua. It does this by binding to the Haru Free PDF Library, an open-source \
        library that manages the details of PDF generation. \
        With this module, you can write Lua programs that will produce PDF files that \
        include lines, text and graphics, PNG and JPEG images, compression, \
        encryption, Type1 and TrueType fonts, various character sets, outlines, \
        links.

homepage            http://code.google.com/p/luahpdf/
master_sites        http://luahpdf.googlecode.com/files/
checksums           md5     960a8b3a7f05fc225ae1b5f0feb2efd7 \
                    sha1    504c170769f1d13882ee9ccb15f55ad8b8e36799 \
                    rmd160  3c282cc152627fd40963d3a75667b9a1667c3f41

distname            luahpdf-${version}
depends_lib         port:lua \
                    port:libharu

patchfiles          patch-Makefile.diff
post-patch {
    reinplace   "s|%PREFIX%|${prefix}|"       ${worksrcpath}/Makefile
    reinplace "s|%COMPILER%|${configure.cc}|" ${worksrcpath}/Makefile
}

use_configure       no

build.env-append    CFLAGS="-I${prefix}/include ${configure.cflags} [get_canonical_archflags cc]" \
                    LDFLAGS="${configure.ldflags} [get_canonical_archflags ld]"

post-destroot {
    xinstall -d -m 755                                 ${destroot}${prefix}/share/examples
    file copy   ${worksrcpath}/demo                    ${destroot}${prefix}/share/examples/${name}
    file rename ${destroot}${prefix}/share/doc/luahpdf ${destroot}${prefix}/share/doc/${name}
}

