[Gtk-sharp-list] Latest version on Windows

Jae Stutzman jaebird at gmail.com
Wed Oct 1 13:18:51 EDT 2008


Brad,

Ok, I'll give more details here. First of all we did not use the MedSphere
SDK this time for the gtk+ libraries, we used the gtk.org bundle. We also
modified the installer to use a script to create the msm modules so that we
did not have to hand code each wix file. This makes it really easy to add
new modules. The basis of the script is found on a blog posting here:
http://weblogs.asp.net/lorenh/archive/2004/05/09/128899.aspx

== Gtk# ==

=== Dependencies ===
Building GTK# 2 uses a similar process as building Mono. First, we'll need
some more dependencies:

 * Cygwin from cygwin.org
 * Microsoft's .NET Framework and SDK(both v1.1!) from
msdn.microsoft.com/downloads.

Next, make sure the following cygwin packages are installed:

Install:
 * automake1.10 (brings in autoconf, libtool)
 * bison
 * file
 * gcc, gcc-mingw, gcc-mingw-core, gcc-mingw-g++
 * gettext
 * libtool
 * make

Remove:
 * pkg-config

The MS .NET SDK is needed because the gtk-sharp2 build currently uses the
disassembler(ildasm) from the MS SDK for a portion of the build. Eventually,
the gtk-sharp2 build will use the tools from Mono, but currently this is how
it's done. Make sure there are no spaces in the installation paths since the
GTK# makefiles do not always quote the path to the executables.

Now the Gtk dependencies:

    * Download the latest Gtk+ bundle from
http://www.gtk.org/download-windows.html

=== Extract Sources ===
In this guide references to ZIP_FILES indicate the Gtk+ bundle unzip
location. Add the ZIP_FILES\bin directory to your path(Windows XP: control
panel->System->Advanced->Environment variables->Path) and run gtk-demo.exe
in the same directory to test your Gtk+ installation.

=== Configure Mono.Cairo ===
You will also need to get Mono.Cairo(v1.0). You can find this in Mono's
Windows installer, IIRC. Copy this file to the following:
{{{
mkdir -p /cygdrive/c/ZIP_FILES/lib/mono/1.0
cp SOURCE/Mono.Cairo.dll /cygdrive/c/ZIP_FILES/lib/mono/1.0
}}}

Then copy the mono-cairo.pc file into /cygdrive/c/ZIP_FILES/lib/pkgconfig.
Change the last line in mono-cairo.pc to reflect its location:
{{{
Libs: -r:C:/ZIP_FILES/lib/mono/1.0/Mono.Cairo.dll
}}}
It's quite important that you make Libs the correct *Windows* path, since
the Libs path will be sent to csc.exe.

=== pkg-config setup ===
As we have to use the win32 pkg-config from the Gtk+ bundle(because has
supports for dynamic disks such as C:/devel/target/... needed by the Gtk+
pkg-config files), create a symlink from your ZIP_FILES/share/aclocal/pkg.m4
file to /usr/share/aclocal/pkg.m4:
{{{
mkdir -p /usr/share/aclocal
ln -s /cygdrive/c/ZIP_FILES/share/aclocal/pkg.m4 /usr/share/aclocal/pkg.m4
}}}

Note: If the target already exists, uninstall the cygwin pkg-config package.


=== Environment Variables ===
Make sure that Mono is not in the path, and put the MS tools in the path.
Create an envronment file enviro.sh, put this file in the user's cygwin home
directory, example below:
{{{
#!/bin/sh

export LD_LIBRARY_PATH=/opt/gtk/lib/pkgconfig:$LD_LIBRARY_PATH

# WARNING Gnu Make cannot handle spaces in PATH, use Dos style paths:
export
PATH=/cygdrive/c/Progra~1/Microsoft.NET/SDK/v1.1/Bin/:/cygdrive/c/WINDOWS/Microsoft.NET/Framework/v1.1.4322/:/cygdrive/c/gtkZip/bin/:$PATH


# export LDFLAGS="-L/cygdrive/c/ZIP_FILES/lib"
# export CPPFLAGS="-I/cygdrive/c/ZIP_FILES/include"

# Make sure we're not dependent on cygwin, and create
export CC="gcc -mno-cygwin"

# We have to use the win32 version of pkg-config from the Gtk+ bundle; do
NOT use Cygwin's pkg-config ./configure --prefix=/tmp/install
export PKG_CONFIG="/cygdrive/c/ZIP_FILES/bin/pkg-config"

# Choose any prefix you like, call bootstrap-2.12 instead when building SVN

export PKG_CONFIG_PATH="/cygdrive/c/ZIP_FILES/lib/pkgconfig"
}}}
When launching a new cygwin shell execute:
{{{
source enviro.sh
}}}

=== Modification of pkg-config files ===
The Gtk+ bundle comes with a non-relocatable prefix for pkg-config files,
execute the script below to replace the prefix.

{{{
find /cygdrive/c/gtkzip/lib/pkgconfig/ -name "*.pc" | xargs sed -i
's,^prefix=.*$,prefix=/cygdrive/c/ZIP_FILES,'
}}}

=== Optional Glade# ===
If you want to build Glade#(optional):

    * libxml2 from http://xmlsoft.org/sources/win32/(libxml2-2.7.1.win32.zip)
    * libglade-bin and libglade-dev from the gladewin32 project:
http://sourceforge.net/project/showfiles.php?group_id=98754(libglade-2.4.0-bin.zip
and libglade-2.4.0-dev.zip)

 1. Extract glade libs into the Gtk+ bundle unzip location (update
libglade-2.0.pc prefix)
 1. copy libxml2 bin, include, lib to gtk+ bundle unzip location (copy the
libxml-2.0.pc file from working linux box, modify prefix)
 1. rename libxml2.lib to libxml2.dll.a for gcc compiler
 1. rename ./include/libxml to ./include/libxml2

=== Build Gtk# ===
Download the version of gtk-sharp that you want to build:

{{{
wget
http://ftp.novell.com/pub/mono/sources/gtk-sharp212/gtk-sharp-2.12.0.tar.bz2
tar -xjf gtk-sharp-2.12.0.tar.bz2
cd gtk-sharp-2.12.0
}}}
 {{{
./configure
make
}}}

If using the latest SVN head:

{{{
./bootstrap-2.12
make
}}}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/gtk-sharp-list/attachments/20081001/8dbb23ac/attachment.html 


More information about the Gtk-sharp-list mailing list