# -*- 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.20 v
# Change github.tarball_from to 'releases' or 'archive' next update
github.tarball_from     tarball
name                    toxcore
epoch                   1
revision                1
categories              net security devel
maintainers             {@barracuda156 gmail.com:vital.had} 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

fetch.type              git
post-extract {
    system -W ${worksrcpath} "git submodule update --init"
}

set py_ver              3.11
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   2017
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.
"
