README.win32 5.17 KB
Newer Older
Tor Lillqvist's avatar
Tor Lillqvist committed
1
The Win32 backend in GTK+ is not as stable or correct as the X11 one.
Tor Lillqvist's avatar
Tor Lillqvist committed
2 3

For prebuilt runtime and developer packages see
Tor Lillqvist's avatar
Tor Lillqvist committed
4
http://ftp.gnome.org/pub/gnome/binaries/win32/
Tor Lillqvist's avatar
Tor Lillqvist committed
5

6 7 8
Building GTK+ on Win32
======================

Tor Lillqvist's avatar
Tor Lillqvist committed
9 10 11 12
First you obviously need developer packages for the compile-time
dependencies: Pango, atk, glib, gettext-runtime, libiconv, libpng,
zlib, libtiff at least. See
http://ftp.gnome.org/pub/gnome/binaries/win32/dependencies .
Tor Lillqvist's avatar
Tor Lillqvist committed
13

Tor Lillqvist's avatar
Tor Lillqvist committed
14 15
After installing the dependencies, there are two ways to build GTK+
for win32.
16

Tor Lillqvist's avatar
Tor Lillqvist committed
17 18
1) GNU tools, ./configure && make install
-----------------------------------------
19

Tor Lillqvist's avatar
Tor Lillqvist committed
20
This requires you have mingw and MSYS.
21

Tor Lillqvist's avatar
Tor Lillqvist committed
22 23 24
Use the configure script, and the resulting Makefiles (which use
libtool and gcc to do the compilation). I use this myself, but it can
be hard to setup correctly.
Tor Lillqvist's avatar
Tor Lillqvist committed
25

Tor Lillqvist's avatar
Tor Lillqvist committed
26 27 28 29 30
The full script I run to build GTK+ 2.10 unpacked from a source
distribution is as below. This is from bulding GTK+ 2.10.9, slightly
edited to make it match this 2.11 development branch. Actually I don't
use any script like this to build the development branch, as I don't
distribute any binaries from development branches.
Tor Lillqvist's avatar
Tor Lillqvist committed
31

Tor Lillqvist's avatar
Tor Lillqvist committed
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79
MOD=gtk+
VER=2.10.9
THIS=$MOD-$VER
HEX=`echo $THIS | md5sum | cut -d' ' -f1`
TARGET=c:/devel/target/$HEX
DEPS="`/devel/src/tml/latest.sh glib atk cairo pango`"
sed -e 's/need_relink=yes/need_relink=no # no way --tml/' <ltmain.sh >ltmain.temp && mv ltmain.temp ltmain.sh
usedev
usemsvs6
MY_PKG_CONFIG_PATH=""
for D in $DEPS; do
    PATH=/devel/dist/$D/bin:$PATH
    MY_PKG_CONFIG_PATH=/devel/dist/$D/lib/pkgconfig:$MY_PKG_CONFIG_PATH
done
PKG_CONFIG_PATH=$MY_PKG_CONFIG_PATH:$PKG_CONFIG_PATH CC='gcc -mtune=pentium3 -mthreads' CPPFLAGS='-I/opt/gnu/include -I/opt/gnuwin32/include -I/opt/misc/include' LDFLAGS='-L/opt/gnu/lib -L/opt/gnuwin32/lib -L/opt/misc/lib -Wl,--enable-auto-image-base' LIBS=-lintl CFLAGS=-O2 ./configure --with-gdktarget=win32 --enable-debug=yes --disable-gtk-doc --disable-static --prefix=$TARGET &&
libtoolcacheize &&
unset MY_PKG_CONFIG_PATH &&
PATH=/devel/target/$HEX/bin:.libs:$PATH make install &&
(cd $TARGET/bin; strip --strip-unneeded *.dll *.exe) &&
(cd $TARGET/lib/gtk-2.0/2.10.0/loaders; strip --strip-unneeded *.dll) &&
(cd $TARGET/lib/gtk-2.0/2.10.0/immodules; strip --strip-unneeded *.dll) &&
(cd $TARGET/lib/gtk-2.0/2.10.0/engines; strip --strip-unneeded *.dll) &&
PATH=$TARGET/bin:$PATH gdk-pixbuf-query-loaders >$TARGET/etc/gtk-2.0/gdk-pixbuf.loaders &&
grep -v -E 'Automatically generated|Created by|LoaderDir =' <$TARGET/etc/gtk-2.0/gdk-pixbuf.loaders >$TARGET/etc/gtk-2.0/gdk-pixbuf.loaders.temp &&
mv $TARGET/etc/gtk-2.0/gdk-pixbuf.loaders.temp $TARGET/etc/gtk-2.0/gdk-pixbuf.loaders &&
grep -v -E 'Automatically generated|Created by|ModulesPath =' <$TARGET/etc/gtk-2.0/gtk.immodules >$TARGET/etc/gtk-2.0/gtk.immodules.temp &&
mv $TARGET/etc/gtk-2.0/gtk.immodules.temp $TARGET/etc/gtk-2.0/gtk.immodules &&
./gtk-zip.sh &&
(cd /devel/src/tml && zip /tmp/$MOD-dev-$VER.zip make/$THIS.make) &&
manifestify /tmp/$MOD*-$VER.zip

