# Copyright 1999-2007 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Header: $ inherit eutils games flag-o-matic DESCRIPTION="Multiple Arcade Machine Emulator (SDL)" HOMEPAGE="http://rbelmont.mameworld.info/?page_id=163" # SRC_URI="http://rbelmont.mameworld.info/${MY_P}.zip" # Same as xmame. Should it be renamed to MAME? LICENSE="XMAME" SLOT="0" KEYWORDS="~amd64 ~ppc ~x86" IUSE="minimal debug wolfmame" DEPEND=">=media-libs/libsdl-1.2.10 sys-libs/zlib dev-libs/expat debug? ( >gnome-base/gconf-2 >=x11-libs/gtk+-2 )" RDEPEND="${DEPEND}" S="${WORKDIR}/sdlmame" RESTRICT="strip" # Function to disable a makefile option disable_feature() { sed -i \ -e "/$1.*=/s:^:# :" \ "${S}"/makefile } # Function to enable a makefile option enable_feature() { sed -i \ -e "/^#.*$1.*=/s:^# ::" \ "${S}"/makefile } src_unpack() { local zip zip=${PN}$(echo ${PV} | sed -r -e "s/([0-9]+\.[0-9]+)\.([0-9]+)$/\1.u\2/" -e "s/\.//g").zip MY_V=$(echo ${PV} | sed -r -e "s/.u[0-9]+$//") # his domain blocks calls without a UserAgent (which is wget's default) local dldir dldir="${PORTAGE_ACTUAL_DISTDIR}/sdlmame" addwrite "${dldir}" mkdir -p "${dldir}" pushd >/dev/null "${dldir}" local zipDir=${zip%.zip} rm -rf ${zipDir} # we can't test for the file's existence, must find out why unzip >/dev/null $zip || \ (curl -A Firefox -C - http://rbelmont.mameworld.info/$zip -o $zip && unzip >/dev/null $zip || die 1) mv ${zipDir} ${WORKDIR}/${PN} || die 1 popd if use wolfmame ; then einfo "Applying WolfMAME patches" cd "${S}" epatch "${FILESDIR}"/${MY_V}/dipports.patch epatch "${FILESDIR}"/${MY_V}/inpview.patch epatch "${FILESDIR}"/${MY_V}/wolf.patch # Minimal driver support. Good for ebuild testing... if use minimal ; then make_opts="SUBTARGET=tiny" fi fi epatch "${FILESDIR}/paths-0.121.patch" } src_compile() { # Don't compile zlib and expat einfo "Disabling embedded libraries: zlib and expat" disable_feature BUILD_ZLIB disable_feature BUILD_EXPAT case ${ARCH} in amd64) einfo "Enabling 64-bit support" enable_feature PTR64 enable_feature AMD64 ;; x86) einfo "Optimizing build for $(get-flag march)" case $(get-flag march) in pentium3) enable_feature PM;; pentium-m) enable_feature PM;; pentium4) enable_feature P4;; athlon) enable_feature ATHLON;; k7) enable_feature ATHLON;; i686) enable_feature I686;; pentiumpro) enable_feature I686;; esac ;; ppc) einfo "Enabling PPC support" enable_feature G4 ;; esac if use debug ; then enable_feature DEBUG enable_feature SYMBOLS enable_feature PROFILE fi emake \ NAME=${PN} \ SUFFIX="" \ ${make_opts} \ || die "emake failed" } src_install() { dogamesbin ${PN} || die "dogamesbin ${PN} failed" # Follows xmame ebuild, avoiding collision on /usr/games/bin/jedutil exeinto $(games_get_libdir)/${PN} local f for f in chdman jedutil romcmp ; do doexe "${f}" || die "doexe ${f} failed" done dodoc docs/* *.txt prepgamesdirs ewarn "The default configuration directory for sdlmame on posix operating" ewarn "systems is now \$HOME/.sdlmame" }