updated on Thu Jan 26 00:18:00 UTC 2012
[aur-mirror.git] / nethack-patch / PKGBUILD
blob8776d2404633cde5028cd5f33be6b03a08cfff41
1 # Contributor : Daenyth <Daenyth+arch _AT_ gmail _DOT_ com>
2 # Contributor : wizzomafizzo <wizzomafizzo@gmail.com>
3 # Contributor : kevin <kevin@archlinux.org>
4 # Contributor : Christian Schmidt <mucknert@gmx.net>
5 # Contributor : Markus Meissner <markus@meissna.de>
7 pkgname=nethack-patch
8 pkgver=3.4.3
9 pkgrel=6
10 pkgdesc="A single player dungeon exploration game patched with UI enhancements"
11 url="http://www.nethack.org/index.html"
12 license=('custom: nethack')
13 arch=('i686' 'x86_64')
14 depends=('ncurses' 'gzip')
15 makedepends=(flex bison)
16 source=(http://downloads.sourceforge.net/sourceforge/nethack/nethack-343-src.tgz
17         nh343-menucolor.diff
18         hpmon.diff
19         dump-343.diff)
21 md5sums=('21479c95990eefe7650df582426457f9'
22          'ade00f9cb51f1b0140557d329d56844c'
23          'a8e5cab6a93100612d428f3973dc418f'
24          'a9631ce3da9b4a57b6a2e6011509ca90')
26 backup=('usr/share/nethack/record'
27         'usr/share/nethack/logfile')
28 conflicts=('nethack')
29 provides=("nethack=$pkgver")
31 build() {
33   # Add the patches to the source
34   cd $srcdir/nethack-$pkgver
35   patch -Np1 -i $srcdir/nh343-menucolor.diff
36   patch -Np1 -i $srcdir/hpmon.diff
37   patch -Np1 -i $srcdir/dump-343.diff
39   # Run the setup script
40   cd $srcdir/nethack-$pkgver/sys/unix
41   sh setup.sh
43   # Enable the hpmon and dumplog patches    
44   cd $srcdir/nethack-$pkgver/include
45   sed -e 's/#endif \/\* CONFIG_H \*\///' -i config.h
46   echo '#define HPMON' >> config.h
47   echo '#define DUMP_FN "/tmp/%n.nh"' >> config.h
48   echo '#define AUTOPICKUP_EXCEPTIONS' >> config.h
49   echo '#endif /* CONFIG_H */' >> config.h
51   # Configure the source for Arch
52   sed -e '/define HACKDIR/ s|/usr/games/lib/nethackdir|/usr/share/nethack/|' \
53       -e '/^#define COMPRESS\s/ s|/usr/bin/compress|/bin/gzip|' \
54       -e '/^#define COMPRESS_EXTENSION/ s|".Z"|".gz"|' \
55       -e 's|^/\* \(#define DLB\) \*/|\1|' -i config.h
56   sed -e 's|^/\* \(#define LINUX\) \*/|\1|' \
57       -e 's|^/\* \(#define TIMED_DELAY\) \*/|\1|' -i unixconf.h
58   cd $srcdir/nethack-$pkgver/src
59   sed -e 's|^# \(WINTTYLIB = -lncurses\)|\1|' \
60       -e 's|^WINTTYLIB = -ltermlib|#&|' -i Makefile
61   cd $srcdir/nethack-$pkgver
62   sed -e '/^GAMEDIR\s*=/ s|/games/.*$|/share/$(GAME)|' \
63       -e '/^GAMEUID\s*=/ s|games|root|' \
64       -e '/^GAMEGRP\s*=/ s|bin|root|' \
65       -e '/^SHELLDIR\s*=/ s|/games|/bin|' -i Makefile
67   # Build and install the package
68   make || return 1
69   make PREFIX=$pkgdir/usr install
71   # Install the license
72   install -Dm644 dat/license $pkgdir/usr/share/licenses/nethack/COPYING
74   # Patch the bin script to work
75   sed -e 's|HACKDIR=.*/pkg/usr/|HACKDIR=/usr/|' -i $pkgdir/usr/bin/nethack
79 # vim:set ts=2 sw=2 et: