# -*- 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           boost 1.0
PortGroup           cmake 1.1
PortGroup           conflicts_build 1.0
PortGroup           github 1.0
PortGroup           openssl 1.0

boost.version       1.81

github.setup        NickvisionApps libnick 2025.9.4
revision            0
categories          devel
license             GPL-3
maintainers         {@nlogozzo} {@barracuda156 macos-powerpc.org:barracuda} openmaintainer
description         Cross-platform base for native Nickvision applications
long_description    {*}${description}
checksums           rmd160  98549eb1f39147f5d51894117834218be3772e0d \
                    sha256  3071fdfba3f3d444a8d5fc41e5fe1babd3f38d3c3c798b49d095f2815c7608dc \
                    size    142428
github.tarball_from archive

# https://github.com/NickvisionApps/libnick/issues/80
patchfiles-append   patch-CMakeLists.txt.diff \
                    patch-config.cmake.diff

depends_build-append \
                    port:gtest \
                    port:maddy-parser \
                    path:bin/pkg-config:pkgconfig

depends_lib-append  port:cpr \
                    port:curl \
                    path:lib/pkgconfig/glib-2.0.pc:glib2 \
                    port:gettext-runtime \
                    port:sqlcipher

set sqlroot         ${prefix}/libexec/sqlcipher

configure.pkg_config_path-prepend \
                    ${sqlroot}/lib/pkgconfig

compiler.cxx_standard   2020

# https://github.com/NickvisionApps/libnick/issues/50
conflicts_build     boost

# FIXME: https://github.com/NickvisionApps/libnick/issues/75
if {${os.platform} eq "darwin" && ${configure.cxx_stdlib} eq "libc++"} {
    configure.args-append \
                    -DBUILD_TESTING=OFF
}

configure.cppflags-prepend \
                    -I${sqlroot}/include

variant secret description "Use libsecret instead of Apple keychain" {
    depends_lib-append \
                    port:libsecret
    configure.args-append \
                    -DUSE_LIBSECRET=ON
}

if {${os.platform} ne "darwin" || ${os.major} < 12} {
    default_variants-append \
                    +secret
}
