# -*- 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.5
github.tarball_from archive
revision            0
license             GPL-2 LGPL-2
categories          graphics
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  49b159e88ba177ad2561b5cf6cbd68ecbe83272f5488bc527e44f97dbf695273 \
                    rmd160  0b2e4178be4a70bbd345462ce6dba4bae768e50d \
                    size    1696209

# 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+)}
