]> Pileus Git - ~andy/gtk/blob - README.win32
Update.
[~andy/gtk] / README.win32
1 The Win32 backend in GTK+ is not as stable or correct as the X11 one.
2
3 For prebuilt runtime and developer packages see
4 http://ftp.gnome.org/pub/gnome/binaries/win32/
5
6 Building GTK+ on Win32
7 ======================
8
9 First you obviously need developer packages for the compile-time
10 dependencies: Pango, atk, glib, gettext-runtime, libiconv, libpng,
11 zlib, libtiff at least. See
12 http://ftp.gnome.org/pub/gnome/binaries/win32/dependencies .
13
14 After installing the dependencies, there are two ways to build GTK+
15 for win32.
16
17 1) GNU tools, ./configure && make install
18 -----------------------------------------
19
20 This requires you have mingw and MSYS.
21
22 Use the configure script, and the resulting Makefiles (which use
23 libtool and gcc to do the compilation). I use this myself, but it can
24 be hard to setup correctly.
25
26 The full script I run to build GTK+ 2.10 unpacked from a source
27 distribution is as below. This is from bulding GTK+ 2.10.9, slightly
28 edited to make it match this 2.11 development branch. Actually I don't
29 use any script like this to build the development branch, as I don't
30 distribute any binaries from development branches.
31
32 MOD=gtk+
33 VER=2.10.9
34 THIS=$MOD-$VER
35 HEX=`echo $THIS | md5sum | cut -d' ' -f1`
36 TARGET=c:/devel/target/$HEX
37 DEPS="`/devel/src/tml/latest.sh glib atk cairo pango`"
38 sed -e 's/need_relink=yes/need_relink=no # no way --tml/' <ltmain.sh >ltmain.temp && mv ltmain.temp ltmain.sh
39 usedev
40 usemsvs6
41 MY_PKG_CONFIG_PATH=""
42 for D in $DEPS; do
43     PATH=/devel/dist/$D/bin:$PATH
44     MY_PKG_CONFIG_PATH=/devel/dist/$D/lib/pkgconfig:$MY_PKG_CONFIG_PATH
45 done
46 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 &&
47 libtoolcacheize &&
48 unset MY_PKG_CONFIG_PATH &&
49 PATH=/devel/target/$HEX/bin:.libs:$PATH make install &&
50 (cd $TARGET/bin; strip --strip-unneeded *.dll *.exe) &&
51 (cd $TARGET/lib/gtk-2.0/2.10.0/loaders; strip --strip-unneeded *.dll) &&
52 (cd $TARGET/lib/gtk-2.0/2.10.0/immodules; strip --strip-unneeded *.dll) &&
53 (cd $TARGET/lib/gtk-2.0/2.10.0/engines; strip --strip-unneeded *.dll) &&
54 PATH=$TARGET/bin:$PATH gdk-pixbuf-query-loaders >$TARGET/etc/gtk-2.0/gdk-pixbuf.loaders &&
55 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 &&
56 mv $TARGET/etc/gtk-2.0/gdk-pixbuf.loaders.temp $TARGET/etc/gtk-2.0/gdk-pixbuf.loaders &&
57 grep -v -E 'Automatically generated|Created by|ModulesPath =' <$TARGET/etc/gtk-2.0/gtk.immodules >$TARGET/etc/gtk-2.0/gtk.immodules.temp &&
58 mv $TARGET/etc/gtk-2.0/gtk.immodules.temp $TARGET/etc/gtk-2.0/gtk.immodules &&
59 ./gtk-zip.sh &&
60 (cd /devel/src/tml && zip /tmp/$MOD-dev-$VER.zip make/$THIS.make) &&
61 manifestify /tmp/$MOD*-$VER.zip
62
63 You should not just copy the above blindly. There are some things in
64 the script that are very specific to *my* build setup on *my* current
65 machine. For instance the "latest.sh" script, the "usedev" and
66 "usemsvs6" shell functions, the /devel/dist folder. The above script
67 is really just meant for reference, to give an idea. You really need
68 to understand what things like PKG_CONFIG_PATH are and set them up
69 properly after installing the dependencies before building GTK+.
70
71 As you see above, after running configure, one can just say "make
72 install", like on Unix. A post-build fix is needed, running
73 gdk-pixbuf-query-loaders once more to get a correct gdk-pixbuf.loaders
74 file.
75
76 2) Microsoft's tools
77 --------------------
78
79 Use the Microsoft compiler, cl and Make, nmake. Say nmake -f
80 makefile.msc in gdk and gtk. Be prepared to manually edit various
81 makefile.msc files, and the makefile snippets in build/win32.
82
83 Alternative 1 also generates Microsoft import libraries (.lib), if you
84 have lib.exe available. It might also work for cross-compilation from
85 Unix.
86
87 I use method 1 myself. Hans Breuer has been taking care of the MSVC
88 makefiles. At times, we disagree a bit about various issues, and for
89 instance the makefile.msc files might not produce identically named
90 DLLs and import libraries as the "autoconfiscated" makefiles and
91 libtool do. If this bothers you, you will have to fix the makefiles.
92
93 Using GTK+ on Win32
94 ===================
95
96 To use GTK+ on Win32, you also need either one of the above mentioned
97 compilers. Other compilers might work, but don't count on it. Look for
98 prebuilt developer packages (DLLs, import libraries, headers) on the
99 above website.
100
101 Multi-threaded use of GTK+ on Win32
102 ===================================
103
104 Multi-threaded GTK+ programs might work on Windows in special simple
105 cases, but not in general. Sorry. If you have all GTK+ and GDK calls
106 in the same thread, it might work. Otherwise, probably not at
107 all. Possible ways to fix this are being investigated.
108
109 Wintab
110 ======
111
112 The tablet support uses the Wintab API. The Wintab development kit is
113 no longer required. The wintab.h header file is bundled with GTK+
114 sources. Unfortunately it seems that only Wacom tablets come with
115 support for the Wintab API nowadays.
116
117 --Tor Lillqvist <tml@iki.fi>, <tml@novell.com>