# 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 gtk java +jpeg lcms libcaca mng ode openal perl +png python sdl speex static test truetype vorbis wxwidgets zlib" RESTRICT="mirror" RDEPEND="virtual/opengl virtual/glu 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*[opengl] ) lcms? ( media-libs/lcms ) java? ( virtual/jdk ) truetype? ( >=media-libs/freetype-2.1 ) speex? ( media-libs/speex ) perl? ( dev-lang/perl ) cairo? ( x11-libs/cairo dev-cpp/cairomm ) png? ( >=media-libs/libpng-1.2 ) jpeg? ( >=media-libs/jpeg-6b ) zlib? ( >=sys-libs/zlib-1.0 ) test? ( dev-util/cppunit ) gtk? ( x11-libs/gtk+:2 ) x11-libs/libXaw x11-libs/libXxf86vm openal? ( media-libs/openal media-libs/freealut )" # tcmalloc? ( >=dev-util/google-perftools-0.91 ) DEPEND="${RDEPEND} 3ds? ( >=media-libs/lib3ds-1.2 ) 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 local my_conf="" if use debug; then my_conf="${my_conf} --enable-debug" CFLAGS="" CXXFLAGS="" LDFLAGS="" else my_conf="${my_conf} --enable-optimize --enable-separate-debug-info=no" fi # use tcmalloc && append-ldflags "-lpthread -ltcmalloc" # $(use_enable !tcmalloc ptmalloc) \ econf \ ${my_conf} \ $(use_with png) \ $(use_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 gtk GTK) \ $(use_with cegui CEGUI) \ $(use_with truetype freetype2) \ $(use_with alsa asound) \ $(use_with cairo) \ $(use_with cairo cairomm) \ $(use_with test cppunit) #If you don't want openal we have to respect that (configure don't have option to disable openal) if ! use openal && grep -q '^OPENAL.AVAILABLE ?= yes' Jamconfig; then grep -v '^OPENAL.' Jamconfig > Jamconfig.new mv Jamconfig.new Jamconfig fi # Configure don't find correct bullet paths if use bullet && ! grep -qi '^bullet' Jamconfig; then echo "BULLET.AVAILABLE ?= yes ;" >> Jamconfig echo "BULLET.CFLAGS ?= $(pkg-config --cflags bullet);" >> Jamconfig echo "BULLET.LDFLAGS ?= $(pkg-config --libs bullet);" >> Jamconfig fi } src_compile() { jam -q ${MAKEOPTS} || die "compile failed" if use static ; then jam -q ${MAKEOPTS} staticplugins || die "compile staticplugins failed" fi } src_install() { local short_pv=$(echo ${PV} | cut -d \. -f 1-2) for installTarget in install_bin install_bindings install_config install_data install_include install_lib install_plugin; do jam -q -s DESTDIR="${D}" ${installTarget} \ || die "jam ${installTarget} failed" done dosym "/usr/$(get_libdir)/libcrystalspace-${short_pv}.so" "/usr/$(get_libdir)/libcrystalspace.so" dosym "/usr/$(get_libdir)/libcrystalspace_opengl-${short_pv}.so" "/usr/$(get_libdir)/libcrystalspace_opengl.so" 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 "/usr/$(get_libdir)/libcrystalspace_staticplugins-${short_pv}.a" "/usr/$(get_libdir)/libcrystalspace_staticplugins.a" 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 "${D}/usr/bin/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 }