Skip to content

Creating appimages from Windows applications

Ismael Barros² edited this page Nov 30, 2020 · 5 revisions

Windows applications can be packaged as an AppImage with a minimal wine installation, customized for each specific application. In this case, we'll be packing an OnLive client, located on a subdirectory named OnLive.

Mixing

We'll start off with a directory containing our Windows application. Now we need two things:

  • Some glue scripts
  • A portable Wine installation

Glue scripts

First, we need to initialize a AppDir for the application. We do this using the wine2AppDir script

wine2AppDir <short name> <Application.exe>

For example:

$ wine2AppDir onlive OnLive/OnLive.exe

This will create some basic stuff, like:

  • The main AppRun script, along with a utils.sh support script
  • A AppRun.desktop metadata file
  • A default AppRun.png icon

Portable Wine installation

Then, we need copy a Wine installation. You can download Wine from any of the sources listed here. Personally, I like to use Slackware's packages, available here.

Wine installations are defined by their usr/ directory. For this example I've downloaded the package wine-1.5.26-i486-1sg.txz from here, and unpacked it to ~/path/to/wine-1.5.26-i486-1sg/, so its usr/ directory is in ~/path/to/wine-1.5.26-i486-1sg/usr/.

We can copy that directory right into our AppDir, and the application will probably work flawlessly. However, most of that will be extra weight in our package, so for most applications we'll find interesting to trim down the Wine installation so that it doesn't contain unused libraries, fonts, support files, etc.

wineTrim <Application.exe> <path to Wine installation's usr/>
Options:
  -mode=[strace|lsof] Use either strace or lsof to extract used files
  -winecfg            Run winecfg instead of wine <Application.exe>

It's recommended to use both strace and lsof methods for each application. Each run of wineTrim will just append more files to our minimal Wine installation, so we can run wineTrim many times, testing different execution paths, and our Wine installation will aggregate the files used on all the runs.

In this example, we'll run OnLive/OnLive.exe using a Wine binary package from Slackware, uncompressed on ~/path/to/wine-1.5.26-i486-1sg/usr/

$ wineTrim OnLive/OnLive.exe ~/path/to/wine-1.5.26-i486-1sg/usr/ -mode=strace
$ wineTrim OnLive/OnLive.exe ~/path/to/wine-1.5.26-i486-1sg/usr/ -mode=lsof

Cooking

Once we have our AppDir ready, we can go on building the AppImage with buildAppImage