The wiki page for emulators/i386-wine{-devel}, the port for delivering a 32-bit Wine (for running 32-bit Microsoft Windows applications) capable of installing and running under FreeBSD/amd64.

This port can only be built in an i386 environment as the FreeBSD Port's Collection does not support cross compiling.

Packages

Packages for i386-wine{-devel} are provided for all supported FreeBSD releases and FreeBSD-current via the normal FreeBSD Ports repository.

You do need a system installed with lib32 libraries. If unsure, test if /libexec/ld-elf32.so.1 is present on your system. If not you can fetch the set "lib32.txz" from the FreeBSD FTP Archives and install it the following way (for example, on an amd64 installation of 10.3-RELEASE):

# fetch -arRo /tmp/ https://download.freebsd.org/ftp/releases/amd64/10.3-RELEASE/lib32.txz
# tar -xpf /tmp/lib32.txz -C /

To install wine do one of the following:

# pkg install i386-wine

for the stable version of wine, or

# pkg install i386-wine-devel

for the development version of wine.

Alternatively you can install directly from the Ports Collection under emulators/i386-wine{-devel} however both approaches uses the same precompiled binaries. For example:

# cd /usr/ports/emulators/i386-wine-devel
# make install

To update the installed wine:

# pkg upgrade

Binary Image Activation

The FreeBSD kernel can be configured to detect a Microsoft Windows binary and to automatically launch Wine to run the Windows binary. This allows one to treat Windows binaries like normal binaries (i.e. no need to call wine foo.exe).

As root do:

# binmiscctl add wine32 --interpreter /usr/local/bin32/wine \
    --magic "\x4d\x5a\x90\x00\x03\x00\x00\x00\x04\x00\x00\x00\xff\xff\x00\x00\xb8\x00\x00\x00" \
    --mask "\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff" \
    --size 20 --set-enabled

Building

Manual

To build the i386-Wine port an i386 environment is required. If such an environment is not available then it can be created from FreeBSD/amd64:

# cd /usr/src
# make buildworld TARGET=i386
# make installworld TARGET=i386 DESTDIR=/compat/i386
# make distribution TARGET=i386 DESTDIR=/compat/i386
# ln /etc/resolv.conf /compat/i386/etc
# mkdir /compat/i386/usr/ports
# mount -t devfs devfs /compat/i386/dev
# mount -t nullfs /usr/ports /compat/i386/usr/ports

When chrooting to /compat/i386 do these additional setups:

# chroot /compat/i386
# setenv MACHINE i386
# setenv UNAME_m i386
# setenv UNAME_p i386
# service ldconfig start

Lastly, the package can be created:

# cd /usr/ports/emulators/i386-wine-devel
# make package -DWINE_CROSS_BUILD

The package created had an architecture label of, for example freebsd:11:x86:32, and will not install in a 64-bit environment unless you use pkg add -f. The package is available at:

# echo /compat/i386/$(make -V PKGFILE)

Poudriere

Poudriere can be used to compile i386-wine by doing the following (using FreeBSD 10.1 as an example):

# pkg install poudriere
# poudriere ports -c 
# poudriere jail -c -j wine-build -a i386 -v 10.3-RELEASE
# echo "WINE_CROSS_BUILD=yes" >> /usr/local/etc/poudriere.d/make.conf
# poudriere bulk -j wine-build emulators/i386-wine

The package is available at

# echo /usr/local/poudriere/data/packages/wine-build-default/All/$(make -C /usr/ports/emulators/i386-wine -V PKGNAME ARCH=i386).txz

and can be installed using

# pkg install -f /usr/local/poudriere/data/packages/wine-build-default/All/$(make -C /usr/ports/emulators/i386-wine -V KGNAME ARCH=i386).txz

TODO

i386-Wine (last edited 2020-04-21T11:33:29+0000 by ChrisRees)