Portable GTK

GTK+ is a Free and portable widget toolkit written in C with support for bindings in lot of scripting languages.

GTK+ is based on GLib, GObject and other technologies, which are high level abstractions on top of C to provide data serialization, object models, introspection, threads, signalling and many other goods in a clean and portable way.

The complexity to use GObject libraries in C can be simplified by using Vala ( http://vala-project.org ) and on top of Vala there's a project named GtkAML which provides a container-oriented description programming that simplifies even more the design and development of applications using Gtk+.

GTK+ is a toolkit used mostly on OpenSource operating systems. This is probably a good thing.. unless you are trying to distribute binaries of your program you end up with these problems:

* The ABI changes between big version number changes of the libraries.
* You end up packaging all the gtk,png|jpeg,pango,glib,x11 dependencies.
* You create a shellscript that depending on the uname and lsb_release or etc/issue you load some or other libraries
* GTK themes are not always respected in this situation
* Some proprietary graphics drivers are linked to X libraries, so you can't distribute them
* Your binary package size has grown to 40 or 50MB when your application is just 400KB
* (place here your problems)

Actually, GTK+-2.0 is stable and the development happens in GTK+-3.0, so most of those problems will be just fixed by having an up-to-date system and using old enought libraries when building your application.

* In my experience, using the older LTS Ubuntu is a good option, so GNOME libraries have some sort of backward compatibility, and applications compiled against old (not ancient) versions of GTK will continue working on future libs.

Many proprietary projects switched to QT because of those problems, they provide a good commercial support.. but personally I prefer GTK, C and a community based development.

After many experiments and projects I end up having an almost simple environment for building portable binary GTK applications for Linux (BSD should be the same), Windows and OSX.

The good point of OSX and Windows is that they have more stable ABI (binary compatibility), so you don't have to care about different versions of OSX of different versions of Windows... In Linux, every distro can have their own drivers hacking X11 libs, different system libraries, etc... which tends to be problematic for distributing binary apps.

Vala/GtkON

When crosscompiling, is better to use Vala and GtkAML compilers natively. As long as they generate C code, you can use them from your own system installation. Only CC environment must be changed in order to specify the mingw32, ARM or whatever crosscompiler.

To create the icon for your application you need to create a 128x128 PNG image and use the [b]FastIcns[/b] application to create a .icns file.

Place your .icns file inside the Resources directory and then just reference your .icns file in the PkgInfo XML like this:

<key>CFBundleIconFile</key>
<string>Ragui.icns</string>

At some point I will write a set of scripts to do all this job automatically.. but until then.. just hack it up in your own way :)

Setting up fonts

If your GTK app is rendering rectangles instead of fonts you will have to setup the pango modules. To do this in a position-independent way.. you have to create a startup script that setups LD_LIBRARY_PATH (linux,bsd) or DYLD_LIBRARY_PATH (osx) and run the following script: