Diff wine-staging-8.0 with a wine-staging-8.13

/usr/portage/app-emulation/wine-staging/wine-staging-8.13.ebuild 2023-10-09 14:52:28.740368331 +0300
4 4
EAPI=8
5 5

  
6 6
MULTILIB_COMPAT=( abi_x86_{32,64} )
7
inherit autotools flag-o-matic multilib multilib-build
8
inherit prefix toolchain-funcs wrapper
9

  
10
WINE_GECKO=2.47.3
11
WINE_MONO=7.4.0
7
PYTHON_COMPAT=( python3_{10..12} )
8
inherit autotools edo flag-o-matic multilib multilib-build
9
inherit prefix python-any-r1 toolchain-funcs wrapper
10

  
11
WINE_GECKO=2.47.4
12
WINE_MONO=8.0.0
13
WINE_P=wine-$(ver_cut 1-2)
12 14

  
13 15
if [[ ${PV} == *9999 ]]; then
14 16
	inherit git-r3
......
17 19
else
18 20
	(( $(ver_cut 2) )) && WINE_SDIR=$(ver_cut 1).x || WINE_SDIR=$(ver_cut 1).0
19 21
	SRC_URI="
20
		https://dl.winehq.org/wine/source/${WINE_SDIR}/wine-${PV}.tar.xz
22
		https://dl.winehq.org/wine/source/${WINE_SDIR}/${WINE_P}.tar.xz
21 23
		https://github.com/wine-staging/wine-staging/archive/v${PV}.tar.gz -> ${P}.tar.gz"
22 24
	KEYWORDS="-* ~amd64 ~x86"
23 25
fi
24
S="${WORKDIR}/wine-${PV}"
26
S="${WORKDIR}/${WINE_P}"
25 27

  
26 28
DESCRIPTION="Free implementation of Windows(tm) on Unix, with Wine-Staging patchset"
27 29
HOMEPAGE="
......
32 34
SLOT="${PV}"
33 35
IUSE="
34 36
	+X +abi_x86_32 +abi_x86_64 +alsa capi crossdev-mingw cups dos
35
	llvm-libunwind debug custom-cflags +fontconfig +gecko gphoto2
36
	+gstreamer kerberos +mingw +mono netapi nls odbc opencl +opengl
37
	osmesa pcap perl pulseaudio samba scanner +sdl selinux +ssl
38
	+truetype udev udisks +unwind usb v4l +vulkan +xcomposite xinerama"
37
	llvm-libunwind custom-cflags +fontconfig +gecko gphoto2 +gstreamer
38
	kerberos +mingw +mono netapi nls opencl +opengl osmesa pcap perl
39
	pulseaudio samba scanner +sdl selinux smartcard +ssl +strip
40
	+truetype udev udisks +unwind usb v4l +vulkan wayland wow64
41
	+xcomposite xinerama"
42
# bug #551124 for truetype
43
# TODO: wow64 can be done without mingw if using clang (needs bug #912237)
39 44
REQUIRED_USE="
40 45
	X? ( truetype )
41
	crossdev-mingw? ( mingw )" # bug #551124 for truetype
46
	crossdev-mingw? ( mingw )
47
	wow64? ( abi_x86_64 !abi_x86_32 mingw )"
42 48

  
43 49
# tests are non-trivial to run, can hang easily, don't play well with
44 50
# sandbox, and several need real opengl/vulkan or network access
......
64 70
	fontconfig? ( media-libs/fontconfig[${MULTILIB_USEDEP}] )
65 71
	kerberos? ( virtual/krb5[${MULTILIB_USEDEP}] )
66 72
	netapi? ( net-fs/samba[${MULTILIB_USEDEP}] )
67
	odbc? ( dev-db/unixODBC[${MULTILIB_USEDEP}] )
68 73
	sdl? ( media-libs/libsdl2[haptic,joystick,${MULTILIB_USEDEP}] )
69 74
	ssl? ( net-libs/gnutls:=[${MULTILIB_USEDEP}] )
70 75
	truetype? ( media-libs/freetype[${MULTILIB_USEDEP}] )
......
89 94
	pcap? ( net-libs/libpcap[${MULTILIB_USEDEP}] )
90 95
	pulseaudio? ( media-libs/libpulse[${MULTILIB_USEDEP}] )
91 96
	scanner? ( media-gfx/sane-backends[${MULTILIB_USEDEP}] )
97
	smartcard? ( sys-apps/pcsc-lite[${MULTILIB_USEDEP}] )
92 98
	udev? ( virtual/libudev:=[${MULTILIB_USEDEP}] )
