]> Pileus Git - ~andy/gtk/blobdiff - README.win32
stylecontext: Do invalidation on first resize container
[~andy/gtk] / README.win32
index 0a0b1284fec1420880aaa38e732694e8eca8813b..42ca66f26331486fb46829105f7aa68af3165db7 100644 (file)
-The Win32 port of GTk+ is a work in progress, and not as stable or
-correct as the Unix/X11 version. For more information about the Win32
-port, see http://www.gimp.org/tml/gimp/win32/ or
-http://www.iki.fi/tml/gimp/win32/ .
-
-The current (CVS) version of the Win32 backend is *not* as stable as it
-was before the no-flicker branch was merged. A zipfile with that
-version is available from http://www.gimp.org/win32/. That should be
-use by "production" code until this CVS version is usable. (But note,
-the Win32 backend has never been claimed to be "production quality".)
-
-To build GTk+ on Win32, you need either the Microsoft compiler and
-tools, or gcc-2.95 or later. The mingw setup of gcc is preferred, but
-you can run gcc also under cygwin-b20.1 or later. Compile in
-gdk\win32, gdk and gtk with `nmake -f makefile.msc` or `make -f
-makefile.cygwin`. The name makefile.cygwin is misleading, it should
-really be called makefile.mingw.
-
-See the README.win32 file in the GLib distribution for instructions
-how to build with gcc.
-
-To use GTk+ on Win32, you also need either of the above mentioned
-compilers. Other compilers might work, but don't count on it.  The
-same instructions on how to set up a correct version of gcc should
-also be followed if you want to build applications that use GTk+ with
-gcc.
-
-The tablet support uses the Wintab API. The Wintab development kit can
-be downloaded from http://www.pointing.com. If you don't care for
-that, undefine HAVE_WINTAB in config.h.win32 and remove references to
-the wntab32x library from the makefile before building.
-
-GTk+ wants to be built with the GNU "intl" library for
-internationalisation (i18n). Get the version ported to Win32 (not a
-very big deal) from tml's web site mentioned above. We build the
-"intl" library as a DLL called gnu-intl.dll (the "gnu" prefix is used
-to reduce name clash risks). If you don't want any i18n stuff,
-undefine ENABLE_NLS, HAVE_GETTEXT and HAVE_LIBINTL in the
-config.h.win32 file, and remove references to the gnu-intl library
-from the makefiles.
-
-Note that while the GNU gettext package is under the GPL, the "intl"
-part of it which is distributed with GNU libc is under the LGPL (like
-GTk+ or GLib). We want the LGPL one, even if they are the same, more
-or less.
+The Win32 backend in GTK+ is not as stable or correct as the X11 one.\r
+\r
+For prebuilt runtime and developer packages see\r
+http://ftp.gnome.org/pub/gnome/binaries/win32/\r
+\r
+Building GTK+ on Win32\r
+======================\r
+\r
+First you obviously need developer packages for the compile-time\r
+dependencies: GDK-Pixbuf, Pango, atk, glib, gettext-runtime, libiconv at least.\r
+See http://ftp.gnome.org/pub/gnome/binaries/win32/dependencies .\r
+\r
+For people compiling GTK+ with Visual C++ 2005 or later, it is\r
+recommended that the same compiler is used for at least GDK-Pixbuf,\r
+Pango, atk and glib so that crashes and errors caused by different CRTs\r
+can be avoided.  The VS 2008 project files and/or VS Makefiles are\r
+either already available or will be available in the next stable release.\r
+Unfortunately compiling with Microsoft's compilers versions 2003 or earlier\r
+is not supported as compiling the latest stable GLib (which *is* required for\r
+building this GTK+ release) requires features from newer compilers\r
+and/or Platform SDKs\r
+\r
+After installing the dependencies, there are two ways to build GTK+\r
+for win32.\r
+\r
+1) GNU tools, ./configure && make install\r
+-----------------------------------------\r
+\r
+This requires you have mingw and MSYS.\r
+\r
+Use the configure script, and the resulting Makefiles (which use\r
+libtool and gcc to do the compilation). I use this myself, but it can\r
+be hard to setup correctly.\r
+\r
+The full script I run to build GTK+ 2.16 unpacked from a source\r
+distribution is as below. This is from bulding GTK+ 2.16.5. I don't\r
+use any script like this to build the development branch, as I don't\r
+distribute any binaries from development branches.\r
+\r
+# This is a shell script that calls functions and scripts from\r
+# tml@iki.fi's personal work envĂ­ronment. It is not expected to be\r
+# usable unmodified by others, and is included only for reference.\r
+\r
+MOD=gtk+\r
+VER=2.16.5\r
+REV=1\r
+ARCH=win32\r
+\r
+THIS=${MOD}_${VER}-${REV}_${ARCH}\r
+\r
+RUNZIP=${MOD}_${VER}-${REV}_${ARCH}.zip\r
+DEVZIP=${MOD}-dev_${VER}-${REV}_${ARCH}.zip\r
+\r
+HEX=`echo $THIS | md5sum | cut -d' ' -f1`\r
+TARGET=c:/devel/target/$HEX\r
+\r
+usedev\r
+usemsvs6\r
+\r
+(\r
+\r
+set -x\r
+\r
+DEPS=`latest --arch=${ARCH} glib atk cairo pango libpng zlib libtiff jpeg`\r
+PROXY_LIBINTL=`latest --arch=${ARCH} proxy-libintl`\r
+\r
+PKG_CONFIG_PATH=\r
+for D in $DEPS; do\r
+    PATH=/devel/dist/${ARCH}/$D/bin:$PATH\r
+    [ -d /devel/dist/${ARCH}/$D/lib/pkgconfig ] && PKG_CONFIG_PATH=/devel/dist/${ARCH}/$D/lib/pkgconfig:$PKG_CONFIG_PATH\r
+done\r
+\r
+LIBPNG=`latest --arch=${ARCH} libpng`\r
+ZLIB=`latest --arch=${ARCH} zlib`\r
+LIBTIFF=`latest --arch=${ARCH} libtiff`\r
+JPEG=`latest --arch=${ARCH} jpeg`\r
+\r
+patch -p0 <<'EOF'\r
+EOF\r
+\r
+lt_cv_deplibs_check_method='pass_all' \\r
+CC='gcc -mtune=pentium3 -mthreads' \\r
+CPPFLAGS="-I/devel/dist/${ARCH}/${LIBPNG}/include \\r
+-I/devel/dist/${ARCH}/${ZLIB}/include \\r
+-I/devel/dist/${ARCH}/${LIBTIFF}/include \\r
+-I/devel/dist/${ARCH}/${JPEG}/include \\r
+-I/devel/dist/${ARCH}/${PROXY_LIBINTL}/include" \\r
+LDFLAGS="-L/devel/dist/${ARCH}/${LIBPNG}/lib \\r
+-L/devel/dist/${ARCH}/${ZLIB}/lib \\r
+-L/devel/dist/${ARCH}/${LIBTIFF}/lib \\r
+-L/devel/dist/${ARCH}/${JPEG}/lib \\r
+-L/devel/dist/${ARCH}/${PROXY_LIBINTL}/lib -Wl,--exclude-libs=libintl.a \\r
+-Wl,--enable-auto-image-base" \\r
+LIBS=-lintl \\r
+CFLAGS=-O2 \\r
+./configure \\r
+--enable-win32-backend \\r
+--disable-gdiplus \\r
+--with-included-immodules \\r
+--without-libjasper \\r
+--enable-debug=yes \\r
+--enable-explicit-deps=no \\r
+--disable-gtk-doc \\r
+--disable-static \\r
+--prefix=$TARGET &&\r
+\r
+libtoolcacheize &&\r
+rm gtk/gtk.def &&\r
+(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
+\r
+PATH="/devel/target/$HEX/bin:$PATH" gdk-pixbuf-query-loaders >/devel/target/$HEX/etc/gtk-2.0/gdk-pixbuf.loaders &&\r
+\r
+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
+    mv $TARGET/etc/gtk-2.0/gdk-pixbuf.loaders.temp $TARGET/etc/gtk-2.0/gdk-pixbuf.loaders &&\r
+grep -v -E 'Automatically generated|Created by|ModulesPath =' <$TARGET/etc/gtk-2.0/gtk.immodules >$TARGET/etc/gtk-2.0/gtk.immodules.temp &&\r
+    mv $TARGET/etc/gtk-2.0/gtk.immodules.temp $TARGET/etc/gtk-2.0/gtk.immodules &&\r
+\r
+./gtk-zip.sh &&\r
+\r
+mv /tmp/${MOD}-${VER}.zip /tmp/$RUNZIP &&\r
+mv /tmp/${MOD}-dev-${VER}.zip /tmp/$DEVZIP\r
+\r
+) 2>&1 | tee /devel/src/tml/packaging/$THIS.log\r
+\r
+(cd /devel && zip /tmp/$DEVZIP src/tml/packaging/$THIS.{sh,log}) &&\r
+manifestify /tmp/$RUNZIP /tmp/$DEVZIP\r
+\r
+You should not just copy the above blindly. There are some things in\r
+the script that are very specific to *my* build setup on *my* current\r
+machine. For instance the "latest" command, the "usedev" and\r
+"usemsvs6" shell functions, the /devel/dist folder. The above script\r
+is really just meant for reference, to give an idea. You really need\r
+to understand what things like PKG_CONFIG_PATH are and set them up\r
+properly after installing the dependencies before building GTK+.\r
+\r
+As you see above, after running configure, one can just say "make\r
+install", like on Unix. A post-build fix is needed, running\r
+gdk-pixbuf-query-loaders once more to get a correct gdk-pixbuf.loaders\r
+file.\r
+\r
+For a 64-bit build you need to remove the gtk/gtk.def file and let it\r
+be regenerated by the makefilery. This is because the 64-bit GTK dll\r
+has a slightly different list of exported function names. This is on\r
+purpose and not a bug. The API is the same at the source level, and\r
+the same #defines of some function names to actually have a _utf8\r
+suffix is used (just to keep the header simpler). But the\r
+corresponding non-suffixed function to maintain ABI stability are not\r
+needed in the 64-bit case (because there are no older EXEs around that\r
+would require such for ABI stability).\r
+\r
+\r
+2) Microsoft's tools\r
+--------------------\r
+\r
+Use the Microsoft compiler, cl and Make, nmake. Say nmake -f\r
+makefile.msc in gdk and gtk. Be prepared to manually edit various\r
+makefile.msc files, and the makefile snippets in build/win32.\r
+\r
+There are also VS 2008/2010 solution and project files to build GTK+, which\r
+are maintained by Chun-wei Fan.  They should build GTK+ out of the box,\r
+provided that the afore-mentioned dependencies are installed.  They will\r
+build GDK with the Win32 backend, GTK+ itself (with GAIL/a11y built in),\r
+the GAIL-Util library and the gtk-demo program.\r
+\r
+Please refer to the following GNOME Live! page for a more detailed ouline\r
+on the process of building the GTK+ stack and its dependencies with Visual\r
+C++:\r
+\r
+https://live.gnome.org/GTK%2B/Win32/MSVCCompilationOfGTKStack\r
+\r
+Alternative 1 also generates Microsoft import libraries (.lib), if you\r
+have lib.exe available. It might also work for cross-compilation from\r
+Unix.\r
+\r
+I (Tor) use method 1 myself. Hans Breuer has been taking care of the MSVC\r
+makefiles. At times, we disagree a bit about various issues, and for\r
+instance the makefile.msc files might not produce identically named\r
+DLLs and import libraries as the "autoconfiscated" makefiles and\r
+libtool do. If this bothers you, you will have to fix the makefiles.\r
+\r
+Using GTK+ on Win32\r
+===================\r
+\r
+To use GTK+ on Win32, you also need either one of the above mentioned\r
+compilers. Other compilers might work, but don't count on it. Look for\r
+prebuilt developer packages (DLLs, import libraries, headers) on the\r
+above website.\r
+\r
+Multi-threaded use of GTK+ on Win32\r
+===================================\r
+\r
+Multi-threaded GTK+ programs might work on Windows in special simple\r
+cases, but not in general. Sorry. If you have all GTK+ and GDK calls\r
+in the same thread, it might work. Otherwise, probably not at\r
+all. Possible ways to fix this are being investigated.\r
+\r
+Wintab\r
+======\r
+\r
+The tablet support uses the Wintab API. The Wintab development kit is\r
+no longer required. The wintab.h header file is bundled with GTK+\r
+sources. Unfortunately it seems that only Wacom tablets come with\r
+support for the Wintab API nowadays.\r
+\r
+--Tor Lillqvist <tml@iki.fi>, <tml@novell.com>\r
+--Updated by Fan, Chun-wei <fanc999@yahoo.com.tw>\r