summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 9dfa60b04d9021ec83e63a5dc0e412beb24c3fed (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
# Maintainer: Sam S. <smls75@gmail.com>
# Contributor: Felix Golatofski <contact@xdfr.de>
# Contributor: Daniel Scharrer <daniel@constexpr.org>

pkgname=arx-libertatis
pkgver=1.2
pkgrel=2
pkgdesc='Cross-platform port of Arx Fatalis, a first-person role-playing game (executables only)'
url='https://arx-libertatis.org/'
arch=('i686' 'x86_64')
license=('GPL3')
depends=('sdl2' 'openal' 'libepoxy')
optdepends=('arx-fatalis-data-demo: game data from official freeware demo'
            'arx-fatalis-data-gog: game data from GOG.com installer'
            'arx-fatalis-data-copy: game data from existing Windows/Wine installation'
            'qt5-base: enable built-in crash handler (Qt5 version; recompile needed)'
            'qt4: enable built-in crash handler (Qt4 version; recompile needed)'
            'curl: enable built-in crash handler'
            'gdb: generate more detailed crash reports'
            'blender: Blender plugin to import/export Arx model files')
makedepends=('boost' 'cmake' 'glm' 'cppunit')
provides=('arx')
conflicts=('arx-git' 'arx-libertatis-git')
source=("https://arx-libertatis.org/files/arx-libertatis-$pkgver.tar.xz")
sha1sums=('afec697725d2cffee4c5ba04479cd5ba78502408')
install='arx-libertatis.install'

build() {
  cd $pkgname-$pkgver
  
  local _cmakeargs=(
          -DCMAKE_INSTALL_PREFIX=/usr
          -DCMAKE_INSTALL_LIBEXECDIR=lib/arx
          -DRUNTIME_DATADIR=""
          -DCMAKE_BUILD_TYPE=Release
          -DUNITY_BUILD=ON
          -DINSTALL_SCRIPTS=ON
          -DBUILD_TOOLS=ON
          -DBUILD_TESTS=ON
          -DUSE_NATIVE_FS=ON
          -DUSE_OPENAL=ON
          -DUSE_OPENGL=ON
          -DWITH_SDL=2
          -DWITH_OPENGL=epoxy
  )

  local _blender_api="$(pacman -Sddp --print-format %v blender 2>/dev/null |grep -oP '(?<=\:)[[:digit:]]{1}\.[[:digit:]]{2}(?=\.)')"
  if [[ "$_blender_api" != "" ]]; then
    _cmakeargs+=(
            -DINSTALL_BLENDER_PLUGIN=ON
            -DINSTALL_BLENDER_PLUGINDIR="/usr/share/blender/${_blender_api}/scripts/addons/arx"
    )
  fi

  # -DUNITY_BUILD
  #   produces a more optimized binary, but uses a lot of RAM during
  #   compilation - disable if low on memory.
  # 
  # -DCMAKE_BUILD_TYPE=Release
  #   can be changed to CMAKE_BUILD_TYPE=Debug to get a debug build,
  #   which will run signifincantly slower but enables more runtime
  #   checks and generates better crash reports.


  # Fixes a crash (fixed upstream in https://arx.vg/9805464 for the next release).
  CFLAGS="$CFLAGS -Wp,-U_GLIBCXX_ASSERTIONS"
  CXXFLAGS="$CXXFLAGS -Wp,-U_GLIBCXX_ASSERTIONS"
  
  cmake . "${_cmakeargs[@]}"
  make
}

check() {
  cd $pkgname-$pkgver
  
  make check
}

package() {
  cd $pkgname-$pkgver
  
  make DESTDIR="$pkgdir" install
  
  install -Dm644 README.md \
          "$pkgdir/usr/share/doc/$pkgname/README.md"
  install -Dm644 CHANGELOG \
          "$pkgdir/usr/share/doc/$pkgname/CHANGELOG"
  install -Dm644 AUTHORS \
          "$pkgdir/usr/share/doc/$pkgname/AUTHORS"
  install -Dm644 LICENSE \
          "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
  install -Dm644 LICENSE.DejaVu \
          "$pkgdir/usr/share/licenses/$pkgname/LICENSE.DejaVu"
          
          
}