93 99
	unwind? (
94 100
		llvm-libunwind? ( sys-libs/llvm-libunwind[${MULTILIB_USEDEP}] )
95 101
		!llvm-libunwind? ( sys-libs/libunwind:=[${MULTILIB_USEDEP}] )
96 102
	)
97
	usb? ( dev-libs/libusb:1[${MULTILIB_USEDEP}] )"
103
	usb? ( dev-libs/libusb:1[${MULTILIB_USEDEP}] )
104
	wayland? ( dev-libs/wayland[${MULTILIB_USEDEP}] )"
98 105
RDEPEND="
99 106
	${WINE_COMMON_DEPEND}
100 107
	app-emulation/wine-desktop-common
......
104 111
			games-emulation/dosbox-staging
105 112
		)
106 113
	)
107
	gecko? ( app-emulation/wine-gecko:${WINE_GECKO}[${MULTILIB_USEDEP}] )
114
	gecko? (
115
		app-emulation/wine-gecko:${WINE_GECKO}[${MULTILIB_USEDEP}]
116
		wow64? ( app-emulation/wine-gecko[abi_x86_32] )
117
	)
108 118
	gstreamer? ( media-plugins/gst-plugins-meta:1.0[${MULTILIB_USEDEP}] )
109 119
	mono? ( app-emulation/wine-mono:${WINE_MONO} )
