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

github.setup            TigerVNC tigervnc 1.14.1 v
revision                0
checksums               rmd160  a94a3249117f5833bdabe30b5dd0a407bfbd7abb \
                        sha256  579d0d04eb5b806d240e99a3c756b38936859e6f7db2f4af0d5656cc9a989d7c \
                        size    2097932

conflicts               vnc tightvnc
categories              x11 vnc
maintainers             {ryandesign @ryandesign} openmaintainer
license                 GPL-2+

description             Advanced VNC implementation.

long_description        TigerVNC is an advanced VNC implementation. \
                        It is based on the fourth generation of VNC. TigerVNC \
                        also includes features from the TightVNC and TurboVNC \
                        projects. This includes accelerated JPEG compression. \
                        TigerVNC supports the latest X.Org X server.

homepage                https://tigervnc.org
github.tarball_from     archive

depends_build-append    port:gettext

depends_lib-append      port:gettext-runtime \
                        path:lib/pkgconfig/gnutls.pc:gnutls \
                        path:lib/libfltk.dylib:fltk \
                        path:include/turbojpeg.h:libjpeg-turbo \
                        port:libiconv \
                        path:lib/pkgconfig/pixman-1.pc:libpixman \
                        port:zlib

patchfiles              patch-release-makemacapp.in.diff \
                        patch-vncviewer-CMakeLists.txt.diff

# ivtools' OS/os.h shadows tigervnc's os/os.h on case-insensitive filesystems.
if {[file exists ${prefix}/include/os/os.h]} {
    conflicts_build-append ivtools
}

build.target            translations dmg

if {${universal_possible} && [variant_isset universal]} {
    merger-post-destroot {
        foreach arch ${universal_archs_to_use} {
            copy "${build.dir}-${arch}/TigerVNC Viewer.app" ${destroot}-${arch}${applications_dir}
            xinstall ${filespath}/vncviewer.in ${destroot}-${arch}${prefix}/bin/vncviewer
            reinplace "s|@APPLICATIONS_DIR@|${applications_dir}|g" ${destroot}-${arch}${prefix}/bin/vncviewer
        }
    }
} else {
    post-destroot {
        copy "${build.dir}/TigerVNC Viewer.app" ${destroot}${applications_dir}
        xinstall ${filespath}/vncviewer.in ${destroot}${prefix}/bin/vncviewer
        reinplace "s|@APPLICATIONS_DIR@|${applications_dir}|g" ${destroot}${prefix}/bin/vncviewer
    }
}

# Skip x.x.9x beta versions.
github.livecheck.regex {((\d+.)+([0-8]?\d))}