summaryrefslogtreecommitdiff
path: root/extra/glhack/PKGBUILD
blob: bdd0a6a44982edec8c41ac74f0a5702ac88dee57 (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
# $Id: PKGBUILD 148744 2012-02-05 11:48:58Z ibiru $
# Maintainer: Eric Bélanger <eric@archlinux.org>

pkgname=glhack
pkgver=1.2
pkgrel=6.1
pkgdesc="A port of Nethack, a single player dungeon exploration game in 2D"
arch=('i686' 'x86_64' 'mips64el')
url="http://glhack.sourceforge.net/"
license=('custom')
depends=('sdl' 'libpng' 'libgl')
makedepends=('mesa')
options=('!makeflags')
install=glhack.install
source=(http://downloads.sourceforge.net/${pkgname}/${pkgname}-${pkgver}.tar.gz glhack-libpng15.patch)
sha1sums=('7dc46e6bd4a3c2ec10ab4d314acfbb30cefc6eae'
          '4cf1a13e76cc1f1eb3708d42c74b85b7f321092d')

build(){
  cd "${srcdir}/${pkgname}-${pkgver}"
  patch -p0 -i ../glhack-libpng15.patch
  sed -i 's|/usr/lib/games|/usr/share|' include/config.h
  sed -i 's|/var/lib/games/glhack|/var/games/glhack|' include/unixconf.h
  sed -i -e 's|PREFIX	 = /usr|PREFIX	 = $(DESTDIR)/usr|' Makefile
  sed -i -e 's|VARDIR   = /var/lib/games/glhack|VARDIR   = $(DESTDIR)/var/games/glhack|' Makefile
  sed -i -e 's|/usr/man/man6|$(DESTDIR)/usr/share/man/man6|' doc/Makefile
  sed -i -e 's|GAMEDIR  = $(PREFIX)/lib/games/$(GAME)|GAMEDIR  = $(PREFIX)/share/$(GAME)|' Makefile

  make
}

package() {
  cd "${srcdir}/${pkgname}-${pkgver}"
  install -d "${pkgdir}"/usr/share/man/man{5,6}
  make DESTDIR="$pkgdir" install
  install -D -m644 dat/license "${pkgdir}/usr/share/licenses/${pkgname}/license"

# Renaming man pages which conflicts with nethack
  cd "${pkgdir}/usr/share/man/man6"
  for manpage in dgn_comp dlb lev_comp nethack recover; do
    mv $manpage.6 $manpage-glhack.6
  done
  cd "${srcdir}/${pkgname}-${pkgver}"

  mv "${pkgdir}/usr/share/glhack/glhack" "${pkgdir}/usr/bin/glhack"
  mv "${pkgdir}/usr/share/glhack/recover_glhack" "${pkgdir}/usr/bin/recover_glhack"

  chown -R root:root "${pkgdir}/usr/share/glhack"

  rm -r "${pkgdir}"/var/games/glhack
  install -d "${pkgdir}/var/games/glhack/save"
  chmod -R 775 "${pkgdir}/var/games"
  chown -R root:games "${pkgdir}/var/games"
}