]> Pileus Git - ~andy/gtk/blob - README.win32
configure.ac: Support multiple GDK backends in one build
[~andy/gtk] / README.win32
1 The Win32 backend in GTK+ is not as stable or correct as the X11 one.\r
2 \r
3 For prebuilt runtime and developer packages see\r
4 http://ftp.gnome.org/pub/gnome/binaries/win32/\r
5 \r
6 Building GTK+ on Win32\r
7 ======================\r
8 \r
9 First you obviously need developer packages for the compile-time\r
10 dependencies: Pango, atk, glib, gettext-runtime, libiconv, libpng,\r
11 zlib, libtiff at least. See\r
12 http://ftp.gnome.org/pub/gnome/binaries/win32/dependencies .\r
13 \r
14 After installing the dependencies, there are two ways to build GTK+\r
15 for win32.\r
16 \r
17 1) GNU tools, ./configure && make install\r
18 -----------------------------------------\r
19 \r
20 This requires you have mingw and MSYS.\r
21 \r
22 Use the configure script, and the resulting Makefiles (which use\r
23 libtool and gcc to do the compilation). I use this myself, but it can\r
24 be hard to setup correctly.\r
25 \r
26 The full script I run to build GTK+ 2.16 unpacked from a source\r
27 distribution is as below. This is from bulding GTK+ 2.16.5. I don't\r
28 use any script like this to build the development branch, as I don't\r
29 distribute any binaries from development branches.\r
30 \r
31 # This is a shell script that calls functions and scripts from\r
32 # tml@iki.fi's personal work envĂ­ronment. It is not expected to be\r
33 # usable unmodified by others, and is included only for reference.\r
34 \r
35 MOD=gtk+\r
36 VER=2.16.5\r
37 REV=1\r
38 ARCH=win32\r
39 \r
40 THIS=${MOD}_${VER}-${REV}_${ARCH}\r
41 \r
42 RUNZIP=${MOD}_${VER}-${REV}_${ARCH}.zip\r
43 DEVZIP=${MOD}-dev_${VER}-${REV}_${ARCH}.zip\r
44 \r
45 HEX=`echo $THIS | md5sum | cut -d' ' -f1`\r
46 TARGET=c:/devel/target/$HEX\r
47 \r
48 usedev\r
49 usemsvs6\r
50 \r
51 (\r
52 \r
53 set -x\r
54 \r
55 DEPS=`latest --arch=${ARCH} glib atk cairo pango libpng zlib libtiff jpeg`\r
56 PROXY_LIBINTL=`latest --arch=${ARCH} proxy-libintl`\r
57 \r
58 PKG_CONFIG_PATH=\r
59 for D in $DEPS; do\r
60     PATH=/devel/dist/${ARCH}/$D/bin:$PATH\r
61     [ -d /devel/dist/${ARCH}/$D/lib/pkgconfig ] && PKG_CONFIG_PATH=/devel/dist/${ARCH}/$D/lib/pkgconfig:$PKG_CONFIG_PATH\r
62 done\r
63 \r
64 LIBPNG=`latest --arch=${ARCH} libpng`\r
65 ZLIB=`latest --arch=${ARCH} zlib`\r
66 LIBTIFF=`latest --arch=${ARCH} libtiff`\r
67 JPEG=`latest --arch=${ARCH} jpeg`\r
68 \r
69 patch -p0 <<'EOF'\r
70 EOF\r
71 \r
72 lt_cv_deplibs_check_method='pass_all' \\r
73 CC='gcc -mtune=pentium3 -mthreads' \\r
74 CPPFLAGS="-I/devel/dist/${ARCH}/${LIBPNG}/include \\r
75 -I/devel/dist/${ARCH}/${ZLIB}/include \\r
76 -I/devel/dist/${ARCH}/${LIBTIFF}/include \\r
77 -I/devel/dist/${ARCH}/${JPEG}/include \\r
78 -I/devel/dist/${ARCH}/${PROXY_LIBINTL}/include" \\r
79 LDFLAGS="-L/devel/dist/${ARCH}/${LIBPNG}/lib \\r
80 -L/devel/dist/${ARCH}/${ZLIB}/lib \\r
81 -L/devel/dist/${ARCH}/${LIBTIFF}/lib \\r
82 -L/devel/dist/${ARCH}/${JPEG}/lib \\r
83 -L/devel/dist/${ARCH}/${PROXY_LIBINTL}/lib -Wl,--exclude-libs=libintl.a \\r
84 -Wl,--enable-auto-image-base" \\r
85 LIBS=-lintl \\r
86 CFLAGS=-O2 \\r
87 ./configure \\r
88 --enable-win32-backend \\r
89 --disable-gdiplus \\r
90 --with-included-immodules \\r
91 --without-libjasper \\r
92 --enable-debug=yes \\r
93 --enable-explicit-deps=no \\r
94 --disable-gtk-doc \\r
95 --disable-static \\r
96 --prefix=$TARGET &&\r
97 \r
98 libtoolcacheize &&\r
99 rm gtk/gtk.def &&\r
100 (PATH="$PWD/gdk-pixbuf/.libs:/devel/target/$HEX/bin:$PATH" make -j3 install || (rm .libtool-cache* && PATH="/devel/target/$HEX/bin:$PATH" make -j3 install)) &&\r
101 \r
102 PATH="/devel/target/$HEX/bin:$PATH" gdk-pixbuf-query-loaders >/devel/target/$HEX/etc/gtk-2.0/gdk-pixbuf.loaders &&\r
103 \r
104 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 &&\r
105     mv $TARGET/etc/gtk-2.0/gdk-pixbuf.loaders.temp $TARGET/etc/gtk-2.0/gdk-pixbuf.loaders &&\r
106 grep -v -E 'Automatically generated|Created by|ModulesPath =' <$TARGET/etc/gtk-2.0/gtk.immodules >$TARGET/etc/gtk-2.0/gtk.immodules.temp &&\r
107     mv $TARGET/etc/gtk-2.0/gtk.immodules.temp $TARGET/etc/gtk-2.0/gtk.immodules &&\r
108 \r
109 ./gtk-zip.sh &&\r
110 \r
111 mv /tmp/${MOD}-${VER}.zip /tmp/$RUNZIP &&\r
112 mv /tmp/${MOD}-dev-${VER}.zip /tmp/$DEVZIP\r
113 \r
114 ) 2>&1 | tee /devel/src/tml/packaging/$THIS.log\r
115 \r
116 (cd /devel && zip /tmp/$DEVZIP src/tml/packaging/$THIS.{sh,log}) &&\r
117 manifestify /tmp/$RUNZIP /tmp/$DEVZIP\r
118 \r
119 You should not just copy the above blindly. There are some things in\r
120 the script that are very specific to *my* build setup on *my* current\r
121 machine. For instance the "latest" command, the "usedev" and\r
122 "usemsvs6" shell functions, the /devel/dist folder. The above script\r
123 is really just meant for reference, to give an idea. You really need\r
124 to understand what things like PKG_CONFIG_PATH are and set them up\r
125 properly after installing the dependencies before building GTK+.\r
126 \r
127 As you see above, after running configure, one can just say "make\r
128 install", like on Unix. A post-build fix is needed, running\r
129 gdk-pixbuf-query-loaders once more to get a correct gdk-pixbuf.loaders\r
130 file.\r
131 \r
132 For a 64-bit build you need to remove the gtk/gtk.def file and let it\r
133 be regenerated by the makefilery. This is because the 64-bit GTK dll\r
134 has a slightly different list of exported function names. This is on\r
135 purpose and not a bug. The API is the same at the source level, and\r
136 the same #defines of some function names to actually have a _utf8\r
137 suffix is used (just to keep the header simpler). But the\r
138 corresponding non-suffixed function to maintain ABI stability are not\r
139 needed in the 64-bit case (because there are no older EXEs around that\r
140 would require such for ABI stability).\r
141 \r
142 \r
143 2) Microsoft's tools\r
144 --------------------\r
145 \r
146 Use the Microsoft compiler, cl and Make, nmake. Say nmake -f\r
147 makefile.msc in gdk and gtk. Be prepared to manually edit various\r
148 makefile.msc files, and the makefile snippets in build/win32.\r
149 \r
150 Alternative 1 also generates Microsoft import libraries (.lib), if you\r
151 have lib.exe available. It might also work for cross-compilation from\r
152 Unix.\r
153 \r
154 I use method 1 myself. Hans Breuer has been taking care of the MSVC\r
155 makefiles. At times, we disagree a bit about various issues, and for\r
156 instance the makefile.msc files might not produce identically named\r
157 DLLs and import libraries as the "autoconfiscated" makefiles and\r
158 libtool do. If this bothers you, you will have to fix the makefiles.\r
159 \r
160 Using GTK+ on Win32\r
161 ===================\r
162 \r
163 To use GTK+ on Win32, you also need either one of the above mentioned\r
164 compilers. Other compilers might work, but don't count on it. Look for\r
165 prebuilt developer packages (DLLs, import libraries, headers) on the\r
166 above website.\r
167 \r
168 Multi-threaded use of GTK+ on Win32\r
169 ===================================\r
170 \r
171 Multi-threaded GTK+ programs might work on Windows in special simple\r
172 cases, but not in general. Sorry. If you have all GTK+ and GDK calls\r
173 in the same thread, it might work. Otherwise, probably not at\r
174 all. Possible ways to fix this are being investigated.\r
175 \r
176 Wintab\r
177 ======\r
178 \r
179 The tablet support uses the Wintab API. The Wintab development kit is\r
180 no longer required. The wintab.h header file is bundled with GTK+\r
181 sources. Unfortunately it seems that only Wacom tablets come with\r
182 support for the Wintab API nowadays.\r
183 \r
184 --Tor Lillqvist <tml@iki.fi>, <tml@novell.com>\r