# -*- 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 120197 2014-05-19 04:32:45Z ryandesign@macports.org $

PortSystem          1.0

name                mupdf
version             1.4
categories          graphics
platforms           darwin
maintainers         gmail.com:starkhalo
license             GPL-3+

description         lightweight PDF and XPS viewer and parser/rendering library

long_description    MuPDF is a lightweight PDF and XPS viewer and \
                    parser/rendering library. \
                    \
                    The renderer in MuPDF is tailored for high-quality \
                    anti-aliased graphics. It renders text with metrics and \
                    spacing accurate to within fractions of a pixel for the \
                    highest fidelity in reproducing the look of a printed \
                    page on screen. \
                    \
                    MuPDF is also small, fast, and yet complete. It supports \
                    PDF 1.7 with transparency, encryption, hyperlinks, \
                    annotations, search and many other bells and whistles. \
                    MuPDF can also read XPS documents (OpenXPS ECMA-388).

homepage            http://www.mupdf.com/

master_sites        ${homepage}downloads/
distname            ${name}-${version}-source

checksums           rmd160 368140a0f825483268faaf778328bc6c3f4d461f \
                    sha256 018bab9520b5e93bb33ab07b0472fdf9f768c5801769f95b9a696941b633ec22

depends_build       port:pkgconfig

depends_lib         port:freetype \
                    port:jbig2dec \
                    port:jpeg \
                    port:openjpeg \
                    port:xorg-libXext \
                    port:zlib

patchfiles          patch-Makerules.diff

use_configure       no

variant universal   {}

build.args          PREFIX=${prefix}
build.args-append   CC=${configure.cc} \
                    CXX=${configure.cxx} \
                    CPP=${configure.cpp}

build.env           CFLAGS="${configure.cflags} [get_canonical_archflags cc]" \
                    LDFLAGS="${configure.ldflags} [get_canonical_archflags ld]" \
                    build=release \
                    verbose=yes

eval destroot.env   ${build.env}

destroot.destdir    prefix=${destroot}${prefix}

# https://trac.macports.org/ticket/33240
# Mac OS X Tiger has an old version of `make`, needs to use GNU make
platform darwin 8 {
    depends_build-append port:gmake
    build.cmd ${prefix}/bin/gmake
} 

livecheck.type      regex
livecheck.url       ${master_sites}
livecheck.regex     ${name}-(\\d\\.\\d)-source
