PKGBUILD 2.23 KB
Newer Older
1
pkgname=nethack
gnastyle's avatar
gnastyle committed
2
pkgver=3.6.0
3
pkgrel=2
4
pkgdesc='A single player dungeon exploration game.'
gnastyle's avatar
gnastyle committed
5
arch=('x86_64')
6 7 8
url="http://www.nethack.org/index.html"
license=('custom:NetHack GPL')
depends=('ncurses' 'gzip')
Giuseppe's avatar
Giuseppe committed
9
categories=('games')
gnastyle's avatar
gnastyle committed
10 11
source=("http://downloads.sourceforge.net/$pkgname/$pkgname-${pkgver//.}-src.tgz")
sha256sums=('1ade698d8458b8d87a4721444cb73f178c74ed1b6fde537c12000f8edf2cb18a')
12

gnastyle's avatar
gnastyle committed
13
prepare() {
14 15 16 17 18 19 20 21
  cd $srcdir/$pkgname-$pkgver/

  sed -e 's|^/\* \(#define LINUX\) \*/|\1|' \
      -e 's|^/\* \(#define TIMED_DELAY\) \*/|\1|' -i include/unixconf.h

  # we are setting up for setgid games, so modify all necessary permissions
  # to allow full access for groups

gnastyle's avatar
gnastyle committed
22 23 24 25 26 27 28 29 30 31
  sed -e '/^HACKDIR/ s|/games/lib/\$(GAME)dir|/var/games/nethack/|' \
      -e '/^SHELLDIR/ s|/games|/usr/bin|' \
      -e '/^VARDIRPERM/ s|0755|0775|' \
      -e '/^VARFILEPERM/ s|0600|0664|' \
      -e '/^GAMEPERM/ s|0755|02755|' \
      -e 's|\(DSYSCF_FILE=\)\\"[^"]*\\"|\1\\"/var/games/nethack/sysconf\\"|' \
      -e 's|\(DHACKDIR=\)\\"[^"]*\\"|\1\\"/var/games/nethack/\\"|' -i sys/unix/hints/linux

  sed -e 's|^#GAMEUID.*|GAMEUID = root|' \
      -e 's|^#GAMEGRP.*|GAMEGRP = games|' \
32
      -e '/^FILEPERM\s*=/ s|0644|0664|' \
gnastyle's avatar
gnastyle committed
33
      -e '/^DIRPERM\s*=/ s|0755|0775|' -i sys/unix/Makefile.top
34

gnastyle's avatar
gnastyle committed
35
  sed -e "/^MANDIR\s*=/s|/usr/man/man6|$pkgdir/usr/share/man/man6|" -i sys/unix/Makefile.doc
36

gnastyle's avatar
gnastyle committed
37 38 39 40 41 42 43
}

build(){
  cd $srcdir/$pkgname-$pkgver/sys/unix
  sh setup.sh hints/linux

  cd $srcdir/$pkgname-$pkgver
44 45 46 47 48 49 50
  make
}
  
package() {
  cd $srcdir/$pkgname-$pkgver/

  install -dm755 $pkgdir/usr/share/{man/man6,doc/nethack}
gnastyle's avatar
gnastyle committed
51 52 53
  install -dm775 $pkgdir/var/games/
  make PREFIX=$pkgdir -j1 install manpages # Multi-threaded builds fail.
  sed -e "s|HACKDIR=$pkgdir/|HACKDIR=/|" \
54 55 56 57
      -e 's|HACK=$HACKDIR|HACK=/usr/lib/nethack|' \
      -i $pkgdir/usr/bin/nethack

  install -dm755 $pkgdir/usr/lib/nethack
gnastyle's avatar
gnastyle committed
58 59 60 61 62 63
  mv $pkgdir/var/games/nethack/{nethack,recover} $pkgdir/usr/lib/nethack/

  # FS#43414: /var/games should be owned by root:games.
  chown -R root:games $pkgdir/var/games/
  chown root:games $pkgdir/usr/lib/nethack/nethack
  #chmod 02755 $pkgdir/usr/lib/nethack/nethack
64 65 66

  install -Dm644 doc/Guidebook.txt $pkgdir/usr/share/doc/nethack/Guidebook.txt
  install -Dm644 dat/license $pkgdir/usr/share/licenses/$pkgname/LICENSE
67
}