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

name                podofo-0.10
github.setup        podofo podofo 0.10.6
github.tarball_from archive
revision            0

categories          graphics
license             GPL-2 LGPL-2
maintainers         {mascguy @mascguy} openmaintainer
description         PoDoFo is a library to work with the PDF file format.
long_description    PoDoFo is a library to work with the PDF file format. The PoDoFo library \
                    is a free, portable C++ library which includes classes to parse PDF files and \
                    modify their contents into memory. The changes can be written back to disk easily. \
                    The parser can also be used to extract information from a PDF file.
homepage            http://podofo.sourceforge.net/

checksums           sha256  276c7de843a4126c092cdf13935a2b01ec1b6415c10415fb97e04a12195c030a \
                    rmd160  f6196886c5bd230efc47c050c99599a70350cc63 \
                    size    1700275

# macports-libcxx needed for std::filesystem
legacysupport.newest_darwin_requires_legacy 18
legacysupport.use_mp_libcxx yes

depends_build-append \
                    path:bin/pkg-config:pkgconfig

depends_lib-append \
                    port:fontconfig \
                    port:freetype \
                    port:libidn \
                    path:include/turbojpeg.h:libjpeg-turbo \
                    port:libpng \
                    port:libunistring \
                    port:libxml2 \
                    port:lua \
                    path:lib/libssl.dylib:openssl \
                    port:tiff \
                    port:zlib

compiler.cxx_standard 2017
compiler.thread_local_storage yes

# Clear optflags; controlled by project, via cmake build type
configure.optflags

if {[variant_isset debug]} {
    cmake.build_type Debug
} else {
    cmake.build_type RelWithDebInfo
}

set port_prefix      ${prefix}/libexec/${subport}
cmake.install_prefix ${port_prefix}

configure.args-append \
                    -DPODOFO_BUILD_EXAMPLES:BOOL=TRUE \
                    -DPODOFO_BUILD_TEST:BOOL=FALSE \
                    -DPODOFO_BUILD_TOOLS:BOOL=TRUE

variant tests description {Enable tests} {
    depends_build-append \
                    port:catch2

    configure.args-replace \
                    -DPODOFO_BUILD_TEST:BOOL=FALSE \
                    -DPODOFO_BUILD_TEST:BOOL=TRUE

    configure.args-append \
                    -DCMAKE_BUILD_WITH_INSTALL_RPATH:BOOL=OFF

    test.run        yes
}

notes-append "
    Binaries for ${subport} are installed in ${port_prefix}/bin
"

github.livecheck.regex {(0.10.\d+)}