You should not just copy the above blindly. There are some things in
the script that are very specific to *my* build setup on *my* current
machine. For instance the "latest.sh" script, the "usedev" and
"usemsvs6" shell functions, the /devel/dist folder. The above script
is really just meant for reference, to give an idea. You really need
to understand what things like PKG_CONFIG_PATH are and set them up
properly after installing the dependencies before building GTK+.

As you see above, after running configure, one can just say "make
install", like on Unix. A post-build fix is needed, running
gdk-pixbuf-query-loaders once more to get a correct gdk-pixbuf.loaders
file.

2) Microsoft's tools
--------------------

Use the Microsoft compiler, cl and Make, nmake. Say nmake -f
Tor Lillqvist's avatar
Tor Lillqvist committed
80 81
makefile.msc in gdk and gtk. Be prepared to manually edit various
makefile.msc files, and the makefile snippets in build/win32.
Tor Lillqvist's avatar
Tor Lillqvist committed
82 83

Alternative 1 also generates Microsoft import libraries (.lib), if you
Tor Lillqvist's avatar
Tor Lillqvist committed
84
have lib.exe available. It might also work for cross-compilation from
Tor Lillqvist's avatar
Tor Lillqvist committed
85 86
Unix.

Tor Lillqvist's avatar
Tor Lillqvist committed
87 88 89 90
I use method 1 myself. Hans Breuer has been taking care of the MSVC
makefiles. At times, we disagree a bit about various issues, and for
instance the makefile.msc files might not produce identically named
DLLs and import libraries as the "autoconfiscated" makefiles and
91
libtool do. If this bothers you, you will have to fix the makefiles.
Tor Lillqvist's avatar
Tor Lillqvist committed
92

93 94 95
Using GTK+ on Win32
===================

Tor Lillqvist's avatar
Tor Lillqvist committed
96
To use GTK+ on Win32, you also need either one of the above mentioned
Tor Lillqvist's avatar
Tor Lillqvist committed
97 98
compilers. Other compilers might work, but don't count on it. Look for
prebuilt developer packages (DLLs, import libraries, headers) on the
Tor Lillqvist's avatar
Tor Lillqvist committed
99
above website.
Tor Lillqvist's avatar
Tor Lillqvist committed
100

101 102 103
Multi-threaded use of GTK+ on Win32
===================================

Tor Lillqvist's avatar
Tor Lillqvist committed
104 105 106 107
Multi-threaded GTK+ programs might work on Windows in special simple
cases, but not in general. Sorry. If you have all GTK+ and GDK calls
in the same thread, it might work. Otherwise, probably not at
all. Possible ways to fix this are being investigated.
108 109 110 111

Wintab
======

Tor Lillqvist's avatar
Tor Lillqvist committed
112 113 114 115
The tablet support uses the Wintab API. The Wintab development kit is
no longer required. The wintab.h header file is bundled with GTK+
sources. Unfortunately it seems that only Wacom tablets come with
support for the Wintab API nowadays.
116

Tor Lillqvist's avatar
Tor Lillqvist committed
117
--Tor Lillqvist <tml@iki.fi>, <tml@novell.com>