# Contributor: Leo <thinkabit.ukim@gmail.com>
# Maintainer: rfaa <rfaa@rfaa.se>
pkgname=glfw-wayland
pkgver=3.3.8
pkgrel=3
pkgdesc="Multi-platform library for OpenGL and Vulkan application development (Wayland)"
options="!check" # tests requires a working wayland session
url="https://www.glfw.org/"
arch="all !armhf" # Limited by extra-cmake-modules
license="Zlib"
depends_dev="
	extra-cmake-modules
	libxkbcommon-dev
	linux-headers
	mesa-dev
	wayland-dev
	wayland-protocols
	"
makedepends="$depends_dev cmake samurai"
subpackages="$pkgname-dbg $pkgname-dev"
source="https://github.com/glfw/glfw/releases/download/$pkgver/glfw-$pkgver.zip
	request-order.patch
	silence-gigaspam.patch
	"
builddir="$srcdir/glfw-$pkgver"

provides="glfw=$pkgver-r$pkgrel"
replaces="glfw"

build() {
	if [ "$CBUILD" != "$CHOST" ]; then
		CMAKE_CROSSOPTS="-DCMAKE_SYSTEM_NAME=Linux -DCMAKE_HOST_SYSTEM_NAME=Linux"
	fi
	cmake -B build -G Ninja \
		-DCMAKE_BUILD_TYPE=MinSizeRel \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DCMAKE_INSTALL_LIBDIR=lib \
		-DBUILD_SHARED_LIBS=ON \
		-DGLFW_USE_WAYLAND=ON \
		$CMAKE_CROSSOPTS
	cmake --build build
}

package() {
	DESTDIR="$pkgdir" cmake --install build
}

sha512sums="
62baab460f22724ed2c63cf71475377f19c0cd086f4e64d46bdd4c8c38035917c7f66c71d27837ba5159ca323a900a6cfa2693e8b06091e73be838a509b278a1  glfw-3.3.8.zip
326a44497b10b9e9aff3e0bf9e350f63d1a84a8a098fa1c50d1571012a48050546e6b14fa0af9a8bb8ec93be5c5e219f8b88676e5e3f9ea67b5466c48b474a04  request-order.patch
297b7a444748ba496640553a5aec320a23e7e27e076e2c566801c745631c3cb5d8453c9f28010cd088798f78b2c98867c436627fb776666c04745761edb72b38  silence-gigaspam.patch
"
