# Copyright 1999-2008 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Header: $ inherit eutils autotools flag-o-matic versionator subversion ESVN_REPO_URI="https://xbmc.svn.sourceforge.net/svnroot/xbmc/branches/linuxport/XBMC" DESCRIPTION="XBMC is a free and open source media-player and entertainment hub" HOMEPAGE="http://xbmc.org/" LICENSE="GPL-2" SLOT="0" KEYWORDS="" IUSE="ccache gnome gprof hal joystick mms opengl pcre xrandr" RDEPEND="app-arch/bzip2 app-arch/unrar app-arch/zip >=dev-lang/python-2.4 dev-libs/boost dev-libs/fribidi pcre? ( dev-libs/libpcre ) dev-libs/lzo dev-libs/tre =dev-python/pysqlite-2* ccache? ( dev-util/ccache ) media-libs/alsa-lib media-libs/fontconfig media-libs/freetype media-libs/glew media-libs/jasper media-libs/libmad mms? ( media-libs/libmms ) media-libs/libogg media-libs/libvorbis media-libs/sdl-gfx media-libs/sdl-image media-libs/sdl-mixer media-libs/sdl-sound net-misc/curl sys-apps/dbus hal? ( sys-apps/hal ) sys-apps/pmount x11-libs/libXinerama xrandr? ( x11-libs/libXrandr ) x11-libs/libXrender x11-proto/xineramaproto virtual/mysql dev-util/cmake opengl? ( virtual/opengl ) media-libs/faac dev-lang/nasm app-i18n/enca media-libs/ftgl sys-apps/lsb-release =sys-devel/automake-1.8* =sys-devel/automake-1.9* =sys-devel/automake-1.10* " DEPEND="${RDEPEND}" pkg_setup() { if use joystick && built_with_use media-libs/libsdl nojoystick; then die "media-libs/libsdl needs to be built with USE -nojoystick." fi if ! built_with_use media-libs/alsa-lib debug; then die "media-libs/alsa-lib needs to be built with the 'debug' USE flag enabled." fi if ! built_with_use media-libs/libsdl alsa; then die "media-libs/libsdl needs to be built with the 'alsa' USE flag enabled." fi } src_unpack() { subversion_src_unpack echo '#!/bin/sh' > tools/Linux/xbmc.sh.in echo '' >> tools/Linux/xbmc.sh.in echo 'export XBMC_PLATFORM_MODE=1' >> tools/Linux/xbmc.sh.in # media-libs/libsdl defaults to 'oss' if built with that USE flag # which is incompatible with xbmc, so force it to use 'alsa' echo 'export SDL_AUDIODRIVER=alsa' >> tools/Linux/xbmc.sh.in # If not using Gnome, clean up attempts to inhibit/uninhibit Gnome's screensaver via dbus # # This works automatically in fullscreen mode using KDE, # # can someone test same in Gnome as dbus connect attempts may not be necessary at all # if use gnome; then echo 'ID=`dbus-send --session --type=method_call --print-reply --dest=org.gnome.ScreenSaver /org/gnome/ScreenSaver org.gnome.ScreenSaver.Inhibit string:XBMC string:InternalHandle | grep uint32 | sed -e 's/.*uint32\ //'`' \ >> tools/Linux/xbmc.sh.in echo 'exec @prefix@/share/xbmc/xbmc.bin -fs $*' >> tools/Linux/xbmc.sh.in echo 'exec dbus-send --session --type=method_call --print-reply --dest=org.gnome.ScreenSaver /org/gnome/ScreenSaver org.gnome.ScreenSaver.UnInhibit uint32:$ID' \ >> tools/Linux/xbmc.sh.in else echo 'exec @prefix@/share/xbmc/xbmc.bin -fs $*' >> tools/Linux/xbmc.sh.in fi # Disabled FTGL support as doesn't work yet (at least for me) # Choosing ProjectM viz. in xbmc barfs with # symbol lookup error: /usr/share/xbmc/visualisations/ProjectM.vis: undefined symbol: _ZN14FTGLPixmapFontC1EPKc # Enable FTGL support for ProjectM visualisations # # sed -e 's/-D USE_FTGL:BOOL=OFF/-D USE_FTGL:BOOL=ON/' \ # -i configure # Fix missing and distro dependant files for 'automake-1.8' # for dir in \ xbmc/cores/dvdplayer/Codecs/libmad \ xbmc/lib/libid3tag/libid3tag do cd ${dir} WANT_AUTOMAKE="1.8" aclocal &> /dev/null WANT_AUTOMAKE="1.8" automake --add-missing &> /dev/null WANT_AUTOMAKE="1.8" libtoolize --copy --force &> /dev/null cd ${S} done # Fix missing and distro dependant files for 'automake-1.9' # for dir in \ xbmc/cores/dvdplayer/Codecs/libDVDCSS \ xbmc/cores/paplayer/MPCCodec do cd ${dir} WANT_AUTOMAKE="1.9" automake --add-missing &> /dev/null WANT_AUTOMAKE="1.9" libtoolize --copy --force &> /dev/null cd ${S} done # Fix missing and distro dependant files for 'automake-1.10' # for dir in \ xbmc/cores/dvdplayer/Codecs/libdvdnav \ xbmc/cores/dvdplayer/Codecs/libfaad2 \ xbmc/visualizations/Goom/goom2k4-0 \ xbmc/lib/libass do cd ${S}/${dir} automake --add-missing &> /dev/null libtoolize --copy --force &> /dev/null done } src_compile() { # Strip out the use of custom C{XX}FLAGS to make debugging easier for upstream # strip-flags # force debug at the request of upstream until stable release econf \ --prefix=/usr \ $(use_enable ccache) \ --enable-debug \ $(use_enable gprof profiling) \ $(use_enable hal halmount) \ $(use_enable joystick) \ $(use_enable mms) \ $(use_enable opengl gl) \ $(use_enable pcre) \ $(use_enable xrandr) \ || die "Configure failed!" emake || die "Make failed!" einfo "Generating textures..." cd "${S}" for skin in skin/* ; do ./tools/XBMCTex/XBMCTex -input "\"${skin}/media/\"" \ -output "\"${skin}/media/Textures.xpr\"" || die "XBMCTex failed..." done einfo "Fixing case sensitivity..." mv "${S}/media/Fonts/arial.ttf" "${S}/media/Fonts/Arial.ttf" mv "${S}/media/Splash.png" "${S}/media/splash.png" einfo "Unzipping web content..." unzip "${S}"/web/Project_Mayhem_III_webserver_*.zip -d "${S}/web/" || die "Unzip web content failed..." } src_install() { einstall INSTALL_ROOT="${D}" || die "Install failed!" mkdir -p "${D}/etc/env.d" echo "CONFIG_PROTECT=\"/usr/share/${PN}/userdata\"" > "${D}/etc/env.d/95${PN}" for I in README.linux copying.txt LICENSE.GPL; do dodoc "${I}" done for I in credits language media screensavers scripts skin sounds system userdata visualisations web; do dodir "${I}" done insinto /usr/share/applications doins tools/Linux/${PN}.desktop insinto /usr/share/pixmaps doins tools/Linux/${PN}.png } pkg_postinst() { elog "If you wish to update ${PN} manually simply run:" elog elog "ESVN_REVISION= emerge =${PF}" elog elog "where is either HEAD (in case you wish to get all updates)" elog "or specific revision number. But NOTE, this update will vanish" elog "next time you reemerge ${PN}. To make update permanent create" elog "/etc/portage/env/${CATEGORY}/${PN} file with ESVN_REVISION=" elog "content. Then each time you run emerge ${PN} you'll have said" elog " installed. For example, if you run" elog " # mkdir -p /etc/portage/env/${CATEGORY}" elog " # echo ESVN_REVISION=HEAD >> /etc/portage/env/${CATEGORY}/${PN}" elog "each time you reemerge ${PN} it'll be updated to get the latest" elog "updates" }