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

github.setup            cnjinhao nana 1.7.4 v
revision                0

categories              graphics devel
license                 Boost-1
maintainers             {@barracuda156 macos-powerpc.org:barracuda} openmaintainer

description             A modern C++ GUI library
long_description        {*}${description}

checksums               rmd160  8e6648e7f9f4b946ed38eefe8df283cd65062688 \
                        sha256  56f7b1ed006c750fccf8ef15ab1e83f96751f2dfdcb68d93e5f712a6c9b58bcb \
                        size    581976
github.tarball_from     archive

# https://github.com/cnjinhao/nana/pull/689
# https://github.com/cnjinhao/nana/pull/731
patchfiles              0001-platform.cpp-add-missing-errno.h.patch \
                        0002-platform.cpp-use-correct-environ-on-macOS.patch \
                        0003-optflags.patch

platform darwin {
    # text_reshaping.hpp:216:50: error: no matching function for call to 'std::basic_string<wchar_t>::insert(std::basic_string<wchar_t>::const_iterator, wchar_t&)'
    if {${configure.cxx_stdlib} ne "libc++"} {
        patchfiles-append \
                        patch-old-cxx-abi.diff
    }
}

post-patch {
    reinplace "s|/opt/X11/include/|${prefix}/include|" ${worksrcpath}/build/cmake/OS.cmake
}

compiler.cxx_standard   2017

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

depends_lib-append      path:lib/pkgconfig/fontconfig.pc:fontconfig \
                        path:lib/pkgconfig/freetype2.pc:freetype \
                        port:libiconv \
                        port:Xft2 \
                        port:xorg-libX11 \
                        port:xorg-libXext

configure.args-append   -DNANA_CMAKE_INSTALL=ON
