# Copyright 1999-2008 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Header: $ inherit eutils games games-ggz DESCRIPTION="GGZ Gaming Zone server and game servers" LICENSE="GPL-2" SLOT="0" KEYWORDS="~x86" IUSE="berkdb sqlite mysql postgresql avahi inotify fam libgcrypt debug threads asyncns gnutls ssl" DEPEND="~dev-games/libggz-${PV} berkdb? ( sys-libs/db:4.5 ) sqlite? ( dev-db/sqlite:3 ) mysql? ( dev-db/mysql ) postgresql? ( dev-db/postgresql-base ) sys-devel/gettext sys-apps/util-linux dev-libs/expat avahi? ( net-dns/avahi ) !inotify? ( fam? ( virtual/fam ) ) libgcrypt? ( dev-libs/libgcrypt ) gnutls? ( net-libs/gnutls ) !gnutls? ( ssl? ( dev-libs/openssl ) ) debug? ( \ sys-devel/gdb \ dev-libs/dmalloc )" GAMES_BINDIR=/usr/bin GAMES_STATEDIR=/var/lib pkg_setup() { if ! use berkdb && ! use mysql && ! use sqlite && ! use postgresql; then eerror "" eerror "You have to specify a database backend:" eerror "berkdb or sqlite or mysql or postgresql" eerror "" die "Invalid USE flag set" fi if use berkdb && ( use mysql || use sqlite || use postgresql ); then ewarn "" ewarn "You have selected more than one database. Falling back to berkdb." ewarn "Large installations should use something sql based." ewarn "" ebeep 3 epause 5 elif use sqlite && ( use mysql || use postgresql ); then ewarn "" ewarn "You have selected more than one database. Falling back to sqlite." ewarn "" ebeep 3 epause 5 elif use mysql && use postgresql; then ewarn "" ewarn "You have selected more than one database. Falling back to mysql." ewarn "" ebeep 3 epause 5 fi } src_unpack() { unpack ${A} cd ${S} #berkdb support for 4.3 seems to be broken sed -i \ -e '/LIB_DATABASE=/ s:\$db4lib:-ldb-4.5:' \ configure \ || die "sed failed" for f in ggzd.rc do sed \ -e "s/GAMES_USER_DED/${GAMES_USER_DED}/" \ -e "s:GAMES_BINDIR:${GAMES_BINDIR}:" \ -e "s:GAMES_STATEDIR:${GAMES_STATEDIR}:" \ "${FILESDIR}/${f}" > "${T}/${f}" \ || die "sed failed" done } src_compile() { local myconf if use berkdb; then myconf="${myconf} \ --with-database=db4" elif use sqlite; then myconf="${myconf} \ --with-database=sqlite" elif use mysql; then myconf="${myconf} \ --with-database=mysql" elif use postgresql; then myconf="${myconf} \ --with-database=pgsql" else die "No database selected!" fi if use avahi; then myconf="${myconf} \ --with-zeroconf=avahi" fi # Reconfiguration without restart in case of room changes if use inotify; then myconf="${myconf} \ --with-reconfiguration=inotify" elif use fam; then myconf="${myconf} \ --with-reconfiguration=fam" fi if ! use threads; then myconf="${myconf} \ --disable-threading" fi if use debug; then myconf="${myconf} \ --enable-debug-gdb" #FIXME: --enable-debug-mem does not work with glibc-2.6? else myconf="${myconf} \ --disable-debug" fi if use asyncns; then myconf="${myconf} \ --enable-anl" fi games-ggz_src_compile \ ${myconf} } src_install() { games-ggz_src_install insinto /usr/include doins ggzdmod/ggzdmod-ggz.h keepdir /var/lib/ggzd fowners ${GAMES_USER_DED}:${GAMES_GROUP} ${GAMES_STATEDIR}/ggzd fowners -R :${GAMES_GROUP} /etc/ggzd newinitd ${T}/ggzd.rc ggzd } pkg_postinst() { games_pkg_postinst echo einfo "ggzd logs default to syslog. This can be changed in config." einfo "Have a look in /etc/ggzd for sample config." einfo "You should have a look on" einfo "http://www.ggzgamingzone.org/docs/guides/hosting/ggz-hosting-guide.html" einfo "If you want support for the python games, you must install" einfo "ggz-python. For external games have a look on:" einfo "http://www.ggzgamingzone.org/docs/guides/hosting/ggz-hosting-guide_28.html#SEC59" echo }