FYI: The scripts I use to build GTK+ for Win32
- From: Tor Lillqvist <tml iki fi>
- To: gtk-devel-list gnome org
- Subject: FYI: The scripts I use to build GTK+ for Win32
- Date: Fri, 11 May 2007 02:21:55 +0300
Poked by arc (Alberto Ruiz) on IRC, here is a description of the
(totally homegrown and not really meant to be used as such by others)
mechanism I use to build GTK+ etc.
The top-level script, one for each package and version, has a name
like gtk+-2.10.11.make. Here is that gtk+-2.10.11.make script, with
blank lines and verbose comments added:
================cut here================
# First identify what this script is building. These shell variables
# have no meaning outside this script.
MOD=gtk+
VER=2.10.11
THIS=$MOD-$VER
# I use a randomish hex digit string in the path passed as --prefix to
# configure to hopefully make it more clear that this is just a
# temporaryish path used on the build system, not something that is
# expected to exist on the end-user systems.
HEX=`echo $THIS | md5sum | cut -d' ' -f1`
TARGET=c:/devel/target/$HEX
# Here I get the list of dependencies. The latest.sh script outputs
# a single line of text, like:
# glib-2.12.12 atk-1.18.0 cairo-1.4.2 pango-1.16.4
# This list will then be used below to add the paths of the "bin"
# folders of the corresponding binary distributions to PATH, and to
# the add the paths of the "lib/pkgconfig" folders to PKG_CONFIG_PATH.
# latest.sh uses just a single file listing the latest stable version
# of each package. No recursive dependencies handled. For the higher
# level GNOME packages I have to list the closure of dependencies
# here.
# For instance, in evolution-2.8.2.make, I have:
# DEPS=`/devel/src/tml/latest.sh glib atk cairo pango gtk+ libglade libIDL ORBit2 libbonobo GConf libbonoboui gnome-mime-data libgnome libgnomeui gnome-vfs libsoup evolution-data-server gnome-icon-theme libgnomeprint libgnomeprintui libart_lgpl libgnomecanvas gail gtkhtml`
DEPS="`/devel/src/tml/latest.sh glib atk cairo pango`"
# I don't want libtool to do its "relink" stuff, as it makes building
# even slower, and also is unnecessary IMHO. I think I have even seen
# it cause hard to understand build problems earlier. So I edit the
# ltmain.sh script (from the gtk+ tarball).
sed -e 's/need_relink=yes/need_relink=no # no way --tml/' <ltmain.sh >ltmain.temp && mv ltmain.temp ltmain.sh
# The usedev and usemsvs6 shell functions set up the PATH,
# PKG_CONFIG_PATH and ACLOCAL_FLAGS environment variables for a basic
# development environment with mingw32, various gnuwin32 packages, and
# other necessary things, but no GTK+ or GNOME-related stuff.
# ACLOCAL_FLAGS of course isn't used when running a configure script,
# but I use the same shell functions also when building stuff from SVN
# and running autogen.sh scripts
# usemsvs6 adds MSVC6 to PATH etc, needed here only to get lib.exe
# from MSVC6, which is used to produce the import libraries (.lib
# files) included in the developer package for MSVC users.
usedev
usemsvs6
# Add the "bin" folders of the dependencies listed above to PATH, and
# the "lib/pkgconfig" folders to PKG_CONFIG_PATH.
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
# Then run the configure script. I explicitly pass in -I flags in
# CFLAGS and -L flags in LDFLAGS pointing to where I have various
# dependencies not handled by the latest.sh mechanism.
# The -mthreads option doesn't do awfully much in a C compilation, but
# should still be used when building code that potentially could be
# used from multiple threads. (On the other hand, the actual
# GUI-related GTK+ functions will not work if used from multiple
# threads on Win32, so it's kinda pointless, but shouldn't hurt
# anyway.)
# The --enable-auto-image-base is used to get a randomized base
# address for DLLs. This is the default (if I recall correctly) in
# more recent libtools, but the one packaged in the gtk+ tarball
# packager would use a fixed base address otherwise, causing all DLLs
# to need relocation at run-time, which adds some (minimal) overhead.
# The --with-wintab and --with-ie55 switches are needed to get Wintab
# and ActiveIMM support in the stable branch. In trunk, wintab support
# gets compiled in always (the required header file is
# redistributable, and included in GTK+ sources in trunk), and
# ActiveIMM support has been removed (because it was something for
# Win9x and NT4 only).
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 --with-wintab=/devel/src/wtkit126 --with-ie55=/devel/src/workshop/ie55_lib --enable-debug=yes --disable-gtk-doc --disable-static --prefix=$TARGET &&
# libtool-cache is a nifty method to speed up libtool. See
# http://libtool-cache.sourceforge.net/
libtoolcacheize &&
unset MY_PKG_CONFIG_PATH &&
# Then run a make install. I'm not sure if adding .libs to PATH
# actually is necessary, it's just a leftover, I should check whether
# it does anything useful currently or not.
PATH=/devel/target/$HEX/bin:.libs:$PATH make install &&
# Then strip the produces dlls and exes to minimize their size
(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) &&
# Run gdk-pixbuf-query-loaders once more, as for some reason when it
# is run as part of make install it produces and empty
# gdk-pixbuf.loaders file
PATH=$TARGET/bin:$PATH gdk-pixbuf-query-loaders >$TARGET/etc/gtk-2.0/gdk-pixbuf.loaders &&
# Edit IMHO unnecessary comments out of gdk-pixbuf.loaders and gtk.immodules
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 &&
# Create the zip files
./gtk-zip.sh &&
# Add *this* script to the dev zip file, for documentation purposes
(cd /devel/src/tml && zip /tmp/$MOD-dev-$VER.zip make/$THIS.make) &&
# Add a manifest file to the zip files
manifestify /tmp/$MOD*-$VER.zip
================cut here================
Now for the other scripts and shell functions called by the above:
This is latest.sh, pretty straightforward /bin/sh code:
================cut here================
#!/bin/sh
result=""
for i in $*; do
gotit=""
while read module version morestuff; do
[ $i = $module ] && {
result="$result $module-$version"
gotit=y
}
done < /devel/dist/LATEST
[ "$gotit" ] || echo Module $i not found >&2
done
echo $result
exit 0
================cut here================
This is the LATEST file read by latest.sh:
================cut here================
GConf 2.18.0.1
ORBit2 2.14.7
atk 1.18.0
cairo 1.4.2
evolution 2.8.2
evolution-exchange 2.8.0-tml
evolution-data-server 1.8.2
expat 2.0.0
fontconfig 2.4.2-tml-20070301
freetype 2.2.1
gail 1.18.0
gettext 0.14.5
glib 2.12.12
gnome-common 2.11.0
gnome-icon-theme 2.18.0
gnome-mime-data 2.4.2
gnome-vfs 2.18.0.1
gtk+ 2.10.11
gtkhtml 3.14.0
gtksourceview 1.8.5
hicolor-icon-theme 0.9
icon-naming-utils 0.8.1
intltool 0.35.0
libIDL 0.8.8
libart_lgpl 2.3.19
libbonobo 2.18.0
libbonoboui 2.18.0
libcroco 0.6.1
libglade 2.6.0
libgnome 2.18.0
libgnomecanvas 2.14.0
libgnomeprint 2.12.1
libgnomeprintui 2.12.1
libgnomeui 2.16.1
libgnurx 2.5
libgsf 1.14.3
libgsf-gnome 1.14.3
libiconv 1.9.1
libjpeg 6b-4
libpng 1.2.8
librsvg 2.16.1
libsoup 2.2.100
libxml2 2.6.27
mozilla-nspr 4.6-winnt-opt
mozilla-nss 3.10-winnt-opt
pango 1.16.4
popt 1.10.2-tml-20050828
pthreads-win32 2.7.0
shared-mime-info 0.16 export XDG_DATA_HOME=$D/share
zenity 2.16.0
zlib 1.2.3
================cut here================
Here are the usedev and usemsvs6 shell functions, and functions they call:
================cut here================
function usedev() {
usebase
PATH="/opt/mingw/bin:/opt/gnu/bin:/opt/misc/bin:/opt/gnuwin32/bin:/opt/mozilla/bin:$PATH"
PKG_CONFIG_PATH=/opt/gnuwin32/lib/pkgconfig:/opt/misc/lib/pkgconfig
ACLOCAL_FLAGS="-I /opt/misc/share/aclocal -I /opt/gnu/share/aclocal -I /opt/gnuwin32/share/aclocal"
}
function usebase() {
PATH="$BASEPATH"
export PKG_CONFIG_PATH=
export ACLOCAL_FLAGS=
export LIBGLADE_MODULE_PATH=
export BONOBO_ACTIVATION_PATH=
unset LIB
unset INCLUDE
}
function usemsvs6() {
PATH="/opt/MSVS6/VC98/Bin:/opt/MSVS6/Common/MSDev98/Bin:/opt/MSVS6/Common/Tools:$PATH"
export INCLUDE='c:\opt\MSVS6\VC98\Include'
export LIB='c:\opt\MSVS6\VC98\Lib'
}
================cut here================
This is the manifestify script:
================cut here================
#!/bin/sh
T=/tmp/$$
mkdir -p $T/manifest
for F in $*; do
(
case $F in
*.zip)
(
B=`basename $F`
BB=`basename $B .zip`
case $F in
/*) ;;
*) cd `dirname $F`; F=$PWD/$B;;
esac
cd `dirname $F`
D=$PWD
unzip -l $B > $T/manifest/$BB.mft
cd $T
zip $F manifest/$BB.mft
N=`unzip -l $F | wc -l | sed -e 's/^ *\([0-9]*\).*/\1/'`
cd $D
Nm1=`expr $N - 1`
unzip -l $B | sed -e "1,3 d" -e "$Nm1,$N d" | awk '{print $4}' | grep -v -E '/$'> $T/manifest/$BB.mft
cd $T
zip $F manifest/$BB.mft
)
;;
*)
echo Not a zip file: $F
;;
esac
)
done
rm -rf $T
================cut here================
That's it. Feel free to ask for more information (on this list).
--tml
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]