1 # Contributor : skualito <lepascalou 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>
8 pkgname=nethack-x11-patch
11 pkgdesc="A single player dungeon exploration game patched with UI enhancements"
12 url="http://www.nethack.org/index.html"
13 license=('custom: nethack')
14 arch=('i686' 'x86_64')
15 depends=('ncurses' 'gzip' 'libx11')
16 makedepends=(flex bison)
17 source=(http://downloads.sourceforge.net/sourceforge/nethack/nethack-343-src.tgz
20 nethack-3.4.3-gray-1.diff
23 md5sums=('21479c95990eefe7650df582426457f9'
24 'ade00f9cb51f1b0140557d329d56844c'
25 'a8e5cab6a93100612d428f3973dc418f'
26 '4d2576ef824b756b2b28ac333fb77535'
27 'a9631ce3da9b4a57b6a2e6011509ca90')
29 backup=('usr/share/nethack/record'
30 'usr/share/nethack/logfile')
32 provides=("nethack=$pkgver")
33 install=nethack-x11-patch.install
37 # Add the patches to the source
38 cd $srcdir/nethack-$pkgver
39 patch -Np1 -i $srcdir/nh343-menucolor.diff
40 patch -Np1 -i $srcdir/hpmon.diff
41 patch -Np1 -i $srcdir/dump-343.diff
42 patch -Np1 -i $srcdir/nethack-3.4.3-gray-1.diff
44 # Run the setup script
45 cd $srcdir/nethack-$pkgver/sys/unix
48 # Enable the hpmon and dumplog patches
49 cd $srcdir/nethack-$pkgver/include
50 sed -e 's/#endif \/\* CONFIG_H \*\///' -i config.h
51 echo '#define HPMON' >> config.h
52 echo '#define DUMP_FN "/tmp/%n.nh"' >> config.h
53 echo '#define AUTOPICKUP_EXCEPTIONS' >> config.h
54 echo '#endif /* CONFIG_H */' >> config.h
56 # Configure the source for Arch
58 sed -e '/define HACKDIR/ s|/usr/games/lib/nethackdir|/usr/share/nethack/|' \
59 -e '/^#define COMPRESS\s/ s|/usr/bin/compress|/bin/gzip|' \
60 -e '/^#define COMPRESS_EXTENSION/ s|".Z"|".gz"|' \
61 -e 's|^/\* \(#define X11_GRAPHICS\) \*/|\1|' \
62 -e 's|^/\* \(# define USE_XPM\) \*/|\1|' \
63 -e 's|^/\* \(#define SCORE_ON_BOTL\) \*/|\1|' \
64 -e 's|^/\* \(#define DLB\) \*/|\1|' -i config.h
65 sed -e 's|^/\* \(#define LINUX\) \*/|\1|' \
66 -e 's|^/\* \(#define TIMED_DELAY\) \*/|\1|' -i unixconf.h
67 cd $srcdir/nethack-$pkgver/src
68 sed -e 's|^# \(WINTTYLIB = -lncurses\)|\1|' \
69 -e 's|^WINTTYLIB = -ltermlib|#&|' \
70 -e 's|^WINSRC = $(WINTTYSRC)|& $(WINX11SRC)|' \
71 -e 's|^WINOBJ = $(WINTTYOBJ)|& $(WINX11OBJ)|' \
72 -e 's|^WINX11LIB = -lXaw -lXmu -lXext -lXt -lX11|#&|' \
73 -e 's|^# \(WINX11LIB = -lXaw -lXmu -lXext -lXt -lXpm -lX11 -lm\)|\1|' \
74 -e 's|^WINLIB = $(WINTTYLIB)|& $(WINX11LIB)|' -i Makefile
76 cd $srcdir/nethack-$pkgver/win/X11
77 sed -e 's|variable|fixed|' \
79 -e 's|^!\(NetHack.tile_file: x11tiles\)|\1|' -i NetHack.ad
81 cd $srcdir/nethack-$pkgver
82 sed -e '/^GAMEDIR\s*=/ s|/games/.*$|/share/$(GAME)|' \
83 -e '/^GAMEUID\s*=/ s|games|root|' \
84 -e '/^GAMEGRP\s*=/ s|bin|root|' \
85 -e '/^SHELLDIR\s*=/ s|/games|/bin|' \
86 -e 's|^VARDATND = |#&|' \
87 -e 's|^# \(VARDATND = x11tiles NetHack.ad pet_mark.xbm rip.xpm\)|\1|' -i Makefile
89 # Build and install the package
91 make PREFIX=$pkgdir/usr install
94 install -Dm644 dat/license $pkgdir/usr/share/licenses/nethack/COPYING
96 # Patch the bin script to work
97 sed -e 's|HACKDIR=.*/pkg/usr/|HACKDIR=/usr/|' -i $pkgdir/usr/bin/nethack
101 # vim:set ts=2 sw=2 et: