-
Notifications
You must be signed in to change notification settings - Fork 13
/
retroarch-1.6.7.ebuild
305 lines (272 loc) · 9.97 KB
/
retroarch-1.6.7.ebuild
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
# Copyright 1999-2017 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# TODO: Rewrite src_prepare() and src_configure()
EAPI=6
PYTHON_COMPAT=( python{3_4,3_5,3_6} )
LIBRETRO_COMMIT_SHA="8e8bdaaab3dc4686ce39e59da922f79a76ba4496"
LIBRETRO_REPO_NAME="libretro/RetroArch"
inherit flag-o-matic libretro python-single-r1
DESCRIPTION="Universal frontend for libretro-based emulators"
HOMEPAGE="http://www.retroarch.com"
KEYWORDS="x86 amd64"
LICENSE="GPL-3"
SLOT="0"
#FIXME: Revaluate the "wayland? ( egl )" entry below. Due to unresolved upstream
#issues, Wayland support erroneously requires EGL support. Ideally, it
#shouldn't. When upstream resolves this, remove this entry. See also:
# https://github.com/stefan-gr/abendbrot/issues/7#issuecomment-204541979
# To avoid fatal dependency failures for users enabling the "python" USE flag, a
# default "python_single_target_python*" USE flag *MUST* be set below to the
# default version of Python 3 for default Portage profiles.
IUSE="+7zip alsa +armvfp +assets cg cheevos +cores +database debug dispmanx egl +fbo ffmpeg gles2 gles3 jack +joypad_autoconfig kms lakka libass libusb +materialui miniupnpc +netplay +neon +network openal +opengl osmesa oss +overlays pulseaudio sdl sdl2 +shaders +truetype +threads +udev v4l2 videocore vulkan wayland X xinerama +xmb +xml xv zlib cpu_flags_x86_sse2 python +python_single_target_python3_4 python_single_target_python3_5"
REQUIRED_USE="
|| ( alsa jack openal oss pulseaudio )
|| ( opengl sdl sdl2 vulkan dispmanx )
|| ( kms X wayland videocore )
alsa? ( threads )
arm? ( gles2? ( egl ) )
cg? ( opengl )
dispmanx? ( videocore arm )
egl? ( opengl )
fbo? ( opengl )
gles2? ( !cg opengl )
gles3? ( gles2 )
kms? ( egl )
libass? ( ffmpeg )
netplay? ( network )
python? ( ${PYTHON_REQUIRED_USE} )
sdl2? ( !sdl )
videocore? ( arm )
vulkan? ( amd64 )
wayland? ( egl )
xinerama? ( X )
xmb? ( assets opengl )
xv? ( X )
lakka? ( assets cores database joypad_autoconfig overlays shaders xmb )
"
RDEPEND="
alsa? ( media-libs/alsa-lib:0= )
assets? ( games-emulation/retroarch-assets:0= )
cg? ( media-gfx/nvidia-cg-toolkit:0= )
cores? ( games-emulation/libretro-meta:0= )
database? ( games-emulation/libretro-database:0= )
arm? ( dispmanx? ( || ( media-libs/raspberrypi-userland:0 media-libs/raspberrypi-userland-bin:0 ) ) )
ffmpeg? ( >=media-video/ffmpeg-2.1.3:0= )
jack? ( virtual/jack:= )
joypad_autoconfig? ( games-emulation/retroarch-joypad-autoconfig:0= )
libass? ( media-libs/libass:0= )
libusb? ( virtual/libusb:1= )
miniupnpc? ( >=net-libs/miniupnpc-2.0:0= )
openal? ( media-libs/openal:0= )
opengl? ( media-libs/mesa:0=[egl?,gles2?] )
osmesa? ( media-libs/mesa:0=[osmesa?] )
overlays? ( games-emulation/common-overlays:0= )
pulseaudio? ( media-sound/pulseaudio:0= )
python? ( ${PYTHON_DEPS} )
sdl? ( >=media-libs/libsdl-1.2.10:0=[joystick] )
sdl2? ( media-libs/libsdl2:0=[joystick] )
shaders? ( vulkan? ( games-emulation/slang-shaders ) )
truetype? ( media-libs/freetype:2= )
udev? ( virtual/udev:0=
X? ( x11-drivers/xf86-input-evdev:0= )
)
amd64? ( vulkan? ( media-libs/vulkan-loader:0= ) )
v4l2? ( media-libs/libv4l:0= )
wayland? ( media-libs/mesa:0=[wayland?] )
X? (
x11-base/xorg-server:0=
>=x11-libs/libxkbcommon-0.4.0:0=
)
xinerama? ( x11-libs/libXinerama:0= )
xml? ( dev-libs/libxml2:2= )
xv? ( x11-libs/libXv:0= )
zlib? ( sys-libs/zlib:0= )
"
DEPEND="${RDEPEND}
virtual/pkgconfig
"
PDEPEND="!vulkan? ( shaders? ( games-emulation/glsl-shaders:0= ) )
!vulkan? ( cg? ( games-emulation/common-shaders:0= ) )
"
pkg_setup() {
use python && python-single-r1_pkg_setup
}
src_prepare() {
epatch \
"${FILESDIR}/${P}-build.patch" \
"${FILESDIR}/${P}-python.patch" \
"${FILESDIR}/${P}-disable_wifi_menu.patch"
# If Python support is enabled, use the currently enabled "python" binary.
if use python; then
sed -i qb/config.libs.sh \
-e "s:%PYTHON_VER%:${EPYTHON/python/}:" \
|| die '"sed" failed.'
fi
# Install application data and pixmaps to standard directories.
sed -i Makefile \
-e 's:$(DESTDIR)$(PREFIX)/share/\(applications\|pixmaps\):$(DESTDIR)usr/share/\1:' \
|| die '"sed" failed.'
# Absolute path of the directory containing Retroarch shared libraries.
export RETROARCH_LIB_DIR="${EROOT}usr/$(get_libdir)/retroarch"
# Absolute path of the directory containing Libretro shared libraries.
export LIBRETRO_LIB_DIR="${EROOT}usr/$(get_libdir)/libretro"
# Replace stock defaults with Gentoo-specific defaults.
sed -i retroarch.cfg \
-e 's:# \(libretro_directory =\):\1 "'${LIBRETRO_LIB_DIR}'/":' \
-e 's:# \(libretro_info_path =\):\1 "'${LIBRETRO_DATA_DIR}'/info/":' \
-e 's:# \(joypad_autoconfig_dir =\):\1 "'${RETROARCH_DATA_DIR}'/autoconfig/":' \
-e 's:# \(assets_directory =\):\1 "'${RETROARCH_DATA_DIR}'/assets/":' \
-e 's:# \(rgui_config_directory =\):\1 "~/.config/retroarch/":' \
-e 's:# \(video_filter_dir =\):\1 "'${RETROARCH_LIB_DIR}'/filters/video/":' \
-e 's:# \(audio_filter_dir =\):\1 "'${RETROARCH_LIB_DIR}'/filters/audio/":' \
-e 's:# \(overlay_directory =\):\1 "'${LIBRETRO_DATA_DIR}'/overlays/":' \
-e 's:# \(content_database_path =\):\1 "'${LIBRETRO_DATA_DIR}'/data/":' \
-e 's:# \(cheat_database_path =\):\1 "'${LIBRETRO_DATA_DIR}'/cheats/":' \
-e 's:# \(system_directory =\):\1 "~/.local/share/retroarch/system/":' \
-e 's:# \(savestate_directory =\):\1 "~/.local/share/retroarch/savestates/":' \
-e 's:# \(savefile_directory =\):\1 "~/.local/share/retroarch/savefiles/":' \
-e 's:# \(screenshot_directory =\):\1 "~/.local/share/retroarch/screenshots/":' \
-e 's:# \(extraction_directory =\):\1 "'${EROOT}'tmp/":' \
-e 's:# \(content_directory =\):\1 "~/":' \
-e 's:# \(rgui_browser_directory =\):\1 "~/":' \
|| die '"sed" failed.'
if use cores; then
sed -i retroarch.cfg \
-e 's:# \(menu_show_core_updater =\) true:\1 "false":'
fi
if use vulkan; then
sed -i retroarch.cfg \
-e 's:# \(video_shader_dir =\):\1 "'${LIBRETRO_DATA_DIR}'/slang-shaders/":' \
|| die '"sed failed.'
else
use cg && sed -i retroarch.cfg \
-e 's:# \(video_shader_dir =\):\1 "'${LIBRETRO_DATA_DIR}'/common-shaders/":'
use cg || use shaders && sed -i retroarch.cfg \
-e 's:# \(video_shader_dir =\):\1 "'${LIBRETRO_DATA_DIR}'/shaders/":'
fi
default_src_prepare
}
src_configure() {
if use cg; then
append-ldflags -L"${EROOT}"opt/nvidia-cg-toolkit/$(get_libdir)
append-cflags -I"${EROOT}"opt/nvidia-cg-toolkit/include
fi
if use videocore; then
export HAVE_VIDEOCORE="yes"
else
export HAVE_VIDEOCORE="no"
sed -i qb/config.libs.sh \
-e 's:\[ -d /opt/vc/lib \] && add_library_dirs /opt/vc/lib && add_library_dirs /opt/vc/lib/GL::' || die 'sed failed'
fi
if use lakka; then
export HAVE_LAKKA="1"
fi
# Note that OpenVG support is hard-disabled. (See ${RDEPEND} above.)
# miniupnpc requires now at least version 2.0
econf \
$(use_enable 7zip) \
$(use_enable alsa) \
$(use_enable armvfp floathard) \
$(use_enable cheevos) \
$(use_enable cg) \
$(use_enable cpu_flags_x86_sse2 sse) \
$(use_enable dispmanx) \
$(use_enable egl) \
$(use_enable fbo) \
$(use_enable ffmpeg) \
$(use_enable gles2 opengles) \
$(use_enable gles3 opengles3) \
$(use_enable jack) \
$(use_enable kms) \
$(use_enable libass ssa) \
$(use_enable libusb) \
$(use_enable materialui) \
$(use_enable miniupnpc) \
$(use_enable network networking) \
$(use_enable neon) \
$(use_enable openal al) \
$(use_enable opengl) \
$(use_enable osmesa) \
$(use_enable oss) \
$(use_enable pulseaudio pulse) \
$(use_enable python) \
$(use_enable sdl) \
$(use_enable sdl2) \
$(use_enable threads) \
$(use_enable truetype freetype) \
$(use_enable udev) \
$(use_enable v4l2) \
$(use_enable vulkan) \
$(use_enable wayland) \
$(use_enable X x11) \
$(use_enable xinerama) \
$(use_enable xmb) \
$(use_enable xml libxml2) \
$(use_enable xv xvideo) \
$(use_enable zlib) \
--enable-dynamic \
--disable-vg \
--with-man_dir="${EROOT}"usr/share/man/man1
}
src_compile() {
# Filtering all -O* flags in favor of upstream ones
filter-flags -O*
emake $(usex debug "DEBUG=1" "")
emake $(usex debug "build=debug" "build=release") -C gfx/video_filters/
emake $(usex debug "build=debug" "build=release") -C libretro-common/audio/dsp_filters/
}
src_install() {
# Install core files and directories.
emake DESTDIR="${ED}" install
# Install documentation.
dodoc README.md
# Install video filters.
insinto ${RETROARCH_LIB_DIR}/filters/video/
doins "${S}"/gfx/video_filters/*.so
doins "${S}"/gfx/video_filters/*.filt
# Install audio filters.
insinto ${RETROARCH_LIB_DIR}/filters/audio/
#doins "${S}"/audio/audio_filters/*.so
doins "${S}"/libretro-common/audio/dsp_filters/*.dsp
# Preserve empty directories.
keepdir ${LIBRETRO_LIB_DIR}
keepdir ${LIBRETRO_DATA_DIR}/info/
use vulkan || keepdir ${LIBRETRO_DATA_DIR}/shaders/
use vulkan && keepdir ${LIBRETRO_DATA_DIR}/slang-shaders/
keepdir ${LIBRETRO_DATA_DIR}/overlays/
keepdir ${LIBRETRO_DATA_DIR}/cheats/
keepdir ${LIBRETRO_DATA_DIR}/data/
keepdir ${RETROARCH_DATA_DIR}/assets/
keepdir ${RETROARCH_DATA_DIR}/autoconfig/
}
pkg_preinst() {
if ! has_version "<=${CATEGORY}/${PN}-${PVR}" ; then
first_install="1"
else
if [[ "${PV}" < "9999" ]]; then
if has_version "<${CATEGORY}/${PN}-1.3.6-r2"; then
upgrade_info="1"
fi
else
if has_version "<${CATEGORY}/${PN}-9999-r2" ; then
upgrade_info="1"
fi
fi
fi
}
pkg_postinst() {
if [[ "${upgrade_info}" == "1" ]]; then
ewarn ""
ewarn "You need to make sure that all directories exist or you must modify your retroarch.cfg accordingly."
ewarn "To create the needed directories for your user run as \$USER (not as root!):"
ewarn ""
ewarn "\$ mkdir -p ~/.local/share/retroarch/{savestates,savefiles,screenshots,system}"
ewarn ""
fi
if [[ "${upgrade_info}" == "1" ]]; then
ewarn ""
ewarn "The path to cores and datafiles changed to [/usr/lib64/libretro, /usr/share/libretro] due to EAPI 6 update."
ewarn "This can be changed via gui or cfg file found in \"\${HOME}/.config/retroarch/retroarch.cfg\""
ewarn ""
fi
}