]> git.donarmstrong.com Git - lilypond.git/blob - buildscripts/guile-gnome.sh
Fix #299.
[lilypond.git] / buildscripts / guile-gnome.sh
1 #!@BASH@
2
3 # guile-gnome.sh -- download, compile, install g-wrap, guile-gnome,
4 # pango
5
6 # LilyPond has an experimental gnome canvas output backend -- hackers
7 # only.  This depends on rather new versions of guile-gnome, g-wrap
8 # and pango.
9
10 set -ex
11
12 # Where user built stuff will be installed
13 OPT=$HOME/usr/pkg
14 # When using GUILE CVS, make a slib/require like so
15 cat > /dev/null <<EOF
16 cd ~/usr/pkg/guile/share/guile/1.7 && ln -s /usr/share/guile/1.6/slib .
17 cd && guile -c "(use-modules (ice-9 slib)) (require 'new-catalog)"
18 EOF
19 # otherwise, this may fix it...
20 SLIB_PATH=`locate slib/require.scm | head -1 | sed -s 's/require.scm//g'`
21
22 # What extra modules to pull (eg: EXTRA="libgnomecanvas libwnck")
23 EXTRA=${EXTRA-libgnomecanvas}
24 PANGOVERSION=1.6.0
25 GGVERSION=2.7.99
26 GWRAPVERSION=1.9.5
27 GLVERSION=0.1.2
28
29 download=$HOME/usr/src/releases
30 [ -d $download ] || mkdir -p $download
31 WGET="wget -N -P $download"
32
33 export AUTOMAKE=automake-1.8
34 export ACLOCAL=aclocal-1.8
35 export AUTOCONF=$(which autoconf2.50)
36 export AUTOHEADER=$(which autoheader2.50)
37
38 export PKG_CONFIG_PATH
39 export LD_LIBRARY_PATH
40 export GUILE_LOAD_PATH
41
42 if [ -z "$AUTOCONF" ]; then
43     unset AUTOCONF
44 fi
45 if [ -z "$AUTOHEADER" ]; then
46     unset AUTOHEADER
47 fi
48
49
50 # test: the name of our download and build directory
51 rm -rf test
52 mkdir -p test
53 cd test
54
55 ## 1.  install gnome-devel
56 ##     - Debian/unstable: apt-get install gnome-devel
57 ##     - ...
58
59 ## 2.  get pango CVS
60
61 PKG_CONFIG_PATH=$OPT/pango/lib/pkgconfig:$PKG_CONFIG_PATH
62 LD_LIBRARY_PATH=$OPT/pango/lib:$LD_LIBRARY_PATH
63
64 mkdir -p gnome/CVS
65 if ! pkg-config --atleast-version=1.5.1 pango; then
66     cd gnome
67     if [ -n "$BLOEDIGE_RAND" ]; then
68         echo ":pserver:anonymous@anoncvs.gnome.org:/cvs/gnome" > CVS/Root
69         echo "." > CVS/Repository
70         cvs -z3 checkout -P pango
71     else
72         $WGET ftp://ftp.gtk.org/pub/gtk/v2.6/pango-$PANGOVERSION.tar.gz
73         tar -xzf $download/pango-$PANGOVERSION.tar.gz
74         ln -s pango-$PANGOVERSION pango
75     fi
76     cd pango
77     rm -rf $OPT/pango
78     if [ ! -f configure ]; then
79         ./autogen.sh --help
80     fi
81     ./configure --prefix=$OPT/pango --enable-maintainer-mode --enable-gtk-doc
82     make XFT_LIBS="-L/usr/lib -lXft -L/usr/X11R6/lib -lfreetype -lz -lXrender -lX11 -lfontconfig" all install
83     cd ../..
84 fi
85
86 ## 3. Currently (2004-9-15) GUILE CVS works somewhat
87 ##    But there's a guile/g-wrap problem with integer parameters
88 ## PATH=/usr/bin:$PATH
89
90 if [ -d $OPT/libffi/ ]; then
91     export LDFLAGS=-L$OPT/libffi/lib
92     export CPPFLAGS=-I$OPT/libffi/include
93 fi
94
95 ## 4.  get g-wrap 2.0
96 if ! pkg-config --atleast-version=$GWRAPVERSION g-wrap-2.0-guile; then
97     if [ -n "$BLOEDIGE_RAND" ]; then
98         tla register-archive a.rottmann@gmx.at--2004-main \
99             http://people.debian.org/~rotty/arch/a.rottmann@gmx.at/2004-main || true
100
101         ## tla get a.rottmann@gmx.at--2004-main/g-wrap--tng g-wrap
102         ## tla get a.rottmann@gmx.at--2004-main/g-wrap--mainline--1.9.0 g-wrap
103         tla get a.rottmann@gmx.at--2004-main/g-wrap--dev--0 g-wrap
104         ## ughr:
105         mkdir -p g-wrap/libffi
106     else
107         $WGET http://savannah.nongnu.org/download/g-wrap/g-wrap-$GWRAPVERSION.tar.gz
108         tar xzf $download/g-wrap-$GWRAPVERSION.tar.gz
109         ln -s g-wrap-$GWRAPVERSION g-wrap
110     fi
111     cd g-wrap
112     
113     rm -rf $OPT/g-wrap
114     if [ ! -f configure ]; then
115         sh autogen.sh --noconfigure
116     fi    
117     mkdir =build
118     cd =build
119     ../configure --prefix=$OPT/g-wrap --enable-maintainer-mode
120     make install
121     cd ../..
122     PKG_CONFIG_PATH=$OPT/g-wrap/lib/pkgconfig:$PKG_CONFIG_PATH
123     LD_LIBRARY_PATH=$OPT/g-wrap/lib:$LD_LIBRARY_PATH
124     GUILE_LOAD_PATH=$OPT/g-wrap/share/guile/site:$GUILE_LOAD_PATH:$SLIB_PATH
125 fi
126
127 ## 4a.  get g-lib 0.1.2
128 if ! guile -c "(use-modules (srfi srfi-35))"; then
129     if [ -n "$BLOEDIGE_RAND" ]; then
130         :
131     else
132         $WGET http://download.gna.org/guile-lib/guile-lib-$GLVERSION.tar.gz
133         tar xzf $download/guile-lib-$GLVERSION.tar.gz
134         ln -s guile-lib-$GLVERSION guile-lib
135     fi
136     cd guile-lib
137     
138     rm -rf $OPT/guile-lib
139     if [ ! -f src/configure ]; then
140         sh autogen.sh --noconfigure
141     fi    
142     mkdir =build
143     cd =build
144     ../src/configure --prefix=$OPT/guile-lib #--enable-maintainer-mode
145     if true; then
146         make
147         cp ./guile-lib/doc/guile-library.info doc
148         install -d $OPT/guile-lib/share/info
149     fi
150     make install
151     cd ../..
152     GUILE_LOAD_PATH=$OPT/guile-lib/share/guile:$GUILE_LOAD_PATH
153 fi    
154
155 # not a good idea
156 ## cp srfi-34.scm from CVS head ?  --hwn
157 #(cd $OPT/g-wrap/share/guile/site
158 # mv srfi-34.scm srfi-34.scm-g-wrap
159 # cp $OPT/guile/share/guile-1.7/srfi/srfi-34.scm .)
160
161 ## 5.  get guile-gnome
162 if ! pkg-config --atleast-version=$GGVERSION guile-gnome-glib; then
163     if [ -n "$BLOEDIGE_RAND" ]; then
164
165         if false; then # rotty
166             tla register-archive guile-gnome-devel@gnu.org--2004 \
167                 http://people.debian.org/~rotty/arch/guile-gnome-devel@gnu.org/2004/ || true
168             tla get guile-gnome-devel@gnu.org--2004/dists--dev guile-gnome
169             cd guile-gnome
170             tla build-config -r configs/gnu.org/dev
171             cd src
172
173             # 5a.  get extra modules (gnome canvas)
174             for i in $EXTRA; do
175                 tla get guile-gnome-devel@gnu.org--2004/$i--dev $i
176             done
177         else # andy
178             tla register-archive wingo@pobox.com--2004-main \
179                 http://ambient.2y.net/wingo/arch/wingo@pobox.com--2004-main || true
180             
181             tla get wingo@pobox.com--2004-main/guile-gnome-dists--release guile-gnome
182             cd guile-gnome
183             tla build-config -r configs/gnu.org/guile-gnome-platform-$GGVERSION
184             cd src
185             EXTRA="pkg atk defs glib gstreamer gtk gtksourceview libgda libglade libgnome libgnomeui pango libgnomecanvas"
186             EXTRA=
187
188             # 5a.  get extra modules (gnome canvas)
189             for i in $EXTRA; do
190                 tla get wingo@pobox.com--2004-main/guile-gnome-$i--release $i
191             done
192
193             cd libgnomecanvas
194             cd ..
195         fi
196
197         if [ ! -f configure ]; then
198             sh autogen.sh --noconfigure
199         fi
200         cd ..
201         srcdir="../src"
202     else
203         #$WGET http://download.gna.org/guile-gnome/releases/guile-gnome-platform-$GGVERSION.tar.gz
204         $WGET ftp://ftp.gnu.org/gnu/guile-gnome/guile-gnome-platform/guile-gnome-platform-$GGVERSION.tar.gz
205         tar xzf $download/guile-gnome-platform-$GGVERSION.tar.gz
206         ln -s guile-gnome-platform-$GGVERSION guile-gnome
207         cd guile-gnome
208         srcdir="../"
209     fi
210     
211     rm -rf $OPT/guile-gnome
212     mkdir =build
213     cd =build
214
215 # Using libtool < 1.6.0 together with gcc-3.4 may trigger this problem:
216 #
217 #    If a tag has not been given, and we're using a compiler which is
218 #    not one of the ones with which libtool was built, attempt to
219 #    infer the compiler from the first word of the command line passed
220 #    to libtool.
221 #
222     if [ -z "$GCC34" ]; then
223     # Use libtool-1.5.6, gcc-3.{2,3} without -O2,
224         CFLAGS='-O -g' $srcdir/configure --prefix=$OPT/guile-gnome --enable-maintainer-mode
225     else
226     # or use gcc-3.4 with libtool-1.6.0
227         CC=$GCC34 $srcdir/configure --prefix=$OPT/guile-gnome --enable-maintainer-mode
228     fi
229     make all install G_WRAP_MODULE_DIR=$OPT/g-wrap/share/guile/site
230     PKG_CONFIG_PATH=$OPT/guile-gnome/lib/pkgconfig:$PKG_CONFIG_PATH
231     LD_LIBRARY_PATH=$OPT/guile-gnome/lib:$LD_LIBRARY_PATH
232     GUILE_LOAD_PATH=$OPT/guile-gnome/share/guile:$GUILE_LOAD_PATH
233 fi
234
235 cat <<EOF
236 ***********************************************************************
237 Before using with Lily, do
238
239     export LD_LIBRARY_PATH=$LD_LIBRARY_PATH
240     export GUILE_LOAD_PATH=$GUILE_LOAD_PATH
241     export PKG_CONFIG_PATH=$PKG_CONFIG_PATH
242 EOF
243
244 # simple test -- fails atm
245 # guile -s ../src/libgnomecanvas/examples/canvas.scm