# Copyright 1999-2007 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Header: $ inherit games toolchain-funcs MY_PV="${PV%.[0-9]*}." # add extra '.' to get length right MY_PV="${MY_PV}Viewer-r${PV:${#MY_PV}}" # just use length of MY_PV MY_PV="Branch_${MY_PV//./-}" # replace all '.' with '-' DESCRIPTION="A 3D MMORPG virtual world entirely built and owned by its residents" HOMEPAGE="http://secondlife.com/" SRC_URI="http://secondlife.com/developers/opensource/downloads/2008/04/slviewer-src-${MY_PV}.tar.gz http://secondlife.com/developers/opensource/downloads/2008/04/slviewer-artwork-${MY_PV}.zip http://secondlife.com/developers/opensource/downloads/2008/04/slviewer-linux-libs-${MY_PV}.tar.gz" LICENSE="GPL-2" SLOT="0" KEYWORDS="~amd64 ~x86" IUSE="debug elfio fmod gstreamer nomozlib nostandalone" #IUSE="debug elfio fmod gstreamer nomozlib nostandalone kdu" RESTRICT="mirror" RDEPEND=">=x11-libs/gtk+-2 =dev-libs/apr-1* =dev-libs/apr-util-1* dev-libs/boost >=net-misc/curl-7.15.4 dev-libs/openssl media-libs/freetype media-libs/jpeg media-libs/libsdl media-libs/mesa media-libs/libogg media-libs/libvorbis fmod? ( x86? ( =media-libs/fmod-3.75* ) ) =sys-libs/db-4.2* dev-libs/expat >=dev-libs/xmlrpc-epi-0.51 sys-libs/zlib elfio? ( dev-libs/elfio ) >=media-libs/openjpeg-1.1.1 media-fonts/kochi-substitute net-dns/c-ares gstreamer? ( >=media-libs/gst-plugins-base-0.10 ) debug? ( dev-libs/google-perftools ) !nomozlib? ( =dev-libs/llmozlib-svn-2.13 )" DEPEND="${RDEPEND} >=dev-util/scons-0.97 dev-util/pkgconfig sys-devel/flex sys-devel/bison !nomozlib? ( =dev-libs/llmozlib-svn-2.13 )" S="${WORKDIR}/linden/indra" dir="${GAMES_DATADIR}/${PN}" src_unpack() { if [ "${ARCH}" == "x86" ] ; then if use nostandalone ; then MSG="(STANDALONE=no already set)" ewarn "nostandalone USE flag is redundant on x86 ${MSG}" fi # on x86_64: # STANDALONE do-not-directly-run-secondlife-bin 38,919,832 # nostandalone do-not-directly-run-secondlife-bin 36,032,152 # # but USE="nostandalone" crashes on x86_64: # # INFO: setStartupState: Startup state changing from 19 to 20 # *** glibc detected *** bin/do-not-directly-run-secondlife-bin: # double free or corruption (fasttop): 0x0000000004cd89a0 *** # ======= Backtrace: ========= # /lib/libc.so.6[0x7fe993330aad] # /lib/libc.so.6(cfree+0x76)[0x7fe993332796] # /usr/lib/gcc/x86_64-pc-linux-gnu/4.1.2/libstdc++.so.6 # (_ZNSs6assignERKSs+0xac)[0x7fe993b3194c] # bin/do-not-directly-run-secondlife-bin[0x198e895] else if use fmod ; then ewarn "fmod USE flag is only available on x86." fi # if use kdu ; then # ewarn "kdu USE flag is only available on x86." # fi fi if use nomozlib ; then ewarn "nomozlib USE disables the dependency on llmozlib-svn" ewarn "secondlife will not display text and may abort with" ewarn "runtime errors" fi # check if eselect opengl is set to xorg-x11 # http://forums.gentoo.org/viewtopic-t-579444.html if ! eselect opengl show | grep -q xorg-x11; then MSG="eselect opengl show needs to say xorg-x11\n" MSG="${MSG}I got `eselect opengl show`\n" MSG="${MSG}Changing it will disable OpenGL temporarily,\n" MSG="${MSG}but once this package builds, you can change it\n" MSG="${MSG}back. If you are feeling brave, try:\n" MSG="${MSG} eselect opengl set xorg-x11" die "${MSG}" fi # unpack font files unpack slviewer-linux-libs-${MY_PV}.tar.gz # if use kdu ; then # find linden/libraries -type f -a ! -name '*kdu*' | xargs rm -f || die # else rm -rf linden/libraries # fi unpack slviewer-src-${MY_PV}.tar.gz unpack slviewer-artwork-${MY_PV}.zip cd "${S}" if use nomozlib ; then rm -rf linden/indra/newview/app_settings else ( dstdir="libraries/`uname -m`-linux/lib_release_client/" cp /usr/share/games/secondlife/lib/llmozlib/* \ "${S}/../${dstdir}" || die ) fi epatch "${FILESDIR}"/${PN}-${MY_PV}-gentoo.patch sed -i \ -e "s|gcc_bin = .*$|gcc_bin = '$(tc-getCXX)'|" \ -e "/_cflags =/s|-O2|${CFLAGS}|" \ -e "/_cxxflags =/s|-O2|${CXXFLAGS}|" \ "${S}"/SConstruct || die # "${S}"/newview/viewer_manifest.py touch "${S}"/newview/gridargs.dat } src_compile() { local myopts="BTARGET=client DISTCC=no" # these options' default in linden/indra/SConstruct is opposite of # our default (i.e. when no USE flags are set) local ffmod="no" # FMOD in SConstruct defaults to yes local fstandalone="" # STANDALONE in SConstruct defaults to no local justj="${MAKEOPTS/*-j/j}" justj="${justj/-*/}" if [ -n "$justj" ]; then myopts="-${justj} ${myopts}" fi if use debug ; then myopts="${myopts} BUILD=debug" else myopts="${myopts} BUILD=release" fi if ! use elfio ; then myopts="${myopts} ELFIO=no" fi if ! use gstreamer ; then myopts="${myopts} GSTREAMER=no" fi case ${ARCH} in x86) myopts="${myopts} ARCH=i686" if use fmod; then myopts="${myopts} OPENSOURCE=no" ffmod="" # let FMOD default to yes fi ;; amd64) myopts="${myopts} ARCH=x86_64" fstandalone="yes" ;; ppc|ppc64) myopts="${myopts} ARCH=powerpc" fstandalone="yes" ;; *) myopts="${myopts} ARCH=i686" fstandalone="yes" ;; esac if use nostandalone ; then fstandalone="" fi if use nomozlib ; then myopts="${myopts} MOZLIB2=no" fstandalone="yes" fi myopts="${myopts} ${fstandalone:+STANDALONE=}${fstandalone}" myopts="${myopts} ${ffmod:+FMOD=}${ffmod}" einfo "scons ${myopts}" TEMP_BUILD_DIR= scons ${myopts} || die } src_install() { cd "${S}"/newview/ insinto "${dir}" doins gpu_table.txt gridargs.dat secondlife-i686.supp featuretable_linux.txt || die doins -r app_settings character fonts skins res-sdl || die doins lsl_guide.html releasenotes.txt || die newins licenses-linux.txt licenses.txt || die newins linux_tools/client-readme.txt README-linux.txt || die newins res/ll_icon.ico secondlife.ico || die insinto "${dir}"/app_settings/ doins "${WORKDIR}"/linden/scripts/messages/message_template.msg || die doins "${WORKDIR}"/linden/etc/message.xml || die exeinto "${dir}" doexe linux_tools/launch_url.sh || die newexe linux_tools/wrapper.sh secondlife || die newexe ../linux_crash_logger/linux-crash-logger-*-bin* linux-crash-logger.bin || die exeinto "${dir}"/bin/ newexe secondlife-*-bin do-not-directly-run-secondlife-bin || die exeinto "${dir}"/lib doexe ../lib_*_client/*-linux/lib* || die dosym /usr/share/fonts/kochi-substitute/kochi-mincho-subst.ttf /usr/share/games/secondlife/unicode.ttf games_make_wrapper secondlife ./secondlife "${dir}" newicon res/ll_icon.ico secondlife.ico || die make_desktop_entry secondlife "Second Life" secondlife.ico dodoc releasenotes.txt newdoc licenses-linux.txt licenses.txt newdoc linux_tools/client-readme.txt README-linux.txt dohtml lsl_guide.html prepgamesdirs }