110 120
	perl? (
......
118 128
	${WINE_COMMON_DEPEND}
119 129
	sys-kernel/linux-headers
120 130
	X? ( x11-base/xorg-proto )"
131
# gitapply.sh prefers git but can fallback to patch+extras
121 132
BDEPEND="
133
	${PYTHON_DEPS}
134
	|| (
135
		dev-vcs/git
136
		(
137
			sys-apps/gawk
138
			sys-apps/util-linux
139
		)
140
	)
141
	|| (
142
		sys-devel/binutils
143
		sys-devel/lld
144
	)
122 145
	dev-lang/perl
123
	sys-devel/binutils
124 146
	sys-devel/bison
125 147
	sys-devel/flex
126 148
	virtual/pkgconfig
127 149
	mingw? ( !crossdev-mingw? (
128 150
		>=dev-util/mingw64-toolchain-10.0.0_p1-r2[${MULTILIB_USEDEP}]
151
		wow64? ( dev-util/mingw64-toolchain[abi_x86_32] )
129 152
	) )
130
	nls? ( sys-devel/gettext )"
153
	nls? ( sys-devel/gettext )
154
	wayland? ( dev-util/wayland-scanner )"
131 155
IDEPEND=">=app-eselect/eselect-wine-2"
132 156

  
133 157
QA_CONFIG_IMPL_DECL_SKIP=(
134 158
	__clear_cache # unused on amd64+x86 (bug #900334)
135 159
	res_getservers # false positive
136 160
)
161
QA_FLAGS_IGNORED="usr/lib/.*/wine/.*-unix/odbc32.so" # has no compiled objects
137 162
QA_TEXTRELS="usr/lib/*/wine/i386-unix/*.so" # uses -fno-PIC -Wl,-z,notext
138 163

  
139 164
PATCHES=(
140 165
	"${FILESDIR}"/${PN}-7.17-noexecstack.patch
141 166
	"${FILESDIR}"/${PN}-7.20-unwind.patch
167
	"${FILESDIR}"/${PN}-8.13-rpath.patch
142 168
)
143 169

  
144 170
pkg_pretend() {
......
146 172

  
147 173
	if use crossdev-mingw && [[ ! -v MINGW_BYPASS ]]; then
148 174
		local mingw=-w64-mingw32
149
		for mingw in $(usev abi_x86_64 x86_64${mingw}) $(usev abi_x86_32 i686${mingw}); do
175
		for mingw in $(usev abi_x86_64 x86_64${mingw}) \
176
			$(use abi_x86_32 || use wow64 && echo i686${mingw}); do
150 177
			if ! type -P ${mingw}-gcc >/dev/null; then
151 178
				eerror "With USE=crossdev-mingw, you must prepare the MinGW toolchain"
152 179
				eerror "yourself by installing sys-devel/crossdev then running:"
......
165 192
		EGIT_CHECKOUT_DIR=${WORKDIR}/${P}
166 193
		git-r3_src_unpack
167 194

  
168
		EGIT_COMMIT=$("${BASH}" "${EGIT_CHECKOUT_DIR}"/patches/patchinstall.sh --upstream-commit) || die
169
		EGIT_REPO_URI=${WINE_EGIT_REPO_URI}
170
		EGIT_CHECKOUT_DIR=${S}
171
		einfo "Fetching Wine commit matching the current patchset by default (${EGIT_COMMIT})"
172
		git-r3_src_unpack
195
		# hack: use subshell to preserve state (including what git-r3 unpack
196
		# sets) for smart-live-rebuild as this is not the repo to look at
197
		(
198
			EGIT_COMMIT=$(<"${EGIT_CHECKOUT_DIR}"/staging/upstream-commit) || die
199
			EGIT_REPO_URI=${WINE_EGIT_REPO_URI}
200
			EGIT_CHECKOUT_DIR=${S}
201
			einfo "Fetching Wine commit matching the current patchset by default (${EGIT_COMMIT})"
202
			git-r3_src_unpack
203
		)
173 204
	else
174 205
		default
175 206
	fi
176 207
}
177 208

  
178 209
src_prepare() {
179
	local staging=(
180
		./patchinstall.sh DESTDIR="${S}"
210
	local patchinstallargs=(
181 211
		--all
182
		--backend=eapply
183 212
		--no-autoconf
184
		-W winemenubuilder-Desktop_Icon_Path #652176
185 213
		${MY_WINE_STAGING_CONF}
186 214
	)
187 215

  
188
	# source patcher in a subshell so can use eapply as a backend
189
	ebegin "Running ${staging[*]}"
190
	( cd ../${P}/patches && . "${staging[@]}" )
191
	eend ${?} || die "Failed to apply the patchset"
216
	edo "${PYTHON}" ../${P}/staging/patchinstall.py "${patchinstallargs[@]}"
192 217

  
193 218
	# sanity check, bumping these has a history of oversights
194 219
	local geckomono=$(sed -En '/^#define (GECKO|MONO)_VER/{s/[^0-9.]//gp}' \
......
208 233
			# phase despite USE=mingw, drop as a quick fix for now
209 234
			sed -i '/MSVCRTFLAGS=/s/-mabi=ms//' configure.ac || die
210 235
		else
211
			# ./configure will fail, abort early
212
			die "building ${PN} with clang is only supported with USE=mingw"
236
			# fails in ./configure unless --enable-archs is passed, allow to
237
			# bypass with EXTRA_ECONF but is currently considered unsupported
238
			# (by Gentoo) as additional work is needed for (proper) support
239
			# note: also fails w/ :17, but unsure if safe to drop w/o mingw
240
			[[ ${EXTRA_ECONF} == *--enable-archs* ]] ||
241
				die "building ${PN} with clang is only supported with USE=mingw"
213 242
		fi
214 243
	fi
215 244

  
......
234 263
		--includedir="${EPREFIX}"/usr/include/${P}
235 264
		--libdir="${EPREFIX}"${WINE_PREFIX}
236 265
		--mandir="${EPREFIX}"${WINE_DATADIR}/man
266

  
267
		$(usev wow64 --enable-archs=x86_64,i386)
268

  
237 269
		$(use_enable gecko mshtml)
238 270
		$(use_enable mono mscoree)
239 271
		--disable-tests
272

  
240 273
		$(use_with X x)
241 274
		$(use_with alsa)
242 275
		$(use_with capi)
......
257 290
		$(use_with pulseaudio pulse)
258 291
		$(use_with scanner sane)
259 292
		$(use_with sdl)
293
		$(use_with smartcard pcsclite)
260 294
		$(use_with ssl gnutls)
261 295
		$(use_with truetype freetype)
262 296
		$(use_with udev)
......
265 299
		$(use_with usb)
266 300
		$(use_with v4l v4l2)
267 301
		$(use_with vulkan)
302
		$(use_with wayland)
268 303
		$(use_with xcomposite)
269 304
		$(use_with xinerama)
270
		$(usev !odbc ac_cv_lib_soname_odbc=)
271 305
	)
272 306

  
273
	tc-ld-force-bfd # builds with non-bfd but broken at runtime (bug #867097)
274 307
	filter-lto # build failure
275
	use mingw || filter-flags -fno-plt # build failure
276 308
	use custom-cflags || strip-flags # can break in obscure ways at runtime
277
	use crossdev-mingw || PATH=${BROOT}/usr/lib/mingw64-toolchain/bin:${PATH}
278 309

  
279
	# temporary workaround for tc-ld-force-bfd not yet enforcing with mold
280
	# https://github.com/gentoo/gentoo/pull/28355
281
	[[ $($(tc-getCC) ${LDFLAGS} -Wl,--version 2>/dev/null) == mold* ]] &&
282
		append-ldflags -fuse-ld=bfd
310
	# wine uses linker tricks unlikely to work with non-bfd/lld (bug #867097)
311
	# (do self test until https://github.com/gentoo/gentoo/pull/28355)
312
	if [[ $(LC_ALL=C $(tc-getCC) ${LDFLAGS} -Wl,--version 2>/dev/null) != @(LLD|GNU\ ld)* ]]
313
	then
314
		has_version -b sys-devel/binutils &&
315
			append-ldflags -fuse-ld=bfd ||
316
			append-ldflags -fuse-ld=lld
317
		strip-unsupported-flags
318
	fi
319

  
320
	if use mingw; then
321
		use crossdev-mingw || PATH=${BROOT}/usr/lib/mingw64-toolchain/bin:${PATH}
322

  
323
		filter-flags -fno-plt # build failure
324

  
325
		# CROSSCC was formerly recognized by wine, thus been using similar
326
		# variables (subject to change, esp. if ever make a mingw.eclass).
327
		local mingwcc_amd64=${CROSSCC:-${CROSSCC_amd64:-x86_64-w64-mingw32-gcc}}
328
		local mingwcc_x86=${CROSSCC:-${CROSSCC_x86:-i686-w64-mingw32-gcc}}
329
		local -n mingwcc=mingwcc_$(usex abi_x86_64 amd64 x86)
330

  
331
		conf+=(
332
			ac_cv_prog_x86_64_CC="${mingwcc_amd64}"
333
			ac_cv_prog_i386_CC="${mingwcc_x86}"
334

  
335
			CROSSCFLAGS="${CROSSCFLAGS:-$(
336
				filter-flags '-fstack-protector*' #870136
337
				filter-flags '-mfunction-return=thunk*' #878849
338

  
339
				# -mavx with mingw-gcc has a history of obscure issues and
340
				# disabling is seen as safer, e.g. `WINEARCH=win32 winecfg`
341
				# crashes with -march=skylake >=wine-8.10, similar issues with
342
				# znver4: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110273
343
				append-cflags -mno-avx #912268
344

  
345
				CC=${mingwcc} test-flags-CC ${CFLAGS:--O2}
346
			)}"
347

  
348
			CROSSLDFLAGS="${CROSSLDFLAGS:-$(
349
				filter-flags '-fuse-ld=*'
350

  
351
				CC=${mingwcc} test-flags-CCLD ${LDFLAGS}
352
			)}"
