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

github.setup                eiskaltdcpp eiskaltdcpp e1cad59efa20b892d3495385fd7b042e1c67c689
version                     2.4.2-github-2024.10.25
revision                    0
epoch                       1
categories                  net p2p www
license                     GPL-3
maintainers                 {@barracuda156 gmail.com:vital.had} openmaintainer
description                 Direct Connect protocols file sharing
long_description            EiskaltDC++ is a cross-platform program that uses the Direct Connect (DC aka NMDC) and Advanced Direct Connect (ADC) protocols. \
                            It is compatible with DC++, AirDC++, FlylinkDC++ and other DC clients. EiskaltDC++ also interoperates with all common DC hub software.

checksums                   rmd160  058de16664f0399f7167c9e2b49584061f61dc9d \
                            sha256  55109ca885f4e8fd4d8d646dc6c5047a1898f83d822b3b5d5d9a194db7b77c7c \
                            size    5904731
github.tarball_from         archive

patchfiles-append           patch-CMakeLists.diff

depends_build-append        port:gettext \
                            path:bin/git:git
depends_lib-append          port:bzip2 \
                            port:gettext-runtime \
                            port:jsoncpp \
                            port:libiconv \
                            port:libidn2 \
                            port:miniupnpc \
                            path:lib/pkgconfig/pango.pc:pango \
                            port:pcre2 \
                            port:sqlite3 \
                            port:zlib

# https://github.com/eiskaltdcpp/eiskaltdcpp/issues/508
conflicts_build             libunwind

configure.args-append       -DBUILD_STATIC=OFF \
                            -DCHECK_GTK_DEPRECATED=OFF \
                            -DDBUS_NOTIFY=OFF \
                            -DENABLE_STACKTRACE=OFF \
                            -DGETTEXT_SEARCH_PATH=${prefix}/bin \
                            -DHAIKU_PKG=OFF \
                            -DINSTALL_RUNTIME_PATH=ON \
                            -DJSONRPC_DAEMON=OFF \
                            -DLOCAL_ASPELL_DATA=OFF \
                            -DLOCAL_JSONCPP=OFF \
                            -DLUA_SCRIPT=OFF \
                            -DNO_UI_DAEMON=ON \
                            -DPERL_REGEX=ON \
                            -DUSE_ASPELL=OFF \
                            -DUSE_CCACHE=OFF \
                            -DUSE_CLI_JSONRPC=ON \
                            -DUSE_CLI_XMLRPC=OFF \
                            -DUSE_GTK=OFF \
                            -DUSE_GTK3=OFF \
                            -DUSE_IDN2=ON \
                            -DUSE_JS=OFF \
                            -DUSE_LIBCANBERRA=OFF \
                            -DUSE_LIBGNOME2=OFF \
                            -DUSE_LIBNOTIFY=OFF \
                            -DUSE_MINIUPNP=ON \
                            -DUSE_PROGRESS_BARS=ON \
                            -DUSE_QT=OFF \
                            -DUSE_QT_QML=OFF \
                            -DUSE_QT_SQLITE=ON \
                            -DUSE_QT5=OFF \
                            -DUSE_XATTR=OFF \
                            -DWITH_DEV_FILES=ON \
                            -DWITH_DHT=ON \
                            -DWITH_EMOTICONS=ON \
                            -DWITH_EXAMPLES=OFF \
                            -DWITH_LUASCRIPTS=OFF \
                            -DWITH_SOUNDS=ON \
                            -DXMLRPC_DAEMON=OFF

compiler.cxx_standard       2014

variant qt4 conflicts qt5 description "Build with Qt4 GUI" {
    PortGroup               qt4 1.0

    # https://github.com/eiskaltdcpp/eiskaltdcpp/issues/501
    patchfiles-append       patch-mac-qt4.diff

    configure.args-replace  -DUSE_QT=OFF -DUSE_QT=ON
}

variant qt5 conflicts qt4 description "Build with Qt5 GUI" {
    PortGroup               qt5 1.0

    qt5.depends_component   qtmultimedia qttools

    configure.args-replace  -DUSE_QT5=OFF -DUSE_QT5=ON
}

if {${os.platform} eq "darwin" && ${os.major} < 20} {
    default_variants-append +qt4
} else {
    default_variants-append +qt5
}

post-destroot {
    xinstall -d ${destroot}${applications_dir}/${name}
    move ${destroot}${prefix}/${name}.app ${destroot}${applications_dir}/${name}
    # https://github.com/eiskaltdcpp/eiskaltdcpp/issues/516
    move ${destroot}${prefix}/eiskaltdcpp-daemon.app/Contents/MacOS/eiskaltdcpp-daemon ${destroot}${prefix}/bin/eiskaltdcpp-daemon
    delete -force ${destroot}${prefix}/eiskaltdcpp-daemon.app
}
