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

name                xscreensaver
version             6.09
revision            0
categories          x11
maintainers         nomaintainer
license             X11
description         X11 screen saver
long_description    The xscreensaver program waits until the keyboard and \
                    mouse have been idle for a period, and then runs a graphics \
                    demo chosen at random.

homepage            https://www.jwz.org/xscreensaver
master_sites        ${homepage}

checksums           rmd160  19f238c292438c4ba094f221301c0e8472da2eea \
                    sha256  f4667705adb8cc43fd2f3973a88a1b54b16f20190afe93b21e221f2f57320b05 \
                    size    22026182

depends_build       port:pkgconfig \
                    port:intltool \
                    port:gettext

depends_lib         path:lib/pkgconfig/gtk+-3.0.pc:gtk3 \
                    port:xorg-libXi \
                    port:xorg-libXt \
                    port:mesa \
                    port:libGLU

depends_run         port:font-bh-ttf

require_active_variants path:lib/pkgconfig/gtk+-3.0.pc:gtk3 x11

# Fix "No GL visuals" when running in fullscreen
patchfiles          patch-driver-subprocs.diff

# Missing 'pthread_attr_set_qos_class_np' on macOS <10.10
if {${os.platform} eq "darwin" && ${os.major} < 14} {
    patchfiles-append   patch-ignore-qos.diff
}

# marbling.c:174:9: error: cannot convert between vector
# values of different size ('v_hi' (vector of 8 'int16_t'
# values) and 'int16_t' (aka 'short')) on macOS <10.13
compiler.blacklist-append \
                    {clang < 1000}

configure.args      --with-app-defaults=${prefix}/share/X11/app-defaults \
                    --with-fontdir=${prefix}/share/fonts/TTF

destroot.destdir    install_prefix=${destroot}

post-destroot {
    # get it from font-bh-ttf
    delete ${destroot}${prefix}/share/fonts/TTF/luximr.ttf
}

livecheck.type      regex
livecheck.url       https://www.jwz.org/xscreensaver/download.html
livecheck.regex     xscreensaver-(\[0-9\.\]+).tar.gz
