This tutorial by the folks at WineHQ shows us how to get Wine set up on FreeBSD. Wine is a compatibility layer that allows you to run Windows application on several open source operating systems.




The FreeBSD Ports repository contains up-to-date packages for both Wine’s stable and development releases, not to mention the experimental wine-staging release (currently a separate project from wine, but not really a fork… it’s complicated).

Installing the necessary package is very easy. If you’re on a 32-bit version of FreeBSD, use the pkg install command with one of wine (stable release), wine-devel (development release), or wine-staging (separate experimental release). For example, to install the wine development release:

pkg install wine-devel

If you’re on a 64-bit version of FreeBSD, support for 64-bit Windows apps hasn’t been implemented yet, but you can still run 32-bit Windows apps fine. Instead of the packages listed above, just choose from i386-wine, i386-wine-devel, or i386-wine-staging.

Building Wine

{i} This section is mostly taken from the FreeBSD Wiki’s page on 32-bit Wine

Since FreeBSD doesn’t yet support cross-compiling 32-bit programs from a 64-bit environment, you’ll need to use a chroot. Otherwise, the process shouldn’t be hard at all….

  1. Load the necessary i386 files for a chroot into a folder
  2. Add mount points for necessary directories to the chroot
  3. Enter the chroot, set a few environment variables, and start ldconfig running

  4. Move to your desired version’s build directory and make the package

cd /usr/src
make buildworld TARGET=i386
make installworld TARGET=i386 DESTDIR=/compat/i386
make distribution TARGET=i386 DESTDIR=/compat/i386
mkdir /compat/i386/usr/ports
mount -t devfs devfs /compat/i386/dev
mount -t nullfs /usr/ports /compat/i386/usr/ports
chroot /compat/i386
setenv MACHINE i386
setenv UNAME_m i386
setenv UNAME_p i386
service ldconfig start
cd /usr/ports/emulators/i386-wine-devel
make package

And you’re finished.

(!) If you’re not sure where the built package was saved, while not logged out of the chroot, you can ask with make -V and the PKGFILE environment variable:

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

See Also