On Sun, Jan 25, 2026 at 07:13:19PM -0500, Ionen Wolkens wrote:
> On Sun, Jan 25, 2026 at 11:05:32PM +0000, Sam James wrote:
> > James Le Cuirot <[email protected]> writes:
> > 
> > > We do not support installing Wine for other architectures, so we assume
> > > that Wine can do its own CPU emulation.
> > 
> > This has been on my mind for a while as something I'd love to try :)
> > 
> > >
> > > The sandbox cannot handle Wine and emits a warning even if you allow all
> > > writes, so it needs to be disabled.
> > >
> > > Unlike Linux shared libraries, Windows DLLs are placed in bin rather
> > > than lib, so we need to include that in WINEPATH. lib has been included
> > > too, just in case.
> > >
> > > binfmt_misc supports Windows binaries, but there is no point in
> > > supporting that combination here, as Wine would need to be installed
> > > locally regardless. This cannot be extended into a container like it can
> > > with QEMU.
> > 
> > "locally" here means inside the sysroot?
> > 
> > >
> > > This has been tested with i686-w64-mingw32 from crossdev against
> > > dev-vcs/git[iconv] after dropping the iconv cross patch.
> > >
> > > Signed-off-by: James Le Cuirot <[email protected]>
> > > ---
> > 
> > Looks ok but see if wine maintainers have input.
> 
> Can't think of much to say (without testing), but sounds ok at a
> glance.
> 
> > 
> > >  eclass/sysroot.eclass | 13 ++++++++++++-
> > >  1 file changed, 12 insertions(+), 1 deletion(-)
> > >
> > > diff --git a/eclass/sysroot.eclass b/eclass/sysroot.eclass
> > > index 0fae642bf593c..dbb0103f6e0e4 100644
> > > --- a/eclass/sysroot.eclass
> > > +++ b/eclass/sysroot.eclass
> > > @@ -80,7 +80,18 @@ sysroot_make_run_prefixed() {
> > >           fi
> > >   fi
> > >  
> > > - if [[ ${QEMU_ARCH} == $(qemu_arch "${CBUILD}") ]]; then
> > > + if [[ ${CHOST} = *-mingw32 ]]; then
> > > +         if ! type -P wine >/dev/null; then
> > > +                 einfo "Wine not found. Continuing without ${SCRIPT##*/} 
> > > wrapper."
> > > +                 return 1
> > > +         fi
> > > +
> > > +         # Assume that Wine can do its own CPU emulation.
> > > +         install -m0755 /dev/stdin "${SCRIPT}" <<-EOF || die
> > 
> > Does - not work instead of /dev/stdin?
> > 
> > > +                 #!/bin/sh
> > > +                 SANDBOX_ON=0 LD_PRELOAD= 
> > > WINEPATH="\${WINEPATH}\${WINEPATH+;}${MYEROOT}/bin;${MYEROOT}/usr/bin;${MYEROOT}/$(get_libdir);${MYEROOT}/usr/$(get_libdir)"
> > >  exec wine "\${@}"
> > 
> > Ah, Wine delimits with ;?
> 
> Yes, because this is supposed to contain C:\ and such, not /usr.
> 
> WINEPATH
>   Specifies additional path(s) to be prepended to the default Windows
>   PATH environment variable. This is a list of Windows-style
>   directories separated by ";".
> 
> I think wine itself is able to make sense of it in this context, but
> maybe it will fail if a Windows executable (not wine) itself
> searches for another executable by using %PATH%? Not that I'm familiar
> with how windows searches for things.
> 
> Aka it is used as-is:
> 
> $ WINEPATH=/usr/bin wine cmd
> echo %PATH%
> /usr/bin;C:\windows\system32;C:\windows;C:\windows\system32\wbem;C:\windows\system32\WindowsPowershell\v1.0
> 
> $ WINEPATH=$(winepath -w /usr/bin) wine cmd
> echo %PATH%
> Z:\usr\bin;C:\windows\system32;C:\windows;C:\windows\system32\wbem;C:\windows\system32\WindowsPowershell\v1.0
> 
> If actually need to convert, multiple paths can be passed at once to
> winepath -w and output will be split by newlines (should be safer
> than trying to convert this manually).

Interesting. I thought what I had was good enough because the git[iconv] test
couldn't find libiconv-2.dll until I set up WINEPATH. Having the correct %PATH%
seems important too though. I'll probably adjust this before merging then.

> 
> > 
> > > +         EOF
> > > + elif [[ ${QEMU_ARCH} == $(qemu_arch "${CBUILD}") ]]; then
> > >           # glibc: ld.so is a symlink, ldd is a binary.
> > >           # musl: ld.so doesn't exist, ldd is a symlink.
> > >           local DLINKER candidate
> 
> 
> 
> -- 
> ionen



Reply via email to