The sys-devel/crossdev package allows for some compiliation of Windows software from a Linux platform. Yes, very cool. At Edoceo we mostly use it for building dev-util/nsis scripts to make Windows installers. NSIS is also necessary for building the Evergreen Client Installer.

Installing Crossdev

This is easy, crossdev is a small and simple package.

~ # emerge -av crossdev
[ebuild  N     ] sys-devel/crossdev-20120305  21 kB

Configuring Crossdev

Once crossdev is installed we have to prepare our system before we can use it to switch to mingw32. If you have existing configurations is /etc/portage you may want to archive (or git-ify) those.

Specifically you'll want to make sure that there are no existing package.* files in there. Crossdev will create directories to contain the data, it's quite an elegant solution. For example, ours now looks like:

drwxr-xr-x 12 atom edoceo 4.0K Jul 18 17:52 .
drwxr-xr-x 69 root root   4.0K Jul 18 17:49 ..
drwxr-xr-x  2 root root   4.0K Jun 11 19:30 bin
-rw-r--r--  1 root root     25 Jul 18 17:51 categories
drwxr-xr-x  3 root root   4.0K Jul 18 17:52 env
drwxr-xr-x  2 root root   4.0K Jul 18 17:52 package.env
drwxr-xr-x  2 root root   4.0K Jul 18 17:52 package.keywords
-rw-r--r--  1 root root      0 Jun  1 21:28 package.license
drwxr-xr-x  2 root root   4.0K Jul 18 17:51 package.mask
drwxr-xr-x  2 root root   4.0K Jul 18 17:52 package.use
drwxr-xr-x  2 root root   4.0K Jun 11 19:30 postsync.d
drwxr-xr-x  4 root root   4.0K Jul 18 17:52 profile
drwxr-xr-x  3 root root   4.0K Jun 10  2009 savedconfig
drwxrwsr-x  2 root root   4.0K Jun 10  2009 sets

When that is ready, simply switch and wait a while, this build can take some time.

~ # crossdev --ov-output /usr/local/portage mingw32

 * crossdev version:      20120305
 * Host Portage ARCH:     amd64
 * Target Portage ARCH:   *
 * Target System:         mingw32
 * Stage:                 4 (C/C++ compiler)
 * ABIs:                  default

 * binutils:              binutils-[latest]
 * gcc:                   gcc-[latest]
 * headers:               w32api-[latest]
 * libc:                  mingw-runtime-[latest]

 * CROSSDEV_OVERLAY:      /usr/local/portage
 * PORT_LOGDIR:           /var/log/portage
 * PORTAGE_CONFIGROOT:    

Building NSIS

Once all the crossdev and MinGW tools are in place building NSIS is a breeze. Now you can complie Windows Installers from your Linux systems.


~ # emerge -av dev-util/nsis
[ebuild  N     ] dev-util/scons-2.1.0  USE="-doc" 562 kB
[ebuild  N     ] dev-util/nsis-2.46  USE="bzip2 -config-log -doc zlib" 1,464 kB

See Also