#3213 NORM Opportu: Running WINE on the XO

Zarro Boogs per Child bugtracker at laptop.org
Mon Oct 22 11:34:31 EDT 2007


#3213: Running WINE on the XO
--------------------------+-------------------------------------------------
  Reporter:  ssb22        |       Owner:  jg                        
      Type:  enhancement  |      Status:  new                       
  Priority:  normal       |   Milestone:  Opportunity (please help!)
 Component:  distro       |     Version:                            
Resolution:               |    Keywords:                            
  Verified:  0            |  
--------------------------+-------------------------------------------------

Comment(by ssb22):

 I managed to get x11vnc software magnification rigged up and this is how I
 did it:

 1.  Make a directory to work in.  I was working on an ext2 image which I
 made on a FAT USB key and mounted with -o loop (less risky than re-
 formatting the USB key to ext2 as not all of them can take this in my
 experience).

 2.  Put the following files into that directory: libvncauth.so.0
 xvncviewer x11vnc Xrealvnc vncpasswd vncserver.  This can be done by
 installing the packages (x11vnc vncserver vncviewer) on a Debian Etch
 coLinux system and copying them out of /usr/bin and /usr/lib.  I have some
 notes about setting up coLinux at http://people.pwf.cam.ac.uk/ssb22/setup
 /vnc-magnification.html#nx

 3.  In order to get vncserver to work, I had to copy the
 /usr/share/fonts/X11 directory from a Debian Etch (coLinux) system to the
 OLPC (as /usr/share/fonts/X11).  It would be really nice if this step
 weren't necessary, but it seems that things won't work without it.

 4. Make a .vnc subdirectory (under the new directory), and put a passwd
 file in it (generate one with 'vncpasswd' on a system that has the
 vncserver package installed).  Note that we're not going to view the VNC
 server directly - we'll use x11vnc to magnify it instead - so it doesn't
 matter what the password is as we won't use it.

 (If you set a .vnc/passwd beforehand then you don't really need vncpasswd
 on the XO, but the vncserver script tests for the existence of at least an
 empty executable file called 'vncpasswd' in the PATH.)

 5.  Put WINE into that directory (I'm using wine version 20050310 in a
 'wine20050310' subdirectory) and put the .wine tree in.  Make a script
 like this:

 {{{
 #!/bin/bash

 # Work out where we are running from
 if test "$(echo "$0"|head -c 1)" == "/"; then
 export ScriptDir=$(echo "$0"|sed -e 's|/[^/]*$||')
 elif echo "$0" | grep / >/dev/null; then
 export ScriptDir="$(pwd)/$(echo "$0"|sed -e 's|/[^/]*$||')"
 else export ScriptDir=$(pwd); fi # assume not in PATH for now

 # We'll call this our HOME directory, but save the old one
 export OldHome="$HOME"
 export HOME="$ScriptDir"
 cd ~

 # The program to run, and optional startup directory:
 export exe="$HOME/.wine/dosdevices/c:/Program Files/Wenlin3/Wenlin.exe"
 cd ".wine/dosdevices/c:/"

 # We need to allocate a number in the range 0 to
 # 9 for this program.  If another Wine program
 # is being run in a similar setup then it will
 # need a different number.
 export ProgramNo=0
 # (the VNC display is :(ProgramNo+10), and the
 # x11vnc will export it on port 590$ProgramNo
 # for display :ProgramNo)

 # The WINE environment:
 export local="$ScriptDir/wine20050310"
 export WINEBIN="$local/bin"
 export WINELIB="$local/lib"
 export WINEDLLPATH="$local/lib/wine"
 export LD_LIBRARY_PATH=$local/lib:$LD_LIBRARY_PATH
 export PATH="$local/bin:$PATH"

 # The VNC server:
 export XAUTHORITY=~/.Xauthority
 export PATH="$ScriptDir/vnc:$PATH"
 vncserver :1$ProgramNo -geometry 600x450 -depth 16
 # (600x450 is half the XO's resolution of 1200x900)
 sleep 3
 export DISPLAY=:1$ProgramNo
 xhost +localhost
 xsetroot -solid black

 # The call to x11vnc itself.
 # If you don't need the large mouse cursor, you can delete "-scale_cursor
 4:nb".
 #
 x11vnc -rfbport 590$ProgramNo -forever -scale 2:nb -scale_cursor 4:nb
 -wait 100 &
 sleep 4

 # Start the viewer:
 DISPLAY=:0 XAUTHORITY=$OldHome/.Xauthority
 LD_LIBRARY_PATH=~/vnc:$LD_LIBRARY_PATH xvncviewer :$ProgramNo &

 # Now start Wine:
 $local/bin/wine "$exe"

 # Wine exitted - now terminate the VNC server (and hence everything else):
 kill $(cat ~/.vnc/*:1$ProgramNo.pid)
 }}}

 The first time it runs for any given $ProgramNo, Wine may take a while to
 start due to caching the font metrics.  It should be faster on subsequent
 runs.

 One problem is that the on-screen buttons (which normally map to the arrow
 keys and PgUp/PgDn/Home/End) do not seem to work when using programs this
 way.  The keyboard works OK however.

-- 
Ticket URL: <https://dev.laptop.org/ticket/3213#comment:6>
One Laptop Per Child <https://dev.laptop.org>
OLPC bug tracking system



More information about the Bugs mailing list