summaryrefslogtreecommitdiff
path: root/app-emulation/vice/vice-3.8-r1.ebuild
blob: 69fdc3b146dccdc3eea66a3c4d889b53ac948150 (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
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
# Copyright 1999-2024 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=8

inherit multibuild toolchain-funcs xdg

DESCRIPTION="Versatile Commodore Emulator"
HOMEPAGE="https://vice-emu.sourceforge.io/"
SRC_URI="https://downloads.sourceforge.net/vice-emu/releases/${P}.tar.gz"

LICENSE="GPL-2+"
SLOT="0"
KEYWORDS="amd64 ~arm ~arm64 x86"
IUSE="
	alsa curl debug doc ethernet flac gif +gtk headless lame mpg123
	ogg openmp oss parport pci png portaudio pulseaudio sdl
"
REQUIRED_USE="|| ( gtk headless sdl )"

RDEPEND="
	sys-libs/zlib:=
	virtual/libintl
	alsa? ( media-libs/alsa-lib )
	curl? ( net-misc/curl )
	ethernet? (
		net-libs/libpcap
		sys-libs/libcap
	)
	flac? ( media-libs/flac:= )
	gif? ( media-libs/giflib:= )
	gtk? (
		>=app-accessibility/at-spi2-core-2.46:2
		dev-libs/glib:2
		media-libs/fontconfig:1.0
		media-libs/glew:0=[-egl-only(-)]
		media-libs/libglvnd[X]
		x11-libs/cairo
		x11-libs/gdk-pixbuf:2
		x11-libs/gtk+:3[X]
		x11-libs/libX11
		x11-libs/pango
	)
	lame? ( media-sound/lame )
	mpg123? ( media-sound/mpg123 )
	ogg? (
		media-libs/libogg
		media-libs/libvorbis
	)
	parport? ( sys-libs/libieee1284 )
	pci? ( sys-apps/pciutils )
	png? ( media-libs/libpng:= )
	portaudio? ( media-libs/portaudio )
	pulseaudio? ( media-libs/libpulse )
	sdl? (
		media-libs/libsdl2[video]
		media-libs/sdl2-image
	)
"
DEPEND="
	${RDEPEND}
	x11-base/xorg-proto
"
BDEPEND="
	app-alternatives/awk
	app-alternatives/yacc
	app-arch/unzip
	app-text/dos2unix
	dev-embedded/xa
	dev-lang/perl
	sys-apps/texinfo
	app-alternatives/lex
	sys-devel/gettext
	virtual/pkgconfig
	doc? ( virtual/texi2dvi )
	gtk? ( x11-misc/xdg-utils )
"

pkg_pretend() {
	[[ ${MERGE_TYPE} != binary ]] && use openmp && tc-check-openmp
}

pkg_setup() {
	[[ ${MERGE_TYPE} != binary ]] && use openmp && tc-check-openmp
}

src_prepare() {
	default

	# Strip the predefined C(XX)FLAGS.
	sed -i -r 's:(VICE_C(XX)?FLAGS=)"[^$]+":\1:' configure || die

	MULTIBUILD_VARIANTS=(
		$(usev gtk)
		$(usev headless)
		$(usev sdl)
	)

	# Debug build currently broken without copy sources.
	multibuild_copy_sources
}

src_configure() {
	tc-export AR

	multibuild_foreach_variant run_in_build_dir multibuild_src_configure
}

multibuild_src_configure() {
	# Append ".variant" to x* programs if building multiple variants.
	local xform
	(( ${#MULTIBUILD_VARIANTS[@]} > 1 )) &&
		xform="/^x/s/\$/.${MULTIBUILD_VARIANT}/"

	vice-multi_enable() {
		if [[ ${MULTIBUILD_VARIANT} == ${1} ]]; then
			echo --enable-${2}
		else
			echo --disable-${2}
		fi
	}

	local econfargs=(
		--program-transform-name="${xform}"
		$(vice-multi_enable gtk desktop-files)
		$(vice-multi_enable gtk gtk3ui)
		$(vice-multi_enable headless headlessui)
		$(vice-multi_enable sdl sdl2ui)
		$(usex debug $(vice-multi_enable gtk debug-gtk3ui) --disable-debug-gtk3ui)
		$(use_enable debug)
		$(use_enable doc pdf-docs)
		$(use_enable ethernet)
		$(use_enable openmp)
		$(use_enable parport parsid)
		$(use_with alsa)
		$(use_with curl libcurl)
		$(use_with flac)
		$(use_with gif)
		$(use_with lame)
		$(use_with lame static-lame) # disables dlopen, uses shared still
		$(use_with mpg123)
		$(use_with ogg vorbis)
		$(use_with oss)
		$(use_with parport libieee1284)
		$(use_with png)
		$(use_with portaudio)
		$(use_with pulseaudio pulse)
		$(usex alsa --enable-midi $(use_enable oss midi))
		$(usev !pci ac_cv_header_pci_pci_h=no)
		--disable-arch
		--disable-ffmpeg # deprecated in 3.8, also bug #834359
		--disable-sdl1ui
		ac_cv_lib_ungif_EGifPutLine=no # ensure use giflib, not ungif
	)

	econf "${econfargs[@]}"
}

src_compile() {
	# bug #924116 wrt SHELL
	multibuild_foreach_variant run_in_build_dir emake SHELL="${BASH}"
}

src_install() {
	# Get xdg-desktop-menu to play nicely while doing the install.
	dodir /etc/xdg/menus /usr/share/{applications,desktop-directories}

	XDG_UTILS_INSTALL_MODE=system \
	XDG_DATA_DIRS="${ED}"/usr/share \
	XDG_CONFIG_DIRS="${ED}"/etc/xdg \
		multibuild_foreach_variant run_in_build_dir default

	rm -f "${ED}"/usr/share/applications/*.cache || die

	vice-install_extras() {
		docinto html
		dodoc doc/html/*.{html,css}
		dodoc -r doc/html/images

		insinto /usr/share/vim/vimfiles/ftdetect
		doins doc/vim/ftdetect/*.vim

		insinto /usr/share/vim/vimfiles/syntax
		doins doc/vim/syntax/*.vim
	}
	multibuild_for_best_variant run_in_build_dir vice-install_extras
}