# -*- 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           boost 1.0
PortGroup           cmake 1.1
PortGroup           github 1.0

github.setup        dannyedel dspdfviewer 1.15.1 v
revision            1

# Drop on next update:
if {${os.platform} eq "darwin" && ${os.major} < 10} {
    incr revision
}

categories          office
license             GPL-2+
maintainers         {@ryanakca debian.org:rak} \
                    openmaintainer
description         dual-screen LaTeX beamer presentation viewer
long_description    Provides a dual-screen presentation viewer for slides \
                    produced with the beamer LaTeX package. It takes slides \
                    produced with the "show notes on second screen" beamer \
                    option, splits them, and shows the slides in one window \
                    and the notes in a second window. The second window also \
                    includes a talk timer, a preview of upcoming slides, \
                    and other features.

checksums           rmd160  34d4fae5923892d3ba7019d45b516bf469ce11ad \
                    sha256  c5b6f8c93d732e65a27810286d49a4b1c6f777d725e26a207b14f6b792307b03 \
                    size    165202
github.tarball_from archive

if {${os.platform} ne "darwin" || ${os.major} > 10} {
    PortGroup       qt5 1.0

    qt5.depends_component \
                    qttools

    depends_lib-append \
                    port:poppler-qt5
} else {
    PortGroup       legacysupport 1.1
    PortGroup       qt4 1.0

    # dspdfviewer(97639) malloc: *** error for object 0x820828: Non-aligned pointer being freed
    legacysupport.redirect_bins dspdfviewer

    depends_lib-append \
                    port:poppler-qt4-mac
    configure.pkg_config_path-append \
                    ${prefix}/libexec/poppler-qt4-mac/lib/pkgconfig

    configure.args-append \
                    -DUseQtFive=OFF
    configure.ldflags-append \
                    -Wl,-L${prefix}/libexec/poppler-qt4-mac/lib
}

# Use prerendered pdfs for testing instead of requiring a pdflatex installation
configure.args-append \
                    -DUsePrerenderedPDF=ON

if {${os.arch} eq "powerpc"} {
    # Without this configure breaks:
    configure.args-append \
                    -DRunTestsOnBigEndian=ON
}

# Compiler does not support -std=c++11, trying c++0x
# Compiler does not support -std=c++0x either.  Please upgrade your compiler.
compiler.cxx_standard   2011
