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

# Upstream build source (until more official): https://github.com/slp/homebrew-krunkit/blob/main/Formula/virglrenderer.rb

PortSystem          1.0
PortGroup           gitlab 1.0
PortGroup           meson 1.0

gitlab.instance     https://gitlab.freedesktop.org
gitlab.setup        slp virglrenderer 0.10.4b "" -krunkit
distname            ${gitlab.project}-${gitlab.version}${gitlab.tag_suffix}

revision            0

categories          graphics
license             MIT
maintainers         {@tsujp wz.ht:jc+macports} openmaintainer

description         VirGL virtual OpenGL renderer
long_description    Library that gives emulators the necessary tools to \
                    implement a virtio-gpu device, in particular one with 3D support.

homepage            https://gitlab.freedesktop.org/virgl/virglrenderer

# XXX: Unsure if this does support x86_64. Upstream only really deals with arm64 so use only that for now.
supported_archs     arm64

checksums           rmd160  29876cdbbc43670a3bb223636b493e5d1ca72a65 \
                    sha256  0544bb19afcb7bddbc40cad7838837c9d58b66146a89fd38ddc7c1277cd0da8b \
                    size    702362

# Disable unexpected download of subprojects
meson.wrap_mode     nodownload

depends_build       port:pkgconfig \
                    port:vulkan-headers
depends_lib         port:libepoxy \
                    port:moltenvk

configure.args \
            -Dvenus=true \
            -Drender-server=false

# TODO: Any tests?
# TODO: Currently this Portfile is only for the variant required for use in libkrun. There should (maybe) be a normal variant and then a +krunkit or +libkrun variant which is the equivalent of this. Look at that later, just get krunkit working for now.
