# Copyright 1999-2008 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Header: $ inherit eutils games-ggz DESCRIPTION="Server for games for GGZ Gaming Zone" 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 ) 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 )" 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_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? 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 dodoc AUTHORS ChangeLog NEWS TODO README* keepdir /var/lib/ggzd fowners games:games /var/lib/ggzd fowners -R :games /etc/ggzd newinitd ${FILESDIR}/ggzd.rc ggzd } 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 }