blob: 964553723c5a223e39c46b32fecd8884e597c304 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
|
# Copyright 1999-2003 Gentoo Technologies, Inc.
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/games-roguelike/nethack/nethack-3.4.2.ebuild,v 1.1 2003/09/15 06:55:29 vapier Exp $
inherit games eutils flag-o-matic gcc
append-flags -I../include
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}.tgz"
#SRC_URI="ftp://ftp.nethack.org/pub/nethack/nh340/src/nethack-340.tgz"
KEYWORDS="x86 ppc"
SLOT="0"
LICENSE="nethack"
IUSE="X qt gnome"
DEPEND="virtual/glibc
dev-util/yacc
>=sys-libs/ncurses-5.2-r5
X? ( x11-base/xfree )
qt? ( x11-libs/qt )
gnome? ( >=gnome-base/gnome-libs-1.4.1.4-r2 )"
HACKDIR=${GAMES_DATADIR}/${PN}
src_unpack() {
unpack ${A}
# This copies the /sys/unix Makefile.*s to their correct places for
# seding and compiling.
cd ${S}/sys/unix
source setup.sh || die
cd ${S}
epatch ${FILESDIR}/${PV}-gentoo-paths.patch
epatch ${FILESDIR}/${PV}-errno.patch
epatch ${FILESDIR}/${PV}-default-options.patch
sed -i "s:GENTOO_STATEDIR:${GAMES_STATEDIR}/${PN}:" include/unixconf.h || die "setting statedir"
sed -i "s:GENTOO_HACKDIR:${HACKDIR}:" include/config.h || die "seting hackdir"
if [ `use X` ] ; then
epatch ${FILESDIR}/${PV}-X-support.patch
if [ `use qt` ] ; then
epatch ${FILESDIR}/${PV}-QT-support.patch
[ `use gnome` ] && epatch ${FILESDIR}/${PV}-QT-GNOME-support.patch
elif [ `use gnome` ] ; then
epatch ${FILESDIR}/${PV}-GNOME-support.patch
fi
fi
}
src_compile() {
local qtver=
has_version =x11-libs/qt-3* \
&& qtver=3 \
|| qtver=2
cd ${S}/src
make \
QTDIR=/usr/qt/${qtver} \
CC="$(gcc-getCC)" \
CFLAGS="${CFLAGS}" \
LFLAGS="-L/usr/X11R6/lib" \
|| die
cd ${S}/util
make CFLAGS="${CFLAGS}" recover || die
}
src_install() {
make \
CC="$(gcc-getCC)" \
CFLAGS="${CFLAGS}" \
LFLAGS="-L/usr/X11R6/lib" \
GAMEPERM=0755 \
PREFIX=${D}/usr \
GAMEDIR=${D}${HACKDIR} \
SHELLDIR=${D}/${GAMES_BINDIR} \
install \
|| die "make install failed"
newgamesbin 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
dosed "s:^\(HACKDIR=\).*:\1${HACKDIR}:" ${GAMES_BINDIR}/nethack
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 gnome` ] && windowtypes="${windowtypes} gnome"
[ `use qt` ] && windowtypes="${windowtypes} qt"
[ `use X` ] && windowtypes="${windowtypes} x11"
set -- ${windowtypes}
dosed "s:GENTOO_WINDOWTYPES:${windowtypes}:" ${HACKDIR}/dot.nethackrc
dosed "s:GENTOO_DEFWINDOWTYPE:$1:" ${HACKDIR}/dot.nethackrc
insinto /etc/skel
newins ${D}/${HACKDIR}/dot.nethackrc .nethackrc
if [ `use X` ] ; then
# install nethack fonts
cd ${S}/win/X11
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
mkfontdir || die "The action mkfontdir ${D}${HACKDIR}/fonts failed"
# copy nethack x application defaults
cd ${S}/win/X11
insinto /etc/X11/app-defaults
newins NetHack.ad NetHack || die "Failed to install NetHack X app defaults"
dosed 's:^!\(NetHack.tile_file.*\):\1:' /etc/X11/app-defaults/NetHack
fi
# make sure we dont overwrite previous settings #16428
local statedir=${GAMES_STATEDIR}/${PN}
dodir ${statedir}
mv ${D}/${HACKDIR}/{record,logfile,perm} ${D}/${statedir}/
for f in record logfile perm ; do
[ ! -e ${statedir}/${f} ] && continue
mv ${D}/${statedir}/${f}{,.sample}
done
keepdir ${statedir}/save
prepgamesdirs
chmod -R 660 ${D}/${statedir}
chmod 770 ${D}/${statedir} ${D}/${statedir}/save
}
pkg_postinst() {
games_pkg_postinst
einfo "you may want to look at /etc/skel/.nethackrc for interesting options"
}
|