summaryrefslogtreecommitdiff
blob: 7030bb006a5e3c2be1eedda19e2c7f2bf76f4dee (plain)
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
# Copyright 1999-2015 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Id$

EAPI=5
inherit autotools eutils toolchain-funcs flag-o-matic games

DESCRIPTION="The Versatile Commodore 8-bit Emulator"
HOMEPAGE="http://vice-emu.sourceforge.net/"
SRC_URI="mirror://sourceforge/vice-emu/releases/${P}.tar.gz"

LICENSE="GPL-2+"
SLOT="0"
KEYWORDS="amd64 ~ppc ~sparc x86"
IUSE="Xaw3d alsa ethernet ffmpeg fullscreen +gtk ipv6 lame nls oss png pulseaudio sdl +sdlsound threads vte zlib"

# upstream says gtk3 and sdl2 shouldn't be exposed yet.
#REQUIRED_USE="?? ( gtk2 gtk3 sdl )"
REQUIRED_USE="?? ( gtk sdl )"

GTK_COMMON="
	x11-libs/pango
	x11-libs/cairo"
#	gtk3? (
#		x11-libs/gtk+:3
#		vte? ( x11-libs/vte:2.90 )
#		${GTK_COMMON}
#	)
RDEPEND="
	virtual/jpeg:0
	virtual/opengl
	media-libs/giflib
	alsa? ( media-libs/alsa-lib )
	pulseaudio? ( media-sound/pulseaudio )
	sdlsound? ( media-libs/libsdl[sound] )
	ethernet? (
	    >=net-libs/libpcap-0.9.8
	    >=net-libs/libnet-1.1.2.1:1.1
	)
	ffmpeg? ( virtual/ffmpeg )
	lame? ( media-sound/lame )
	nls? ( virtual/libintl )
	png? ( media-libs/libpng:0 )
	zlib? ( sys-libs/zlib )
	sdl? (
		media-libs/libsdl[joystick,video]
	)
	!sdl? (
		fullscreen? (
			x11-libs/libXrandr
			x11-libs/libXxf86vm )
		x11-libs/libX11
		x11-libs/libXext
		sys-libs/readline:0
	)
	gtk? (
		x11-libs/gtk+:2
		vte? ( x11-libs/vte:0 )
		x11-libs/gtkglext
		${GTK_COMMON}
	)
	!sdl? ( !gtk? (
		x11-libs/libXmu
		x11-libs/libXpm
		x11-libs/libXt
		x11-libs/libXv
		Xaw3d? ( x11-libs/libXaw3d )
		!Xaw3d? ( x11-libs/libXaw )
	) )
	"
DEPEND="${RDEPEND}
	virtual/pkgconfig
	!sdl? (
		fullscreen? ( x11-proto/xf86vidmodeproto )
		!gtk? (
			x11-libs/libICE
			x11-libs/libSM
		)
	)
	x11-apps/bdftopcf
	x11-apps/mkfontdir
	x11-proto/xproto
	x11-proto/xextproto
	media-libs/fontconfig
	x11-proto/videoproto
	nls? ( sys-devel/gettext )"

src_prepare() {
	epatch "${FILESDIR}"/${P}-autotools.patch
	sed -i \
		-e 's/building//' \
		doc/Makefile.am || die
	sed -i \
		-e "/^docdir =/s:=.*:=/usr/share/doc/${PF}:" \
		doc/Makefile.am \
		doc/readmes/Makefile.am || die
	sed -i \
		-e "/^docdir =/s:=.*:=/usr/share/doc/${PF}/html:" \
		doc/html/Makefile.am || die
	sed -i \
		-e "s:/usr/local/lib/VICE:$(games_get_libdir)/${PN}:" \
		man/vice.1 \
		$(grep -rl --exclude="*texi" /usr/local/lib doc) || die
	sed -i \
		-e "/VICEDIR=/s:=.*:=\"$(games_get_libdir)/${PN}\";:" \
		configure.ac || die
	sed -i \
		-e "s:\(#define LIBDIR \).*:\1\"$(games_get_libdir)/${PN}\":" \
		-e "s:\(#define DOCDIR \).*:\1\"/usr/share/doc/${PF}\":" \
		src/arch/unix/archdep.h \
		src/arch/sdl/archdep_unix.h || die
	rm -rf src/lib/{libffmpeg,liblame} || die
	sed -i \
		-e '/SUBDIRS/s/libffmpeg//;' \
		-e '/SUBDIRS/s/liblame//;' \
		src/lib/Makefile.am || die
	AT_NO_RECURSIVE=1 eautoreconf
}

src_configure() {
	local gui_arg snd_arg

	snd_arg+=" $(use_with alsa)"
	snd_arg+=" $(use_with oss)"
	snd_arg+=" $(use_with pulseaudio pulse)"
	snd_arg+=" $(use_with sdlsound)"

	gui_arg+=" $(use_enable sdl sdlui)"
	# The gtk UI code has raw calls to XOpenDisplay and
	# is missing -lX11 if vte doesn't pull it in.
	#if use gtk2 || use gtk3 ; then
	if use gtk ; then
		use vte || append-libs -lX11
	fi
	gui_arg+=" $(use_enable gtk gnomeui)"
	#gui_arg+=" $(use_enable gtk3 gnomeui3)"
	gui_arg+=" $(use_enable Xaw3d xaw3d)"

	# --with-readline is forced to avoid using the embedded copy
	# don't try to actually run fc-cache (bug #280976)
	FCCACHE=/bin/true \
	PKG_CONFIG=$(tc-getPKG_CONFIG) \
	egamesconf \
		--enable-parsid \
		--with-resid \
		--with-readline \
		--without-arts \
		--without-midas \
		$(use_enable ethernet) \
		$(use_enable ffmpeg) \
		$(use_enable ffmpeg external-ffmpeg) \
		$(use_enable fullscreen) \
		$(use_enable ipv6) \
		$(use_enable lame) \
		$(use_enable nls) \
		$(use_enable vte) \
		$(use_with png) \
		$(use_with threads uithreads) \
		$(use_with zlib) \
		${gui_arg} \
		${snd_arg} \
		--disable-option-checking
		# --disable-option-checking has to be last
}

src_install() {
	DOCS="AUTHORS ChangeLog FEEDBACK README" \
		default
	prepgamesdirs
}