353
		)
354
	fi
283 355

  
284
	# build using upstream's way (--with-wine64)
285
	# order matters: configure+compile 64->32, install 32->64
356
	# order matters with multilib: configure+compile 64->32, install 32->64
286 357
	local -i bits
287 358
	for bits in $(usev abi_x86_64 64) $(usev abi_x86_32 32); do
288 359
	(
......
291 362
		mkdir ../build${bits} || die
292 363
		cd ../build${bits} || die
293 364

  
294
		pe_arch=i386
295 365
		if (( bits == 64 )); then
296
			pe_arch=x86_64
297
			: "${CROSSCC:=${CROSSCC_amd64:-x86_64-w64-mingw32-gcc}}"
298 366
			conf+=( --enable-win64 )
299 367
		elif use amd64; then
300 368
			conf+=(
......
304 372
			# _setup is optional, but use over Wine's auto-detect (+#472038)
305 373
			multilib_toolchain_setup x86
306 374
		fi
307
		: "${CROSSCC:=${CROSSCC_x86:-i686-w64-mingw32-gcc}}"
308

  
309
		if use mingw; then
310
			# CROSSCC is no longer recognized by Wine, but still use for now
311
			# (future handling for CROSS* variables is subject to changes)
312
			conf+=( ac_cv_prog_${pe_arch}_CC="${CROSSCC}" )
313

  
314
			# use *FLAGS for mingw, but strip unsupported
315
			: "${CROSSCFLAGS:=$(
316
				# >=wine-7.21 configure.ac no longer adds -fno-strict by mistake
317
				append-cflags -fno-strict-aliasing
318

  
319
				filter-flags '-fstack-protector*' #870136
320
				filter-flags '-mfunction-return=thunk*' #878849
321

  
322
				# -mavx with mingw-gcc has a history of obscure issues and
323
				# disabling is seen as safer, e.g. `WINEARCH=win32 winecfg`
324
				# crashes with -march=skylake >=wine-8.10, similar issues with
325
				# znver4: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110273
326
				append-cflags -mno-avx #912268
327

  
328
				CC=${CROSSCC} test-flags-CC ${CFLAGS:--O2})}"
329
			: "${CROSSLDFLAGS:=$(
330
				filter-flags '-fuse-ld=*'
