From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp.gentoo.org (woodpecker.gentoo.org [140.211.166.183]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id 9387A1584AD for ; Mon, 21 Apr 2025 02:39:05 +0000 (UTC) Received: from lists.gentoo.org (bobolink.gentoo.org [140.211.166.189]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) (Authenticated sender: relay-lists.gentoo.org@gentoo.org) by smtp.gentoo.org (Postfix) with ESMTPSA id 6EDCB342FB1 for ; Mon, 21 Apr 2025 02:39:05 +0000 (UTC) Received: from bobolink.gentoo.org (localhost [127.0.0.1]) by bobolink.gentoo.org (Postfix) with ESMTP id 54ABA1104B1; Mon, 21 Apr 2025 02:39:01 +0000 (UTC) Received: from smtp.gentoo.org (woodpecker.gentoo.org [140.211.166.183]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by bobolink.gentoo.org (Postfix) with ESMTPS id 470181104B1 for ; Mon, 21 Apr 2025 02:39:01 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id DF5AF342FB1 for ; Mon, 21 Apr 2025 02:39:00 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 45D92ADE for ; Mon, 21 Apr 2025 02:38:59 +0000 (UTC) From: "Ionen Wolkens" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Ionen Wolkens" Message-ID: <1745200369.3f72e677e174de7decb9f3e6f1695d093eddf954.ionen@gentoo> Subject: [gentoo-commits] repo/gentoo:master commit in: eclass/ X-VCS-Repository: repo/gentoo X-VCS-Files: eclass/wine.eclass X-VCS-Directories: eclass/ X-VCS-Committer: ionen X-VCS-Committer-Name: Ionen Wolkens X-VCS-Revision: 3f72e677e174de7decb9f3e6f1695d093eddf954 X-VCS-Branch: master Date: Mon, 21 Apr 2025 02:38:59 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Archives-Salt: c11e4da4-a39a-401e-989d-0f828df83261 X-Archives-Hash: 75df38ee954c53c45131dbd89304df24 commit: 3f72e677e174de7decb9f3e6f1695d093eddf954 Author: Ionen Wolkens gentoo org> AuthorDate: Sat Apr 19 05:18:48 2025 +0000 Commit: Ionen Wolkens gentoo org> CommitDate: Mon Apr 21 01:52:49 2025 +0000 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=3f72e677 wine.eclass: new eclass Trying to keep Wine ebuilds in sync between wine-vanilla, wine-staging, and wine-proton which each have several ebuilds been giving headaches, and the addition of arm64 support is not helping. Goal is to offload only the gritty toolchain and slotting bits, and leave ebuilds to deal with normal dependencies and configure options. Could've put these in the eclass too, but it'd likely become messy as dependencies get added/removed between versions (want to avoid too many ${PV} -gt rules). Also want to avoid these to allow overlays to use this to package their own variants with more freedom. Note there is some difference compared to current ebuilds: - arm64 support using https://github.com/gentoo/gentoo/pull/41650 as a guideline (not tested myself, pending keywording) - no support for non-PE builds to simplify and having less to test, wine-proton was already doing this to match what upstream Proton does - ^ may be a bit misleading but if USE=-mingw, will still do PE builds but using clang (less tested, so +mingw remains default), debated USE=clang and dropping USE=mingw instead but that feels confusing for other reasons - drop REQUIRED_USE that prevented USE="wow64 -mingw" - drop workaround that ensured man pages were installed for a pure (non-default) 64bit build (feels not worth it, and no longer needed for >=10.2) - no support for gmail.com> Signed-off-by: Ionen Wolkens gentoo.org> eclass/wine.eclass | 413 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 413 insertions(+) diff --git a/eclass/wine.eclass b/eclass/wine.eclass new file mode 100644 index 000000000000..b82dd469c191 --- /dev/null +++ b/eclass/wine.eclass @@ -0,0 +1,413 @@ +# Copyright 2025 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +# @ECLASS: wine.eclass +# @MAINTAINER: +# Wine +# @AUTHOR: +# Ionen Wolkens +# @SUPPORTED_EAPIS: 8 +# @BLURB: Common functions for app-emuluation/wine-* ebuilds +# @DESCRIPTION: +# Given the large amount of Wine ebuilds (and variants) that need +# duplicated code, this is used to offload the more complex bits +# (primarily toolchain and slotting) and leave ebuilds to only need +# to deal with dependencies and configure options like any other. +# +# Note to overlays: this can be used to package other variants of +# Wine, but there is currently no garantee that eclass changes may +# not break these ebuilds now and then without real warnings + +case ${EAPI} in + 8) ;; + *) die "${ECLASS}: EAPI ${EAPI:-0} not supported" ;; +esac + +if [[ -z ${_WINE_ECLASS} ]]; then +_WINE_ECLASS=1 + +inherit autotools flag-o-matic multilib prefix toolchain-funcs wrapper + +# @ECLASS_VARIABLE: WINE_USEDEP +# @DESCRIPTION: +# Meant be used like multilib-build.eclass' MULTILIB_USEDEP. Handled +# specially here given Wine ebuilds are not *really* multilib and are +# abusing abi_x86_* with some specific requirements. +# +# TODO: when the *new* wow64 mode (aka USE=wow64) is mature enough to +# be preferred over abi_x86_32, this should be removed and support for +# 32bit-only-on-64bit be dropped matching how /no-multilib/ handles it +readonly WINE_USEDEP="abi_x86_32(-)?,abi_x86_64(-)?" + +IUSE=" + +abi_x86_32 +abi_x86_64 crossdev-mingw custom-cflags + +mingw +strip wow64 +" +REQUIRED_USE=" + || ( abi_x86_32 abi_x86_64 arm64 ) + crossdev-mingw? ( mingw ) + wow64? ( abi_x86_64 !abi_x86_32 ) +" + +BDEPEND=" + || ( + sys-devel/binutils:* + llvm-core/lld:* + ) + dev-lang/perl + mingw? ( + !crossdev-mingw? ( + dev-util/mingw64-toolchain[${WINE_USEDEP}] + wow64? ( dev-util/mingw64-toolchain[abi_x86_32] ) + ) + ) + !mingw? ( + llvm-core/clang:*[${WINE_USEDEP}] + strip? ( llvm-core/llvm:* ) + ) +" +IDEPEND=">=app-eselect/eselect-wine-2" + +# @ECLASS_VARIABLE: WINE_SKIP_INSTALL +# @DESCRIPTION: +# Array of files to delete from the installation relative +# to ${ED}, must be set before running wine_src_install. +WINE_SKIP_INSTALL=() + +# @FUNCTION: wine_pkg_pretend +# @DESCRIPTION: +# Verifies if crossdev-mingw is used properly, ignored if +# ``MINGW_BYPASS`` is set. +wine_pkg_pretend() { + [[ ${MERGE_TYPE} == binary ]] && return + + if use crossdev-mingw && [[ ! -v MINGW_BYPASS ]]; then + local arches=( + $(usev abi_x86_64 x86_64) + $(usev abi_x86_32 i686) + $(usev wow64 i686) + $(usev arm64 aarch64) + ) + + local mingw + for mingw in "${arches[@]/%/-w64-mingw32}"; 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 +} + +# @FUNCTION: wine_src_prepare +# @DESCRIPTION: +# Apply various minor adjustments, run eautoreconf, make_requests, and +# perform a version mismatch sanity check if WINE_GECKO and WINE_MONO +# are set. +# +# If need more than make_requests, it should be either handled in +# the ebuild or (for users) optionally through portage hooks, e.g. +# +# @CODE +# echo "post_src_prepare() { tools/make_specfiles || die; }" \ +# > /etc/portage/env/app-emulation/wine-vanilla +# @CODE +wine_src_prepare() { + default + + if [[ ${WINE_GECKO} && ${WINE_MONO} ]]; then + # 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= + has live ${PROPERTIES} && gmfatal=nonfatal + ${gmfatal} die -n "gecko/mono mismatch in ebuild, has: " ${geckomono} " (please file a bug)" + fi + fi + + if tc-is-clang && use mingw; then + # -mabi=ms was ignored by