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

# Prior to updating please make sure toxic builds against a new version.
github.setup            TokTok c-toxcore 0.2.23 v
github.tarball_from     releases
distname                ${github.project}-v${version}
extract.mkdir           yes
checksums               rmd160  1a1f1a4d441b5943221440b3b4250df12b5cdf67 \
                        sha256  15cdd006ed7793dfc657e340ef9f218f6637d2fe5b130704d39b961389bb6cd6 \
                        size    1415886
name                    toxcore
epoch                   1
revision                0
categories              net security devel
maintainers             {disroot.org:nulflox @nilFinx} openmaintainer
license                 GPL-3
description             Tox is a peer to peer (serverless) instant messenger aimed at making security and privacy \
                        easy to obtain for regular users. It uses NaCl for its encryption and authentication.
long_description        {*}${description}
homepage                https://tox.chat

set py_ver              3.14
set py_ver_nodot        [string map {. {}} ${py_ver}]

depends_build-append    port:pkgconfig
depends_lib-append      path:lib/pkgconfig/vpx.pc:libvpx \
                        port:libconfig-hr \
                        port:libsodium \
                        port:libopus \
                        port:python${py_ver_nodot}

compiler.c_standard     1999
compiler.cxx_standard   2020
compiler.openmp_version 3.0

configure.args-append   -DBOOTSTRAP_DAEMON=ON \
                        -DBUILD_FUN_UTILS=ON \
                        -DBUILD_TOXAV=ON \
                        -DDHT_BOOTSTRAP=ON \
                        -DENABLE_SHARED=ON \
                        -DENABLE_STATIC=ON \
                        -DSTRICT_ABI=OFF

if {[string match *clang* ${configure.compiler}]} {
    # Undefined symbols for architecture x86_64: ___kmpc_*, _omp_get_max_threads
    configure.ldflags-append \
                        -L${prefix}/lib/libomp \
                        -lomp
}

notes "
This is an experimental cryptographic network library.\
It has not been formally audited by an independent third party\
that specializes in cryptography or cryptanalysis. Use this library at your own risk.
"
