1. # Contributor: Nick <iglu.sitar at gmail dot com>
  2. # Contributor: Daenyth <Daenyth+arch _AT_ gmail _DOT_ com>
  3. # Contributor: wizzomafizzo <wizzomafizzo@gmail.com>
  4. # Contributor: kevin <kevin@archlinux.org>
  5. # Contributor: Christian Schmidt <mucknert@gmx.net>
  6. # Contributor: Markus Meissner <markus@meissna.de>
  7.  
  8. pkgname=nethack-patch
  9. pkgver=3.4.3
  10. pkgrel=8
  11. pkgdesc="A single player dungeon exploration game patched with UI enhancements"
  12. arch=('i686' 'x86_64')
  13. url="http://www.nethack.org/index.html"
  14. license=('custom: nethack')
  15. depends=('ncurses' 'gzip')
  16. makedepends=(flex bison)
  17. install=nethack.install
  18. source=("http://downloads.sourceforge.net/nethack/nethack-343-src.tgz"
  19.          nh343-menucolor.diff
  20.          hpmon.diff
  21.          dump-343.diff
  22.          sortloot-343d.diff
  23.          paranoid-343.diff
  24.          nh343-darkgray-option.diff)
  25. md5sums=('21479c95990eefe7650df582426457f9'
  26.          'ade00f9cb51f1b0140557d329d56844c'
  27.          'a8e5cab6a93100612d428f3973dc418f'
  28.          'e61887eed94ecf4d3233bc6bc04bd7b5'
  29.          '4b0e68547c081b0ca2204b9b7019459c'
  30.          '8c9aeefd18faa754b32efa3fd09f7b19'
  31.          'e3595efef03e10657ad7303d3280fb36')
  32. provides=("nethack=$pkgver")
  33. conflicts=('nethack')
  34. backup=(usr/share/nethack/record
  35.         usr/share/nethack/logfile)
  36.  
  37. build() {
  38.   # Add the patches to the source
  39.   cd $srcdir/nethack-$pkgver/
  40.   patch -Np1 -i $srcdir/nh343-menucolor.diff
  41.   patch -Np1 -i $srcdir/hpmon.diff
  42.   patch -Np1 -i $srcdir/dump-343.diff
  43.   patch -Np1 -i $srcdir/sortloot-343d.diff
  44.   patch -Np1 -i $srcdir/paranoid-343.diff
  45.   patch -Np1 -i $srcdir/nh343-darkgray-option.diff
  46.  
  47.   # Run the setup script
  48.   sh sys/unix/setup.sh
  49.  
  50.   # Enable the hpmon and dumplog patches    
  51.   sed -e 's/#endif \/\* CONFIG_H \*\///' -i include/config.h
  52.   echo '#define HPMON' >> include/config.h
  53.   echo '#define DUMP_FN "/tmp/%n.nh"' >> include/config.h
  54.   echo '#define SORTLOOT' >> include/config.h
  55.   echo '#define PARANOID' >> include/config.h
  56.   echo '#define AUTOPICKUP_EXCEPTIONS' >> include/config.h
  57.   echo '#endif /* CONFIG_H */' >> include/config.h
  58.  
  59.   sed -e "s/\"wizard\"/\"root\"/" -i include/config.h
  60.  
  61.   # Configure the source for Arch
  62.   sed -e '/define HACKDIR/ s|/usr/games/lib/nethackdir|/usr/share/nethack/|' \
  63.       -e '/^#define COMPRESS\s/ s|/usr/bin/compress|/bin/gzip|' \
  64.       -e '/^#define COMPRESS_EXTENSION/ s|".Z"|".gz"|' \
  65.       -e 's|^/\* \(#define DLB\) \*/|\1|' -i include/config.h
  66.  
  67.   sed -e 's|^/\* \(#define LINUX\) \*/|\1|' \
  68.       -e 's|^/\* \(#define TIMED_DELAY\) \*/|\1|' -i include/unixconf.h
  69.  
  70.   sed -e 's|^# \(WINTTYLIB = -lncurses\)|\1|' \
  71.       -e 's|^WINTTYLIB = -ltermlib|#&|' -i src/Makefile
  72.  
  73.   sed -e '/^GAMEDIR\s*=/ s|/games/.*$|/usr/share/$(GAME)|' \
  74.       -e '/^GAMEUID\s*=/ s|games|root|' \
  75.       -e '/^GAMEGRP\s*=/ s|bin|root|' \
  76.       -e '/^SHELLDIR\s*=/ s|/games|/usr/bin|' -i Makefile
  77.  
  78.   sed -e "/^MANDIR\s*=/s|/usr/man/man6|$pkgdir/usr/share/man/man6|" -i doc/Makefile
  79.  
  80.   # Build and install the package
  81.   make || return 1
  82. }
  83.  
  84. package() {
  85.   cd $srcdir/nethack-$pkgver/
  86.  
  87.   install -dm755 $pkgdir/usr/share/{man/man6,doc/nethack}
  88.   make PREFIX=$pkgdir install manpages
  89.  
  90.   # Patch the bin script to work
  91.   sed -e "s|HACKDIR=$pkgdir/|HACKDIR=/|" \
  92.       -e 's|HACK=$HACKDIR|HACK=/usr/lib/nethack|' -i $pkgdir/usr/bin/nethack
  93.  
  94.   install -dm755 $pkgdir/usr/lib/nethack
  95.   mv $pkgdir/usr/share/nethack/{nethack,recover} $pkgdir/usr/lib/nethack/
  96.  
  97.   install -Dm644 doc/Guidebook.txt $pkgdir/usr/share/doc/nethack/Guidebook.txt
  98.  
  99.   install -Dm644 dat/license $pkgdir/usr/share/licenses/nethack/LICENSE
  100. }
  101.  
  102. # vim:set ts=2 sw=2 et: