# POWER Maintainer: Alexander Baldeck <alex.bldck@gmail.com>
# Maintainer: Antonio Rojas <arojas@archlinux.org>
# Maintainer: Felix Yan <felixonmars@archlinux.org>

pkgname=qt6-quick3dphysics
pkgver=6.7.2
pkgrel=1
arch=(x86_64 riscv64)
url='https://www.qt.io'
license=(GPL3 LGPL3 FDL custom)
pkgdesc='Physics engine integration for Qt Quick 3D'
depends=(gcc-libs
         glibc
         qt6-base
         qt6-declarative
         qt6-quick3d)
makedepends=(cmake
             git
             ninja
             qt6-shadertools)
groups=(qt6)
_pkgfn=${pkgname/6-/}
source=(git+https://code.qt.io/qt/$_pkgfn#tag=v$pkgver
        physx-rv64.patch)
sha256sums=('576a5e14bf90760dcf53f541112113329a957eb6d7010f706be894260b087701'
            '404a2d7b532a5b78c13b2a110aebebdce1dbcc2f9138319bb53a6b9ca7dce785')

prepare() {
  cd $_pkgfn
  patch -Np1 -i "$srcdir/physx-rv64.patch"
}

build() {
  cmake -B build -S $_pkgfn -G Ninja \
    -DCMAKE_MESSAGE_LOG_LEVEL=STATUS
  cmake --build build
}

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

  install -d "$pkgdir"/usr/share/licenses
  ln -s /usr/share/licenses/qt6-base "$pkgdir"/usr/share/licenses/$pkgname
}
