summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: aad9f1fbf8aaffac9b16a8849d9929fe7a05d989 (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
# Maintainer: carstene1ns <arch carsten-teibes de> - http://git.io/ctPKG

pkgname=yamagi-quake2-git
pkgver=8.00.r0.gf6483786
pkgrel=1
pkgdesc="Enhanced Quake II engine optimized for modern systems (development version)"
url="http://www.yamagi.org/quake2/"
arch=('i686' 'x86_64' 'aarch64')
license=('custom: Info-ZIP' 'GPL2')
depends=('sdl2')
optdepends=('quake2-demo: shareware data files'
            'openal: alternative audio backend'
            'curl: http download support')
makedepends=('cmake' 'ninja' 'openal' 'mesa' 'curl')
provides=("${pkgname%-*}")
conflicts=("${pkgname%-*}")
install=${pkgname%-*}.install
source=(${pkgname%-*}::"git+https://github.com/yquake2/yquake2.git"
        "${pkgname%-*}.desktop")
sha256sums=('SKIP'
            '7049a1798e38a263fb2660b94fb70f5154fad1f807259d41649e12cea1a6757c')

pkgver() {
  cd ${pkgname%-*}
  git describe --long --tags | sed 's/^QUAKE2_//;s/_/./;s/\([^-]*-g\)/r\1/;s/-/./g'
}

build() {
  rm -rf build
  cmake ${pkgname%-*} -Bbuild \
    -DCMAKE_BUILD_TYPE=Release \
    -DSYSTEMWIDE_SUPPORT=ON \
    -GNinja
  cmake --build build
}

package() {
  cd build

  # client + server binaries
  install -Dm755 release/quake2 "$pkgdir"/usr/lib/${pkgname%-*}/quake2
  install -m755 release/q2ded "$pkgdir"/usr/lib/${pkgname%-*}

  # symlinks to make the commands available
  install -d "$pkgdir"/usr/bin
  ln -s /usr/lib/${pkgname%-*}/quake2 "$pkgdir"/usr/bin/${pkgname%-*}
  ln -s /usr/lib/${pkgname%-*}/q2ded "$pkgdir"/usr/bin/yamagi-q2ded

  # game libraries
  install -m644 release/*.so "$pkgdir"/usr/lib/${pkgname%-*}
  install -Dm644 release/baseq2/game.so "$pkgdir"/usr/lib/${pkgname%-*}/baseq2/game.so

  # shared game directory
  install -d "$pkgdir"/usr/share/games/quake2
  echo "You can put Quake 2 game files here." > "$pkgdir"/usr/share/games/quake2/README

  cd ../${pkgname%-*}

  # doc
  install -Dm644 stuff/yq2.cfg "$pkgdir"/usr/share/doc/${pkgname%-*}/yq2.cfg
  install -m644 doc/*.md "$pkgdir"/usr/share/doc/${pkgname%-*}

  # desktop entry
  install -Dm644 ../${pkgname%-*}.desktop "$pkgdir"/usr/share/applications/${pkgname%-*}.desktop
  install -Dm644 stuff/icon/Quake2.png "$pkgdir"/usr/share/pixmaps/${pkgname%-*}.png

  # licenses
  install -Dm644 LICENSE "$pkgdir"/usr/share/licenses/$pkgname/LICENSE
}