root/main/trunk/greenstone2/common-src/packages/configure @ 26655

Revision 26655, 9.8 KB (checked in by davidb, 6 years ago)

Support for cross-compilation added

  • Property svn:executable set to *
Line 
1#!/bin/sh
2
3PACKAGES=`pwd`
4cd ../..
5GSDLHOME=`pwd`
6cd $PACKAGES
7
8GSDLOS=`uname -s |tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
9# check for running bash under cygwin
10if test "`echo $GSDLOS | sed 's/cygwin//'`" != "$GSDLOS" ;
11then
12 GSDLOS=windows
13fi
14if test "x$crossOS" != "x" ; then
15  # Override derived value with value explicitly provided in crossOS
16  GSDLOS=$crossOS
17fi
18
19prefix=""
20bindir=""
21HOSTTARGETFLAGS=""
22
23# only some of the packages can take environment variables as options to
24# configure
25# format is VAR=value, e.g "LDFLAGS=-static"
26ENVIRONMENT=""
27
28# Java support enabled by default, can switch it off with --disable-java
29ENABLE_JAVA=1
30# GDBM support enabled by default, can switch it off with --disable-jdbm
31USE_GDBM=1
32# JDBM support enabled by default, can switch it off with --disable-jdbm
33USE_JDBM=1
34# SQLite support enabled by default, can switch it off with --disable-sqlite
35USE_SQLITE=true
36# yaz compilation enabled by default, can switch it off with --disable-yaz
37USE_YAZ=true
38# z3950 server disabled by default, switch it on with --enable-z3950
39USE_Z3950=false
40# CORBA support disabled by default, switch it on with --enable-corba
41USE_CORBA=false
42MICO_DIR=default
43
44# parse any arguments given from toplevel configure
45while test $# -ne 0; do
46    case "$1" in
47    --cache-file=*)
48        cache_filename=`echo $1 | sed s/--cache-file=//`
49        # turn relative path into an absolute path
50        cache_dir=`echo $cache_filename | sed 's@/[^/]*$@@'`
51        cache_dir=`cd $cache_dir 2>/dev/null && pwd`
52
53        cache_basefile=`echo $cache_filename | sed 's@.*/@@'`
54        cache_file="$cache_dir/$cache_basefile"
55        if test ! -f "$cache_file"; then
56        CACHE_FILE=""
57        else
58        CACHE_FILE="--cache-file=$cache_file"
59        fi
60        ;;
61    --disable-java)
62        ENABLE_JAVA=0
63        USE_JDBM=0
64        ;;
65    --disable-gdbm)
66        USE_GDBM=0
67        ;;
68    --disable-jdbm)
69        USE_JDBM=0
70        ;;
71    --disable-sqlite)
72        USE_SQLITE=false
73        ;;
74    --disable-yaz)
75        USE_YAZ=false
76        ;;
77    --enable-z3950)
78        USE_Z3950=true
79        ;;
80    --enable-corba)
81        USE_CORBA=true
82        ;;
83    --with-micodir=*)
84        if test $1 = ""; then
85          $1 = "default"
86            fi
87        MICO_DIR=$1
88        ;;       
89    --prefix=*)
90        prefix=`echo $1 | sed s/--prefix=//`
91        ;;
92    --bindir=*)
93        # where to install binaries to
94        bindir=`echo $1 | sed s/--bindir=//`
95        # turn relative path into an absolute path
96        if test -d "$bindir" ; then
97          bindir=`cd "$bindir" ; pwd `
98          cd "$PACKAGES"
99        elif test -z `echo $bindir | sed '/^\// p;D'` ; then
100          rel_bindir="`echo $bindir | sed s@/.*@@`"
101          cd "$rel_bindir"
102          bindir="`pwd`/`echo $bindir | sed s@^[^/]*/@@`"
103          cd "$PACKAGES"
104        else
105          # bindir doesn't exist, and isn't relative
106          true
107        fi
108        ;;
109    --host=* | --target=* | --build=*)
110        HOSTTARGETFLAGS="$HOSTTARGETFLAGS $1"
111        ;;
112    *)
113        # ignore all other options for now
114        ;;
115    esac
116    shift
117done
118
119# note! Our GSDL package currently always installs into it's source
120# directory, ignoring any --prefix given to configure.
121# When this is fixed, uncomment the relevant lines below...
122
123##if test -z "$prefix" ; then
124prefix="${GSDLHOME}"
125##fi
126
127##if test -z "$bindir" ; then
128bindir="${prefix}/bin/$GSDLOS"
129##fi
130
131#libdir="${prefix}/lib/$GSDLOS"
132
133# This loads the top configure's cache file, with variables already set.
134if test -f "$cache_file" ; then
135  . $cache_file
136fi
137
138# we assume that gzip and tar are on the search path.
139# non-GNU versions of tar don't take the -z option.
140
141
142
143# configure expat (needs to be done before XML::Parser)
144# now compile expat during the configure stage itself
145echo ""
146echo "Configuring expat"
147echo ""
148cd "$PACKAGES/expat"
149if test ! -d expat-1.95.8 ;
150then
151  gzip -dc expat-1.95.8.tar.gz | tar -xf -
152fi
153
154cd "$PACKAGES/expat/expat-1.95.8"
155
156if test -e Makefile ; then
157  echo make distclean && \
158  make distclean
159fi
160
161#Configure and compile expat
162echo CFLAGS="$CFLAGS $ARCH_DEP_FLAGS" CXXFLAGS="$CXXFLAGS $ARCH_DEP_FLAGS" LDFLAGS="$LDFLAGS $ARCH_DEP_FLAGS" ./configure $CACHE_FILE --disable-shared --with-pic --prefix=$PACKAGES/expat --bindir="$bindir" $HOSTTARGETFLAGS $ENVIRONMENT
163CFLAGS="$CFLAGS $ARCH_DEP_FLAGS" CXXFLAGS="$CXXFLAGS $ARCH_DEP_FLAGS" LDFLAGS="$LDFLAGS $ARCH_DEP_FLAGS" ./configure $CACHE_FILE --disable-shared --with-pic --prefix=$PACKAGES/expat --bindir="$bindir" $HOSTTARGETFLAGS $ENVIRONMENT
164
165echo CFLAGS="$CFLAGS $ARCH_DEP_FLAGS" CXXFLAGS="$CXXFLAGS $ARCH_DEP_FLAGS" LDFLAGS="$LDFLAGS $ARCH_DEP_FLAGS" make $ENVIRONMENT
166CFLAGS="$CFLAGS $ARCH_DEP_FLAGS" CXXFLAGS="$CXXFLAGS $ARCH_DEP_FLAGS" LDFLAGS="$LDFLAGS $ARCH_DEP_FLAGS" make $ENVIRONMENT
167
168echo CFLAGS="$CFLAGS $ARCH_DEP_FLAGS" CXXFLAGS="$CXXFLAGS $ARCH_DEP_FLAGS" LDFLAGS="$LDFLAGS $ARCH_DEP_FLAGS" make install $ENVIRONMENT
169CFLAGS="$CFLAGS $ARCH_DEP_FLAGS" CXXFLAGS="$CXXFLAGS $ARCH_DEP_FLAGS" LDFLAGS="$LDFLAGS $ARCH_DEP_FLAGS" make install $ENVIRONMENT
170
171echo make distclean && \
172make distclean
173
174# configure and compile libiconv during configuration stage
175echo ""
176echo "Configuring iconv"
177echo ""
178cd "$PACKAGES/iconv"
179
180# Darwin requires a different version of iconv than the one we use for Linux
181if test $GSDLOS != darwin ; then
182
183    if test ! -d libiconv-1.13.1 ; then
184    gzip -dc libiconv-1.13.1.tar.gz | tar -xf -
185    fi
186    cd "$PACKAGES/iconv/libiconv-1.13.1"
187
188    if test -e Makefile ; then 
189    echo make distclean && \
190        make distclean
191    fi
192
193    # configure
194    echo CFLAGS="$CFLAGS $ARCH_DEP_FLAGS" CXXFLAGS="$CXXFLAGS $ARCH_DEP_FLAGS" LDFLAGS="$LDFLAGS $ARCH_DEP_FLAGS" ./configure $CACHE_FILE --enable-shared --enable-static --prefix="$PACKAGES/iconv" $HOSTTARGETFLAGS $ENVIRONMENT
195    CFLAGS="$CFLAGS $ARCH_DEP_FLAGS" CXXFLAGS="$CXXFLAGS $ARCH_DEP_FLAGS" LDFLAGS="$LDFLAGS $ARCH_DEP_FLAGS" ./configure $CACHE_FILE --enable-shared --enable-static --prefix="$PACKAGES/iconv" $HOSTTARGETFLAGS $ENVIRONMENT
196else
197    if test ! -d libiconv-1.11 ; then
198    gzip -dc libiconv-1.11.tar.gz | tar -xf -
199    fi
200    cd "$PACKAGES/iconv/libiconv-1.11"
201
202    if test -e Makefile ; then 
203    echo make distclean && \
204        make distclean
205    fi
206
207    # configure
208    echo CFLAGS="$CFLAGS $ARCH_DEP_FLAGS" CXXFLAGS="$CXXFLAGS $ARCH_DEP_FLAGS" LDFLAGS="$LDFLAGS $ARCH_DEP_FLAGS" ./configure $CACHE_FILE --disable-shared --enable-static --prefix="$PACKAGES/iconv" $HOSTTARGETFLAGS $ENVIRONMENT
209    CFLAGS="$CFLAGS $ARCH_DEP_FLAGS" CXXFLAGS="$CXXFLAGS $ARCH_DEP_FLAGS" LDFLAGS="$LDFLAGS $ARCH_DEP_FLAGS" ./configure $CACHE_FILE --disable-shared --enable-static --prefix="$PACKAGES/iconv" $HOSTTARGETFLAGS $ENVIRONMENT
210fi
211
212# make
213echo CFLAGS="$CFLAGS $ARCH_DEP_FLAGS" CXXFLAGS="$CXXFLAGS $ARCH_DEP_FLAGS" LDFLAGS="$LDFLAGS $ARCH_DEP_FLAGS" make $ENVIRONMENT
214CFLAGS="$CFLAGS $ARCH_DEP_FLAGS" CXXFLAGS="$CXXFLAGS $ARCH_DEP_FLAGS" LDFLAGS="$LDFLAGS $ARCH_DEP_FLAGS" make $ENVIRONMENT
215
216# make install
217echo CFLAGS="$CFLAGS $ARCH_DEP_FLAGS" CXXFLAGS="$CXXFLAGS $ARCH_DEP_FLAGS" LDFLAGS="$LDFLAGS $ARCH_DEP_FLAGS" make install $ENVIRONMENT
218CFLAGS="$CFLAGS $ARCH_DEP_FLAGS" CXXFLAGS="$CXXFLAGS $ARCH_DEP_FLAGS" LDFLAGS="$LDFLAGS $ARCH_DEP_FLAGS" make install $ENVIRONMENT
219
220echo make distclean && \
221make distclean
222
223
224# configure GDBM
225echo ""
226echo "Configuring GDBM"
227if test $USE_GDBM  ;
228then
229    echo ""
230    cd "$PACKAGES/gdbm"
231
232    echo CFLAGS="$CFLAGS $ARCH_DEP_FLAGS" CXXFLAGS="$CXXFLAGS $ARCH_DEP_FLAGS" LDFLAGS="$LDFLAGS $ARCH_DEP_FLAGS" ./configure $CACHE_FILE --disable-shared --prefix=$PACKAGES/gdbm $HOSTTARGETFLAGS $ENVIRONMENT
233
234    cd "$PACKAGES/gdbm/gdbm-1.8.3" && \
235    CFLAGS="$CFLAGS $ARCH_DEP_FLAGS" CXXFLAGS="$CXXFLAGS $ARCH_DEP_FLAGS" LDFLAGS="$LDFLAGS $ARCH_DEP_FLAGS" ./configure $CACHE_FILE --disable-shared --prefix=$PACKAGES/gdbm $HOSTTARGETFLAGS $ENVIRONMENT
236else
237  echo " GDBM support disabled."
238  echo "  add '--enable-gdbm' to the configure command to include GDBM support."
239  echo ""
240fi
241
242# configure JDBM
243echo ""
244echo "Configuring JDBM"
245if test $USE_JDBM  ;
246then
247  echo ""
248  cd "$PACKAGES/jdbm"
249  if test ! -d jdbm-1.0 ;
250  then
251    gzip -dc gs-jdbm-1.0.tar.gz | tar -xf -
252  fi
253
254  if test "x$JAVAC" = "x" ; then
255    JAVAC=javac
256  fi
257
258  if test "x$JAVACFLAGS" = "x" ; then
259    JAVACFLAGS="-source 1.4 -target 1.4"
260  fi
261
262  cd jdbm-1.0 && cat Makefile.in | sed -e "s,@JAVAC@,$JAVAC,g" -e "s,@JAVACFLAGS@,$JAVACFLAGS,g" > Makefile
263else
264  echo "JDBM support disabled."
265  echo "  add '--enable-jdbm' to the configure command to include JDBM support."
266  echo ""
267fi
268
269# configure SQLite
270echo ""
271echo "Configuring SQLite"
272if test x$USE_SQLITE = xtrue ;
273then
274  echo ""
275  cd "$PACKAGES/sqlite"
276  if test ! -d sqlite-autoconf-3070602 ;
277  then
278    gzip -dc sqlite-autoconf-3070602.tar.gz | tar -xf -
279  fi
280
281  arch=`uname -p`
282
283  if test $arch = powerpc ; then
284      CFLAGS="-DSQLITE_ENABLE_LOCKING_STYLE=0 $CFLAGS"
285  fi
286
287  echo CFLAGS="$CFLAGS $ARCH_DEP_FLAGS" CXXFLAGS="$CXXFLAGS $ARCH_DEP_FLAGS" LDFLAGS="$LDFLAGS $ARCH_DEP_FLAGS" ./configure $CACHE_FILE --prefix="$PACKAGES/sqlite" --bindir="$bindir" $HOSTTARGETFLAGS $ENVIRONMENT
288
289  cd "$PACKAGES/sqlite/sqlite-autoconf-3070602" && \
290  CFLAGS="$CFLAGS $ARCH_DEP_FLAGS" CXXFLAGS="$CXXFLAGS $ARCH_DEP_FLAGS" LDFLAGS="$LDFLAGS $ARCH_DEP_FLAGS" ./configure $CACHE_FILE --prefix="$PACKAGES/sqlite" --bindir="$bindir" $HOSTTARGETFLAGS $ENVIRONMENT
291else
292  echo "SQLite support disabled."
293  echo "  add '--enable-sqlite' to the configure command to include SQLite support."
294  echo ""
295fi
296
297# configure search4j
298echo ""
299echo "Configuring search4j"
300echo ""
301cd "$PACKAGES/search4j"
302
303#echo CFLAGS="$CFLAGS $ARCH_DEP_FLAGS" CXXFLAGS="$CXXFLAGS $ARCH_DEP_FLAGS" LDFLAGS="$LDFLAGS $ARCH_DEP_FLAGS" ./configure --bindir="$GSDLHOME/bin/$GSDLOS" $CACHE_FILE $HOSTTARGETFLAGS $ENVIRONMENT
304echo ./configure --bindir="$GSDLHOME/bin/$GSDLOS" $CACHE_FILE $HOSTTARGETFLAGS $ENVIRONMENT
305
306cd "$PACKAGES/search4j" && \
307 ./configure --bindir="$GSDLHOME/bin/$GSDLOS" $CACHE_FILE $HOSTTARGETFLAGS $ENVIRONMENT
308# CFLAGS="$CFLAGS $ARCH_DEP_FLAGS" CXXFLAGS="$CXXFLAGS $ARCH_DEP_FLAGS" LDFLAGS="$LDFLAGS $ARCH_DEP_FLAGS" ./configure --bindir="$GSDLHOME/bin/$GSDLOS" $CACHE_FILE $HOSTTARGETFLAGS $ENVIRONMENT
Note: See TracBrowser for help on using the browser.