# Copyright 1999-2013 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Header: $ EAPI="5" inherit eutils games mercurial DESCRIPTION="cross-platform plugin-based N64 emulator" HOMEPAGE="http://code.google.com/p/mupen64plus/" SRC_URI="" LICENSE="GPL-2" SLOT="0" KEYWORDS="~amd64 ~x86" MUPEN64_CORE_BASE_URI="https://bitbucket.org/richard42" MUPEN64_CORE_MODULES="mupen64plus-core mupen64plus-ui-console mupen64plus-audio-sdl mupen64plus-input-sdl mupen64plus-rsp-hle mupen64plus-video-rice" MUPEN64_PLUGINS_BASE_URI="https://bitbucket.org/wahrhaft" # add USE_EXPAND="MUPEN64_PLUGINS_RSP MUPEN64_PLUGINS_VIDEO" to your make.conf for proper # display of use flags MUPEN64_PLUGINS_RSP="z64" MUPEN64_PLUGINS_VIDEO="arachnoid glide64 z64" IUSE="debug libsamplerate lirc pic profile sse" for plugin in $MUPEN64_PLUGINS_RSP; do IUSE="${IUSE} mupen64_plugins_rsp_${plugin}" done for plugin in $MUPEN64_PLUGINS_VIDEO; do IUSE="${IUSE} mupen64_plugins_video_${plugin}" done RDEPEND="virtual/opengl media-libs/freetype:2 media-libs/libpng media-libs/libsdl || ( =sys-libs/zlib-1.2.5.1-r2[minizip] ) libsamplerate? ( media-libs/libsamplerate ) lirc? ( app-misc/lirc ) mupen64_plugins_video_glide64? ( media-libs/glew )" DEPEND="${RDEPEND} dev-util/pkgconfig" # Otherwise we have to create $WORKDIR/$P manually before calling mercurial_fetch. S="${WORKDIR}" src_unpack() { # Fetch source from all repos for REPO in ${MUPEN64_CORE_MODULES[@]}; do mercurial_fetch "${MUPEN64_CORE_BASE_URI}/${REPO}" "${REPO}" "${S}/${REPO}" done # Fetch source for plugins for plugin in ${MUPEN64_PLUGINS_RSP}; do if use mupen64_plugins_rsp_${plugin}; then local module="mupen64plus-rsp-${plugin}" mercurial_fetch "${MUPEN64_PLUGINS_BASE_URI}/${module}" "${module}" "${S}/${module}" fi done for plugin in ${MUPEN64_PLUGINS_VIDEO}; do if use mupen64_plugins_video_${plugin}; then local module="mupen64plus-video-${plugin}" mercurial_fetch "${MUPEN64_PLUGINS_BASE_URI}/${module}" "${module}" "${S}/${module}" fi done } src_compile() { # Note: Variables cannot be quoted or ui-console will not build OPTS="PREFIX=${GAMES_PREFIX} LIBDIR=$(games_get_libdir)/${PN} SHAREDIR=${GAMES_DATADIR}/${PN} DESTDIR=${D} COREDIR=$(games_get_libdir)/${PN}/ PLUGINDIR=$(games_get_libdir)/${PN}/plugins MANDIR=/usr/share/man" # Disable (some of) the built-in CFLAGS. By default these include -flto. # If gcc has not been compiled with USE=lto, mupen64+ will fail to compile. # LTO can still be enabled if the user adds -flto to thier CFLAGS. OPTS+=" OPTFLAGS=" use debug && OPTS+=" DEBUG=1 DEBUGGER=1 PLUGINDBG=1" use libsamplerate || OPTS+=" NO_RESAMP=1" use lirc && OPTS+=" LIRC=1" use pic && OPTS+=" PIC=1" use profile && OPTS+=" PROFILE=1" use sse || OPTS+=" NO_ASM=1" # Build all modules for REPO in ${MUPEN64_CORE_MODULES[@]}; do einfo "\nBuilding ${REPO}..." emake -C "${REPO}/projects/unix" all $OPTS || die "make ${REPO} failed" done # Build all plugins for plugin in ${MUPEN64_PLUGINS_RSP}; do if use mupen64_plugins_rsp_${plugin}; then local module="mupen64plus-rsp-${plugin}" einfo "\nBuilding ${module}..." emake -C "${module}/projects/unix" all $OPTS || die "make ${module} failed" fi done for plugin in ${MUPEN64_PLUGINS_VIDEO}; do if use mupen64_plugins_video_${plugin}; then local module="mupen64plus-video-${plugin}" einfo "\nBuilding ${module}..." emake -C "${module}/projects/unix" all $OPTS || die "make ${module} failed" fi done } src_install() { # Install binary/libraries and documentation for REPO in ${MUPEN64_CORE_MODULES[@]}; do einfo "\nInstalling ${REPO}..." emake -C "${REPO}/projects/unix" install $OPTS || die "install ${REPO} failed" [ -f "${module}/RELEASE" ] && newdoc "${module}/RELEASE" "RELEASE.${module}" [ -f "${REPO}/README" ] && newdoc "${REPO}/README" "README.${REPO}" done # Install plugins for plugin in ${MUPEN64_PLUGINS_RSP}; do if use mupen64_plugins_rsp_${plugin}; then local module="mupen64plus-rsp-${plugin}" einfo "\nInstalling ${module}..." emake -C "${module}/projects/unix" install $OPTS || die "install ${module} failed" [ -f "${module}/RELEASE" ] && newdoc "${module}/RELEASE" "RELEASE.${module}" [ -f "${module}/README" ] && newdoc "${module}/README" "README.${module}" fi done for plugin in ${MUPEN64_PLUGINS_VIDEO}; do if use mupen64_plugins_video_${plugin}; then local module="mupen64plus-video-${plugin}" einfo "\nInstalling ${module}..." emake -C "${module}/projects/unix" install $OPTS || die "install ${module} failed" [ -f "${module}/RELEASE" ] && newdoc "${module}/RELEASE" "RELEASE.${module}" [ -f "${module}/README" ] && newdoc "${module}/README" "README.${module}" fi done prepgamesdirs } pkg_postinst() { games_pkg_postinst elog "As of 2.0, Mupen64Plus includes only a command line launcher." elog "Run 'mupen64plus --help' for options." echo elog "If you would prefer to use a GUI frontend, see the following for options:" elog "http://code.google.com/p/mupen64plus/wiki/ThirdPartyPlugins#Third-Party_Front-end_Applications" if use lirc; then echo elog "For lirc configuration see:" elog "http://code.google.com/p/mupen64plus/wiki/LIRC" fi }