| 1 |
# Copyright 1999-2012 Gentoo Foundation
|
| 2 |
# Distributed under the terms of the GNU General Public License v2
|
| 3 |
# $Header: /var/cvsroot/gentoo-x86/eclass/games-ggz.eclass,v 1.8 2012/04/23 07:16:34 mr_bones_ Exp $
|
| 4 |
|
| 5 |
inherit base
|
| 6 |
|
| 7 |
# For GGZ Gaming Zone packages
|
| 8 |
|
| 9 |
GAMES_GGZ_EXPF="src_compile src_install pkg_postinst pkg_postrm"
|
| 10 |
case "${EAPI:-0}" in
|
| 11 |
2|3|4|5) GAMES_GGZ_EXPF+=" src_configure" ;;
|
| 12 |
0|1) : ;;
|
| 13 |
*) die "EAPI=${EAPI} is not supported" ;;
|
| 14 |
esac
|
| 15 |
EXPORT_FUNCTIONS ${GAMES_GGZ_EXPF}
|
| 16 |
|
| 17 |
HOMEPAGE="http://www.ggzgamingzone.org/"
|
| 18 |
SRC_URI="mirror://ggz/${PV}/${P}.tar.gz"
|
| 19 |
|
| 20 |
GGZ_MODDIR="/usr/share/ggz/modules"
|
| 21 |
|
| 22 |
games-ggz_src_configure() {
|
| 23 |
local reg="--enable-noregistry=\"${GGZ_MODDIR}\""
|
| 24 |
[[ ${PN} == ggz-client-libs ]] && reg=''
|
| 25 |
econf \
|
| 26 |
--disable-dependency-tracking \
|
| 27 |
$reg \
|
| 28 |
$(has debug ${IUSE} && ! use debug && echo --disable-debug) \
|
| 29 |
"$@"
|
| 30 |
}
|
| 31 |
|
| 32 |
games-ggz_src_compile() {
|
| 33 |
has src_configure ${GAMES_GGZ_EXPF} || games-ggz_src_configure
|
| 34 |
emake || die "emake failed"
|
| 35 |
}
|
| 36 |
|
| 37 |
games-ggz_src_install() {
|
| 38 |
emake DESTDIR="${D}" install || die "emake install failed"
|
| 39 |
local f
|
| 40 |
for f in AUTHORS ChangeLog NEWS QuickStart.GGZ README* TODO ; do
|
| 41 |
[[ -f ${f} ]] && dodoc ${f}
|
| 42 |
done
|
| 43 |
}
|
| 44 |
|
| 45 |
# Update ggz.modules with the .dsc files from ${GGZ_MODDIR}.
|
| 46 |
games-ggz_update_modules() {
|
| 47 |
[[ ${EBUILD_PHASE} == "postinst" || ${EBUILD_PHASE} == "postrm" ]] \
|
| 48 |
|| die "${FUNCNAME} can only be used in pkg_postinst or pkg_postrm"
|
| 49 |
|
| 50 |
# ggz-config needs libggz, so it could be broken
|
| 51 |
ggz-config -h &> /dev/null || return 1
|
| 52 |
|
| 53 |
local confdir=${ROOT}/etc
|
| 54 |
local moddir=${ROOT}/${GGZ_MODDIR}
|
| 55 |
local dsc rval=0
|
| 56 |
|
| 57 |
mkdir -p "${confdir}"
|
| 58 |
echo -n > "${confdir}"/ggz.modules
|
| 59 |
if [[ -d ${moddir} ]] ; then
|
| 60 |
ebegin "Updating GGZ modules"
|
| 61 |
cd "${moddir}"
|
| 62 |
find . -type f -name '*.dsc' | while read dsc ; do
|
| 63 |
DESTDIR=${ROOT} ggz-config -Dim "${dsc}" || ((rval++))
|
| 64 |
done
|
| 65 |
eend ${rval}
|
| 66 |
fi
|
| 67 |
return ${rval}
|
| 68 |
}
|
| 69 |
|
| 70 |
# Register new modules
|
| 71 |
games-ggz_pkg_postinst() {
|
| 72 |
games-ggz_update_modules
|
| 73 |
}
|
| 74 |
|
| 75 |
# Unregister old modules
|
| 76 |
games-ggz_pkg_postrm() {
|
| 77 |
games-ggz_update_modules
|
| 78 |
}
|