# -*- 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
PortGroup           active_variants 1.1

name                advi
version             1.10.2
revision            5
categories          x11 graphics
license             LGPL
maintainers         nomaintainer
description         TeX DVI previewer
long_description    Active-DVI is an O'Caml Unix-platform DVI previewer and a \
                    programmable presenter for slides written in LaTeX.

homepage            http://advi.inria.fr/

master_sites        ${homepage}

checksums           rmd160  7609b68e1a05b1057bb8f5c9e5c413c5d8111263 \
                    sha256  01556d20896db57c1d05961b2dd48a44d2fbca2adb10d4a9ded732bcf6cb0cc6 \
                    size    9772060

# you can install hevea if you want additional functionality
depends_run         path:bin/kpsewhich:texlive-basic

depends_build       port:ocaml-findlib \
                    port:ImageMagick

depends_lib         port:ocaml \
                    port:camlimages \
                    port:xorg-libXinerama \
                    port:xpm \
                    port:freetype

# advi 1.10.2 only supports OCaml < 5; upstream advi 2.x (github.com/diremy/advi)
# requires camlimages >= 5.0.5 and ocaml >= 5.3, but has no released tag yet.
# Mark broken on OCaml 5 until upstream cuts a release.
known_fail          yes
pre-fetch {
    ui_error "${name} @${version} requires OCaml < 5; upstream has not released a"
    ui_error "version compatible with the OCaml 5.x compiler shipped by port:ocaml."
    return -code error "incompatible OCaml version"
}

# see https://trac.macports.org/ticket/43747
build.env-append    LANG=C

# avoid:
#    Error: This expression has type bytes but an expression was expected of type
#             string
build.env-append    OCAMLPARAM="safe-string=0,_"


post-activate {
    system "${prefix}/bin/mktexlsr"
}
post-deactivate {
    system "${prefix}/bin/mktexlsr"
}

livecheck.type      regex
livecheck.url       ${homepage}
livecheck.regex     ">Version (\[0-9.\]+)"
