Hi guys,
This is a short guide detailing my adventures in building x2goclient for my OSX users, so they can easily login to our upcoming load balanced x2goserver farm.
Problem: In order to login to a load balanced farm you need to connect to a broker, which, at the time of writing this, requires x2goclient to be started with the --broker-url=<url> argument. This is not exactly userfriendly. Most normal desktop users aren't comfortable with the command line. On Linux and Windows you can distribute a new start shortcut with the correct --broker-url added (a .desktop file for Linux and who-knows for Windows). This isn't possible on OSX due to the way applications are packaged. You can still start apps like x2goclient from the command line with arguments and all, but it is a bit more complex and difficult on OSX than Linux.
Solution: Build a custom x2goclient package containing a start-script which includes your broker-url, so users will automatically be connected to your broker when starting x2goclient by clicking the app icon. This makes your custom version unusable for power users who need to connect to different servers, but for making it easy for your ordinary users to work from home or on the road, it is great. They only need to install your customized x2goclient and know their username/password.
Steps:
1. You need a bunch of prerequisites to be able to build x2goclient:
1a. Install XCode with command line utilities (guides available elsewhere online)
1b. Install MacPorts. Remember to fix your PATH.
1c. Install x2goclient from source using port, to get all dependencies: sudo port -s install x2goclient
1d. Install dylibbundler: sudo port install dylibbundler
2. Fix permissions on certain libraries, or dylibbundler will choke on them, and they won't be added to the finished .app:
2a. In /opt/local/lib: chmod ug+w libssh.4.dylib libcrypto.1.0.0.dylib libssl.1.0.0.dylib (expects that your user is in group 'adm')
2b. At the time of writing this, libtiff needs to be build with other parameters, than the binary version distributed by macports. As soon as a new revision of libtiff is released this step should be unnecessary. Until then, rebuild libtiff: sudo port -s -n upgrade --force tiff
3. Grab the newest version of x2goclient source tarball from x2goclient
4. Unpack it somewhere: tar -zxvf x2goclient-<VERSION>.tar.gz
5. Go into it and create a file called x2goclient-start-script with this content:
#!/usr/bin/env bash
DIR=$(cd "$(dirname "$0")"; pwd)
exec $DIR/x2goclient.bin --broker-url=<YOUR_BROKER_URL>
6. Make it +x: chmod +x x2goclient-start-script
7. Modify macbuild.sh. Between the "Bundling" phase and the "Creating DMG" phase, add these lines:
phase "Setting up custom run script"
mv "$APPBUNDLE/Contents/MacOS/x2goclient" "$APPBUNDLE/Contents/MacOS/x2goclient.bin"
cp x2goclient-start-script "$APPBUNDLE/Contents/MacOS/x2goclient"
8. run macbuild.sh to get both a x2goclient.app and x2goclient.dmg
When a newer version of x2goclient is released, just repeat steps 3 through 8.
--
Anders Bruun Olsen
It-ansvarlig
Det Danske Sprog- og Litteraturselskab
(Society for Danish Language and Literature)