# Copyright 1999-2008 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Header: $ EAPI=2 inherit eutils flag-o-matic multilib wxwidgets MY_P=${PN}-src-${PV} DESCRIPTION="Portable 3D Game Development Kit written in C++" HOMEPAGE="http://crystal.sourceforge.net/" SRC_URI="mirror://sourceforge/crystal/${MY_P}.tar.bz2" LICENSE="LGPL-2.1" SLOT="0" KEYWORDS=" ~x86 ~amd64" IUSE="3ds alsa bullet cal3d cairo cegui cg doc debug java lcms libcaca maxoptimization mng ode python sdl +speex static tcmalloc truetype vorbis wxwidgets" RESTRICT="mirror" RDEPEND="virtual/opengl virtual/glu tcmalloc? ( >=dev-util/google-perftools-0.91 ) cegui? ( >=dev-games/cegui-0.5 ) ode? ( >=dev-games/ode-0.8 ) bullet? ( >=sci-physics/bullet-2.69 ) sdl? ( media-libs/libsdl ) vorbis? ( >=media-libs/libogg-1.1 media-libs/libvorbis ) alsa? ( media-libs/alsa-lib ) mng? ( >=media-libs/libmng-1.0.9 ) cg? ( >=media-gfx/nvidia-cg-toolkit-2.0 ) cal3d? ( =media-libs/cal3d-0.11* ) libcaca? ( >=media-libs/libcaca-0.99_beta13 ) wxwidgets? ( =x11-libs/wxGTK-2.8* ) lcms? ( media-libs/lcms ) java? ( virtual/jre ) truetype? ( >=media-libs/freetype-2.1 ) speex? ( media-libs/speex ) perl? ( dev-lang/perl ) cairo? ( x11-libs/cairo dev-cpp/cairomm ) >=media-libs/libpng-1.2 >=media-libs/jpeg-6b >=sys-libs/zlib-1.0 x11-libs/libXaw x11-libs/libXxf86vm media-libs/openal media-libs/freealut " DEPEND="${RDEPEND} 3ds? ( media-libs/lib3ds ) dev-util/ftjam python? ( dev-lang/swig dev-lang/python )" S="${WORKDIR}/$MY_P" src_prepare() { # Installing doc conflict with dodoc on src_install # Removing conflicting target sed -i \ -e "/^InstallDoc/d" \ Jamfile.in \ docs/Jamfile \ || die "sed failed" } src_configure() { if useq wxwidgets; then WX_GTK_VER=2.8 need-wxwidgets gtk2 fi my_conf="" if use maxoptimization && ! use debug ; then my_conf="--enable-cpu-specific-optimizations=maximum" else my_conf="--enable-cpu-specific-optimizations=no" fi if use debug; then my_conf="${my_conf} --enable-debug" CFLAGS="" CXXFLAGS="" LDFLAGS="" else my_conf="${my_conf} --enable-separate-debug-info=no" fi use tcmalloc && append-flags "-DCS_NO_PTMALLOC" use tcmalloc && append-ldflags "-lpthread -ltcmalloc" econf \ ${my_conf} \ --with-png \ --with-jpeg \ $(use_with speex) \ $(use_with lcms) \ $(use_with perl) \ $(use_with java) \ $(use_with python) \ $(use_with cg Cg) \ $(use_with cal3d) \ $(use_with wxwidgets wx) \ $(use_with libcaca caca) \ $(use_with bullet) \ $(use_with mng) \ $(use_with vorbis) \ $(use_with 3ds) \ $(use_with ode) \ $(use_with sdl) \ $(use_with cegui CEGUI) \ $(use_with truetype freetype2) \ $(use_with alsa asound) \ $(use_with cairo) \ $(use_with cairo cairomm) # Configure don't find correct bullet paths if use bullet && ! `grep -i '^bullet' Jamconfig`; then echo "BULLET.AVAILABLE ?= yes ;" >> Jamconfig echo "BULLET.LDFLAGS ?= `pkg-config --libs bullet` ;" >> Jamconfig fi #remove unwanted CFLAGS added by ./configure if ! use debug ; then if use maxoptimization ; then sed -e 's!-O[s012]!-O3!g' -i Jamconfig sed -e 's!COMPILER.CFLAGS += "-march=.*!!' -i Jamconfig else sed -e '/COMPILER\.CFLAGS\.optimize/d' -i Jamconfig fi fi } src_compile() { jam -q ${MAKEOPTS} || die "compile failed" if use static ; then jam -q ${MAKEOPTS} staticplugins || die "compile staticplugins failed" fi } src_install() { for installTarget in install_bin install_plugin install_lib \ install_include install_data install_config do jam -q -s DESTDIR="${D}" ${installTarget} \ || die "jam ${installTarget} failed" done if use static ; then sed -i -e 's!Depends install_staticplugins : install_libs ;!!' \ mk/jam/static.jam jam -q -s DESTDIR="${D}" install_staticplugins || die "make install_static_plugins failed" dosym libcrystalspace_staticplugins-1.4.a /usr/$(get_libdir)/libcrystalspace_staticplugins.a else PWD="`pwd`" cd "${D}/usr/$(get_libdir)" dosym libcrystalspace-1.4.so libcrystalspace.so dosym libcrystalspace_opengl-1.4.so libcrystalspace_opengl.so cd "$PWD" fi if use doc; then jam -q -s DESTDIR="${D}" install_doc || die "jam install_doc failed" fi dodoc README docs/history* docs/todo_* if [[ ! -e cs-config ]]; then dosym /usr/bin/cs-config-1.4 /usr/bin/cs-config fi echo "CRYSTAL_PLUGIN=/usr/$(get_libdir)/${P}" > 90crystalspace echo "CRYSTAL_CONFIG=/etc/${P}" >> 90crystalspace doenvd "${T}"/90crystalspace } pkg_postinst() { elog "Examples coming with this package, need correct light calculation" elog "Do the following commands, with the root account, to fix that:" # Fill cache directory for the examples local dir for dir in castle flarge isomap parallaxtest partsys r3dtest stenciltest \ terrain terrainf; do elog "cslight -video=null /usr/share/${P}/data/maps/${dir}" done }