wine.eclass: do not pass CFLAGS as CROSSCFLAGS for mingw by default

Desktop integration tab wrt bug #960825 is not *that* big of an issue,
but these kind of issues with CROSSCFLAGS="-march=native ..." keep
coming back and I'd rather this not be done anymore unless
USE=custom-cflags so regular users do not have to deal with this.
Very few people/distros set CROSSCFLAGS and by default wine will use
just -O2 rather than try to copy CFLAGS which results in a lot of
(not really) "Gentoo"-specific obscure issues.

Closing bug given not currently planning to change this even if that
specific issue is fixed in upstream gcc/wine, but feel free to
re-open/repurpose if someone wants to pursue this further.

Technically needs revbumps, but letting this propagate on wine bumps
should be sufficient, wine should still mostly work albeit the exact
extend of issues beyond the desktop integration tab is unknown. Please
rebuild manually if affected and want this fixed now.

Leaving this alone for clang (USE=-mingw), no issues that I'm aware
of yet (or at least not specific to *FLAGS, it is generally less
tested with wine and may have other unrelated issues).

Closes: https://bugs.gentoo.org/960825
Thanks-to: GoldsrcSource
Signed-off-by: Ionen Wolkens <ionen@gentoo.org>
This commit is contained in:
Ionen Wolkens
2025-07-29 00:56:47 -04:00
parent 54afc2733c
commit bcebdbdbeb

View File

@@ -459,17 +459,33 @@ _wine_flags() {
case ${1} in
c)
# many hardening options are unlikely to work right
filter-flags '-fstack-protector*' #870136
filter-flags '-mfunction-return=thunk*' #878849
if use mingw && use !custom-cflags; then
# Changing CROSSCFLAGS is not very tested and often cause
# problems even with simple things like -march=native/-O3 when
# using mingw-gcc (thus -mno-avx below, also bug #960825), only
# inherit basic flags from CFLAGS unless USE=custom-cflags.
#
# Note that users setting CROSSCFLAGS directly (unfiltered)
# are on their own just like with USE=custom-cflags.
local flag flags=${CFLAGS} CFLAGS=-O2
# not get-flag() given it returns only the first occurence
for flag in ${flags}; do
[[ ${flag} == @(-g*|-O[0-1g]) ]] && CFLAGS+=" ${flag}"
done
else
# many hardening options are unlikely to work right
filter-flags '-fstack-protector*' #870136
filter-flags '-mfunction-return=thunk*' #878849
# bashrc-mv users often do CFLAGS="${LDFLAGS}" and then
# compile-only tests miss stripping unsupported linker flags
filter-flags '-Wl,*'
# bashrc-mv users often do CFLAGS="${LDFLAGS}" and then
# compile-only tests miss stripping unsupported linker flags
filter-flags '-Wl,*'
# -mavx with mingw-gcc has a history of problems and still see
# users have issues despite Wine's -mpreferred-stack-boundary=2
use mingw && append-cflags -mno-avx
# -mavx with mingw-gcc has a history of problems and still see
# users have issues despite Wine's -mpreferred-stack-boundary=2
# (kept even with USE=custom-cflags wrt bug #912268)
use mingw && append-cflags -mno-avx
fi
# same as strip-unsupported-flags but echos only for CC
CC="${wcc} ${wccflags}" test-flags-CC ${CFLAGS}