summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobin H. Johnson <robbat2@gentoo.org>2015-08-08 13:49:04 -0700
committerRobin H. Johnson <robbat2@gentoo.org>2015-08-08 17:38:18 -0700
commit56bd759df1d0c750a065b8c845e93d5dfa6b549d (patch)
tree3f91093cdb475e565ae857f1c5a7fd339e2d781e /games-roguelike/nethack
downloadgentoo-56bd759df1d0c750a065b8c845e93d5dfa6b549d.tar.gz
gentoo-56bd759df1d0c750a065b8c845e93d5dfa6b549d.tar.bz2
gentoo-56bd759df1d0c750a065b8c845e93d5dfa6b549d.zip
proj/gentoo: Initial commit
This commit represents a new era for Gentoo: Storing the gentoo-x86 tree in Git, as converted from CVS. This commit is the start of the NEW history. Any historical data is intended to be grafted onto this point. Creation process: 1. Take final CVS checkout snapshot 2. Remove ALL ChangeLog* files 3. Transform all Manifests to thin 4. Remove empty Manifests 5. Convert all stale $Header$/$Id$ CVS keywords to non-expanded Git $Id$ 5.1. Do not touch files with -kb/-ko keyword flags. Signed-off-by: Robin H. Johnson <robbat2@gentoo.org> X-Thanks: Alec Warner <antarus@gentoo.org> - did the GSoC 2006 migration tests X-Thanks: Robin H. Johnson <robbat2@gentoo.org> - infra guy, herding this project X-Thanks: Nguyen Thai Ngoc Duy <pclouds@gentoo.org> - Former Gentoo developer, wrote Git features for the migration X-Thanks: Brian Harring <ferringb@gentoo.org> - wrote much python to improve cvs2svn X-Thanks: Rich Freeman <rich0@gentoo.org> - validation scripts X-Thanks: Patrick Lauer <patrick@gentoo.org> - Gentoo dev, running new 2014 work in migration X-Thanks: Michał Górny <mgorny@gentoo.org> - scripts, QA, nagging X-Thanks: All of other Gentoo developers - many ideas and lots of paint on the bikeshed
Diffstat (limited to 'games-roguelike/nethack')
-rw-r--r--games-roguelike/nethack/Manifest1
-rw-r--r--games-roguelike/nethack/files/3.4.3-X-support.patch26
-rw-r--r--games-roguelike/nethack/files/3.4.3-bison.patch18
-rw-r--r--games-roguelike/nethack/files/3.4.3-default-options.patch29
-rw-r--r--games-roguelike/nethack/files/3.4.3-gentoo-paths.patch18
-rw-r--r--games-roguelike/nethack/files/3.4.3-macos.patch11
-rw-r--r--games-roguelike/nethack/files/dot.nethackrc92
-rw-r--r--games-roguelike/nethack/files/nethack-3.4.3-gibc210.patch13
-rw-r--r--games-roguelike/nethack/files/nethack-3.4.3-recover.patch94
-rw-r--r--games-roguelike/nethack/metadata.xml13
-rw-r--r--games-roguelike/nethack/nethack-3.4.3-r3.ebuild218
-rw-r--r--games-roguelike/nethack/nethack-3.4.3-r4.ebuild231
12 files changed, 764 insertions, 0 deletions
diff --git a/games-roguelike/nethack/Manifest b/games-roguelike/nethack/Manifest
new file mode 100644
index 000000000000..8776166e7815
--- /dev/null
+++ b/games-roguelike/nethack/Manifest
@@ -0,0 +1 @@
+DIST nethack-343-src.tgz 3497458 SHA256 bb39c3d2a9ee2df4a0c8fdde708fbc63740853a7608d2f4c560b488124866fe4 SHA512 052342c19619219f291571d48cf7799f962eb6ec6f8a276427225c0abbd833eada18abeff9fbd647919f2a9e3bb097d7f154675e283fe48abc4752f24c192d8f WHIRLPOOL 397c787f83149d96ddbfa6a2235c20c3724ed67946889d432774901cb7ddc71b177e2cbd6c3029f4eb0b4df21c81c6a427494dad550fdbace01876a3d9c79d75
diff --git a/games-roguelike/nethack/files/3.4.3-X-support.patch b/games-roguelike/nethack/files/3.4.3-X-support.patch
new file mode 100644
index 000000000000..6687f8865509
--- /dev/null
+++ b/games-roguelike/nethack/files/3.4.3-X-support.patch
@@ -0,0 +1,26 @@
+--- include/config.h.orig 2003-06-21 20:58:57.000000000 -0400
++++ include/config.h 2003-06-21 20:59:44.000000000 -0400
+@@ -46 +46 @@
+-/* #define X11_GRAPHICS */ /* X11 interface */
++#define X11_GRAPHICS 1
+@@ -127 +127 @@
+-/* # define USE_XPM */ /* Disable if you do not have the XPM library */
++# define USE_XPM 1
+--- Makefile.orig 2003-06-21 21:01:03.000000000 -0400
++++ Makefile 2003-06-21 21:01:16.000000000 -0400
+@@ -43 +43 @@
+-VARDATND =
++VARDATND = x11tiles pet_mark.xbm rip.xpm
+--- src/Makefile.orig 2003-06-21 21:02:01.000000000 -0400
++++ src/Makefile 2003-06-21 21:02:11.000000000 -0400
+@@ -207,2 +207,2 @@
+-WINSRC = $(WINTTYSRC)
+-WINOBJ = $(WINTTYOBJ)
++WINSRC = $(WINTTYSRC) $(WINX11SRC)
++WINOBJ = $(WINTTYOBJ) $(WINX11OBJ)
+@@ -228 +228 @@
+-WINX11LIB = -lXaw -lXmu -lXext -lXt -lX11
++WINX11LIB = -lXaw -lXmu -lXext -lXt -lX11 -lXpm
+@@ -248 +248 @@
+-WINLIB = $(WINTTYLIB)
++WINLIB = $(WINTTYLIB) $(WINX11LIB)
diff --git a/games-roguelike/nethack/files/3.4.3-bison.patch b/games-roguelike/nethack/files/3.4.3-bison.patch
new file mode 100644
index 000000000000..0bec63a7b6ae
--- /dev/null
+++ b/games-roguelike/nethack/files/3.4.3-bison.patch
@@ -0,0 +1,18 @@
+--- nethack-3.4.3/util/Makefile 2004-08-21 01:09:06.724326360 +0200
++++ nethack-3.4.3.new//util/Makefile 2004-08-21 01:08:03.852884272 +0200
+@@ -101,11 +101,11 @@
+
+ # yacc/lex programs to use to generate *_comp.h, *_lex.c, and *_yacc.c.
+ # if, instead of yacc/lex you have bison/flex, comment/uncomment the following.
+-YACC = yacc
+-LEX = lex
+-# YACC = bison -y
++#YACC = yacc
++#LEX = lex
++ YACC = bison -y
+ # YACC = byacc
+-# LEX = flex
++ LEX = flex
+
+ # these are the names of the output files from YACC/LEX. Under MS-DOS
+ # and similar systems, they may differ
diff --git a/games-roguelike/nethack/files/3.4.3-default-options.patch b/games-roguelike/nethack/files/3.4.3-default-options.patch
new file mode 100644
index 000000000000..83ab94a95375
--- /dev/null
+++ b/games-roguelike/nethack/files/3.4.3-default-options.patch
@@ -0,0 +1,29 @@
+--- include/config.h.orig 2003-06-21 20:44:00.000000000 -0400
++++ include/config.h 2003-06-21 20:46:42.000000000 -0400
+@@ -172,2 +172,2 @@
+-#define COMPRESS "/usr/bin/compress" /* Lempel-Ziv compression */
+-#define COMPRESS_EXTENSION ".Z" /* compress's extension */
++#define COMPRESS "/bin/bzip2" /* Lempel-Ziv compression */
++#define COMPRESS_EXTENSION ".bz2" /* compress's extension */
+@@ -188 +188 @@
+-/* #define DLB */ /* not supported on all platforms */
++#define DLB 1 /* not supported on all platforms */
+@@ -207 +207 @@
+-# define HACKDIR "/usr/games/lib/nethackdir"
++# define HACKDIR "GENTOO_HACKDIR"
+@@ -303 +303 @@
+-/* #define VISION_TABLES */ /* use vision tables generated at compile time */
++#define VISION_TABLES 1 /* use vision tables generated at compile time */
+--- include/unixconf.h.orig 2003-06-21 20:47:54.000000000 -0400
++++ include/unixconf.h 2003-06-21 20:48:39.000000000 -0400
+@@ -40 +40 @@
+-/* #define LINUX */ /* Another Unix clone */
++#define LINUX 1 /* Another Unix clone */
+@@ -135 +135 @@
+-/* #define TIMED_DELAY */ /* usleep() */
++#define TIMED_DELAY 1
+--- src/Makefile.orig 2003-06-21 20:55:36.000000000 -0400
++++ src/Makefile 2003-06-21 20:55:49.000000000 -0400
+@@ -234 +234 @@
+-WINTTYLIB = -ltermlib
++WINTTYLIB = -lncurses
diff --git a/games-roguelike/nethack/files/3.4.3-gentoo-paths.patch b/games-roguelike/nethack/files/3.4.3-gentoo-paths.patch
new file mode 100644
index 000000000000..af86cd1fe637
--- /dev/null
+++ b/games-roguelike/nethack/files/3.4.3-gentoo-paths.patch
@@ -0,0 +1,18 @@
+--- include/unixconf.h.orig 2003-08-07 23:18:03.070299152 -0400
++++ include/unixconf.h 2003-08-07 23:18:39.699730632 -0400
+@@ -96,13 +96,13 @@
+ */
+
+ /* #define NO_FILE_LINKS */ /* if no hard links */
+-/* #define LOCKDIR "/usr/games/lib/nethackdir" */ /* where to put locks */
++#define LOCKDIR "GENTOO_STATEDIR"
+
+ /*
+ * If you want the static parts of your playground on a read-only file
+ * system, define VAR_PLAYGROUND to be where the variable parts are kept.
+ */
+-/* #define VAR_PLAYGROUND "/var/lib/games/nethack" */
++#define VAR_PLAYGROUND "GENTOO_STATEDIR"
+
+
+ /*
diff --git a/games-roguelike/nethack/files/3.4.3-macos.patch b/games-roguelike/nethack/files/3.4.3-macos.patch
new file mode 100644
index 000000000000..d5aad3810878
--- /dev/null
+++ b/games-roguelike/nethack/files/3.4.3-macos.patch
@@ -0,0 +1,11 @@
+--- nethack-3.4.3/win/Qt/qt_win.cpp.orig 2005-11-22 21:24:03.000000000 +0100
++++ nethack-3.4.3/win/Qt/qt_win.cpp 2005-11-22 21:25:26.000000000 +0100
+@@ -102,7 +102,7 @@
+ #include "qt_xpms.h"
+
+ #include <dirent.h>
+-#ifdef Q_WS_MACX
++#ifdef __APPLE__
+ # include <sys/malloc.h>
+ #else
+ # include <malloc.h>
diff --git a/games-roguelike/nethack/files/dot.nethackrc b/games-roguelike/nethack/files/dot.nethackrc
new file mode 100644
index 000000000000..55899338cee7
--- /dev/null
+++ b/games-roguelike/nethack/files/dot.nethackrc
@@ -0,0 +1,92 @@
+#
+# Nethack configuration file.
+#
+# Please read the Guidebook in /usr/share/doc/nethack or at www.nethack.org.
+#
+# Naming this file $(HOME)/.nethackrc or setting the environment
+# variable NETHACKOPTIONS to point to its full path name elsewhere tells
+# NetHack to use X11 windowing (provided the executable was compiled with
+# that ability).
+#
+# SET YOUR WINDOW TYPE
+# Your windowtype choices are: GENTOO_WINDOWTYPES
+#
+OPTIONS=windowtype:GENTOO_DEFWINDOWTYPE
+#OPTIONS=color
+#OPTIONS=name:player
+#OPTIONS=gender:male
+#OPTIONS=fruit:mango
+#OPTIONS=dogname:Izchak
+#OPTIONS=catname:Chun-Li
+#OPTIONS=horsename:Marlon
+
+# Suggested for qt:
+#OPTIONS=number_pad,menustyle:partial,!time,showexp
+#OPTIONS=hilite_pet,toptenwin,msghistory:200,windowtype:Qt
+
+# The font settings below are for X11 untiled
+#
+# There are 17 object symbols and various graphics symbols.
+# The descriptions of these symbols can be found in dat/opthelp.
+#
+#
+# Font: nh10 (10x20)
+#
+#OBJECTS= 180 183 188 192 181 184 182 189 190 196 \
+# 191 194 193 187 185 186 195
+#
+#DUNGEON= 032 025 018 013 012 014 011 015 023 024 \
+# 022 021 128 129 130 131 132 035 035 133 \
+# 134 135 136 137 145 146 144 124 143 142 \
+# 141 140 149 150 031 031 147 148 031 161 \
+# 140
+#
+#TRAPS= 138 138 138 138 138 138 138 138 138 138 \
+# 138 138 138 138 138 139 138 138 138 138 \
+# 138 138
+#
+#EFFECTS= 151 152 153 154 155 156 157 158 \
+# 159 160 161 162 \
+# 163 164 165 166 167 168 169 170 \
+# 171 172 173 174 175 176 177 178 179
+#
+#
+# Font: ibm (8x14)
+#
+#OBJECTS= 207 210 215 219 208 211 209 216 217 223 \
+# 218 221 220 214 212 213 222
+#
+#DUNGEON= 032 128 129 130 131 132 133 134 135 136 \
+# 137 138 139 045 124 142 143 035 035 144 \
+# 145 146 147 148 155 156 227 124 154 153 \
+# 152 151 159 160 200 200 157 158 250 170 \
+# 151
+#
+#TRAPS= 149 149 149 149 149 149 149 149 149 149 \
+# 149 149 149 149 149 150 149 149 149 149 \
+# 149 149
+#
+#EFFECTS= 161 162 163 164 165 166 167 168 \
+# 169 170 171 172 \
+# 173 174 175 176 177 178 179 180 \
+# 181 182 183 184 185 186 187 188 189
+#
+#
+# Font: a "standard" font like 6x13
+# Note that this version is unlikely to work on a tty on a Unix system because
+# many of these characters are also control characters.
+#
+#DUNGEON = 032 025 018 013 012 014 011 015 023 024 \
+# 022 021 031 045 124 043 043 035 035 031 \
+# 035 001 060 062 060 062 019 124 092 035 \
+# 123 125 031 125 046 046 035 035 046 127 \
+# 125
+#
+#TRAPS= 094 094 094 094 094 094 094 094 094 094 \
+# 094 094 094 094 094 002 094 094 094 094 \
+# 094 094
+#
+#EFFECTS= 124 045 092 047 042 033 041 040 \
+# 048 035 064 042 \
+# 047 045 092 124 124 092 045 047 \
+# 047 064 092 064 064 064 092 064 047
diff --git a/games-roguelike/nethack/files/nethack-3.4.3-gibc210.patch b/games-roguelike/nethack/files/nethack-3.4.3-gibc210.patch
new file mode 100644
index 000000000000..20675cabf4b4
--- /dev/null
+++ b/games-roguelike/nethack/files/nethack-3.4.3-gibc210.patch
@@ -0,0 +1,13 @@
+--- include/unixconf.h.old 2009-10-07 09:37:46.000000000 +0200
++++ include/unixconf.h 2009-10-07 09:38:05.000000000 +0200
+@@ -293,10 +293,8 @@
+ # endif
+ #else /* therefore SYSV */
+ # ifndef index /* some systems seem to do this for you */
+-#define index strchr
+ # endif
+ # ifndef rindex
+-#define rindex strrchr
+ # endif
+ #endif
+
diff --git a/games-roguelike/nethack/files/nethack-3.4.3-recover.patch b/games-roguelike/nethack/files/nethack-3.4.3-recover.patch
new file mode 100644
index 000000000000..3ad80b072bfc
--- /dev/null
+++ b/games-roguelike/nethack/files/nethack-3.4.3-recover.patch
@@ -0,0 +1,94 @@
+--- doc/recover.6 2003-12-07 18:39:13.000000000 -0500
++++ doc/nethack-recover.6 2010-03-02 16:03:26.978172561 -0500
+@@ -1,9 +1,9 @@
+-.TH RECOVER 6 "9 January 1993"
++.TH NETHACK-RECOVER 6 "9 January 1993"
+ .UC 4
+ .SH NAME
+-recover \- recover a NetHack game interrupted by disaster
++nethack-recover \- nethack-recover a NetHack game interrupted by disaster
+ .SH SYNOPSIS
+-.B recover
++.B nethack-recover
+ [
+ .B \-d
+ .I directory
+@@ -21,7 +21,7 @@
+ The
+ .I base
+ options tell
+-.I recover
++.I nethack-recover
+ which files to process.
+ Each base option specifies recovery of a separate game.
+ .PP
+@@ -56,24 +56,24 @@
+ or "xlock" if the number of concurrent players is being limited.
+ It may be necessary to look in the playground to find the correct
+ base name of the interrupted game.
+-.I recover
++.I nethack-recover
+ will transform these level files into a save file of the same name as
+ .I nethack
+ would have used.
+ .PP
+ Since
+-.I recover
++.I nethack-recover
+ must be able to read and delete files from the playground
+ and create files in the save directory,
+ it has interesting interactions with game security.
+ Giving ordinary players access to
+-.I recover
++.I nethack-recover
+ through setuid or setgid is tantamount to leaving the playground
+ world-writable,
+ with respect to both cheating and messing up other players.
+ For a single-user system, this of course does not change anything,
+ so some of the microcomputer ports install
+-.I recover
++.I nethack-recover
+ by default.
+ .PP
+ For a multi-user system,
+@@ -81,22 +81,22 @@
+ playground to be fed to recover when the host machine boots,
+ and handle game crashes individually.
+ If the user population is sufficiently trustworthy,
+-.I recover
++.I nethack-recover
+ can be installed with the same permissions the
+ .I nethack
+ executable has.
+ In either case,
+-.I recover
++.I nethack-recover
+ is easily compiled from the distribution utility directory.
+ .SH NOTES
+ .PP
+ Like
+ .I nethack
+ itself,
+-.I recover
++.I nethack-recover
+ will overwrite existing savefiles of the same name.
+ Savefiles created by
+-.I recover
++.I nethack-recover
+ are uncompressed;
+ they may be compressed afterwards if desired,
+ but even a compression-using
+@@ -106,11 +106,11 @@
+ nethack(6)
+ .SH BUGS
+ .PP
+-.I recover
++.I nethack-recover
+ makes no attempt to find out if a base name specifies a game in progress.
+ If multiple machines share a playground, this would be impossible to
+ determine.
+ .PP
+-.I recover
++.I nethack-recover
+ should be taught to use the nethack playground locking mechanism to
+ avoid conflicts.
diff --git a/games-roguelike/nethack/metadata.xml b/games-roguelike/nethack/metadata.xml
new file mode 100644
index 000000000000..28f26f28ac64
--- /dev/null
+++ b/games-roguelike/nethack/metadata.xml
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <herd>proxy-maintainers</herd>
+ <maintainer>
+ <email>aranea@aixah.de</email>
+ <name>Luis Ressel</name>
+ <description>Maintainer</description>
+ </maintainer>
+ <upstream>
+ <remote-id type="sourceforge">nethack</remote-id>
+ </upstream>
+</pkgmetadata>
diff --git a/games-roguelike/nethack/nethack-3.4.3-r3.ebuild b/games-roguelike/nethack/nethack-3.4.3-r3.ebuild
new file mode 100644
index 000000000000..c4a490fbe5a1
--- /dev/null
+++ b/games-roguelike/nethack/nethack-3.4.3-r3.ebuild
@@ -0,0 +1,218 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+inherit eutils toolchain-funcs flag-o-matic user
+
+MY_PV=${PV//.}
+DESCRIPTION="The ultimate old-school single player dungeon exploration game"
+HOMEPAGE="http://www.nethack.org/"
+SRC_URI="mirror://sourceforge/nethack/${PN}-${MY_PV}-src.tgz"
+
+LICENSE="nethack"
+SLOT="0"
+KEYWORDS="~amd64 ~hppa ~ppc ~sparc ~x86 ~x86-fbsd"
+IUSE="X"
+
+RDEPEND=">=sys-libs/ncurses-5.2-r5
+ X? (
+ x11-libs/libXaw
+ x11-libs/libXpm
+ x11-libs/libXt
+ )"
+DEPEND="${RDEPEND}
+ virtual/pkgconfig
+ X? (
+ x11-proto/xproto
+ x11-apps/bdftopcf
+ x11-apps/mkfontdir
+ )"
+
+BINDIR="/usr/games/bin"
+HACKDIR="/usr/share/games/${PN}"
+STATEDIR="/var/games/${PN}"
+
+NETHACK_GROUP="gamestat"
+
+pkg_setup() {
+ enewgroup gamestat 36
+}
+
+src_prepare() {
+ # This copies the /sys/unix Makefile.*s to their correct places for
+ # seding and compiling.
+ cd "sys/unix" || die "Could not go into sys/unix directory"
+ source setup.sh || die
+
+ cd ../.. || die "Failed to get back to main directory"
+ epatch \
+ "${FILESDIR}"/${PV}-gentoo-paths.patch \
+ "${FILESDIR}"/${PV}-default-options.patch \
+ "${FILESDIR}"/${PV}-bison.patch \
+ "${FILESDIR}"/${PV}-macos.patch \
+ "${FILESDIR}"/${P}-gibc210.patch \
+ "${FILESDIR}"/${P}-recover.patch
+
+ epatch_user
+
+ mv doc/recover.6 doc/nethack-recover.6 || die "Could not rename recover.6 to nethack-recover.6"
+
+ sed -i \
+ -e "s:GENTOO_STATEDIR:${STATEDIR}:" include/unixconf.h \
+ || die "setting statedir"
+ sed -i \
+ -e "s:GENTOO_HACKDIR:${HACKDIR}:" include/config.h \
+ || die "setting hackdir"
+ # set the default pager from the environment bug #52122
+ if [[ -n "${PAGER}" ]] ; then
+ sed -i \
+ -e "115c\#define DEF_PAGER \"${PAGER}\"" \
+ include/unixconf.h \
+ || die "setting statedir"
+ # bug #57410
+ sed -i \
+ -e "s/^DATNODLB =/DATNODLB = \$(DATHELP)/" Makefile \
+ || die "sed Makefile failed"
+ fi
+
+ # sys-libs/ncurses[tinfo]
+ sed -i \
+ -e '/^WINTTYLIB/s| = .*| = '"$(
+ $(tc-getPKG_CONFIG) --libs ncurses
+ )"'|g' \
+ src/Makefile || die
+
+ if use X ; then
+ epatch "${FILESDIR}/${PV}-X-support.patch"
+ fi
+}
+
+src_compile() {
+ local lflags="${LDFLAGS}"
+
+ cd "${S}"/src || die "Failed to enter src directory"
+ append-flags -I../include
+
+ emake \
+ CC="$(tc-getCC)" \
+ CFLAGS="${CFLAGS}" \
+ LFLAGS="${lflags}" \
+ ../util/makedefs
+ emake \
+ CC="$(tc-getCC)" \
+ CFLAGS="${CFLAGS}" \
+ LFLAGS="${lflags}"
+ cd "${S}"/util || die "Failed to enter util directory"
+ emake \
+ CC="$(tc-getCC)" \
+ CFLAGS="${CFLAGS}" \
+ LFLAGS="${lflags}" \
+ recover
+}
+
+src_install() {
+ emake \
+ CC="$(tc-getCC)" \
+ CFLAGS="${CFLAGS}" \
+ LFLAGS="-L/usr/X11R6/lib" \
+ GAMEPERM=02755 \
+ GAMEUID="root" GAMEGRP="${NETHACK_GROUP}" \
+ PREFIX="${D}/usr" \
+ GAMEDIR="${D}/${HACKDIR}" \
+ SHELLDIR="${D}/${BINDIR}" \
+ install
+
+ # We keep this stuff in STATEDIR instead so tidy up.
+ rm -rf "${D}/${HACKDIR}/"{recover,save}
+
+ exeinto "${BINDIR}"
+ newexe util/recover recover-nethack
+
+ # The final nethack is a sh script. This fixes the hard-coded
+ # HACKDIR directory so it doesn't point to ${D}/usr/share/nethackdir
+ sed -i \
+ -e "s:^\(HACKDIR=\).*:\1${HACKDIR}:" \
+ "${D}/${BINDIR}/nethack" \
+ || die "sed /${BINDIR}/nethack failed"
+
+ doman doc/*.6
+ dodoc doc/*.txt
+
+ # Can be copied to ~/.nethackrc to set options
+ # Add this to /etc/.skel as well, thats the place for default configs
+ insinto "${HACKDIR}"
+ doins "${FILESDIR}/dot.nethackrc"
+
+ local windowtypes="tty"
+ use X && windowtypes="${windowtypes} x11"
+ set -- ${windowtypes}
+ sed -i \
+ -e "s:GENTOO_WINDOWTYPES:${windowtypes}:" \
+ -e "s:GENTOO_DEFWINDOWTYPE:$1:" \
+ "${D}${HACKDIR}/dot.nethackrc" \
+ || die "sed ${HACKDIR}/dot.nethackrc failed"
+ insinto /etc/skel
+ newins "${D}/${HACKDIR}/dot.nethackrc" .nethackrc
+
+ if use X ; then
+ # install nethack fonts
+ cd "${S}/win/X11" || die "Failed to enter win/X11 directory"
+ bdftopcf -o nh10.pcf nh10.bdf || die "Converting fonts failed"
+ bdftopcf -o ibm.pcf ibm.bdf || die "Converting fonts failed"
+ insinto "${HACKDIR}/fonts"
+ doins *.pcf
+ cd "${D}/${HACKDIR}/fonts" || die "Failed to enter fonts directory"
+ mkfontdir || die "The action mkfontdir ${HACKDIR}/fonts failed"
+
+ # copy nethack x application defaults
+ cd "${S}/win/X11" || die "Failed to enter win/X11 directory again"
+ insinto /etc/X11/app-defaults
+ newins NetHack.ad NetHack
+ sed -i \
+ -e 's:^!\(NetHack.tile_file.*\):\1:' \
+ "${D}/etc/X11/app-defaults/NetHack" \
+ || die "sed /etc/X11/app-defaults/NetHack failed"
+ fi
+
+ keepdir "${STATEDIR}/save"
+ rm "${D}/${HACKDIR}/"{logfile,perm,record}
+ make_desktop_entry nethack "Nethack"
+
+ fowners -R "root:${NETHACK_GROUP}" "${STATEDIR}"
+ fperms -R 660 "${STATEDIR}"
+ fperms 770 "${STATEDIR}" "${STATEDIR}/save"
+
+ # FIXME: main executable in /usr/games/share
+}
+
+pkg_preinst() {
+ if has_version "<${CATEGORY}/${PN}-3.4.3-r3" ; then
+ migration=true
+
+ # preserve STATEDIR/{logfile,record} (previous ebuild rev mistakenly removes it)
+ cp "${ROOT}/${STATEDIR}/"{logfile,record} "$T" # nonfatal
+ fi
+}
+
+pkg_postinst() {
+ # we don't want to overwrite existing files, as they contain user data
+ cd "${ROOT}/${STATEDIR}" || die "Failed to enter ${STATEDIR} directory"
+ local files="logfile perm record"
+
+ touch $files && \
+ chmod 660 $files && \
+ chown root:"${NETHACK_GROUP}" $files || \
+ die "Adjustment of file permissions in "${ROOT}/${STATEDIR}" failed"
+
+ if [[ -v migration ]] ; then
+ cp "$T/"{logfile,record} "${ROOT}/${STATEDIR}" # nonfatal
+
+ chown -R root:"${NETHACK_GROUP}" "${ROOT}/${STATEDIR}" && \
+ chmod -R 660 "${ROOT}/${STATEDIR}" && \
+ chmod 770 "${ROOT}/${STATEDIR}" "${ROOT}/${STATEDIR}/save" || \
+ die "Adjustment of file permissions in "${ROOT}/${STATEDIR}" failed"
+ fi
+
+ elog "You may want to look at /etc/skel/.nethackrc for interesting options"
+}
diff --git a/games-roguelike/nethack/nethack-3.4.3-r4.ebuild b/games-roguelike/nethack/nethack-3.4.3-r4.ebuild
new file mode 100644
index 000000000000..7e82eb8964a4
--- /dev/null
+++ b/games-roguelike/nethack/nethack-3.4.3-r4.ebuild
@@ -0,0 +1,231 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+inherit eutils toolchain-funcs flag-o-matic user
+
+MY_PV=${PV//.}
+DESCRIPTION="The ultimate old-school single player dungeon exploration game"
+HOMEPAGE="http://www.nethack.org/"
+SRC_URI="mirror://sourceforge/nethack/${PN}-${MY_PV}-src.tgz"
+
+LICENSE="nethack"
+SLOT="0"
+KEYWORDS="~amd64 ~hppa ~ppc ~sparc ~x86 ~x86-fbsd"
+IUSE="X"
+
+RDEPEND=">=sys-libs/ncurses-5.2-r5
+ X? (
+ x11-libs/libXaw
+ x11-libs/libXpm
+ x11-libs/libXt
+ )"
+DEPEND="${RDEPEND}
+ virtual/pkgconfig
+ X? (
+ x11-proto/xproto
+ x11-apps/bdftopcf
+ x11-apps/mkfontdir
+ )"
+
+BINDIR="/usr/games/bin"
+HACKDIR="/usr/share/games/${PN}"
+STATEDIR="/var/games/${PN}"
+
+NETHACK_GROUP="gamestat"
+
+pkg_setup() {
+ enewgroup gamestat 36
+}
+
+src_prepare() {
+ # This copies the /sys/unix Makefile.*s to their correct places for
+ # seding and compiling.
+ cd "sys/unix" || die "Could not go into sys/unix directory"
+ source setup.sh || die
+
+ cd ../.. || die "Failed to get back to main directory"
+ epatch \
+ "${FILESDIR}"/${PV}-gentoo-paths.patch \
+ "${FILESDIR}"/${PV}-default-options.patch \
+ "${FILESDIR}"/${PV}-bison.patch \
+ "${FILESDIR}"/${PV}-macos.patch \
+ "${FILESDIR}"/${P}-gibc210.patch \
+ "${FILESDIR}"/${P}-recover.patch
+
+ epatch_user
+
+ mv doc/recover.6 doc/nethack-recover.6 || die "Could not rename recover.6 to nethack-recover.6"
+
+ sed -i \
+ -e "s:GENTOO_STATEDIR:${STATEDIR}:" include/unixconf.h \
+ || die "setting statedir"
+ sed -i \
+ -e "s:GENTOO_HACKDIR:${HACKDIR}:" include/config.h \
+ || die "setting hackdir"
+ # set the default pager from the environment bug #52122
+ if [[ -n "${PAGER}" ]] ; then
+ sed -i \
+ -e "115c\#define DEF_PAGER \"${PAGER}\"" \
+ include/unixconf.h \
+ || die "setting statedir"
+ # bug #57410
+ sed -i \
+ -e "s/^DATNODLB =/DATNODLB = \$(DATHELP)/" Makefile \
+ || die "sed Makefile failed"
+ fi
+
+ # sys-libs/ncurses[tinfo]
+ sed -i \
+ -e '/^WINTTYLIB/s| = .*| = '"$(
+ $(tc-getPKG_CONFIG) --libs ncurses
+ )"'|g' \
+ src/Makefile || die
+
+ if use X ; then
+ epatch "${FILESDIR}/${PV}-X-support.patch"
+ fi
+}
+
+src_compile() {
+ local lflags="${LDFLAGS}"
+
+ cd "${S}"/src || die "Failed to enter src directory"
+ append-flags -I../include
+
+ emake \
+ CC="$(tc-getCC)" \
+ CFLAGS="${CFLAGS}" \
+ LFLAGS="${lflags}" \
+ ../util/makedefs
+ emake \
+ CC="$(tc-getCC)" \
+ CFLAGS="${CFLAGS}" \
+ LFLAGS="${lflags}"
+ cd "${S}"/util || die "Failed to enter util directory"
+ emake \
+ CC="$(tc-getCC)" \
+ CFLAGS="${CFLAGS}" \
+ LFLAGS="${lflags}" \
+ recover
+}
+
+src_install() {
+ emake \
+ CC="$(tc-getCC)" \
+ CFLAGS="${CFLAGS}" \
+ LFLAGS="-L/usr/X11R6/lib" \
+ GAMEPERM=02755 \
+ GAMEUID="root" GAMEGRP="${NETHACK_GROUP}" \
+ PREFIX="${D}/usr" \
+ GAMEDIR="${D}/${HACKDIR}" \
+ SHELLDIR="${D}/${BINDIR}" \
+ install
+
+ # We keep this stuff in STATEDIR instead so tidy up.
+ rm -rf "${D}/${HACKDIR}/"{nethack,recover,save}
+
+ exeinto "${BINDIR}"
+ newexe src/nethack nethack-bin
+ newexe util/recover recover-nethack
+
+ # The final nethack is a sh script. This fixes the hard-coded
+ # HACKDIR directory so it doesn't point to ${D}/usr/share/nethackdir
+ # and points HACK to BINDIR/nethack-bin (see above)
+ sed -i \
+ -e "s:^\(HACKDIR=\).*$:\1${HACKDIR}:;
+ s:^\(HACK=\).*$:\1${BINDIR}/nethack-bin:" \
+ "${D}/${BINDIR}/nethack" \
+ || die "sed /${BINDIR}/nethack failed"
+
+ doman doc/*.6
+ dodoc doc/*.txt
+
+ # Can be copied to ~/.nethackrc to set options
+ # Add this to /etc/.skel as well, thats the place for default configs
+ insinto "${HACKDIR}"
+ doins "${FILESDIR}/dot.nethackrc"
+
+ local windowtypes="tty"
+ use X && windowtypes="${windowtypes} x11"
+ set -- ${windowtypes}
+ sed -i \
+ -e "s:GENTOO_WINDOWTYPES:${windowtypes}:" \
+ -e "s:GENTOO_DEFWINDOWTYPE:$1:" \
+ "${D}${HACKDIR}/dot.nethackrc" \
+ || die "sed ${HACKDIR}/dot.nethackrc failed"
+ insinto /etc/skel
+ newins "${D}/${HACKDIR}/dot.nethackrc" .nethackrc
+
+ if use X ; then
+ # install nethack fonts
+ cd "${S}/win/X11" || die "Failed to enter win/X11 directory"
+ bdftopcf -o nh10.pcf nh10.bdf || die "Converting fonts failed"
+ bdftopcf -o ibm.pcf ibm.bdf || die "Converting fonts failed"
+ insinto "${HACKDIR}/fonts"
+ doins *.pcf
+ cd "${D}/${HACKDIR}/fonts" || die "Failed to enter fonts directory"
+ mkfontdir || die "The action mkfontdir ${HACKDIR}/fonts failed"
+
+ # copy nethack x application defaults
+ cd "${S}/win/X11" || die "Failed to enter win/X11 directory again"
+ insinto /etc/X11/app-defaults
+ newins NetHack.ad NetHack
+ sed -i \
+ -e 's:^!\(NetHack.tile_file.*\):\1:' \
+ "${D}/etc/X11/app-defaults/NetHack" \
+ || die "sed /etc/X11/app-defaults/NetHack failed"
+ fi
+
+ keepdir "${STATEDIR}/save"
+ rm "${D}/${HACKDIR}/"{logfile,perm,record}
+ make_desktop_entry nethack "Nethack"
+
+ fowners -R "root:${NETHACK_GROUP}" "${STATEDIR}"
+ fperms -R 660 "${STATEDIR}"
+ fperms 770 "${STATEDIR}" "${STATEDIR}/save"
+
+ fowners "root:${NETHACK_GROUP}" ${BINDIR}/nethack-bin
+ fperms g+s ${BINDIR}/nethack-bin
+}
+
+pkg_preinst() {
+ if has_version "<${CATEGORY}/${PN}-3.4.3-r3" ; then
+ migration=true
+
+ # preserve STATEDIR/{logfile,record}
+ # (previous ebuild rev mistakenly removes it)
+ for f in "${ROOT}/${STATEDIR}/"{logfile,record} ; do
+ if [[ -e "$f" ]] ; then
+ cp "$f" "$T" || die "Failed to preserve ${ROOT}/${STATEDIR} files"
+ else
+ touch "$T/$f" || die "Failed to preserve ${ROOT}/${STATEDIR} files"
+ fi
+ done
+ fi
+}
+
+pkg_postinst() {
+ cd "${ROOT}/${STATEDIR}" || die "Failed to enter ${STATEDIR} directory"
+
+ if [[ -v migration ]] ; then
+ cp "$T/"{logfile,record} . || \
+ die "Failed to preserve ${ROOT}/${STATEDIR} files"
+
+ chown -R root:"${NETHACK_GROUP}" . && \
+ chmod -R 660 . && \
+ chmod 770 . save || \
+ die "Adjustment of file permissions in ${ROOT}/${STATEDIR} failed"
+ fi
+
+ # we don't want to overwrite existing files, as they contain user data
+ local files="logfile perm record"
+
+ touch $files && \
+ chmod 660 $files && \
+ chown root:"${NETHACK_GROUP}" $files || \
+ die "Adjustment of file permissions in "${ROOT}/${STATEDIR}" failed"
+
+ elog "You may want to look at /etc/skel/.nethackrc for interesting options"
+}