cross compiling gtk cairo clock example

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi...

I've written a script that downloads and intalls the current mingw
cross compiler and downloads and builds a simple gtk/cairo example
from http://gnomejournal.org/article/34 and I thought it would be useful
to readers of this list.  It seems to work on my fedora core 5 box and
generate a clock.exe file that I can run under wine (I don't have a
Windows system).  Before running it, I created a directory /opt/cross-tools
and made it writable.  I also installed the gcc32 compiler since
gcc4 seems to choke building older versions of binutils and gcc.
Below is the script for your reading pleasure.  If anybody sees
anything stupid that I've done, please respond.

#!/bin/bash
export CC=gcc32

mkdir /tmp/mingwtmp
cd /tmp/mingwtmp
wget http://www.libsdl.org/extras/win32/cross/build-cross.sh

#update script to "current" versions of gcc, mingw-runtime, binutils, and w32api
#also, force use of gcc32
#(fedora users can get this using "yum install compat-gcc-32.i386")
cat build-cross.sh | sed 's/\/usr\/local\/cross-tools/\/opt\/cross-tools/' | \
   sed 's/3.4.1-20040711-1/3.4.2-20040916-1/' | \
   sed 's/mingw-runtime-3.3/mingw-runtime-3.9/' | \
   sed 's/# where does it go?/export CC=gcc32/' | \
   sed 's/2.15.90-20040222-1/2.15.91-20040904-1/' | \
   sed 's/w32api-2.5/w32api-3.6/' > build-cross-new.sh

chmod u+x build-cross-new.sh
./build-cross-new.sh

mkdir /tmp/gtkwin32tmp
cd /tmp/gtkwin32tmp

wget ftp://ftp.gtk.org/pub/gtk/v2.8/win32/atk-1.10.3.zip
wget ftp://ftp.gtk.org/pub/gtk/v2.8/win32/atk-dev-1.10.3.zip
wget ftp://ftp.gtk.org/pub/gtk/v2.8/win32/cairo-1.2.4.zip
wget ftp://ftp.gtk.org/pub/gtk/v2.8/win32/cairo-dev-1.2.4.zip
wget ftp://ftp.gtk.org/pub/gtk/v2.8/win32/glib-2.8.6.zip
wget ftp://ftp.gtk.org/pub/gtk/v2.8/win32/glib-dev-2.8.6.zip
wget ftp://ftp.gtk.org/pub/gtk/v2.8/win32/gtk+-dev-2.8.20.zip
wget ftp://ftp.gtk.org/pub/gtk/v2.8/win32/pango-1.10.3.zip
wget ftp://ftp.gtk.org/pub/gtk/v2.8/win32/pango-dev-1.10.3.zip
wget ftp://ftp.gtk.org/pub/gtk/v2.8/win32/gtk+-2.8.20.zip


wget ftp://ftp.gtk.org/pub/gtk/v2.8/win32/dependencies/fontconfig-2.2.2-20040412.zip wget ftp://ftp.gtk.org/pub/gtk/v2.8/win32/dependencies/fontconfig-dev-2.2.2-20040412.zip
wget ftp://ftp.gtk.org/pub/gtk/v2.8/win32/dependencies/freetype-2.1.10.zip
wget ftp://ftp.gtk.org/pub/gtk/v2.8/win32/dependencies/gettext-0.14.5.tar.gz
wget ftp://ftp.gtk.org/pub/gtk/v2.8/win32/dependencies/gettext-0.14.5.zip
wget ftp://ftp.gtk.org/pub/gtk/v2.8/win32/dependencies/gettext-dev-0.14.5.zip wget ftp://ftp.gtk.org/pub/gtk/v2.8/win32/dependencies/libiconv-1.9.1.bin.woe32.zip
wget ftp://ftp.gtk.org/pub/gtk/v2.8/win32/dependencies/libiconv-1.9.1.tar.gz
wget ftp://ftp.gtk.org/pub/gtk/v2.8/win32/dependencies/libpng-1.2.8-bin.zip
wget ftp://ftp.gtk.org/pub/gtk/v2.8/win32/dependencies/pkg-config-0.20.zip
wget ftp://ftp.gtk.org/pub/gtk/v2.8/win32/dependencies/zlib123-dll.zip

wget http://www.gnome.org/~davyd/gnome-journal-cairo-article/clock-ex3.c
wget http://www.gnome.org/~davyd/gnome-journal-cairo-article/clock.h
wget http://www.gnome.org/~davyd/gnome-journal-cairo-article/main.c


cd /opt/cross-tools/i386-mingw32msvc/
for i in /tmp/gtkwin32tmp/*.zip
do
unzip $i
done

#
for i in lib/pkgconfig/*.pc
do
cat $i  |sed 's/prefix=c:.\+/prefix=\/opt\/cross-tools\/i386-mingw32msvc/' \
   > $i.tmp
/bin/mv $i.tmp $i
done


export PKG_CONFIG_PATH=/opt/cross-tools/i386-mingw32msvc/lib/pkgconfig

cd /tmp/gtkwin32tmp
/opt/cross-tools/bin/i386-mingw32msvc-gcc -o clock.exe \
   `pkg-config --cflags gtk+-2.0` clock-ex3.c main.c clock.h \
   `pkg-config --libs gtk+-2.0`

_________________________________________________________________
Windows Live Spaces is here! It?s easy to create your own personal Web site. http://spaces.live.com/signup.aspx

_______________________________________________
gtk-list mailing list
gtk-list@xxxxxxxxx
http://mail.gnome.org/mailman/listinfo/gtk-list

[Index of Archives]     [Touch Screen Library]     [GIMP Users]     [Gnome]     [KDE]     [Yosemite News]     [Steve's Art]

  Powered by Linux