1 # Copyright 1999-2015 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
6 PYTHON_COMPAT=( python2_7 )
7 inherit eutils flag-o-matic python-any-r1 games
16 SRC_URI="$(for PATCH_VER in $(seq 1 ${PV##*_p}) ; do echo "https://dev.gentoo.org/~hasufell/distfiles/${MY_P}u${PATCH_VER}_diff.zip"; done)"
18 DESCRIPTION="Multiple Arcade Machine Emulator (SDL)"
19 HOMEPAGE="http://mamedev.org/"
20 # Upstream doesn't allow fetching with unknown User-Agent such as wget
21 SRC_URI="$SRC_URI https://dev.gentoo.org/~hasufell/distfiles/${MY_P/sdl}s.zip"
22 if [[ ${PN} == "sdlmame" ]] ; then
23 SRC_URI="$SRC_URI http://www.netswarm.net/misc/sdlmame-ui.bdf.gz"
28 KEYWORDS="~amd64 ~ppc ~x86"
29 IUSE="X alsa debug opengl"
30 REQUIRED_USE="debug? ( X )"
32 RDEPEND=">=dev-lang/lua-5.2
36 >=media-libs/libsdl-1.2.10[sound,joystick,opengl?,video]
40 alsa? ( media-libs/alsa-lib )
53 X? ( x11-proto/xineramaproto )"
57 # Function to disable a makefile option
61 "${S}"/${2:-makefile} \
65 # Function to enable a makefile option
68 -e "/^#.*$1.*=/s:^#::" \
69 "${S}"/${2:-makefile} \
75 python-any-r1_pkg_setup
85 if [[ $PV == *_p* ]] ; then
86 edos2unix $(find $(grep +++ *diff | awk '{ print $2 }' | sort -u) 2>/dev/null) *diff
87 einfo "Patching release with source updates"
88 epatch ${MY_PV%%_p*}*.diff
90 edos2unix makefile src/osd/sdl/{osdsdl.h,sdl.mak}
93 "${FILESDIR}"/${P}-QA.patch \
94 "${FILESDIR}"/${P}-system-lua.patch \
95 "${FILESDIR}"/${P}-no-opengl.patch \
96 "${FILESDIR}"/${P}-debugger-linking.patch
98 # Don't compile zlib and expat
99 einfo "Disabling embedded libraries: expat, flac, jpeg, zlib, lua"
100 disable_feature BUILD_EXPAT
101 disable_feature BUILD_FLAC
102 disable_feature BUILD_JPEG
103 disable_feature BUILD_ZLIB
104 disable_feature BUILD_LUA
107 einfo "Enabling 64-bit support"
112 einfo "Enabling PPC support"
113 enable_feature BIGENDIAN
117 einfo "Enabling debug support"
119 enable_feature DEBUG src/osd/sdl/sdl.mak
122 enable_feature NO_USE_QTDEBUG src/osd/sdl/sdl.mak
124 if ! use opengl ; then
125 einfo "Disabling opengl support"
126 enable_feature NO_OPENGL src/osd/sdl/sdl.mak
130 einfo "Disabling alsa midi support"
131 enable_feature NO_USE_MIDI src/osd/sdl/sdl.mak
135 einfo "Disabling X support"
136 enable_feature NO_X11 src/osd/sdl/sdl.mak
144 OPT_FLAGS='-DINI_PATH=\"\$$HOME/.'${PN}'\;'"${GAMES_SYSCONFDIR}/${PN}"'\"' \
145 NO_DEBUGGER=$(usex debug "0" "1") default
149 newgamesbin ${PN}$(use amd64 && echo 64)$(use debug && echo d) ${PN}
151 newman src/osd/sdl/man/${PN#sdl}.6 ${PN}.6
153 insinto "${GAMES_DATADIR}/${PN}"
154 doins -r src/osd/sdl/keymaps
155 [[ ${PN} == "sdlmame" ]] && newins sdlmame-ui.bdf ui.bdf
157 insinto "${GAMES_SYSCONFDIR}/${PN}"
158 doins "${FILESDIR}"/vector.ini
161 -e "s:@GAMES_SYSCONFDIR@:${GAMES_SYSCONFDIR}:" \
162 -e "s:@GAMES_DATADIR@:${GAMES_DATADIR}:" \
163 "${FILESDIR}/${MY_CONF_PN}-${MY_CONF_VER}".ini.in > "${D}/${GAMES_SYSCONFDIR}/${PN}/${MY_CONF_PN}".ini \
166 dodoc docs/{config,mame,newvideo}.txt
167 if [[ ${PN} == "sdlmame" ]] ; then
174 "${GAMES_DATADIR}/${PN}"/{ctrlr,cheats,roms,samples,artwork,crosshair} \
175 "${GAMES_SYSCONFDIR}/${PN}"/{ctrlr,cheats}
183 elog "optional dependencies:"
184 elog " games-emulation/sdlmametools (development tools)"
186 elog "It's strongly recommended that you change either the system-wide"
187 elog "${MY_CONF_PN}.ini at \"${GAMES_SYSCONFDIR}/${PN}\" or use a per-user setup at \$HOME/.${PN}"
191 elog "You built ${PN} with opengl support and should set"
192 elog "\"video\" to \"opengl\" in ${MY_CONF_PN}.ini to take advantage of that"