# -*- 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

legacysupport.newest_darwin_requires_legacy 16
legacysupport.use_mp_libcxx yes

github.setup        qpdf qpdf 11.9.0 v
revision            0

categories          textproc pdf
license             Apache-2
maintainers         {mps @Schamschula} openmaintainer

description         content-preserving PDF transformation system
long_description    QPDF is a command-line program that does structural, \
                    content-preserving transformations on PDF files.

homepage            http://qpdf.sourceforge.net/
github.tarball_from releases

checksums           rmd160  99bc15e15cce5dd42d8611791d495aeed83e1b56 \
                    sha256  9f5d6335bb7292cc24a7194d281fc77be2bbf86873e8807b85aeccfbff66082f \
                    size    18552462

depends_build-append \
                    port:perl5

depends_lib-append  path:include/turbojpeg.h:libjpeg-turbo \
                    port:libxml2 \
                    port:libxslt \
                    port:zlib

compiler.cxx_standard   2017

cmake.build_type    Release
configure.args      -DUSE_IMPLICIT_CRYPTO=NO \
                    -DREQUIRE_CRYPTO_NATIVE=YES \
                    -DREQUIRE_CRYPTO_GNUTLS=NO \
                    -DREQUIRE_CRYPTO_OPENSSL=NO

platform darwin 8 {
    configure.cppflags-append -D__DARWIN_UNIX03
}

variant gnutls conflicts openssl description {Build against gnutls} {
    depends_lib-append      path:lib/pkgconfig/gnutls.pc:gnutls
    configure.args-delete   -DREQUIRE_CRYPTO_GNUTLS=NO
    configure.args-append   -DREQUIRE_CRYPTO_GNUTLS=YES
}

variant openssl conflicts gnutls description {Build against openssl} {
    depends_lib-append      port:openssl
    configure.args-delete   -DREQUIRE_CRYPTO_OPENSSL=NO
    configure.args-append   -DREQUIRE_CRYPTO_OPENSSL=YES
}

if {![variant_isset openssl]} {
    default_variants        +gnutls
}
