1SUMMARY="The ultimate old-school single player dungeon exploration game"
2DESCRIPTION="NetHack is a single-player roguelike video game originally \
3released in 1987 with ASCII graphics. It is a descendant of an earlier game \
4called Hack (1985), which is a descendant of Rogue (1980)."
5HOMEPAGE="http://www.nethack.org/"
6COPYRIGHT="1985-2015 Stichting Mathematisch Centrum and M. Stephenson"
7LICENSE="nethack"
8REVISION="1"
9SOURCE_URI="https://www.nethack.org/download/$portVersion/nethack-362-src.tgz"
10CHECKSUM_SHA256="fbd00ada6a4ee347ecd4a350a5b2995b4b4ab5dcc63881b3bc4485b0479ddb1d"
11SOURCE_DIR="nethack-$portVersion"
12PATCHES="nethack-$portVersion.patchset"
13
14#the x86 is left is somebody wanted to edit it to work under gcc4
15#(it compiles in gcc4, but what is the point if it compiles under gcc2)
16ARCHITECTURES="all ?x86"
17
18GLOBAL_WRITABLE_FILES="
19	settings/nethack directory keep-old
20	"
21
22PROVIDES="
23	nethack = $portVersion
24	cmd:nethack
25	cmd:nethack_bin
26	"
27REQUIRES="
28	haiku
29	lib:libncurses >= 6
30	"
31
32BUILD_REQUIRES="
33	haiku_devel
34	devel:libncurses >= 6
35	"
36BUILD_PREREQUIRES="
37	cmd:awk
38	cmd:bison
39	cmd:flex
40	cmd:gcc
41	cmd:groff
42	cmd:install
43	cmd:make
44	cmd:nroff
45	cmd:sed
46	cmd:tbl
47	"
48
49defineDebugInfoPackage nethack \
50	"$binDir"/nethack_bin
51
52BUILD()
53{
54	./sys/unix/setup.sh ./sys/unix/hints/haiku
55	make PREFIX=$binDir $jobArgs
56}
57
58INSTALL()
59{
60	mkdir -p $binDir
61	make install PREFIX=$binDir
62
63	#copy the main binary file to be in main directory
64	cp $binDir/nethack/nethack $binDir/nethack_bin
65	mkdir -p $settingsDir/nethack
66
67	#move configs to writable directory (license also belongs there)
68	cp -r $binDir/nethack/license \
69		$binDir/nethack/logfile \
70		$binDir/nethack/nhdat \
71		$binDir/nethack/perm \
72		$binDir/nethack/record \
73		$binDir/nethack/save \
74		$binDir/nethack/symbols \
75		$binDir/nethack/sysconf \
76		$binDir/nethack/xlogfile \
77		$settingsDir/nethack/
78
79	#remove first nethack dir to not make a name problems
80	rm -rf $binDir/nethack
81
82	#replace paths from installation to rights paths in system
83	sed "s/HACKDIR=.*/HACKDIR=\/boot\/system\/settings\/nethack/; \
84		s/HACK=.*/HACK=\/bin\/nethack_bin/" \
85		$binDir/nethacksh/nethack > $binDir/nethack
86	chmod +x $binDir/nethack
87	rm -rf $binDir/nethacksh
88}
89