Commit 17f9ba3a authored by Tor Lillqvist's avatar Tor Lillqvist

Update README.win32

parent abf088f1
The Win32 backend in GTK+ is not as stable or correct as the X11 one. The Win32 backend in GTK+ is not as stable or correct as the X11 one.
For prebuilt runtime and developer packages see For prebuilt runtime and developer packages see
http://ftp.gnome.org/pub/gnome/binaries/win32/ http://ftp.gnome.org/pub/gnome/binaries/win32/
Building GTK+ on Win32 Building GTK+ on Win32
====================== ======================
First you obviously need developer packages for the compile-time First you obviously need developer packages for the compile-time
dependencies: Pango, atk, glib, gettext-runtime, libiconv, libpng, dependencies: Pango, atk, glib, gettext-runtime, libiconv, libpng,
zlib, libtiff at least. See zlib, libtiff at least. See
http://ftp.gnome.org/pub/gnome/binaries/win32/dependencies . http://ftp.gnome.org/pub/gnome/binaries/win32/dependencies .
After installing the dependencies, there are two ways to build GTK+ After installing the dependencies, there are two ways to build GTK+
for win32. for win32.
1) GNU tools, ./configure && make install 1) GNU tools, ./configure && make install
----------------------------------------- -----------------------------------------
This requires you have mingw and MSYS. This requires you have mingw and MSYS.
Use the configure script, and the resulting Makefiles (which use Use the configure script, and the resulting Makefiles (which use
libtool and gcc to do the compilation). I use this myself, but it can libtool and gcc to do the compilation). I use this myself, but it can
be hard to setup correctly. be hard to setup correctly.
The full script I run to build GTK+ 2.10 unpacked from a source The full script I run to build GTK+ 2.16 unpacked from a source
distribution is as below. This is from bulding GTK+ 2.10.9, slightly distribution is as below. This is from bulding GTK+ 2.16.5. I don't
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
use any script like this to build the development branch, as I don't distribute any binaries from development branches.
distribute any binaries from development branches.
# This is a shell script that calls functions and scripts from
MOD=gtk+ # tml@iki.fi's personal work envronment. It is not expected to be
VER=2.10.9 # usable unmodified by others, and is included only for reference.
THIS=$MOD-$VER
HEX=`echo $THIS | md5sum | cut -d' ' -f1` MOD=gtk+
TARGET=c:/devel/target/$HEX VER=2.16.5
DEPS="`/devel/src/tml/latest.sh glib atk cairo pango`" REV=1
sed -e 's/need_relink=yes/need_relink=no # no way --tml/' <ltmain.sh >ltmain.temp && mv ltmain.temp ltmain.sh ARCH=win32
usedev
usemsvs6 THIS=${MOD}_${VER}-${REV}_${ARCH}
MY_PKG_CONFIG_PATH=""
for D in $DEPS; do RUNZIP=${MOD}_${VER}-${REV}_${ARCH}.zip
PATH=/devel/dist/$D/bin:$PATH DEVZIP=${MOD}-dev_${VER}-${REV}_${ARCH}.zip
MY_PKG_CONFIG_PATH=/devel/dist/$D/lib/pkgconfig:$MY_PKG_CONFIG_PATH
done HEX=`echo $THIS | md5sum | cut -d' ' -f1`
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 && TARGET=c:/devel/target/$HEX
libtoolcacheize &&
unset MY_PKG_CONFIG_PATH && usedev
PATH=/devel/target/$HEX/bin:.libs:$PATH make install && usemsvs6
(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) && set -x
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 && DEPS=`latest --arch=${ARCH} glib atk cairo pango libpng zlib libtiff jpeg`
mv $TARGET/etc/gtk-2.0/gdk-pixbuf.loaders.temp $TARGET/etc/gtk-2.0/gdk-pixbuf.loaders && PROXY_LIBINTL=`latest --arch=${ARCH} proxy-libintl`
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 && PKG_CONFIG_PATH=
./gtk-zip.sh && for D in $DEPS; do
(cd /devel/src/tml && zip /tmp/$MOD-dev-$VER.zip make/$THIS.make) && PATH=/devel/dist/${ARCH}/$D/bin:$PATH
manifestify /tmp/$MOD*-$VER.zip [ -d /devel/dist/${ARCH}/$D/lib/pkgconfig ] && PKG_CONFIG_PATH=/devel/dist/${ARCH}/$D/lib/pkgconfig:$PKG_CONFIG_PATH
done
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 LIBPNG=`latest --arch=${ARCH} libpng`
machine. For instance the "latest.sh" script, the "usedev" and ZLIB=`latest --arch=${ARCH} zlib`
"usemsvs6" shell functions, the /devel/dist folder. The above script LIBTIFF=`latest --arch=${ARCH} libtiff`
is really just meant for reference, to give an idea. You really need JPEG=`latest --arch=${ARCH} jpeg`
to understand what things like PKG_CONFIG_PATH are and set them up
properly after installing the dependencies before building GTK+. patch -p0 <<'EOF'
EOF
As you see above, after running configure, one can just say "make
install", like on Unix. A post-build fix is needed, running lt_cv_deplibs_check_method='pass_all' \
gdk-pixbuf-query-loaders once more to get a correct gdk-pixbuf.loaders CC='gcc -mtune=pentium3 -mthreads' \
file. CPPFLAGS="-I/devel/dist/${ARCH}/${LIBPNG}/include \
-I/devel/dist/${ARCH}/${ZLIB}/include \
2) Microsoft's tools -I/devel/dist/${ARCH}/${LIBTIFF}/include \
-------------------- -I/devel/dist/${ARCH}/${JPEG}/include \
-I/devel/dist/${ARCH}/${PROXY_LIBINTL}/include" \
Use the Microsoft compiler, cl and Make, nmake. Say nmake -f LDFLAGS="-L/devel/dist/${ARCH}/${LIBPNG}/lib \
makefile.msc in gdk and gtk. Be prepared to manually edit various -L/devel/dist/${ARCH}/${ZLIB}/lib \
makefile.msc files, and the makefile snippets in build/win32. -L/devel/dist/${ARCH}/${LIBTIFF}/lib \
-L/devel/dist/${ARCH}/${JPEG}/lib \
Alternative 1 also generates Microsoft import libraries (.lib), if you -L/devel/dist/${ARCH}/${PROXY_LIBINTL}/lib -Wl,--exclude-libs=libintl.a \
have lib.exe available. It might also work for cross-compilation from -Wl,--enable-auto-image-base" \
Unix. LIBS=-lintl \
CFLAGS=-O2 \
I use method 1 myself. Hans Breuer has been taking care of the MSVC ./configure \
makefiles. At times, we disagree a bit about various issues, and for --with-gdktarget=win32 \
instance the makefile.msc files might not produce identically named --disable-gdiplus \
DLLs and import libraries as the "autoconfiscated" makefiles and --with-included-immodules \
libtool do. If this bothers you, you will have to fix the makefiles. --without-libjasper \
--enable-debug=yes \
Using GTK+ on Win32 --enable-explicit-deps=no \
=================== --disable-gtk-doc \
--disable-static \
To use GTK+ on Win32, you also need either one of the above mentioned --prefix=$TARGET &&
compilers. Other compilers might work, but don't count on it. Look for
prebuilt developer packages (DLLs, import libraries, headers) on the libtoolcacheize &&
above website. rm gtk/gtk.def &&
(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)) &&
Multi-threaded use of GTK+ on Win32
=================================== PATH="/devel/target/$HEX/bin:$PATH" gdk-pixbuf-query-loaders >/devel/target/$HEX/etc/gtk-2.0/gdk-pixbuf.loaders &&
Multi-threaded GTK+ programs might work on Windows in special simple 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 &&
cases, but not in general. Sorry. If you have all GTK+ and GDK calls mv $TARGET/etc/gtk-2.0/gdk-pixbuf.loaders.temp $TARGET/etc/gtk-2.0/gdk-pixbuf.loaders &&
in the same thread, it might work. Otherwise, probably not at grep -v -E 'Automatically generated|Created by|ModulesPath =' <$TARGET/etc/gtk-2.0/gtk.immodules >$TARGET/etc/gtk-2.0/gtk.immodules.temp &&
all. Possible ways to fix this are being investigated. mv $TARGET/etc/gtk-2.0/gtk.immodules.temp $TARGET/etc/gtk-2.0/gtk.immodules &&
Wintab ./gtk-zip.sh &&
======
mv /tmp/${MOD}-${VER}.zip /tmp/$RUNZIP &&
The tablet support uses the Wintab API. The Wintab development kit is mv /tmp/${MOD}-dev-${VER}.zip /tmp/$DEVZIP
no longer required. The wintab.h header file is bundled with GTK+
sources. Unfortunately it seems that only Wacom tablets come with ) 2>&1 | tee /devel/src/tml/packaging/$THIS.log
support for the Wintab API nowadays.
(cd /devel && zip /tmp/$DEVZIP src/tml/packaging/$THIS.{sh,log}) &&
--Tor Lillqvist <tml@iki.fi>, <tml@novell.com> manifestify /tmp/$RUNZIP /tmp/$DEVZIP
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" command, 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.
For a 64-bit build you need to remove the gtk/gtk.def file and let it
be regenerated by the makefilery. This is because the 64-bit GTK dll
has a slightly different list of exported function names. This is on
purpose and not a bug. The API is the same at the source level, and
the same #defines of some function names to actually have a _utf8
suffix is used (just to keep the header simpler). But the
corresponding non-suffixed function to maintain ABI stability are not
needed in the 64-bit case (because there are no older EXEs around that
would require such for ABI stability).
2) Microsoft's tools
--------------------
Use the Microsoft compiler, cl and Make, nmake. Say nmake -f
makefile.msc in gdk and gtk. Be prepared to manually edit various
makefile.msc files, and the makefile snippets in build/win32.
Alternative 1 also generates Microsoft import libraries (.lib), if you
have lib.exe available. It might also work for cross-compilation from
Unix.
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
libtool do. If this bothers you, you will have to fix the makefiles.
Using GTK+ on Win32
===================
To use GTK+ on Win32, you also need either one of the above mentioned
compilers. Other compilers might work, but don't count on it. Look for
prebuilt developer packages (DLLs, import libraries, headers) on the
above website.
Multi-threaded use of GTK+ on Win32
===================================
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.
Wintab
======
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.
--Tor Lillqvist <tml@iki.fi>, <tml@novell.com>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment