summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 87b3cd1f59b15dde501b9414d4cb01c66e88db35 (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
# Contributor: Lari Tikkanen <lartza@wippies.com>
# Maintainer: Rafael Fontenelle <rafaelff@gnome.org>

pkgname=teeworlds-git
pkgver=0.7.5.6245.26d24ec06
pkgrel=1
pkgdesc='Fast-paced multiplayer 2D shooter game'
arch=('x86_64')
url="https://teeworlds.com"
license=('custom' 'CCPL:by-nc-sa')
depends=('alsa-lib' 'glu' 'sdl2' 'freetype2' 'pnglite' 'wavpack' 'openssl')
makedepends=('python' 'git' 'cmake' 'ninja' 'imagemagick' 'gtest')
provides=('teeworlds')
conflicts=('teeworlds')
source=('git+https://github.com/teeworlds/teeworlds.git'
        'git+https://github.com/teeworlds/teeworlds-translation.git'
        'git+https://github.com/teeworlds/teeworlds-maps.git')
md5sums=('SKIP'
         'SKIP'
         'SKIP')

pkgver() {
  cd teeworlds
  v=$(grep "GAME_VERSION " src/game/version.h | cut -d\" -f2)
  printf "$v.%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)"
}

prepare() {
  convert "teeworlds/other/icons/teeworlds.ico" "$srcdir/teeworlds.png"

  cd teeworlds
  git submodule init
  git config submodule.data/languages.url "$srcdir/teeworlds-translation"
  git config submodule.data/maps.url "$srcdir/teeworlds-maps"
  git submodule update
}

build() {
  mkdir -p build
  cd build
  cmake ../teeworlds \
    -DCMAKE_INSTALL_PREFIX=/usr \
    -GNinja
  ninja
}

check() {
  ninja run_tests -C build
}

package() {
  DESTDIR="$pkgdir" ninja install -C build
  
  install -dm755 "$pkgdir/usr/share/"{licenses/$pkgname,metainfo,applications}
  install -m644 teeworlds/license.txt -t "$pkgdir/usr/share/licenses/$pkgname/"
  install -m644 teeworlds/other/teeworlds.appdata.xml -t "$pkgdir/usr/share/metainfo/"
  install -m644 teeworlds/other/teeworlds.desktop -t "$pkgdir/usr/share/applications/"

   # Install client and server icon files according to the image size
  for _icon in $(ls -1 "$srcdir"/teeworlds-*.png); do
    _s=$(identify $_icon | awk '{print $3}')
    [[ $_s =~ ([0-9])+x([0-9])+ ]] || ( echo "Not a NUMxNUM: '$_s'"; exit 1; )
    install -Dm644 "$_icon" "$pkgdir/usr/share/icons/hicolor/$_s/apps/teeworlds.png"
  done
}