# $Id$
# Maintainer (Arch): Sven-Hendrik Haase <sh@lutzhaase.com>
# Maintainer: Omar Vega Ramos <ovruni@gnu.org.pe>
# Contributor: Márcio Silva <coadde@hyperbola.info>

# parabola changes and rationale:
#  - not building ogre-docs
#  - removed nonfree samples and tests
#  - removed nonfree files and references

pkgbase=ogre
pkgname=('ogre')
pkgver=1.10.11
pkgrel=3.parabola1
pkgdesc='Scene-oriented, flexible 3D engine written in C++, without nonfree software support and files'
arch=('x86_64' 'i686' 'armv7h')
url='http://www.ogre3d.org'
license=('custom:MIT')
depends=('boost-libs' 'freeimage' 'freetype2' 'libxaw' 'libxrandr'
         'zziplib' 'sdl2' 'glu' 'tinyxml')
makedepends=('boost' 'cmake' 'doxygen' 'graphviz' 'ttf-dejavu' 'mesa' 'mercurial' 'python' 'swig' 'systemd')
install=ogre.install
source=("https://github.com/OGRECave/ogre/archive/v${pkgver}.tar.gz"
        libre.patch)
sha512sums=('2dfedd6f0a0de1a8c687c001439138b233200ca11e5c9940debf43d8a0380ca6472e0b5f4d599f0e22ca2049d0a5d34066ef41b6bc4912130694fa5d851fc900'
            '81e3997c5bad64d8bae511222d8ab3766699c0923e9303640925525908ee2c19dfb37549cc02bc3e172ea248c0c01c0a58bdcc20d545980bf93b15e02ceb514c')

prepare() {
  cd ogre-${pkgver}

  # remove nonfree files
  rm -v RenderSystems/GL/include/GL/gl.h
  rm -rv Samples/Media/materials/textures/nvidia
  rm -v Samples/Media/packs/chiropteraDM.{pk3,txt}

  # remove nonfree references
  rm -v CMake/Templates/quakemap.cfg.in
  patch -Np1 -i $srcdir/libre.patch
}

build() {
  cd ogre-${pkgver}

  [[ -d build ]] && rm -rf build
  mkdir build && cd build

  cmake .. \
    -DCMAKE_INSTALL_PREFIX=/usr \
    -DOGRE_INSTALL_SAMPLES=FALSE\
    -DOGRE_INSTALL_DOCS=FALSE\
    -DOGRE_INSTALL_SAMPLES_SOURCE=FALSE\
    -DOGRE_BUILD_DEPENDENCIES=FALSE \
    -DOGRE_BUILD_COMPONENT_PYTHON=TRUE \
    -DCMAKE_BUILD_TYPE=Release \
    -DOGRE_BUILD_RENDERSYSTEM_GL=FALSE\
    -DOGRE_BUILD_RENDERSYSTEM_GLES=FALSE\
    -DOGRE_BUILD_RENDERSYSTEM_GLES2=FALSE\
    -DOGRE_BUILD_SAMPLES=FALSE\
    -DOGRE_BUILD_TESTS=FALSE

  make
}

package_ogre() {
  optdepends=('cppunit: unit testing'
              'intel-tbb: better threading support'
              'poco: portability'
              'python: python bindings'
              'boost: for developing using ogre'
              'ogre-docs: documentation')

  cd ogre-${pkgver}/build

  make DESTDIR=${pkgdir} install

  install -Dm644 ../LICENSE ${pkgdir}/usr/share/licenses/${pkgname}/LICENSE
}

# vim:set ts=2 sw=2 et:
