/[gentoo-x86]/games-roguelike/nethack/nethack-3.4.3-r3.ebuild
Gentoo

Contents of /games-roguelike/nethack/nethack-3.4.3-r3.ebuild

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1 - (show annotations) (download)
Fri Feb 20 16:24:58 2015 UTC (5 years, 4 months ago) by swift
Branch: MAIN
CVS Tags: HEAD
Update ebuild to reflect QA policy on games and gamestats, with thanks to Luis "aranea" Ressel

(Portage version: 2.2.14/cvs/Linux x86_64, signed Manifest commit with key 0x2EDD52403B68AF47)

1 # Copyright 1999-2015 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3 # $Header: /var/cvsroot/gentoo-x86/games-roguelike/nethack/nethack-3.4.3-r2.ebuild,v 1.1 2015/02/19 14:11:41 swift Exp $
4
5 EAPI=5
6 inherit eutils toolchain-funcs flag-o-matic user
7
8 MY_PV=${PV//.}
9 DESCRIPTION="The ultimate old-school single player dungeon exploration game"
10 HOMEPAGE="http://www.nethack.org/"
11 SRC_URI="mirror://sourceforge/nethack/${PN}-${MY_PV}-src.tgz"
12
13 LICENSE="nethack"
14 SLOT="0"
15 KEYWORDS="~amd64 ~hppa ~ppc ~sparc ~x86 ~x86-fbsd"
16 IUSE="X"
17
18 RDEPEND=">=sys-libs/ncurses-5.2-r5
19 X? (
20 x11-libs/libXaw
21 x11-libs/libXpm
22 x11-libs/libXt
23 )"
24 DEPEND="${RDEPEND}
25 virtual/pkgconfig
26 X? (
27 x11-proto/xproto
28 x11-apps/bdftopcf
29 x11-apps/mkfontdir
30 )"
31
32 BINDIR="/usr/games/bin"
33 HACKDIR="/usr/share/games/${PN}"
34 STATEDIR="/var/games/${PN}"
35
36 NETHACK_GROUP="gamestat"
37
38 pkg_setup() {
39 enewgroup gamestat 36
40 }
41
42 src_prepare() {
43 # This copies the /sys/unix Makefile.*s to their correct places for
44 # seding and compiling.
45 cd "sys/unix" || die "Could not go into sys/unix directory"
46 source setup.sh || die
47
48 cd ../.. || die "Failed to get back to main directory"
49 epatch \
50 "${FILESDIR}"/${PV}-gentoo-paths.patch \
51 "${FILESDIR}"/${PV}-default-options.patch \
52 "${FILESDIR}"/${PV}-bison.patch \
53 "${FILESDIR}"/${PV}-macos.patch \
54 "${FILESDIR}"/${P}-gibc210.patch \
55 "${FILESDIR}"/${P}-recover.patch
56
57 epatch_user
58
59 mv doc/recover.6 doc/nethack-recover.6 || die "Could not rename recover.6 to nethack-recover.6"
60
61 sed -i \
62 -e "s:GENTOO_STATEDIR:${STATEDIR}:" include/unixconf.h \
63 || die "setting statedir"
64 sed -i \
65 -e "s:GENTOO_HACKDIR:${HACKDIR}:" include/config.h \
66 || die "setting hackdir"
67 # set the default pager from the environment bug #52122
68 if [[ -n "${PAGER}" ]] ; then
69 sed -i \
70 -e "115c\#define DEF_PAGER \"${PAGER}\"" \
71 include/unixconf.h \
72 || die "setting statedir"
73 # bug #57410
74 sed -i \
75 -e "s/^DATNODLB =/DATNODLB = \$(DATHELP)/" Makefile \
76 || die "sed Makefile failed"
77 fi
78
79 # sys-libs/ncurses[tinfo]
80 sed -i \
81 -e '/^WINTTYLIB/s| = .*| = '"$(
82 $(tc-getPKG_CONFIG) --libs ncurses
83 )"'|g' \
84 src/Makefile || die
85
86 if use X ; then
87 epatch "${FILESDIR}/${PV}-X-support.patch"
88 fi
89 }
90
91 src_compile() {
92 local lflags="${LDFLAGS}"
93
94 cd "${S}"/src || die "Failed to enter src directory"
95 append-flags -I../include
96
97 emake \
98 CC="$(tc-getCC)" \
99 CFLAGS="${CFLAGS}" \
100 LFLAGS="${lflags}" \
101 ../util/makedefs
102 emake \
103 CC="$(tc-getCC)" \
104 CFLAGS="${CFLAGS}" \
105 LFLAGS="${lflags}"
106 cd "${S}"/util || die "Failed to enter util directory"
107 emake \
108 CC="$(tc-getCC)" \
109 CFLAGS="${CFLAGS}" \
110 LFLAGS="${lflags}" \
111 recover
112 }
113
114 src_install() {
115 emake \
116 CC="$(tc-getCC)" \
117 CFLAGS="${CFLAGS}" \
118 LFLAGS="-L/usr/X11R6/lib" \
119 GAMEPERM=02755 \
120 GAMEUID="root" GAMEGRP="${NETHACK_GROUP}" \
121 PREFIX="${D}/usr" \
122 GAMEDIR="${D}/${HACKDIR}" \
123 SHELLDIR="${D}/${BINDIR}" \
124 install
125
126 # We keep this stuff in STATEDIR instead so tidy up.
127 rm -rf "${D}/${HACKDIR}/"{recover,save}
128
129 exeinto "${BINDIR}"
130 newexe util/recover recover-nethack
131
132 # The final nethack is a sh script. This fixes the hard-coded
133 # HACKDIR directory so it doesn't point to ${D}/usr/share/nethackdir
134 sed -i \
135 -e "s:^\(HACKDIR=\).*:\1${HACKDIR}:" \
136 "${D}/${BINDIR}/nethack" \
137 || die "sed /${BINDIR}/nethack failed"
138
139 doman doc/*.6
140 dodoc doc/*.txt
141
142 # Can be copied to ~/.nethackrc to set options
143 # Add this to /etc/.skel as well, thats the place for default configs
144 insinto "${HACKDIR}"
145 doins "${FILESDIR}/dot.nethackrc"
146
147 local windowtypes="tty"
148 use X && windowtypes="${windowtypes} x11"
149 set -- ${windowtypes}
150 sed -i \
151 -e "s:GENTOO_WINDOWTYPES:${windowtypes}:" \
152 -e "s:GENTOO_DEFWINDOWTYPE:$1:" \
153 "${D}${HACKDIR}/dot.nethackrc" \
154 || die "sed ${HACKDIR}/dot.nethackrc failed"
155 insinto /etc/skel
156 newins "${D}/${HACKDIR}/dot.nethackrc" .nethackrc
157
158 if use X ; then
159 # install nethack fonts
160 cd "${S}/win/X11" || die "Failed to enter win/X11 directory"
161 bdftopcf -o nh10.pcf nh10.bdf || die "Converting fonts failed"
162 bdftopcf -o ibm.pcf ibm.bdf || die "Converting fonts failed"
163 insinto "${HACKDIR}/fonts"
164 doins *.pcf
165 cd "${D}/${HACKDIR}/fonts" || die "Failed to enter fonts directory"
166 mkfontdir || die "The action mkfontdir ${HACKDIR}/fonts failed"
167
168 # copy nethack x application defaults
169 cd "${S}/win/X11" || die "Failed to enter win/X11 directory again"
170 insinto /etc/X11/app-defaults
171 newins NetHack.ad NetHack
172 sed -i \
173 -e 's:^!\(NetHack.tile_file.*\):\1:' \
174 "${D}/etc/X11/app-defaults/NetHack" \
175 || die "sed /etc/X11/app-defaults/NetHack failed"
176 fi
177
178 keepdir "${STATEDIR}/save"
179 rm "${D}/${HACKDIR}/"{logfile,perm,record}
180 make_desktop_entry nethack "Nethack"
181
182 fowners -R "root:${NETHACK_GROUP}" "${STATEDIR}"
183 fperms -R 660 "${STATEDIR}"
184 fperms 770 "${STATEDIR}" "${STATEDIR}/save"
185
186 # FIXME: main executable in /usr/games/share
187 }
188
189 pkg_preinst() {
190 if has_version "<${CATEGORY}/${PN}-3.4.3-r3" ; then
191 migration=true
192
193 # preserve STATEDIR/{logfile,record} (previous ebuild rev mistakenly removes it)
194 cp "${ROOT}/${STATEDIR}/"{logfile,record} "$T" # nonfatal
195 fi
196 }
197
198 pkg_postinst() {
199 # we don't want to overwrite existing files, as they contain user data
200 cd "${ROOT}/${STATEDIR}" || die "Failed to enter ${STATEDIR} directory"
201 local files="logfile perm record"
202
203 touch $files && \
204 chmod 660 $files && \
205 chown root:"${NETHACK_GROUP}" $files || \
206 die "Adjustment of file permissions in "${ROOT}/${STATEDIR}" failed"
207
208 if [[ -v migration ]] ; then
209 cp "$T/"{logfile,record} "${ROOT}/${STATEDIR}" # nonfatal
210
211 chown -R root:"${NETHACK_GROUP}" "${ROOT}/${STATEDIR}" && \
212 chmod -R 660 "${ROOT}/${STATEDIR}" && \
213 chmod 770 "${ROOT}/${STATEDIR}" "${ROOT}/${STATEDIR}/save" || \
214 die "Adjustment of file permissions in "${ROOT}/${STATEDIR}" failed"
215 fi
216
217 elog "You may want to look at /etc/skel/.nethackrc for interesting options"
218 }

  ViewVC Help
Powered by ViewVC 1.1.20