Portfile

# $Id: Portfile 22478 2007-03-02 05:16:40Z pipping@macports.org $

PortSystem 1.0
name nethack
version 3.4.3
revision 2
categories games
maintainers nomaintainer@macports.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
}

files