Running tools in WINE
It is possible is some cases to run a Windows binary via WINE in the hub. This document describes some of the issues involved.
Normally WINE will create a $HOME/.wine directory and install a windows-like file system inside this directory. This doesn't work well for hub tools.
- There is normally only one copy of any version of a tool on the hub. It would be a waste of resources to copy the tool into each user's home directory.
- Tool owners want to make fixes and updates immediately available to users.
- Tool owners do not want users to accidentally overwrite or modify their tools.
- Users don't have time to install each update of the tool.
- Some Windows tools that use .NET can not run when the Windows root drive is network mounted.
Limitations
- Hub tool containers have no sound card or graphics card. If your program does 3D graphics or uses sound, it may not work properly as a hub tool.
- Text may not display properly due to differences in available fonts.
Prerequistes
- A very recent version of WINE. Debian 7 (wheezy) version may be OK.
apt-get install wine apt-get install winetricks
Step 1. Set up WINE
Set the environment variables WINEPREFIX and WINEARCH.
WINEPREFIX=/tmp/<toolname> WINEARCH=win32
WINEPREFIX specifies where the root of the wine directory is to be located. By default it's $HOME/.wine.
.NET may not run correctly because if the $WINEPREFIX variable points to a directory on a networked file system. To work around this problem, set $WINEPREFIX to reside in /tmp which resides on a local disk.
WINEARCH specifies the architecture of the tool. We assume is a 32-bit window ("win32") binary.
Use winetricks to install the necessary fonts and DLLs. You may not need to install anything.
winetricks -q corefonts msxml3 dotnet20
Use winecfg to configure WINE
Step 1. Install your tool as you would under Windows
Install your tool as you would under Windows by running the installed under WINE. The installer file may need to be located within the $WINEPREFIX hierarchy.
cp mytoolinstaller.exe $WINEPREFIX/drive_c/users/default wine $WINEPREFIX/drive_c/users/default/mytoolinstaller.exe
Step 2. Run and test the tool under WINE
Try to run the tool under WINE. You may need to install extra packages like .NET or extra fonts. Verify the tool behaviour.
wine $WINEPREFIX/drive_c/Program\ Files/MyTool/mytool.exe
The "Help" button usually doesn't work. You can possibly convert the help file to a webpage and add that to your tool page.
If the tool takes file arguments, the file paths have to be converted to windows-like paths. Let's say I want to load a file "myFile" from my home directory.
file=`winepath --windows $HOME/myFile` wine $WINEPREFIX/drive_c/Program\ Files/MyTool/mytool.exe "$file"
The winepath command converts the file path from a UNIX path to a Windows path.