# Copyright 1999-2011 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Header: $ EAPI=5 inherit autotools eutils toolchain-funcs games git-2 DESCRIPTION="unique multiplayer wargame" HOMEPAGE="http://www.gnu.org/software/liquidwar6/" EGIT_REPO_URI="git://git.sv.gnu.org/${PN}.git" LICENSE="GPL-3" SLOT="0" KEYWORDS="amd64" IUSE="+allinone caca csound cunit doc gles2 gtk +http +maps nls ogg opengl openmp soft linguas_fr linguas_nn linguas_ru readline static-libs" REQUIRED_USE="gtk? ( || ( opengl gles2 ) ) || ( allinone cunit )" # TODO patch for libpng 1.6 RDEPEND="dev-db/sqlite:3 dev-lang/perl dev-libs/expat dev-scheme/guile net-misc/curl virtual/libintl virtual/libiconv sys-libs/zlib caca? ( media-libs/libcaca ) cunit? ( dev-util/cunit ) csound? ( media-sound/csound ) gles2? ( media-libs/mesa[gles2?] ) gtk? ( media-libs/freetype:2 media-libs/libpng:0 media-libs/sdl-ttf media-libs/sdl-image virtual/jpeg x11-libs/gtk+:2 ) ogg? ( media-libs/libogg media-libs/libvorbis ) opengl? ( virtual/opengl ) readline? ( sys-libs/ncurses sys-libs/readline )" DEPEND="${RDEPEND} nls? ( sys-devel/gettext )" S=${WORKDIR} pkg_setup() { if use openmp; then if [[ $(tc-getCC) == *gcc ]] && ! tc-has-openmp ; then ewarn "OpenMP is not available in your current selected gcc" die "need openmp capable gcc" fi fi games_pkg_setup } src_prepare() { cd "${WORKDIR}/${PN}" || die sed -i -e '/ldconfig/d' src/Makefile.am || die sed -i -e '/AC_CHECK_HEADERS/s:libpng15/png.h:& libpng16/png.h:' configure.ac || die sed -i -e 's/test x${HAVE_LIBPNG15_PNG_H} = x1/& || test x${HAVE_LIBPNG16_PNG_H} = x1/' configure.ac || die sed -i -e 'N;N;s:LIBPNG_1X_H=libpng15/png.h\n[[:space:]]\+fi:&\nif test x${HAVE_LIBPNG16_PNG_H} = x1; then\nLIBPNG_1X_H=libpng16/png.h\nfi:' configure.ac || die eautoreconf if use maps; then cd "${WORKDIR}/${PN}-extra-maps" eautoreconf fi } src_configure() { if ! use ogg || ! use csound; then myconf="${myconf} --enable-silent" fi if use opengl || use caca || use soft; then myconf="${myconf} $(use_enable gtk)" else myconf="${myconf} --disable-gtk" myconf="${myconf} --enable-headless" fi cd "${WORKDIR}/${PN}" || die "Cannot access source directory" egamesconf $(use_enable nls) \ $(use_enable allinone) \ $(usex allinone "--disable-shared" "--enable-shared") \ $(use_enable cunit) \ $(use_enable openmp) \ $(use_enable ogg mod-ogg) \ $(use_enable http mod-http) \ $(use_enable readline console) \ $(use_enable csound mod-csound) \ $(use_enable static-libs static) \ $(use_enable caca mod-caca) \ $(use_enable gles2 mod-gles2) \ $(use_enable opengl mod-gl1) \ $(use_enable soft mod-soft) \ --mandir=/usr/share/man \ --docdir=/usr/share/doc/${P} \ --htmldir=/usr/share/doc/${P}/html \ ${myconf} if use maps; then cd "${S}/${PN}-extra-maps" || die "Cannot access extra maps directory" egamesconf fi } src_compile() { cd "${WORKDIR}/${PN}" || die "Cannot access source directory" games_src_compile if use doc; then emake html fi if use maps; then cd "${WORKDIR}/${PN}-extra-maps" || die "Cannot access extra maps directory" emake fi } src_install() { cd "${WORKDIR}/${PN}" || die "Cannot access source directory" emake DESTDIR="${D}" install || die "Cannot install base" use allinone && rm -rf "${D}${GAMES_PREFIX}"/include if use maps; then cd "${WORKDIR}/${PN}-extra-maps" || die "Cannot access extra maps directory" find . -name README -delete emake DESTDIR="${D}" install || die "Cannot install maps" fi prepgamesdirs }