commit:     ccf773f720d02c436a47ec81f8669c439971a5c9
Author:     Ionen Wolkens <ionen <AT> gentoo <DOT> org>
AuthorDate: Mon Aug 14 12:17:27 2023 +0000
Commit:     Ionen Wolkens <ionen <AT> gentoo <DOT> org>
CommitDate: Mon Aug 14 16:39:24 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=ccf773f7

app-emulation/wine-vanilla: more solid wine{64,} symlink handling

To ensure potential situations where the wine binary would
be overwritten by a symlink don't happen.

Current layout worked but future changes or EXTRA_ECONF can
make it rather fragile. Only changing in 8.13/9999 given wow64
is what complexified this further.

For the record:
abi_x86_64 -abi_x86_32 -wow64 = wine64-only
abi_x86_64 -abi_x86_32 wow64 = wine-only
-abi_x86_64 abi_x86_32 -wow64 = wine-only
abi_x86_64 abi_x86_32 -wow64 = wine and wine64

Could argue that having "wine64" is not really useful, but lot of
scripts and users still expect it and other distros like Alpine are
making the symlink with wow64 too.

Signed-off-by: Ionen Wolkens <ionen <AT> gentoo.org>

 .../wine-vanilla/wine-vanilla-8.13.ebuild          | 37 ++++++++++++----------
 .../wine-vanilla/wine-vanilla-9999.ebuild          | 37 ++++++++++++----------
 2 files changed, 42 insertions(+), 32 deletions(-)

diff --git a/app-emulation/wine-vanilla/wine-vanilla-8.13.ebuild 
b/app-emulation/wine-vanilla/wine-vanilla-8.13.ebuild
index c6b837670cbb..c23622bc7e06 100644
--- a/app-emulation/wine-vanilla/wine-vanilla-8.13.ebuild
+++ b/app-emulation/wine-vanilla/wine-vanilla-8.13.ebuild
@@ -344,22 +344,27 @@ src_install() {
        use abi_x86_32 && emake DESTDIR="${D}" -C ../build32 install
        use abi_x86_64 && emake DESTDIR="${D}" -C ../build64 install # do last
 
-       if use wow64; then
-               # compat symlinks, albeit ideally no one should call "wine64"
-               dosym wine ${WINE_PREFIX}/bin/wine64
-               dosym wine-preloader ${WINE_PREFIX}/bin/wine64-preloader
-       elif use abi_x86_64 && use !abi_x86_32; then
-               # if no 32bit support it instead only installs "wine64" which 
may
-               # come as unexpected, so provide "wine" alongside its man page
-               dosym wine64 ${WINE_PREFIX}/bin/wine
-               dosym wine64-preloader ${WINE_PREFIX}/bin/wine-preloader
-               local man
-               for man in ../build64/loader/wine.*man; do
-                       : "${man##*/wine}"
-                       : "${_%.*}"
-                       insinto ${WINE_DATADIR}/man/${_:+${_#.}/}man1
-                       newins ${man} wine.1
-               done
+       # 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 \

diff --git a/app-emulation/wine-vanilla/wine-vanilla-9999.ebuild 
b/app-emulation/wine-vanilla/wine-vanilla-9999.ebuild
index c6b837670cbb..c23622bc7e06 100644
--- a/app-emulation/wine-vanilla/wine-vanilla-9999.ebuild
+++ b/app-emulation/wine-vanilla/wine-vanilla-9999.ebuild
@@ -344,22 +344,27 @@ src_install() {
        use abi_x86_32 && emake DESTDIR="${D}" -C ../build32 install
        use abi_x86_64 && emake DESTDIR="${D}" -C ../build64 install # do last
 
-       if use wow64; then
-               # compat symlinks, albeit ideally no one should call "wine64"
-               dosym wine ${WINE_PREFIX}/bin/wine64
-               dosym wine-preloader ${WINE_PREFIX}/bin/wine64-preloader
-       elif use abi_x86_64 && use !abi_x86_32; then
-               # if no 32bit support it instead only installs "wine64" which 
may
-               # come as unexpected, so provide "wine" alongside its man page
-               dosym wine64 ${WINE_PREFIX}/bin/wine
-               dosym wine64-preloader ${WINE_PREFIX}/bin/wine-preloader
-               local man
-               for man in ../build64/loader/wine.*man; do
-                       : "${man##*/wine}"
-                       : "${_%.*}"
-                       insinto ${WINE_DATADIR}/man/${_:+${_#.}/}man1
-                       newins ${man} wine.1
-               done
+       # 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 \

Reply via email to