pkgname = "wayland"
pkgver = "1.21.0"
pkgrel = 0
build_style = "meson"
# "Tests must not be built with NDEBUG defined, they rely on assert()."
configure_args = ["-Ddocumentation=false", "-Db_ndebug=false"]
hostmakedepends = ["meson", "pkgconf", "flex"]
makedepends = [
    "libexpat-devel", "libffi-devel", "libfl-devel-static", "libxml2-devel"
]
pkgdesc = "Wayland compositor infrastructure"
maintainer = "q66 <q66@chimera-linux.org>"
license = "MIT"
url = "https://wayland.freedesktop.org"
source = f"https://gitlab.freedesktop.org/{pkgname}/{pkgname}/-/releases/{pkgver}/downloads/{pkgname}-{pkgver}.tar.xz"
sha256 = "6dc64d7fc16837a693a51cfdb2e568db538bfdc9f457d4656285bb9594ef11ac"

if self.profile().cross:
    hostmakedepends += ["wayland-progs"]

def post_install(self):
    self.install_license("COPYING")

@subpackage("wayland-progs")
def _progs(self):
    return self.default_progs(extra = [
        "usr/share/aclocal/wayland-scanner.m4",
        "usr/share/wayland/wayland-scanner.mk",
    ])

@subpackage("wayland-devel")
def _devel(self):
    self.depends += [
        f"wayland-progs={pkgver}-r{pkgrel}",
        "libffi-devel"
    ]
    return self.default_devel(extra = ["usr/share/wayland"])
