# $Id: Portfile,v 1.23 2006/04/08 07:10:20 markd Exp $

PortSystem 1.0
name		nethack
version		3.4.3
revision	2
categories	games
maintainers	kevin@opendarwin.org
description	Classic dungeon adventure game.
long_description \
		${description}
homepage	http://nethack.sourceforge.net/
platforms	darwin freebsd

master_sites	sourceforge
distname	${name}-343-src
extract.suffix	.tgz
checksums	md5 21479c95990eefe7650df582426457f9

worksrcdir	${name}-${version}

## patch ##

patchfiles	patch-sys__unix__Makefile.doc \
		patch-sys__unix__Makefile.src \
		patch-sys__unix__Makefile.top \
		patch-win__tty__termcap.c

post-patch {
	reinplace "s|__PREFIX__|${prefix}|" \
		"${worksrcpath}/sys/unix/Makefile.doc" \
		"${worksrcpath}/sys/unix/Makefile.top"
}

## configure ##

configure.dir	${worksrcpath}/sys/unix
configure.cmd	/bin/sh
configure.pre_args	setup.sh

## destroot ##

pre-destroot {
	file mkdir "${destroot}${prefix}/share/man/man6"
	file mkdir "${destroot}${prefix}/share/nethackdir/save"
}

destroot.target	install manpages
destroot.keepdirs "${destroot}${prefix}/share/nethackdir/save/"

post-destroot {
	reinplace "s|${destroot}||" "${destroot}${prefix}/bin/nethack"
}

## variants ##

variant x11 {
	patchfiles-append \
		x11/patch-include__config.h \
		x11/patch-sys__unix__Makefile.src \
		x11/patch-sys__unix__Makefile.top
}

variant autopickup_exceptions {
        patchfiles-append \
                patch-include__config.h
}               
