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

name                spice-server
version             0.15.2
revision            0

categories          devel
license             BSD
maintainers         {makr @mohd-akram} openmaintainer

description         Remote virtual machine server
long_description    {*}${description}
homepage            https://www.spice-space.org/

master_sites        https://www.spice-space.org/download/releases/
use_bzip2           yes
distname            spice-${version}

checksums           rmd160  a540a901e256ad2f806a25aa8861bcf7fdea507e \
                    sha256  6d9eb6117f03917471c4bc10004abecff48a79fb85eb85a1c45f023377015b81 \
                    size    1663326

# Needed for 'clock_gettime', along with newer CXX features like std::logical_not
legacysupport.newest_darwin_requires_legacy 18
legacysupport.use_mp_libcxx                 yes

depends_build-append \
                    path:bin/pkg-config:pkgconfig

depends_lib-append \
                    path:lib/pkgconfig/gdk-pixbuf-2.0.pc:gdk-pixbuf2 \
                    path:lib/pkgconfig/glib-2.0.pc:glib2 \
                    port:gstreamer1 \
                    port:gstreamer1-gst-plugins-base \
                    path:include/turbojpeg.h:libjpeg-turbo \
                    port:libopus \
                    path:lib/pkgconfig/pixman-1.pc:libpixman \
                    port:lz4 \
                    port:spice-protocol

patchfiles          visibility.patch

# https://trac.macports.org/wiki/WimplicitFunctionDeclaration#strchr
configure.checks.implicit_function_declaration.whitelist-append strchr

configure.args-append \
                    --disable-silent-rules \
                    --enable-lz4=yes \
                    --enable-manual=no \
                    --enable-smartcard=no \
                    --with-sasl=no

compiler.cxx_standard 2011

if { [string match *clang* ${configure.compiler}] } {
    # Quiet warnings
    configure.cxxflags-append \
                    -Wno-address-of-packed-member \
                    -Wno-extern-c-compat \
                    -Wno-mismatched-tags \
                    -Wno-error=unknown-warning-option \
                    -Wno-unknown-warning-option
}

livecheck.regex     {spice-(\d+(?:\.\d+)*)}