# Maintainer: Sven-Hendrik Haase <svenstaro@gmail.com>
# Contributor: Sandy Carter <bwrsandman@gmail.com>

pkgname=openmw
# Build from git until 0.47.0 stable is out. Sadly openmw releases are very
# rare these days and backporting takes too much time.
pkgver=0.47.0rc
pkgrel=2
pkgdesc="Open-source engine reimplementation for the role-playing game Morrowind"
arch=('x86_64')
url="http://www.openmw.org"
license=('GPL3' 'MIT' 'custom')
depends=('openal' 'openscenegraph' 'mygui' 'qt5-base' 'ffmpeg' 'sdl2' 'unshield' 'libxt')
makedepends=('cmake' 'boost' 'doxygen' 'ninja' 'git')
source=("git+https://gitlab.com/OpenMW/openmw.git#commit=08f7c73e")
sha512sums=('SKIP')

build() {
  cd openmw
  # We can't use system bullet because openmw needs a version built with double
  # precision but the one we ship in Arch is built with single precision for
  # performance reasons.
  cmake \
    -DCMAKE_INSTALL_PREFIX=/usr \
    -DCMAKE_BUILD_TYPE=Release \
    -DOPENMW_LTO_BUILD=ON \
    -DDESIRED_QT_VERSION=5 \
    -DOPENMW_USE_SYSTEM_BULLET=OFF \
    -GNinja \
    -Bbuild
  ninja -C build
}

package() {
  cd openmw
  DESTDIR="$pkgdir" ninja -C build install
}

# vim: ts=2 sw=2 et:
