# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:filetype=tcl:et:sw=4:ts=4:sts=4

PortSystem          1.0
PortGroup           github 1.0
PortGroup           meson 1.0

set port_ver_major  3
name                libsigcxx${port_ver_major}
github.setup        libsigcplusplus libsigcplusplus ${port_ver_major}.8.1
set gname           libsigc++
revision            0
categories          devel
license             LGPL-2.1
maintainers         {devans @dbevans} {mascguy @mascguy} openmaintainer

description         Typesafe callback framework for C++
long_description    libsigc++ implements a typesafe callback system for standard C++. It allows \
                    you to define signals and to connect those signals to any callback function, \
                    either global or a member function, regardless of whether it is static or virtual. \
                    This is the libsigc++-3.0 API, which installs in parallel with libsigc++-2.0. \
                    The API is not significantly different, but the implementation is far simpler, \
                    using variadic templates instead of generating C++ code from .m4 filessystem.
homepage            https://libsigcplusplus.github.io/libsigcplusplus/
distname            ${gname}-${version}
use_xz              yes
checksums           rmd160  b0120b6a5e58247b6ea32393b02f8c9086eed0a5 \
                    sha256  4ff41d1474e501d3baeced4c989d154338206ac16471e614376496b63fe252d1 \
                    size    996324
github.tarball_from releases

# Disable unexpected download of subprojects
meson.wrap_mode     nodownload

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

# requires a compiler that supports C++17
compiler.cxx_standard   2017

# support for C++17 std::invoke_result in Apple clang requires Xcode 10 or better
compiler.blacklist-append \
                    {clang < 1000} macports-clang-3.* {macports-clang-[4-9].0}
compiler.fallback-append \
                    macports-clang-8.0 macports-clang-7.0

# powerpc platforms want to use macports-gcc-6
# C++17 support requires macports-gcc-7
compiler.blacklist-append \
                    macports-gcc-6
compiler.fallback-append \
                    macports-gcc-7

configure.perl      /usr/bin/perl
configure.env-append \
                    M4=${prefix}/bin/gm4

configure.args-append \
                    -Dbuild-deprecated-api=true \
                    -Dbuild-documentation=false \
                    -Dbuild-examples=false

post-destroot {
    set docdir ${prefix}/share/doc/${gname}-${port_ver_major}.0
    xinstall -d ${destroot}${docdir}
    xinstall -m 0644 -W ${worksrcpath} \
        COPYING ChangeLog NEWS README.md \
        ${destroot}${docdir}
}