331
				CC=${CROSSCC} test-flags-CCLD ${LDFLAGS})}"
332
			export CROSS{C,LD}FLAGS
333
		fi
334 375

  
335 376
		ECONF_SOURCE=${S} econf "${conf[@]}"
336 377
	)
......
346 387
	use abi_x86_32 && emake DESTDIR="${D}" -C ../build32 install
347 388
	use abi_x86_64 && emake DESTDIR="${D}" -C ../build64 install # do last
348 389

  
349
	# symlink for plain 'wine' and install its man pages if 64bit-only #404331
350
	if use abi_x86_64 && use !abi_x86_32; then
351
		dosym wine64 ${WINE_PREFIX}/bin/wine
352
		dosym wine64-preloader ${WINE_PREFIX}/bin/wine-preloader
353
		local man
354
		for man in ../build64/loader/wine.*man; do
355
			: "${man##*/wine}"
356
			: "${_%.*}"
357
			insinto ${WINE_DATADIR}/man/${_:+${_#.}/}man1
358
			newins ${man} wine.1
359
		done
390
	# Ensure both wine64 and wine are available if USE=abi_x86_64 (wow64,
391
	# -abi_x86_32, and/or EXTRA_ECONF could cause varying scenarios where
392
	# one or the other could be missing and that is unexpected for users
393
	# and some tools like winetricks)
394
	if use abi_x86_64; then
395
		if [[ -e ${ED}${WINE_PREFIX}/bin/wine64 && ! -e ${ED}${WINE_PREFIX}/bin/wine ]]; then
396
			dosym wine64 ${WINE_PREFIX}/bin/wine
397
			dosym wine64-preloader ${WINE_PREFIX}/bin/wine-preloader
398

  
399
			# also install wine(1) man pages (incl. translations)
400
			local man
401
			for man in ../build64/loader/wine.*man; do
402
				: "${man##*/wine}"
403
				: "${_%.*}"
404
				insinto ${WINE_DATADIR}/man/${_:+${_#.}/}man1
405
				newins ${man} wine.1
406
			done
407
		elif [[ ! -e ${ED}${WINE_PREFIX}/bin/wine64 && -e ${ED}${WINE_PREFIX}/bin/wine ]]; then
408
			dosym wine ${WINE_PREFIX}/bin/wine64
409
			dosym wine-preloader ${WINE_PREFIX}/bin/wine64-preloader
410
		fi
360 411
	fi
361 412

  
362 413
	use perl || rm "${ED}"${WINE_DATADIR}/man/man1/wine{dump,maker}.1 \
......
368 419
		make_wrapper "${bin##*/}-${P#wine-}" "${bin#"${ED}"}"
369 420
	done
370 421

  
371
	# don't let portage try to strip PE files with the wrong
372
	# strip executable and instead handle it here (saves ~120MB)
373 422
	if use mingw; then
423
		# don't let portage try to strip PE files with the wrong
424
		# strip executable and instead handle it here (saves ~120MB)
374 425
		dostrip -x ${WINE_PREFIX}/wine/{i386,x86_64}-windows
375
		use debug ||
426

  
427
		if use strip; then
428
			ebegin "Stripping Windows (PE) binaries"
376 429
			find "${ED}"${WINE_PREFIX}/wine/*-windows -regex '.*\.\(a\|dll\|exe\)' \
377
				-exec $(usex abi_x86_64 x86_64 i686)-w64-mingw32-strip --strip-unneeded {} + || die
430
				-exec $(usex abi_x86_64 x86_64 i686)-w64-mingw32-strip --strip-unneeded {} +
431
			eend ${?} || die
432
		fi
378 433
	fi
379 434

  
380 435
	dodoc ANNOUNCE AUTHORS README* documentation/README*
381 436
}
382 437

  
383 438
pkg_postinst() {
384
	if use abi_x86_32 && { use opengl || use vulkan; } &&
439
	if use !abi_x86_32 && use !wow64; then
440
		ewarn "32bit support is disabled. While 64bit applications themselves will"
441
		ewarn "work, be warned that it is not unusual that installers or other helpers"
442
		ewarn "will attempt to use 32bit and fail. If do not want full USE=abi_x86_32,"
443
		ewarn "note the experimental/WIP USE=wow64 can allow 32bit without multilib."
444
	elif use abi_x86_32 && { use opengl || use vulkan; } &&
385 445
		has_version 'x11-drivers/nvidia-drivers[-abi_x86_32]'
386 446
	then
387 447
		ewarn "x11-drivers/nvidia-drivers is installed but is built without"
Thank you!