diff --git a/app-emulation/wine-osu/Manifest b/app-emulation/wine-osu/Manifest index 24da756..c6ca18c 100644 --- a/app-emulation/wine-osu/Manifest +++ b/app-emulation/wine-osu/Manifest @@ -3,12 +3,14 @@ DIST 11-22-2024-51ccd95c-7ba8823e-patch.tar.gz 1087861 BLAKE2B 90b6a1caa0ab98525 DIST 12-09-2024-4161e62e-4f96088b-patch.tar.gz 1059981 BLAKE2B 3c124b19fa0e02eb5bb7d6fcf836cce7349010f7d0258e75eee72fd2e8589cdd6096dee67cab3611a71109c6c892b87951552865b5d3b73441a2a6d1f097a170 SHA512 168955caeb4f950128a51df208b88dbdcc26f5f8a43cf4717773b08d6059fc6f4f18e469a9e6939cdff6d4d4ea4c0e900b3b509d7d2d5995e839f717d2a798a8 DIST 12-13-2024-5bfbeb67-c8d46d4c-patch.tar.gz 1073003 BLAKE2B 0d55d945bb2c054d9cbab6a09773284e2a9980d972ce0c165deb3906564684878a6adac14769891217fbac1b48ad6a95f2fcc47b13968eb4bb911812edcd1245 SHA512 9e98666f62d06905131ed784d5f3cb4e7841ea3114d09be8ccfd079a76bc59175e43b511556a6f78d5a5c4eb0865c92d3bd8a0387238381e787976beb37c8283 DIST 12-16-2024-538cae09-c2de76b8-patch.tar.gz 1093376 BLAKE2B d4183496730c469651598cd5f8abd652cc694bff807bff4ee72dec86886471ed68c4c55ea9013c160f4557227f14f13c9917a32add498b632fb420d9644e60b4 SHA512 6586a79787f0bbbbcbf08a4e121ed244630eec0c780a0e76b43fc954cf429edc25965598cbe57c2ab96ffc2ee0734b7f1787f967dd0cfd99d098004430f5977c +DIST 12-25-2024-e713c348-f10d2d04-patch.tar.gz 1176436 BLAKE2B 558b1d3bfef9573eab6ea393bfd9cc45ff3f78b23b39cc99937b670b4cd98b1c6f7457bb771866ce308df689a8cd0e524e77f16ffaa21d6ad2ff72a67e66dfba SHA512 530fe645e84776ea192e9bf4f85bcaeb08466bf823489212ac77c697dd1bdbf519b432fa68b8874a0b9a5b61be1bcbffbee667fdbc89f16fe351055a76ec1a8e DIST wine-osu-10.0-4161e62e478f61fdcd0365d9bd7b21e3b1a5197b.tar.gz 51980907 BLAKE2B d157f9ccde72ec794aab88f5540541b15bad792f68c30485c19e3df39b595b56f46bb969046275a21b75b31aec2794cd0c848d161f2ae7f68f3165173cdf39d2 SHA512 9aeee1a7603e29b1b05459a1bb6830624c0e0fd790201eca36397d99203ac52e6d10a76b12fd87f3539c9e1fcda1155a48cfed758053b862da1e60d8f612ddbb DIST wine-osu-10.0-4f96088b1e12db6134dff4090797c3d61b05833d-staging.tar.gz 9394245 BLAKE2B c4b55b0e760aa121d9b52563f6696abb60e2087a4dc1e63ed76865779960626a74265e598cba25e294e3c67f1f93e74bc564b9b115d1275f22dd8515be5be290 SHA512 32dc7c09665f91fbf40a7e951370c362d0d41968623ceb58549ffdc7e350a84946366d97fd32bc6a39e2950e704b10a86c6b7cdf530a475a6109c2c3b89ae0d5 DIST wine-osu-10.0-538cae099cde66706428ead4ae8951c1e389d3f2.tar.gz 51990247 BLAKE2B 15600299e0c627e543cb6493a6f14278d1f1a030254101b17eb22781aed1c4e64a50ef8fb39c217df21b28aff0bd30c25d39a171facbf6e1860140142c8866c0 SHA512 9712712e8d24ff97a417a8aeaebe79ea4a5284942213fab7fbbdbd06dc498d245497bd7f23fae104dbd6f2d6b3628e94bc6db7272acc39ff805be7892048039b DIST wine-osu-10.0-5bfbeb677f472d30c5dc5d855b0a045a7157cc43.tar.gz 51983247 BLAKE2B 4c48b81bab547b7bed6c5e1923f1e6d1661c8a47bce2c8ea8263a80c3bd8618729acef4295cb027f6bbe2786694d5b262f5dc2c23bdd018d1c23fda80861b978 SHA512 58834d5652d4a3e2047e724f5cd8fe6eb27a2969cbbfd7fcc75ec44acba3a80166be9bafa86e32c75e07ed85f084d164804fbe9cd4f590dbc1f88d7c374d596d DIST wine-osu-10.0-c2de76b8048c67aa33c57cff60f98ba1b1675e72-staging.tar.gz 9442824 BLAKE2B 54d4ae8ef85c076eea7f0b0303d62fecaef6f889126028b7def97828bf57faf39be19f0e08ccdba0ae6698ecd0a377a2e1d5283c6ac42023e86705f6b85202ba SHA512 59ea63886cbf34de7417eee4f311ec2e98aae86cdd0274a4619cd8f39a8159f84c6ac388260bf752939df7d34bc17c6bbfad3cfa41b72ab1589c6236976a9745 DIST wine-osu-10.0-c8d46d4ca3c505014f55cc92296592119abf84f1-staging.tar.gz 9394404 BLAKE2B 34b06a1895e6c32e516140b2cea0725389815739e17aba6fae6345b68025c0f703580e7e44ba63e29246cf56df740f318448b5d2834e52abf74737e63d622ec3 SHA512 c3cd7427a39cec06fa1af4e3cfff3f41ae5bbfe8a43c5833b1e9eed18cbfa90bdd4326246ead5f5de4d2453130b2f65f7684008078d02dd60f306a955ab31f20 +DIST wine-osu-10.0-e713c3487f9fc9b7ded528f9ce49844facb99a90.tar.gz 51993364 BLAKE2B 7d330161bcfa780dbff5988925a87428e62ca4f62164e4334bed0ea2f98bc797605813b88932c83357159d9d4b76f3fd4f586801b75f92f0128c51f99bec80ed SHA512 e618c48f05172603ed2bb57b375f9338177c39f518c4c6d5c18733272fcaa230bc0eb69d480521e1ec709fa5225e3b5fbd199ec5849a49c6327b19a065503b38 DIST wine-osu-9.21-32abf9fc9756ad912b39acb93bcf60f448942a20-staging.tar.gz 9562227 BLAKE2B 7cb461cd96978c86e0c05191c1148e1eca638518ae328229b1564011af3bdfeef29607b798aed4ccac055d222fee61ef767c63f75181879f066624669c3d0f4c SHA512 097edad4cc00d411a1e1c8ef7e6ef207101baf30f1648df40d24bc96d5cf276a61f39c82779a74debebe52d986facf74a8c04f9c76cb73841b96b5a667d03f36 DIST wine-osu-9.21-60ddc9613b0a48b20fd1180409bea849f02961ef.tar.gz 51802979 BLAKE2B 954806c889129ef8b31f7e83b2190768f20a71a76903e1f24d20ec6b43e6fad63d2fbd2460a7c6be208dd775a241646b01e6d1dee1bc42011f10fc84cd541789 SHA512 a76507e4e11b5f359477bed6e8e7147135b232c97460b5c81760a4496108c332997536bb83a286b9f53cbb7fc28a37cde65bfae1885ad021721d524157371b6f DIST wine-osu-9.22-51ccd95c49c2c61ad41960b25a01f834601d70c0.tar.gz 51862026 BLAKE2B 9f6be839e86a74870fdb7dcb64855b3fea18b0fe10e570440f52a05cf0716033e68f84666dcb7e8d5af62e7da22062eab4d2beee62540a9dbac6d9d5dd4e8674 SHA512 73bbb86d6590bac066e2b7689e5ea61754232bb3fcc8efa2c1ab3dd5fe94f55b9e7152cbb7b54bf37b28b033720fc3157c554c6e49291202e70f8d532076ee5a diff --git a/app-emulation/wine-osu/wine-osu-10.0-r3.ebuild b/app-emulation/wine-osu/wine-osu-10.0-r3.ebuild index 6375f3d..2682081 100644 --- a/app-emulation/wine-osu/wine-osu-10.0-r3.ebuild +++ b/app-emulation/wine-osu/wine-osu-10.0-r3.ebuild @@ -238,7 +238,7 @@ src_prepare() { --all --no-autoconf # No need esync fsync for using proton fsync instead - -W eventfd_synchronization + -W eventfd_synchronization -W wined3d-unset-flip-gdi ${MY_WINE_STAGING_CONF} ) @@ -387,7 +387,7 @@ src_configure() { local _CROSS_FLAGS="${_common_cflags} ${CPPFLAGS}" local _CROSS_LD_FLAGS="${_CROSS_FLAGS} -Wl,-O3,--sort-common,--as-needed,--file-alignment=4096" - + # broken with gcc-15's c23 default (TODO: try w/o occasionally, bug #943849) append-cflags -std=gnu17 @@ -518,4 +518,3 @@ pkg_postinst() { pkg_postrm() { eselect wine update --if-unset || die } - diff --git a/app-emulation/wine-osu/wine-osu-10.0-r4.ebuild b/app-emulation/wine-osu/wine-osu-10.0-r4.ebuild new file mode 100644 index 0000000..3f8edac --- /dev/null +++ b/app-emulation/wine-osu/wine-osu-10.0-r4.ebuild @@ -0,0 +1,519 @@ +# Copyright 2022-2024 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +MULTILIB_COMPAT=(abi_x86_{32,64}) +PYTHON_COMPAT=(python3_{10..13}) +inherit autotools edo flag-o-matic multilib multilib-build optfeature +inherit prefix python-any-r1 toolchain-funcs wrapper + +WINE_GECKO=2.47.4 +WINE_MONO=9.4.0 +_PV=${PV/_/-} +WINE_P=wine-${_PV} +_P=wine-staging-${PV} +STAGING_COMMIT="c2de76b8048c67aa33c57cff60f98ba1b1675e72" +WINE_COMMIT="e713c3487f9fc9b7ded528f9ce49844facb99a90" +OSU_PATCHES_TAGS="12-25-2024-e713c348-f10d2d04" + +if [[ ${PV} == *9999 ]]; then + inherit git-r3 + EGIT_REPO_URI="https://gitlab.winehq.org/wine/wine-staging.git" + WINE_EGIT_REPO_URI="https://gitlab.winehq.org/wine/wine.git" +else + (($(ver_cut 2))) && WINE_SDIR=$(ver_cut 1).x || WINE_SDIR=$(ver_cut 1).0 + SRC_URI=" + https://github.com/wine-mirror/wine/archive/${WINE_COMMIT}.tar.gz -> ${P}-${WINE_COMMIT}.tar.gz + https://github.com/wine-staging/wine-staging/archive/${STAGING_COMMIT}.tar.gz -> ${P}-${STAGING_COMMIT}-staging.tar.gz + https://github.com/whrvt/wine-osu-patches/archive/refs/tags/${OSU_PATCHES_TAGS}.tar.gz -> ${OSU_PATCHES_TAGS}-patch.tar.gz" + KEYWORDS="-* ~amd64 ~x86" +fi + +DESCRIPTION="Free implementation of Windows(tm) on Unix, with Wine-Staging patchset" +HOMEPAGE=" + https://wiki.winehq.org/Wine-Staging + https://gitlab.winehq.org/wine/wine-staging/ +" + +S="${WORKDIR}/${WINE_P}" + +LICENSE="LGPL-2.1+ BSD BSD-2 IJG MIT OPENLDAP ZLIB gsm libpng2 libtiff" +SLOT="${PV}" +IUSE=" + +X +abi_x86_32 +abi_x86_64 +alsa capi crossdev-mingw cups dos + llvm-libunwind custom-cflags ffmpeg +fontconfig +gecko gphoto2 + +gstreamer kerberos +mingw +mono netapi nls odbc opencl +opengl + osmesa pcap perl pulseaudio samba scanner +sdl selinux smartcard + +ssl +strip +truetype udev udisks +unwind usb v4l +vulkan wayland + wow64 +xcomposite xinerama +" +# bug #551124 for truetype +# TODO: wow64 can be done without mingw if using clang (needs bug #912237) +REQUIRED_USE=" + X? ( truetype ) + crossdev-mingw? ( mingw ) + wow64? ( abi_x86_64 !abi_x86_32 mingw ) +" + +# tests are non-trivial to run, can hang easily, don't play well with +# sandbox, and several need real opengl/vulkan or network access +RESTRICT="test" + +# `grep WINE_CHECK_SONAME configure.ac` + if not directly linked +WINE_DLOPEN_DEPEND=" + X? ( + x11-libs/libXcursor[${MULTILIB_USEDEP}] + x11-libs/libXfixes[${MULTILIB_USEDEP}] + x11-libs/libXi[${MULTILIB_USEDEP}] + x11-libs/libXrandr[${MULTILIB_USEDEP}] + x11-libs/libXrender[${MULTILIB_USEDEP}] + x11-libs/libXxf86vm[${MULTILIB_USEDEP}] + opengl? ( + media-libs/libglvnd[X,${MULTILIB_USEDEP}] + osmesa? ( media-libs/mesa[osmesa,${MULTILIB_USEDEP}] ) + ) + xcomposite? ( x11-libs/libXcomposite[${MULTILIB_USEDEP}] ) + xinerama? ( x11-libs/libXinerama[${MULTILIB_USEDEP}] ) + ) + cups? ( net-print/cups[${MULTILIB_USEDEP}] ) + fontconfig? ( media-libs/fontconfig[${MULTILIB_USEDEP}] ) + kerberos? ( virtual/krb5[${MULTILIB_USEDEP}] ) + netapi? ( net-fs/samba[${MULTILIB_USEDEP}] ) + odbc? ( dev-db/unixODBC[${MULTILIB_USEDEP}] ) + sdl? ( media-libs/libsdl2[haptic,joystick,${MULTILIB_USEDEP}] ) + ssl? ( net-libs/gnutls:=[${MULTILIB_USEDEP}] ) + truetype? ( media-libs/freetype[${MULTILIB_USEDEP}] ) + udisks? ( sys-apps/dbus[${MULTILIB_USEDEP}] ) + v4l? ( media-libs/libv4l[${MULTILIB_USEDEP}] ) + vulkan? ( media-libs/vulkan-loader[X?,wayland?,${MULTILIB_USEDEP}] ) +" +WINE_COMMON_DEPEND=" + ${WINE_DLOPEN_DEPEND} + X? ( + x11-libs/libX11[${MULTILIB_USEDEP}] + x11-libs/libXext[${MULTILIB_USEDEP}] + ) + alsa? ( media-libs/alsa-lib[${MULTILIB_USEDEP}] ) + capi? ( net-libs/libcapi:=[${MULTILIB_USEDEP}] ) + ffmpeg? ( media-video/ffmpeg:=[${MULTILIB_USEDEP}] ) + gphoto2? ( media-libs/libgphoto2:=[${MULTILIB_USEDEP}] ) + gstreamer? ( + dev-libs/glib:2[${MULTILIB_USEDEP}] + media-libs/gst-plugins-base:1.0[${MULTILIB_USEDEP}] + media-libs/gstreamer:1.0[${MULTILIB_USEDEP}] + ) + opencl? ( virtual/opencl[${MULTILIB_USEDEP}] ) + pcap? ( net-libs/libpcap[${MULTILIB_USEDEP}] ) + pulseaudio? ( media-libs/libpulse[${MULTILIB_USEDEP}] ) + scanner? ( media-gfx/sane-backends[${MULTILIB_USEDEP}] ) + smartcard? ( sys-apps/pcsc-lite[${MULTILIB_USEDEP}] ) + udev? ( virtual/libudev:=[${MULTILIB_USEDEP}] ) + unwind? ( + llvm-libunwind? ( sys-libs/llvm-libunwind[${MULTILIB_USEDEP}] ) + !llvm-libunwind? ( sys-libs/libunwind:=[${MULTILIB_USEDEP}] ) + ) + usb? ( dev-libs/libusb:1[${MULTILIB_USEDEP}] ) + wayland? ( + dev-libs/wayland[${MULTILIB_USEDEP}] + x11-libs/libxkbcommon[${MULTILIB_USEDEP}] + ) +" +RDEPEND=" + ${WINE_COMMON_DEPEND} + app-emulation/wine-desktop-common + dos? ( + || ( + games-emulation/dosbox + games-emulation/dosbox-staging + ) + ) + gecko? ( + app-emulation/wine-gecko:${WINE_GECKO}[${MULTILIB_USEDEP}] + wow64? ( app-emulation/wine-gecko[abi_x86_32] ) + ) + gstreamer? ( media-plugins/gst-plugins-meta:1.0[${MULTILIB_USEDEP}] ) + mono? ( app-emulation/wine-mono:${WINE_MONO} ) + perl? ( + dev-lang/perl + dev-perl/XML-LibXML + ) + samba? ( net-fs/samba[winbind] ) + selinux? ( sec-policy/selinux-wine ) + udisks? ( sys-fs/udisks:2 ) +" +DEPEND=" + ${WINE_COMMON_DEPEND} + sys-kernel/linux-headers + X? ( x11-base/xorg-proto ) +" +# gitapply.sh "can" work without git but that is hardly tested +# and known failing with some versions, so force real git +BDEPEND=" + ${PYTHON_DEPS} + || ( + sys-devel/binutils + sys-devel/lld + ) + dev-lang/perl + dev-vcs/git + sys-devel/bison + sys-devel/flex + virtual/pkgconfig + mingw? ( !crossdev-mingw? ( + >=dev-util/mingw64-toolchain-10.0.0_p1-r2[${MULTILIB_USEDEP}] + wow64? ( dev-util/mingw64-toolchain[abi_x86_32] ) + ) ) + nls? ( sys-devel/gettext ) + wayland? ( dev-util/wayland-scanner ) +" +IDEPEND=">=app-eselect/eselect-wine-2" + +QA_CONFIG_IMPL_DECL_SKIP=( + __clear_cache # unused on amd64+x86 (bug #900334) + res_getservers # false positive +) +QA_TEXTRELS="usr/lib/*/wine/i386-unix/*.so" # uses -fno-PIC -Wl,-z,notext + +PATCHES=( + "${FILESDIR}"/${PN}-7.17-noexecstack.patch + "${FILESDIR}"/${PN}-7.20-unwind.patch + "${FILESDIR}"/${PN}-8.13-rpath.patch + "${FILESDIR}/lto-fixup.patch" +) + +pkg_pretend() { + [[ ${MERGE_TYPE} == binary ]] && return + + if use crossdev-mingw && [[ ! -v MINGW_BYPASS ]]; then + local mingw=-w64-mingw32 + for mingw in $(usev abi_x86_64 x86_64${mingw}) \ + $(use abi_x86_32 || use wow64 && echo i686${mingw}); do + if ! type -P ${mingw}-gcc >/dev/null; then + eerror "With USE=crossdev-mingw, you must prepare the MinGW toolchain" + eerror "yourself by installing sys-devel/crossdev then running:" + eerror + eerror " crossdev --target ${mingw}" + eerror + eerror "For more information, please see: https://wiki.gentoo.org/wiki/Mingw" + die "USE=crossdev-mingw is enabled, but ${mingw}-gcc was not found" + fi + done + fi +} + +src_unpack() { + if [[ ${PV} == *9999 ]]; then + EGIT_CHECKOUT_DIR=${WORKDIR}/${P} + git-r3_src_unpack + + # hack: use subshell to preserve state (including what git-r3 unpack + # sets) for smart-live-rebuild as this is not the repo to look at + ( + EGIT_COMMIT=$(<"${EGIT_CHECKOUT_DIR}"/staging/upstream-commit) || die + EGIT_REPO_URI=${WINE_EGIT_REPO_URI} + EGIT_CHECKOUT_DIR=${S} + einfo "Fetching Wine commit matching the current patchset by default (${EGIT_COMMIT})" + git-r3_src_unpack + ) + else + default + fi + + # Currently don't have a better solution on this + mkdir ${WORKDIR}/${WINE_P} || die + mv ${WORKDIR}/wine-${WINE_COMMIT}/* ${WORKDIR}/${WINE_P} || die + mkdir ${WORKDIR}/${_P} || die + mv ${WORKDIR}/wine-staging-${STAGING_COMMIT}/* ${WORKDIR}/${_P} || die + + mkdir ${WORKDIR}/patch || die + + for dir in ./wine-osu-patches-${OSU_PATCHES_TAGS}/**; do + mv "$dir" ${WORKDIR}/patch/. || die + done +} + +src_prepare() { + local patchinstallargs=( + --all + --no-autoconf + # No need esync fsync for using proton fsync instead + -W eventfd_synchronization + ${MY_WINE_STAGING_CONF} + ) + + edo "${PYTHON}" ../${_P}/staging/patchinstall.py "${patchinstallargs[@]}" &>>"${WORKDIR}"/patchlog.txt + + # sanity check, bumping these has a history of oversights + local geckomono=$(sed -En '/^#define (GECKO|MONO)_VER/{s/[^0-9.]//gp}' \ + dlls/appwiz.cpl/addons.c || die) + if [[ ${WINE_GECKO}$'\n'${WINE_MONO} != "${geckomono}" ]]; then + local gmfatal= + [[ ${PV} == *9999 ]] && gmfatal=nonfatal + ${gmfatal} die -n "gecko/mono mismatch in ebuild, has: " ${geckomono} " (please file a bug)" + fi + + default + + if tc-is-clang; then + if use mingw; then + # -mabi=ms was ignored by > "${WORKDIR}"/patchlog.txt || \ + # patch -Np1 <"${patch}" &>> "${WORKDIR}"/patchlog.txt || \ + # _failure "An error occurred applying ${shortname}, check patchlog.txt for info." || die + eapply --ignore-whitespace -Np1 "$patch" + done + + # ensure .desktop calls this variant + slot + sed -i "/^Exec=/s/wine /${P} /" loader/wine.desktop || die + + # datadir is not where wine-mono is installed, so prefixy alternate paths + hprefixify -w /get_mono_path/ dlls/mscoree/metahost.c + + # always update for patches (including user's wrt #432348) + eautoreconf + tools/make_requests || die # perl + if [ -e tools/make_specfiles ]; then + tools/make_specfiles || die # perl + fi + # tip: if need more for user patches, with portage can e.g. do + # echo "post_src_prepare() { tools/make_specfiles || die; }" \ + # > /etc/portage/env/app-emulation/wine-staging +} + +src_configure() { + WINE_PREFIX=/usr/lib/${P} + WINE_DATADIR=/usr/share/${P} + + local conf=( + --prefix="${EPREFIX}"${WINE_PREFIX} + --datadir="${EPREFIX}"${WINE_DATADIR} + --includedir="${EPREFIX}"/usr/include/${P} + --libdir="${EPREFIX}"${WINE_PREFIX} + --mandir="${EPREFIX}"${WINE_DATADIR}/man + + $(usev wow64 --enable-archs=x86_64,i386) + + $(use_enable gecko mshtml) + $(use_enable mono mscoree) + --disable-tests + + $(use_with X x) + $(use_with alsa) + $(use_with capi) + $(use_with cups) + $(use_with ffmpeg) + $(use_with fontconfig) + $(use_with gphoto2 gphoto) + $(use_with gstreamer) + $(use_with kerberos gssapi) + $(use_with kerberos krb5) + $(use_with mingw) + $(use_with netapi) + $(use_with nls gettext) + $(use_with opencl) + $(use_with opengl) + $(use_with osmesa) + --without-oss # media-sound/oss is not packaged (OSSv4) + $(use_with pcap) + $(use_with pulseaudio pulse) + $(use_with scanner sane) + $(use_with sdl) + $(use_with smartcard pcsclite) + $(use_with ssl gnutls) + $(use_with truetype freetype) + $(use_with udev) + $(use_with udisks dbus) # dbus is only used for udisks + $(use_with unwind) + $(use_with usb) + $(use_with v4l v4l2) + $(use_with vulkan) + $(use_with wayland) + $(use_with xcomposite) + $(use_with xinerama) + $(usev !odbc ac_cv_lib_soname_odbc=) + ) + + # filter-lto # build failure + # filter-flags -Wl,--gc-sections # runtime issues (bug #931329) + # use custom-cflags || strip-flags # can break in obscure ways at runtime + + # broken with gcc-15's c23 default (TODO: try w/o occasionally, bug #943849) + # append-cflags -std=gnu17 + + # wine uses linker tricks unlikely to work with non-bfd/lld (bug #867097) + # (do self test until https://github.com/gentoo/gentoo/pull/28355) + # if [[ $(LC_ALL=C $(tc-getCC) ${LDFLAGS} -Wl,--version 2>/dev/null) != @(LLD|GNU\ ld)* ]]; then + # has_version -b sys-devel/binutils && + # append-ldflags -fuse-ld=bfd || + # append-ldflags -fuse-ld=lld + # strip-unsupported-flags + # fi + + if use mingw; then + use crossdev-mingw || PATH=${BROOT}/usr/lib/mingw64-toolchain/bin:${PATH} + + # CROSSCC was formerly recognized by wine, thus been using similar + # variables (subject to change, esp. if ever make a mingw.eclass). + local mingwcc_amd64=${CROSSCC:-${CROSSCC_amd64:-x86_64-w64-mingw32-gcc}} + local mingwcc_x86=${CROSSCC:-${CROSSCC_x86:-i686-w64-mingw32-gcc}} + local -n mingwcc=mingwcc_$(usex abi_x86_64 amd64 x86) + + # # From https://aur.archlinux.org/cgit/aur.git/tree/PKGBUILD?h=wine-osu-spectator-wow64 + local _common_cflags="-pipe -O3 -march=native -fomit-frame-pointer -fwrapv -fno-strict-aliasing -mfpmath=sse -Wno-error=incompatible-pointer-types -Wno-error=implicit-function-declaration -w" + local _native_common_cflags="-fuse-linker-plugin -fdevirtualize-at-ltrans -flto-partition=one -flto=auto -Wl,-flto=auto -ffunction-sections -fdata-sections" + local _extra_native_flags="-floop-nest-optimize -fgraphite-identity -floop-strip-mine" # graphite opts + local _lto_error_flags="-Werror=odr -Werror=lto-type-mismatch -Werror=strict-aliasing" + export CPPFLAGS="-U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=0 -DNDEBUG -D_NDEBUG" + local _GCC_FLAGS="${_common_cflags} ${_native_common_cflags} ${_extra_native_flags} ${_lto_error_flags} ${CPPFLAGS}" + local _LD_FLAGS="${_GCC_FLAGS} -Wl,-O3,--sort-common,--as-needed -static-libgcc" + + local _CROSS_FLAGS="${_common_cflags} ${CPPFLAGS}" + local _CROSS_LD_FLAGS="${_CROSS_FLAGS} -Wl,-O3,--sort-common,--as-needed,--file-alignment=4096" + + # broken with gcc-15's c23 default (TODO: try w/o occasionally, bug #943849) + append-cflags -std=gnu17 + + conf+=( + ac_cv_prog_x86_64_CC="ccache ${mingwcc_amd64}" + ac_cv_prog_i386_CC="ccache ${mingwcc_x86}" + + CPPFLAGS="${CPPFLAGS}" + CFLAGS="${_GCC_FLAGS}" + CXXFLAGS="${_GCC_FLAGS}" + CROSSCFLAGS="${_CROSS_FLAGS}" + CROSSCXXFLAGS="${_CROSS_FLAGS}" + LDFLAGS="${_LD_FLAGS}" + CROSSLDFLAGS="${_CROSS_LD_FLAGS}" + ) + fi + + # order matters with multilib: configure+compile 64->32, install 32->64 + local -i bits + for bits in $(usev abi_x86_64 64) $(usev abi_x86_32 32); do + ( + einfo "Configuring ${PN} for ${bits}bits in ${WORKDIR}/build${bits} ..." + + mkdir ../build${bits} || die + cd ../build${bits} || die + + if ((bits == 64)); then + conf+=(--enable-win64) + elif use amd64; then + conf+=( + $(usev abi_x86_64 --with-wine64=../build64) + TARGETFLAGS=-m32 # for widl + ) + # _setup is optional, but use over Wine's auto-detect (+#472038) + multilib_toolchain_setup x86 + fi + + ECONF_SOURCE=${S} econf "${conf[@]}" + ) + done +} + +src_compile() { + use abi_x86_64 && emake -C ../build64 # do first + use abi_x86_32 && emake -C ../build32 +} + +src_install() { + use abi_x86_32 && emake DESTDIR="${D}" -C ../build32 install + use abi_x86_64 && emake DESTDIR="${D}" -C ../build64 install # do last + + # Ensure both wine64 and wine are available if USE=abi_x86_64 (wow64, + # -abi_x86_32, and/or EXTRA_ECONF could cause varying scenarios where + # one or the other could be missing and that is unexpected for users + # and some tools like winetricks) + if use abi_x86_64; then + if [[ -e ${ED}${WINE_PREFIX}/bin/wine64 && ! -e ${ED}${WINE_PREFIX}/bin/wine ]]; then + dosym wine64 ${WINE_PREFIX}/bin/wine + dosym wine64-preloader ${WINE_PREFIX}/bin/wine-preloader + + # also install wine(1) man pages (incl. translations) + local man + for man in ../build64/loader/wine.*man; do + : "${man##*/wine}" + : "${_%.*}" + insinto ${WINE_DATADIR}/man/${_:+${_#.}/}man1 + newins ${man} wine.1 + done + elif [[ ! -e ${ED}${WINE_PREFIX}/bin/wine64 && -e ${ED}${WINE_PREFIX}/bin/wine ]]; then + dosym wine ${WINE_PREFIX}/bin/wine64 + dosym wine-preloader ${WINE_PREFIX}/bin/wine64-preloader + fi + fi + + use perl || rm "${ED}"${WINE_DATADIR}/man/man1/wine{dump,maker}.1 \ + "${ED}"${WINE_PREFIX}/bin/{function_grep.pl,wine{dump,maker}} || die + + # create variant wrappers for eselect-wine + local bin + for bin in "${ED}"${WINE_PREFIX}/bin/*; do + make_wrapper "${bin##*/}-${P#wine-}" "${bin#"${ED}"}" + done + + if use mingw; then + # don't let portage try to strip PE files with the wrong + # strip executable and instead handle it here (saves ~120MB) + dostrip -x ${WINE_PREFIX}/wine/{i386,x86_64}-windows + + if use strip; then + ebegin "Stripping Windows (PE) binaries" + find "${ED}"${WINE_PREFIX}/wine/*-windows -regex '.*\.\(a\|dll\|exe\)' \ + -exec $(usex abi_x86_64 x86_64 i686)-w64-mingw32-strip --strip-unneeded {} + + eend ${?} || die + fi + fi + + dodoc ANNOUNCE* AUTHORS README* documentation/README* +} + +pkg_postinst() { + if use !abi_x86_32 && use !wow64; then + ewarn "32bit support is disabled. While 64bit applications themselves will" + ewarn "work, be warned that it is not unusual that installers or other helpers" + ewarn "will attempt to use 32bit and fail. If do not want full USE=abi_x86_32," + ewarn "note the experimental/WIP USE=wow64 can allow 32bit without multilib." + elif use abi_x86_32 && { use opengl || use vulkan; }; then + # difficult to tell what is needed from here, but try to warn + if has_version 'x11-drivers/nvidia-drivers'; then + if has_version 'x11-drivers/nvidia-drivers[-abi_x86_32]'; then + ewarn "x11-drivers/nvidia-drivers is installed but is built without" + ewarn "USE=abi_x86_32 (ABI_X86=32), hardware acceleration with 32bit" + ewarn "applications under ${PN} will likely not be usable." + ewarn "Multi-card setups may need this on media-libs/mesa as well." + fi + elif has_version 'media-libs/mesa[-abi_x86_32]'; then + ewarn "media-libs/mesa seems to be in use but is built without" + ewarn "USE=abi_x86_32 (ABI_X86=32), hardware acceleration with 32bit" + ewarn "applications under ${PN} will likely not be usable." + fi + fi + + optfeature "/dev/hidraw* access used for *some* controllers (e.g. DualShock4)" \ + games-util/game-device-udev-rules + + eselect wine update --if-unset || die +} + +pkg_postrm() { + eselect wine update --if-unset || die +}