We do not support installing Wine for other architectures, so we assume that Wine can do its own CPU emulation.
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. 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]> --- 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 + #!/bin/sh + SANDBOX_ON=0 LD_PRELOAD= WINEPATH="\${WINEPATH}\${WINEPATH+;}${MYEROOT}/bin;${MYEROOT}/usr/bin;${MYEROOT}/$(get_libdir);${MYEROOT}/usr/$(get_libdir)" exec wine "\${@}" + 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 -- 2.52.0
