Code

* packaging/macosx/native-gtk/build-gtk.sh: Further fixes for stable builds.
[inkscape.git] / packaging / macosx / native-gtk / build-gtk.sh
1 #!/bin/sh
2 #
3 # Based on the Imendio 'build-gtk.sh' script.
4 #
5 # Inkscape build additions by Michael Wybrow <mjwybrow@users.sf.net>
6 #
7 # See the following page for build instructions:
8 # http://developer.imendio.com/projects/gtk-macosx/build-instructions
9 #
10 # Usage:
11 # export PREFIX=/your/install/prefix
12 # ./build-gtk bootstrap
13 # ./build-gtk build inkscape
14 #
16 # XXX: Check for xargs with -i
17 #
18 # In lib/pkgconfig/freetpe2.pc
19 #
20 # -  Libs: -L${libdir} -lfreetype -lz
21 # +  Libs: -L${libdir} -lfreetype -lz -Wl,-framework,CoreServices,-framework,ApplicationServices 
22 #
23 # bin/freetype-config
24 #
25 # -  libs="-lfreetype -lz"
26 # +  libs="-lfreetype -lz -Wl,-framework,CoreServices,-framework,ApplicationServices"
27 #
28 # In lib/pkgconfig/fontconfig.pc
29 #       Add -lexpat
30 #       
32 version=1.3.1-inkscape
34 export PREFIX=${PREFIX-/opt/gtk}
35 export PATH=$PREFIX/bin:/usr/bin:$PATH
36 #export PATH=$PREFIX/bin:/bin:/sbin:/usr/bin:/usr/sbin:/usr/X11R6/bin:
37 export LIBTOOLIZE=$PREFIX/bin/libtoolize
39 # FIXME: We might need some more intelligent way to get the path here.
40 export PYTHONPATH=$PREFIX/lib/python2.3/site-packages
42 # Needed for glib etc to pick up gettext
43 export LDFLAGS=-L$PREFIX/lib
44 export CPPFLAGS=-I$PREFIX/include
46 export XDG_DATA_DIRS=$PREFIX/share
48 COMMON_OPTIONS="--prefix=$PREFIX --disable-static --enable-shared \
49 --disable-gtk-doc --disable-scrollkeeper"
51 #export MAKEFLAGS=-j2
53 if [ "x$PANTHER_BUILD" = "xYes" ]; then
54     # XXX: Check the machine is PPC
55     #      or rework to have things like pkg-config built natively.
57     # Overwrite some build settings.
58     export SDK="/Developer/SDKs/MacOSX10.3.9.sdk"
59     export MACOSX_DEPLOYMENT_TARGET=10.3
60     export CFLAGS="-isysroot ${SDK} -arch ppc"
61     export CXXFLAGS="-isysroot ${SDK} -arch ppc"
63     export STABLE_BUILD=Yes
64 fi
66 if [ "x$UNIVERSAL_BUILD" = "xYes" ]; then
67     COMMON_OPTIONS="$COMMON_OPTIONS --disable-dependency-tracking"
69     export SDK="/Developer/SDKs/MacOSX10.4u.sdk"
70     export MACOSX_DEPLOYMENT_TARGET=10.4
71     #export MACOSX_DEPLOYMENT_TARGET_i386=10.4
72     #export MACOSX_DEPLOYMENT_TARGET_ppc=10.3
73     export CFLAGS="-isysroot ${SDK} -arch ppc -arch i386"
74     export CXXFLAGS="-isysroot ${SDK} -arch ppc -arch i386"
76     CONFIGURE_pkg_config="--with-pc-path=$PREFIX/lib/pkgconfig:/usr/X11R6/lib/pkgconfig --enable-indirect-deps --disable-dependency-tracking"
78     CONFIGURE_libpng="--disable-dependency-tracking"
79     PRECONFIGURE_libpng="eval CPPFLAGS='$CPPFLAGS -DPNG_NO_ASSEMBLER_CODE'"
80     
81     CONFIGURE_tiff="--disable-dependency-tracking"
83     POSTCONFIGURE_jpeg_6b="patch_libtool_dylib"
84     
85     CONFIGURE_gc="--disable-dependency-tracking"
86     POSTCONFIGURE_gc="patch_libtool_dylib"
87     PRECONFIGURE_gc="eval CFLAGS='$CFLAGS -DUSE_GENERIC_PUSH_REGS'"
88     
89     POSTCONFIGURE_freetype="eval cd builds/unix/ && pwd && patch_libtool_dylib && cd ../.."
91     CONFIGURE_fontconfig="--disable-dependency-tracking --disable-docs"
92     POSTCONFIGURE_fontconfig="eval cd fc-arch && make all && cd .. && perl -pi~ -e 's|#define FC_ARCHITECTURE \"x86\"|#ifdef __ppc__\n#define FC_ARCHITECTURE \"ppc\"\n#else\n#define FC_ARCHITECTURE \"x86\"\n#endif|g' fc-arch/fcarch.h"
94     CONFIGURE_cairo="--disable-dependency-tracking --enable-shared --disable-quartz --disable-atsui --enable-glitz"
95     POSTCONFIGURE_cairo="patch_libtool_dylib"
96     
97     CONFIGURE_glitz="--disable-dependency-tracking"
99     CONFIGURE_lcms="--disable-dependency-tracking"
100     
101     CONFIGURE_glib="$COMMON_OPTIONS"
102     POSTCONFIGURE_glib="eval make glibconfig.h config.h && cp ~/ws-fat/{glib,}config.h ."
103     #POSTCONFIGURE_glib="eval make glibconfig.h && perl -pi~ -e 's|#define G_BYTE_ORDER G_LITTLE_ENDIAN|#include <machine/endian.h>\n#define G_BYTE_ORDER __DARWIN_BYTE_ORDER|g' glibconfig.h"
104     
105     CONFIGURE_pango="$COMMON_OPTIONS"
106     POSTCONFIGURE_pango="eval perl -pi~ -e 's|SUBDIRS = pango modules examples docs tools tests|SUBDIRS = pango modules docs tools tests|g' Makefile && perl -pi~ -e 's|harfbuzz_dump_LDADD = |harfbuzz_dump_LDADD = -Xlinker -framework -Xlinker CoreServices -Xlinker -framework -Xlinker ApplicationServices|g' pango/opentype/Makefile"
107     
108     CONFIGURE_gtk="$COMMON_OPTIONS"
110     CONFIGURE_atk="$COMMON_OPTIONS"
111     
112     CONFIGURE_libxml2="$COMMON_OPTIONS"
113     
114     CONFIGURE_libsigc="$COMMON_OPTIONS"
115     POSTCONFIGURE_libsigc="patch_libtool_dylib"
116     
117     CONFIGURE_glibmm="$COMMON_OPTIONS"
118     
119     CONFIGURE_cairomm="$COMMON_OPTIONS"
120     
121     CONFIGURE_gtkmm="$COMMON_OPTIONS --disable-examples --disable-demos"
122     POSTCONFIGURE_gtkmm="patch_libtool_dylib"
123     
124     CONFIGURE_libxslt="$COMMON_OPTIONS"
125     
126     CONFIGURE_popt="$COMMON_OPTIONS"
127     POSTCONFIGURE_popt="patch_libtool_dylib"
128 elif [ "x$STABLE_BUILD" = "xYes" ]; then
129     COMMON_OPTIONS="$COMMON_OPTIONS --disable-dependency-tracking"
131     CONFIGURE_pkg_config="--with-pc-path=$PREFIX/lib/pkgconfig:/usr/X11R6/lib/pkgconfig --enable-indirect-deps --disable-dependency-tracking"
133     CONFIGURE_libpng="--disable-dependency-tracking"
134     
135     CONFIGURE_tiff="--disable-dependency-tracking"
137     CONFIGURE_gc="--disable-dependency-tracking"
138     
139     CONFIGURE_fontconfig="--disable-dependency-tracking --disable-docs"
141     CONFIGURE_cairo="--disable-dependency-tracking --enable-shared --disable-quartz --disable-atsui --enable-glitz"
142     
143     CONFIGURE_glitz="--disable-dependency-tracking"
145     CONFIGURE_lcms="--disable-dependency-tracking"
146     
147     CONFIGURE_glib="$COMMON_OPTIONS"
148     
149     CONFIGURE_pango="$COMMON_OPTIONS"
150     POSTCONFIGURE_pango="eval perl -pi~ -e 's|SUBDIRS = pango modules examples docs tools tests|SUBDIRS = pango modules docs tools tests|g' Makefile && perl -pi~ -e 's|harfbuzz_dump_LDADD = |harfbuzz_dump_LDADD = -Xlinker -framework -Xlinker CoreServices -Xlinker -framework -Xlinker ApplicationServices|g' pango/opentype/Makefile"
151     
152     CONFIGURE_gtk="$COMMON_OPTIONS"
154     CONFIGURE_atk="$COMMON_OPTIONS"
155     
156     CONFIGURE_libxml2="$COMMON_OPTIONS"
157     
158     CONFIGURE_libsigc="$COMMON_OPTIONS"
159     
160     CONFIGURE_glibmm="$COMMON_OPTIONS"
161     
162     CONFIGURE_cairomm="$COMMON_OPTIONS"
163     
164     CONFIGURE_gtkmm="$COMMON_OPTIONS --disable-examples --disable-demos"
165     
166     CONFIGURE_libxslt="$COMMON_OPTIONS"
167     
168     CONFIGURE_popt="$COMMON_OPTIONS"
169 fi
172 # Support install-check from jhbuild to speed up compilation
173 if [ -x $PREFIX/bin/install-check ]; then
174     export INSTALL=$PREFIX/bin/install-check
175 fi
178 SOURCE=${SOURCE-$HOME/Source/gtk}
179 CAIROCVSROOT=${CAIROCVSROOT-:pserver:anoncvs@cvs.freedesktop.org:/cvs/cairo}
180 INKSCAPESVNURL="https://svn.sourceforge.net/svnroot/inkscape"
181 GNOMESVNURL=${GNOMESVNURL-https://svn.gnome.org/svn}
183 if [ x$1 = xrun ]; then
184     cmd="$2"
185     shift 2
186     exec $cmd $*
187 fi
189 if [ $# -eq 0 -o "x`echo "$*" | grep shell`" = xshell ]; then
190     # Can be used in .bashrc to set a fancy prompt...
191     export INSIDE_GTK_BUILD=1
192     bash
193     exit 0
194 fi
196 CORE_MODULES="glitz cairo gnome-common glib pango atk gtk+"
197 EXTRA_MODULES="libxml2 libxslt loudmouth libglade gossip gtk-engines"
198 PYGTK_MODULES=" pycairo pygobject pygtk"
199 INKSCAPE_MODULES="$CORE_MODULES libxml2 libxslt gc lcms libsig++ doxygen glibmm cairomm gtkmm popt inkscape"
201 # Could add those (orbit requires popt though)
202 MORE_MODULES="libIDL ORBit2 gconf"
204 function print_usage
206     echo
207     echo "GTK+ on Mac OS X build script version $version."
208     echo 
209     echo "Usage:"
210     echo "`basename $0` [bootstrap|[shell]|run <cmd>|build [<modules>]], modules are:"
211     echo " Core: $CORE_MODULES"
212     echo " Extra: $EXTRA_MODULES"
213     echo " Python: $PYGTK_MODULES"
214     echo " Inkscape: $INKSCAPE_MODULES"
215     echo
216     echo "Setup: This script defaults to downloading source to ~/Source/gtk and"
217     echo "installing in /opt/gtk. Make sure your user has write access to the"
218     echo "latter directory. You can override those directories by setting the"
219     echo "SOURCE and PREFIX environment variables. Anoncvs is used by default"
220     echo "for access to GNOME SVN, if you wish to override, set the environment"
221     echo "variable GNOMESVNURL to your own account."
222     echo
223     echo "While in the shell that this script provides, the environment variable"
224     echo "INSIDE_GTK_BUILD is set, which makes it possible to put something like"
225     echo "the following in ~/.bashrc:"
226     echo
227     echo " if [ x\$INSIDE_GTK_BUILD != x ]; then"
228     echo "     PS1=\"[GTK] \u@\h \W $ \""
229     echo " fi"
230     echo
231     echo "Start by bootstrapping. This will install the necessary build tools."
232     echo "Then build GTK+ & co by using the \"build\" command. If no modules are"
233     echo "specified, only the ones needed for GTK+ will be built. The special"
234     echo "modules \"core\" and \"all\" can be used to build just the core or all"
235     echo "modules."
236     echo
237     echo "If you want to build something manually or run something, use the "
238     echo "\"shell\" command (or no command) to get a shell with the environment"
239     echo "properly setup."
240     echo 
241     echo "Tip: if you build and install \"install-check\" from jhbuild into your"
242     echo "PREFIX, recompiling when hacking on GTK+ & co will be a lot faster."
243     echo
246 function download
248     BASENAME=`basename $1`
250     if [ -s $BASENAME ]; then
251         echo "Already downloaded"
252         return 0
253     fi
255     curl $1 > $BASENAME || return 1
257     return 0
260 function should_build
262     if [ -f $1/BUILT ]; then
263         echo "Already built"
264         return 1
265     fi
267     return 0
270 function tarball_get_and_build
272     BASENAME=`basename $1`
273     DIRNAME=`echo $BASENAME | sed -e s,.src.,., | sed -e s,.tar.*,,`
274     INSTCMD="make install"
275     PREFIXARG="--prefix=$PREFIX"
276     COMMONOPTS="$COMMON_OPTIONS"
277    
278     SHORTNAME=`echo $DIRNAME | sed -e s,-*[0-9\.]*$,,`
279     if !(echo "$MODULES" | grep -w $SHORTNAME) >/dev/null; then
280         return 0
281     fi
282     
283     echo
284     echo "Building $DIRNAME"
285     echo -ne "\033]0;Building $DIRNAME\007"
286     
287     # Special case jpeg... :/
288     if [ x`echo $DIRNAME | grep jpeg` != x ]; then
289         INSTCMD="make install-lib"
290     fi
291     
292     if [ x`echo $BASENAME | grep bz2` != x ]; then
293         COMP="j"
294     else
295         COMP="z"
296     fi
297     
298     # Doxygen doesn't have a standard configure script.
299     if [ x`echo $BASENAME | grep doxygen` != x ]; then
300         PREFIXARG="--prefix $PREFIX"
301         COMMONOPTS="--shared"
302     fi
303     
304     # Modify specific configure options
305     UNDERSCORENAME=`echo $SHORTNAME | sed -e s,-,_, | tr -d '+'`
306     CONFIGURE_EXTRA=`eval echo '\$'{CONFIGURE_$UNDERSCORENAME}`
307     if [ "x$CONFIGURE_EXTRA" != "x" ]; then
308         COMMONOPTS="$COMMONOPTS $CONFIGURE_EXTRA"
309     fi
310     PRECONFIGURE=`eval echo '\$'{PRECONFIGURE_$UNDERSCORENAME}`
311     if [ "x$PRECONFIGURE" == "x" ]; then
312         PRECONFIGURE="true"
313     fi
314     POSTCONFIGURE=`eval echo '\$'{POSTCONFIGURE_$UNDERSCORENAME}`
315     if [ "x$POSTCONFIGURE" == "x" ]; then
316         POSTCONFIGURE="true"
317     fi
318     
319     cd $SOURCE || return 1
320     download $1 || return 1
321     should_build $DIRNAME || return 0
322     tar ${COMP}xf $BASENAME && \
323         cd $DIRNAME && \
324         $PRECONFIGURE && \
325         echo "./configure $PREFIXARG $COMMONOPTS $2" && \
326         ./configure $PREFIXARG $COMMONOPTS $2 && \
327         $POSTCONFIGURE && \
328         make && $INSTCMD && touch BUILT
332 function cpan_get_and_build
334     BASENAME=`basename $1`
335     DIRNAME=`echo $BASENAME | sed -e s,.tar.*,,`
336     
337     SHORTNAME=`echo $DIRNAME | sed -e s,-*[0-9\.]*$,,`
338     if !(echo "$MODULES" | grep -w $SHORTNAME) >/dev/null; then
339         return 0
340     fi
341     
342     echo
343     echo "Building $DIRNAME"
344     echo -ne "\033]0;Building $DIRNAME\007"
345     
346     if [ x`echo $BASENAME | grep bz2` != x ]; then
347         COMP="j"
348     else
349         COMP="z"
350     fi
351     
352     cd $SOURCE || return 1
353     download $1 || return 1
354     should_build $DIRNAME || return 0
355     tar ${COMP}xf $BASENAME && \
356         cd $DIRNAME && \
357         perl Makefile.PL $2 && \
358         make && \
359         (echo "Enter your password to istall $BASENAME"; make install) && \
360         touch BUILT
363 function git_get_and_build
365     if !(echo "$MODULES" | grep -w $2) >/dev/null; then
366         return 0
367     fi
368     
369     echo
370     echo "Building $2"
371     echo -ne "\033]0;Building $2\007"
372     
373     cd $SOURCE
374     if [ -d $2 ]; then
375         cd $2
376         cg-update || return
377     else
378         cg-clone $1/$2 || return
379         cd $2
380     fi
381     
382     echo "./autogen.sh $COMMON_OPTIONS $3"
383     (./autogen.sh $COMMON_OPTIONS $3 && make && make install)
386 function cvs_get_and_build
388     if !(echo "$MODULES" | grep -w $2) >/dev/null; then
389         return 0
390     fi
391     
392     echo
393     echo "Building $2"
394     echo -ne "\033]0;Building $2\007"
395     
396     cd $SOURCE
397     if [ -d $2 ]; then
398         cd $2
399         cvs up -dP || return
400     else
401         cvs -d $1 co -P $2 || return
402         cd $2
403     fi
404     
405     echo "./autogen.sh $COMMON_OPTIONS $3"
406     (./autogen.sh $COMMON_OPTIONS $3 && make && make install)
409 function svn_get_and_build
411     if !(echo "$MODULES" | grep -w $2) >/dev/null; then
412         return 0
413     fi
414     
415     echo
416     echo "Building $2"
417     echo -ne "\033]0;Building $2\007"
418     
419     cd $SOURCE
420     if [ -d $2 ]; then
421         cd $2
422         svn up || return
423     else
424         svn co $1/$2/trunk $2 || return
425         cd $2
426     fi
427     
428     echo "./autogen.sh $COMMON_OPTIONS $3"
429     #(./autogen.sh $COMMON_OPTIONS $3 && ./configure --prefix=$PREFIX $COMMON_OPTIONS $3 && make && make install)
430     (./autogen.sh $COMMON_OPTIONS $3 && make && make install)
433 function set_automake
435     old_AUTOMAKE=$AUTOMAKE
436     old_ACLOCAL=$ACLOCAL
438     export AUTOMAKE=automake-$1
439     export ACLOCAL=aclocal-$1
442 function restore_automake
444     if [ x$old_AUTOMAKE != x ]; then
445         export AUTOMAKE=$old_AUTOMAKE
446     else
447         unset AUTOMAKE
448     fi
450     if [ x$old_ACLOCAL != x ]; then
451         export ACLOCAL=$old_ACLOCAL
452     else
453         unset ACLOCAL
454     fi
457 function do_exit
459     echo -ne "\033]0;\007"
460     exit
463 # Make sure to restore the title when done.
464 trap do_exit EXIT SIGINT SIGTERM
467 # configure doesn't pass CFLAGS through to generated libtool 
468 function patch_libtool_dylib()
470     # Only do this for universal builds.
471     if [ "x$UNIVERSAL_BUILD" != "xYes" ]; then
472         return 0
473     fi
475     cp libtool libtool.old
476     perl -pi -e "s@-dynamiclib@$CFLAGS \$&@" libtool
477     if test "x$1" = "xwithbundle"; then
478         perl -pi -e "s@-bundle@$CFLAGS \$&@" libtool
479     fi
483 function process_modules()
485     # Bootstrap packages.
486     PACKAGES=" \
487         http://pkgconfig.freedesktop.org/releases/pkg-config-0.21.tar.gz \
488         http://ftp.gnu.org/gnu/libtool/libtool-1.5.22.tar.gz \
489         http://ftp.gnu.org/gnu/autoconf/autoconf-2.61.tar.bz2 \
490         http://ftp.gnu.org/pub/gnu/automake/automake-1.7.9.tar.bz2 \
491         http://ftp.gnu.org/gnu/automake/automake-1.9.6.tar.bz2 \
492         http://heanet.dl.sourceforge.net/sourceforge/libpng/libpng-1.2.15.tar.bz2 \
493         ftp://ftp.remotesensing.org/pub/libtiff/tiff-3.8.2.tar.gz \
494         http://people.imendio.com/richard/gtk-osx/files/jpeg-6b.tar.gz \
495         http://ftp.gnu.org/gnu/gettext/gettext-0.16.tar.gz \
496         http://heanet.dl.sourceforge.net/sourceforge/expat/expat-2.0.0.tar.gz \
497         http://heanet.dl.sourceforge.net/sourceforge/freetype/freetype-2.3.0.tar.bz2 \
498         http://fontconfig.org/release/fontconfig-2.4.2.tar.gz \
499         http://people.imendio.com/richard/gtk-osx/files/docbook-files-1.tar.gz \
500         http://www.cs.mu.oz.au/~mjwybrow/gtk-osx/gnome-doc-utils-fake-1.tar.gz \
501         "
503         #http://people.imendio.com/richard/gtk-osx/files/popt-1.7.tar.gz
504     
505     for PACKAGE in $PACKAGES; do
506         tarball_get_and_build $PACKAGE || exit 1
507     done
509     PACKAGE=http://ftp.gnome.org/pub/GNOME/sources/gtk-doc/1.6/gtk-doc-1.6.tar.bz2
510     tarball_get_and_build $PACKAGE "--with-xml-catalog=$PREFIX/etc/xml/catalog" || exit 1
511     
512     PACKAGE=ftp://ftp4.freebsd.org/pub/FreeBSD/ports/distfiles/XML-Parser-2.34.tar.gz
513     cpan_get_and_build $PACKAGE "PREFIX=$PREFIX INSTALLDIRS=perl EXPATLIBPATH=$PREFIX/lib EXPATINCPATH=$PREFIX/include" || exit 1
515     PACKAGES=" \
516         http://ftp.gnome.org/pub/GNOME/sources/intltool/0.35/intltool-0.35.0.tar.bz2 \
517         http://icon-theme.freedesktop.org/releases/hicolor-icon-theme-0.9.tar.gz \
518         http://ftp.gnome.org/pub/GNOME/sources/gnome-icon-theme/2.14/gnome-icon-theme-2.14.2.tar.bz2 \
519         "
520     
521     for PACKAGE in $PACKAGES; do
522         tarball_get_and_build $PACKAGE || exit 1
523     done
526     # Other packages:
527     if [ "x$UNIVERSAL_BUILD" == "xYes" -o "x$STABLE_BUILD" = "xYes"  ];
528     then
529         tarball_get_and_build http://cairographics.org/snapshots/glitz-0.5.6.tar.gz || exit 1
530         tarball_get_and_build http://cairographics.org/releases/cairo-1.2.6.tar.gz || exit 1
531         tarball_get_and_build http://www.hpl.hp.com/personal/Hans_Boehm/gc/gc_source/gc6.8.tar.gz || exit 1
532         tarball_get_and_build http://www.littlecms.com/lcms-1.16.tar.gz || exit 1
533         tarball_get_and_build ftp://ftp.gtk.org/pub/glib/2.12/glib-2.12.9.tar.bz2 || exit 1
534         tarball_get_and_build ftp://ftp.gnome.org/mirror/gnome.org/sources/pango/1.14/pango-1.14.5.tar.bz2 || exit 1
535         tarball_get_and_build ftp://ftp.gnome.org/mirror/gnome.org/sources/atk/1.12/atk-1.12.4.tar.bz2 || exit 1
536         tarball_get_and_build ftp://ftp.gnome.org/mirror/gnome.org/sources/gtk+/2.10/gtk+-2.10.10.tar.bz2 || exit 1
537         tarball_get_and_build ftp://ftp.gnome.org/mirror/gnome.org/sources/libxml2/2.6/libxml2-2.6.26.tar.bz2 || exit 1
538         tarball_get_and_build ftp://ftp.gnome.org/mirror/gnome.org/sources/libsigc++/2.0/libsigc++-2.0.17.tar.bz2 || exit 1
539         tarball_get_and_build ftp://ftp.gnome.org/mirror/gnome.org/sources/glibmm/2.12/glibmm-2.12.4.tar.bz2 || exit 1
540         tarball_get_and_build http://cairographics.org/releases/cairomm-1.2.4.tar.gz || exit 1
541         tarball_get_and_build ftp://ftp.gnome.org/mirror/gnome.org/sources/gtkmm/2.10/gtkmm-2.10.6.tar.bz2 || exit 1
542         tarball_get_and_build ftp://ftp.gnome.org/mirror/gnome.org/sources/libxslt/1.1/libxslt-1.1.17.tar.bz2 || exit 1
543         tarball_get_and_build ftp://ftp.rpm.org/pub/rpm/dist/rpm-4.1.x/popt-1.7.tar.gz || exit 1
545         svn_get_and_build $INKSCAPESVNURL inkscape || exit 1
547         exit 0
548     else
549             git_get_and_build git://git.cairographics.org/git cairo "--enable-pdf --enable-atsui --enable-quartz --disable-xlib" || exit 1
551             tarball_get_and_build http://www.hpl.hp.com/personal/Hans_Boehm/gc/gc_source/gc6.7.tar.gz || exit 1
552             tarball_get_and_build ftp://ftp.gnome.org/mirror/gnome.org/sources/libsigc++/2.0/libsigc++-2.0.17.tar.gz || exit 1
553             tarball_get_and_build http://ftp.stack.nl/pub/users/dimitri/doxygen-1.5.1.src.tar.gz || exit 1
554             tarball_get_and_build ftp://ftp.rpm.org/pub/rpm/dist/rpm-4.1.x/popt-1.7.tar.gz || exit 1
555     fi
557     svn_get_and_build $GNOMESVNURL libxml2 || exit 1
558     svn_get_and_build $GNOMESVNURL libxslt || exit 1
559     svn_get_and_build $GNOMESVNURL gnome-common || exit 1
560     svn_get_and_build $GNOMESVNURL glib || exit 1
561     svn_get_and_build $GNOMESVNURL atk || exit 1
562     svn_get_and_build $GNOMESVNURL pango "--without-x" || exit 1
563     svn_get_and_build $GNOMESVNURL gtk+ "--with-gdktarget=quartz" || exit 1
564     svn_get_and_build $GNOMESVNURL gtk-engines || exit 1
565     svn_get_and_build $GNOMESVNURL loudmouth "--with-ssl=openssl" || exit 1
566     svn_get_and_build $GNOMESVNURL libglade || exit 1
567     # gossip needs xml2po from gnome-doc-utils.
568     svn_get_and_build $GNOMESVNURL gossip "--with-backend=cocoa" || exit 1
569     svn_get_and_build $CAIROCVSROOT pycairo || exit 1
570     svn_get_and_build $GNOMESVNURL pygobject "--disable-docs" || exit 1
571     svn_get_and_build $GNOMESVNURL pygtk "--disable-docs" || exit 1
573     svn_get_and_build $GNOMESVNURL glibmm "--disable-docs --disable-fulldocs" || exit 1
574     cvs_get_and_build $CAIROCVSROOT cairomm || exit 1
575     svn_get_and_build $GNOMESVNURL gtkmm "--disable-docs --disable-examples --disable-demos" || exit 1
577     svn_get_and_build $INKSCAPESVNURL inkscape || exit 1
580     #svn_get_and_build $GNOMESVNURL gimp || exit 1
581     # For gimp:
582     # libart_lgpl, needs automake 1.4 and doesn't run libtoolize
583     # gtkhtml2 (optional)
584     # libpoppler (optional)
585     # ./autogen.sh --prefix=/opt/gimp --disable-gtk-doc 
588 if (echo "$*" | grep bootstrap) >/dev/null; then
589     if [ "x`cg-version 2>/dev/null`" == "x" ]; then
590         echo "You need the cogito to get cairo from git. It's available e.g. in Darwin ports."
591         exit 1
592     fi
593     if [ "x`which svn 2>/dev/null`" == "x" ]; then
594         echo "You need the svn client to get inkscape."
595         exit 1
596     fi
597     
598     mkdir -p $SOURCE 2>/dev/null || \
599         (echo "Error: Couldn't create source checkout dir $SOURCE"; exit 1)
600     mkdir -p $PREFIX/bin 2>/dev/null || \
601         (echo "Error: Couldn't create bin dir $PREFIX/bin"; exit 1)
602     
603     echo "Building bootstrap packages."
604  
605     MODULES="pkg-config libtool autoconf automake libpng tiff jpeg-6b gettext \
606              expat fontconfig docbook-files \
607              "
608              # freetype
609              # XML-Parser intltool hicolor-icon-theme gnome-icon-theme"
610              # gnome-doc-utils-fake gtk-doc \
611     process_modules
612     
613     # Setup glibtool* links since some stuff expects them to be named like 
614     # that on OSX
615     if [ -z $PREFIX/bin/glibtoolize ]; then
616         ln -s $PREFIX/bin/libtoolize $PREFIX/bin/glibtoolize
617         ln -s $PREFIX/bin/libtool $PREFIX/bin/glibtool
618     fi
620     echo
621     echo "Done bootstrapping. Continue with \"build\" or \"shell\"."
622     exit 0
623 fi
625 if [ "x$1" != xbuild ]; then
626     print_usage
627     exit 1
628 fi
630 shift
632 MODULES=$*
633 if [ $# -eq 0 ]; then
634     echo "Building core modules."
635     MODULES="$CORE_MODULES"
636 elif [ "x$1" = xcore ]; then
637     echo "Building core modules."
638     MODULES="$CORE_MODULES"
639 elif [ "x$1" = xpython ]; then
640     echo "Building python modules."
641     MODULES="$PYGTK_MODULES"
642 elif [ "x$1" = xall ]; then
643     echo "Building core+extra+python modules."
644     MODULES="$CORE_MODULES $EXTRA_MODULES $PYGTK_MODULES"
645 elif [ "x$1" = xinkscape ]; then
646     echo "Building inkscape modules."
647     MODULES="$INKSCAPE_MODULES"
648 fi
650 process_modules
651 echo "Done."