# POWER Maintainer: Alexander Baldeck <alex.bldck@gmail.com>
# Maintainer: Sven-Hendrik Haase <svenstaro@archlinux.org>
pkgname=openxr
pkgver=1.1.43
pkgrel=1
pkgdesc='An open standard for virtual reality and augmented reality platforms and devices'
arch=(x86_64 powerpc64le powerpc64 powerpc riscv64)
url='https://www.khronos.org/openxr/'
depends=('jsoncpp' 'libx11' 'vulkan-icd-loader' 'libglvnd' 'libxrandr' 'libxxf86vm')
makedepends=('cmake' 'vulkan-headers' 'python' 'ninja' 'wayland' 'mesa')
license=('APACHE')
source=("https://github.com/KhronosGroup/OpenXR-SDK-Source/releases/download/release-${pkgver}/OpenXR-SDK-Source-release-${pkgver}.tar.gz"{,.asc}
        ppc.patch)
validpgpkeys=(45207B2B1E53E1F2755FF63CC5A2D593A61DBC9D)
sha512sums=('99b9db642b4600401fbb8ba5c99337b5322995eb5741179dc226c94c1a2de7ac00881aa7aa71e9694e37a0f5b605d433b248d6ae6be25efc07f9693514383db2'
            'SKIP'
            '62922939346a94fac23b377aeb6227b511c3e7ac814c873f04a59846cecd7494d37cf3ac78d2220fce80b6f891eb4c0abd55261d005a30b80b9525a4158960a8')

prepare() {
  cd OpenXR-SDK-Source-release-${pkgver}
  patch -Np1 -i ${srcdir}/ppc.patch
}

build() {
  cd OpenXR-SDK-Source-release-${pkgver}

  cmake \
    -GNinja \
    -Bbuild \
    -DCMAKE_INSTALL_PREFIX=/usr \
    -DCMAKE_INSTALL_LIBDIR=lib \
    -DCMAKE_BUILD_TYPE=Release \
    -DBUILD_TESTS=ON \
    -DPRESENTATION_BACKEND=xlib \
    -DDYNAMIC_LOADER=ON
  ninja -C build
}

package() {
  cd OpenXR-SDK-Source-release-${pkgver}

  DESTDIR="$pkgdir" ninja -C build install
}
