# -*- 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
PortGroup           meson 1.0

name                cairomm-1.0
set my_name         cairomm
version             1.14.6
revision            0

# The 1.14.x release series is the latest for ABI 1.0
set pinned_ver      1.14

categories          graphics
license             LGPL-2+
maintainers         {devans @dbevans} {mascguy @mascguy} openmaintainer
description         cairomm is a C++ wrapper for the cairo graphics library.
long_description    cairomm-1.0 is the legacy ABI predating the cairomm-1.16 ABI. \
                    The cairomm-1.0 ABI is used by gtkmm-2.4 and gtkmm-3.0
homepage            https://www.cairographics.org

# Disable unexpected download of subprojects
meson.wrap_mode     nodownload

master_sites        ${homepage}/releases/
distname            ${my_name}-${version}
dist_subdir         ${my_name}
use_xz              yes

checksums           rmd160  635313c1bbbe69ac5a4ecfc27f28b4efa76b7c75 \
                    sha256  7e0d5c7f29175d573a03ab5c45aef63f48dd91a5caf335a404cd763e4b7cea4a \
                    size    632112

depends_build-append \
                    port:mm-common \
                    path:bin/pkg-config:pkgconfig

depends_lib-append \
                    path:lib/pkgconfig/cairo.pc:cairo \
                    port:libsigcxx2

# cairomm > 1.10.0 requires C++11 or better
compiler.cxx_standard 2011

configure.args-append \
                    -Dboost-shared=false \
                    -Dbuild-documentation=false \
                    -Dbuild-examples=false \
                    -Dbuild-tests=false

# dummy variants to ensure that this port gets rebuilt if
# the corresponding variants for cairo change
variant x11 {}
variant quartz {}

default_variants +x11 +quartz

if {[variant_isset quartz]} {
    require_active_variants path:lib/pkgconfig/cairo.pc:cairo quartz
}

if {[variant_isset x11]} {
    require_active_variants path:lib/pkgconfig/cairo.pc:cairo x11
}

variant docs description {Build documentation} {
    depends_build-append \
                    port:doxygen \
                    port:graphviz \
                    port:libxslt

    configure.args-replace \
                    -Dbuild-documentation=false \
                    -Dbuild-documentation=true
}

# TODO: Examples aren't automatically installed by upstream's build script; we need to copy ourselves
#variant examples description {Build example programs} {
#    configure.args-replace \
#                    -Dbuild-examples=false \
#                    -Dbuild-examples=true
#}

livecheck.type      regex
livecheck.url       [lindex ${master_sites} 0]
livecheck.regex     ${my_name}-(${pinned_ver}\\.\[0-9\]+)
