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

name            libprelude
version         5.2.0
revision        1
categories      security
license         LGPL-2.1+
maintainers     {gmail.com:thomas.andrejak @ToToL} openmaintainer

description     Secure Connections between all Sensors and the Prelude Manager

long_description \
        Libprelude is a collection of generic functions providing communication \
        between all Sensors, like IDS (Intrusion Detection System), and the Prelude \
        Manager. It provides a convenient interface for sending and receiving IDMEF \
        (Information and Event Message Exchange Format) alerts to Prelude Manager with \
        transparent SSL, fail-over and replication support, asynchronous events and \
        timer interfaces, an abstracted configuration API (hooking at the command-line, \
        the configuration line, or wide configuration, available from the Manager), and \
        a generic plugin API. It allows you to easily turn your favorite security \
        program into a Prelude sensor.

homepage        https://www.prelude-siem.org/
master_sites    ${homepage}pkg/src/${version}/
build.type      gnu

checksums       rmd160  0a1cb980fa55d87b35f575c706415580c7b99b89 \
                sha256  187e025a5d51219810123575b32aa0b40037709a073a775bc3e5a65aa6d6a66e \
                size    2902019
 
depends_build-append \
                port:pkgconfig \
                port:gtk-doc

depends_lib     port:gettext path:lib/pkgconfig/gnutls.pc:gnutls port:libgpg-error \
                port:libiconv port:libtasn1 port:libtool port:zlib

patchfiles        patch-fix-test_rwlock1.diff \
                  patch-fix_gtkdoc_1.32.diff \
                  patch-fix_prelude_tests_timer.diff \
                  patch-fix_timegm.diff \
                  patch-fix_perl_rpath.diff \
                  patch-src-idmef-class.diff

# We patch configure.ac and Makefile.am, but this also teaches
# libtool to pass the -stdlib flag when making dynamic libraries.
use_autoreconf  yes
autoreconf.args -fvi

configure.args  --mandir=${prefix}/share/man \
                --with-html-dir=${prefix}/share/doc \
                --localstatedir=${prefix}/var \
                --without-swig \
                --without-lua \
                --without-perl \
                --without-python3 \
                --without-python2 \
                RUBY=no \
                HAVE_CXX=yes

# checking size of long... configure: error: cannot determine a size for long
universal_variant   no

destroot.keepdirs \
        ${destroot}${prefix}/var/spool/prelude \
        ${destroot}${prefix}/etc/prelude/profile

if {${os.platform} eq "darwin" && ${os.major} < 17} {
    if {[variant_isset python38]} {
        pre-fetch {
        # needs fmemopen which is present in OSX SDK 10.13 and later
            ui_error "${name} python bindings are not available on OSX 10.12 and earlier."
            return -code error "+python38 is not supported`"
        }
    }
} else {
    # coordinate default python version with libpreludedb
    default_variants    +python38
}

variant python38 description {python3.8 bindings} {
        configure.args-replace  --without-python3 \
                                --with-python3=${prefix}/bin/python3.8
        depends_lib-append port:python38
}

variant perl description {perl bindings} {
        configure.args-delete   --without-perl
        configure.args-append   --with-perl=${prefix}/bin/perl
        depends_lib-append path:bin/perl:perl5
}

livecheck.type  regex
livecheck.url   ${homepage}projects/prelude/files
livecheck.regex ${name}-(\[0-9.\]+)${extract.suffix}