source: main/trunk/greenstone2/build-src/packages/configure@ 36321

Last change on this file since 36321 was 36321, checked in by kjdon, 21 months ago

forgot to set ssl_status for main case of running config.

  • Property svn:executable set to *
File size: 15.4 KB
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# WVWARE compilation enabled by default, can switch it off with --disable-wvware
29USE_WVWARE=true
30# GDBM compilation enabled by default, can switch it off with --disable-gdbm
31USE_GDBM=true
32# JDBM compilation enabled by default, can switch it off with --disable-jdbm
33USE_JDBM=true
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-wvware)
62 USE_WVWARE=false
63 ;;
64 --disable-gdbm)
65 USE_GDBM=false
66 ;;
67 --disable-jdbm)
68 USE_JDBM=false
69 ;;
70 --disable-sqlite)
71 USE_SQLITE=false
72 ;;
73 --disable-yaz)
74 USE_YAZ=false
75 ;;
76 --enable-z3950)
77 USE_Z3950=true
78 ;;
79 --enable-corba)
80 USE_CORBA=true
81 ;;
82 --with-micodir=*)
83 if test $1 = ""; then
84 $1 = "default"
85 fi
86 MICO_DIR=$1
87 ;;
88 --prefix=*)
89 prefix=`echo $1 | sed s/--prefix=//`
90 ;;
91 --bindir=*)
92 # where to install binaries to
93 bindir=`echo $1 | sed s/--bindir=//`
94 # turn relative path into an absolute path
95 if test -d "$bindir" ; then
96 bindir=`cd "$bindir" ; pwd `
97 cd "$PACKAGES"
98 elif test -z `echo $bindir | sed '/^\// p;D'` ; then
99 rel_bindir="`echo $bindir | sed s@/.*@@`"
100 cd "$rel_bindir"
101 bindir="`pwd`/`echo $bindir | sed s@^[^/]*/@@`"
102 cd "$PACKAGES"
103 else
104 # bindir doesn't exist, and isn't relative
105 true
106 fi
107 ;;
108 --host=* | --target=* | --build=*)
109 HOSTTARGETFLAGS="$HOSTTARGETFLAGS $1"
110 ;;
111 *)
112 # ignore all other options for now
113 ;;
114 esac
115 shift
116done
117
118# note! Our GSDL package currently always installs into it's source
119# directory, ignoring any --prefix given to configure.
120# When this is fixed, uncomment the relevant lines below...
121
122##if test -z "$prefix" ; then
123prefix="${GSDLHOME}"
124##fi
125
126##if test -z "$bindir" ; then
127bindir="${prefix}/bin/$GSDLOS"
128##fi
129
130libdir="${prefix}/lib/$GSDLOS"
131
132# This loads the top configure's cache file, with variables already set.
133if test -f "$cache_file" ; then
134 . $cache_file
135fi
136
137# we assume that gzip and tar are on the search path.
138# non-GNU versions of tar don't take the -z option.
139
140
141
142# The way common-src compiles up expat during the configure stage itself,
143# configure openssl (needs to be done before wget)
144# and compile openssl during the configure stage itself.
145# Needed by wget for https support
146
147echo ""
148echo "Configuring openssl"
149echo ""
150cd "$PACKAGES/openssl"
151openssl_pkgname=openssl-1.0.2l
152#openssl_pkgname=openssl-1.1.0f
153if test ! -d $openssl_pkgname ;
154then
155 gzip -dc $openssl_pkgname.tar.gz | tar -xf -
156fi
157cd $openssl_pkgname
158
159# configure
160# see the INSTALL file for OpenSSL to see config options for openssl
161# --prefix indicates where the generated lib, include and bin folders will go
162# --openssldir will contain the manuals and other non-essentials
163# BEWARE: The defaults for --prefix and meaning of --openssldir differ between
164# versions of openssl. In the earlier version (1.0.* like 1.0.2l), if
165# --prefix is not supplied, then the generated lib, include and bin folders
166# will also go into --openssldir.
167# In the newer version 1.1.* 1.1.0f, if --prefix is not supplied, it will
168# try to install the generated lib, include and bin folders into a system place.
169# So better to provide both --openssldir and --prefix, for both openssl versions
170# to compile succesfully.
171# If you ever want to have the .a libraries that building openssl generates,
172# then point the --prefix to the $bindir. We currently don't need to put them
173# into $bindir/openssl for wget to use, since wget is built against openssl's
174# static libraries and therefore wget doesn't need these when running.
175
176# for 64 bit Macs, need to run ./Configure with darwin64-x86_64-cc, rather than ./config
177# To overcome an error in openssl's perl script determining the LLVM version, we also need force the
178# compilers to be GNU since Clang comes back with an LLVM version that doesn't work out
179stored_CC=$CC
180stored_CXX=$CXX
181ssl_status=
182if [[ "x$GSDLOS" == "xdarwin" ]] && [[ `uname -m` == *"64" ]] ; then
183 export CC="gcc"
184 export CXX="g++"
185 echo ./Configure --openssldir=$PACKAGES/openssl no-shared darwin64-x86_64-cc
186 #CC="gcc" CXX="g++" ./Configure --openssldir=$PACKAGES/openssl no-shared darwin64-x86_64-cc
187 ./Configure --openssldir=$PACKAGES/openssl no-shared darwin64-x86_64-cc
188 ssl_status=$?
189elif [[ "x$RK32" != "x" ]] ; then
190 echo "in RK32 mode"
191 echo ./Configure --prefix=$PACKAGES/openssl --openssldir=$PACKAGES/openssl no-shared linux-generic32
192 # we found that the following needs bash to run as running it directly here (from within ant)
193 # as ./Configure had an error, even though the command worked fine on the command line
194 bash ./Configure --prefix=$PACKAGES/openssl --openssldir=$PACKAGES/openssl no-shared linux-generic32
195 ssl_status=$?
196
197else
198 # this will auto guess the system you are running on
199 echo ./config --prefix=$PACKAGES/openssl --openssldir=$PACKAGES/openssl no-shared
200 ./config --prefix=$PACKAGES/openssl --openssldir=$PACKAGES/openssl no-shared
201 ssl_status=$?
202fi
203if [[ $ssl_status != 0 ]] ; then
204 echo "ERROR: something went wrong with configuring openssl"
205 exit $ssl_status
206fi
207# make
208echo make
209make
210# make 'install_sw' is a target this package has for installing just the software,
211# skipping the installation of, for example, the man pages
212echo make install_sw
213make install_sw
214# restore the compile flags
215export CC=$stored_CC
216export CXX=$stored_CXX
217
218# GS3 needs the now-built openssl to set up https. So we copy (hardlink?) the necessary openssl stuff
219# Copying is perhaps OK: <12Mb without the manual or 14.4Mb with manuals.
220# to GSDL3SRCHOME/bin/$GSDLOS. Not sure if GSDL3SRCHOME is even set during configure
221# if this is a GS3 installation. But we have $GSDLHOME.
222cd $PACKAGES
223gs3_bin_osdir=../../../bin/$GSDLOS
224if [[ -f ../../../gs3-setup.sh ]] && [[ -d $gs3_bin_osdir ]] ; then
225 # get rid of any openssl copy from a previous installation
226 if [ -d $gs3_bin_osdir/openssl ] ; then
227 rm -rf $gs3_bin_osdir/openssl
228 fi
229 mkdir $gs3_bin_osdir/openssl
230 cp -r $PACKAGES/openssl/bin $PACKAGES/openssl/certs $PACKAGES/openssl/include $PACKAGES/openssl/lib $PACKAGES/openssl/misc $PACKAGES/openssl/private $gs3_bin_osdir/openssl/.
231fi
232
233# now move the include, lib and bin folders to the correct place
234
235# configure the wvWare Word document converter
236echo ""
237echo "Configuring wvWare"
238echo ""
239
240# datadir flag is for default location of wvHtml.xml config file
241if test x$USE_WVWARE = xtrue ;
242then
243
244 # Look to see if gnome-lib extension is present and if so, source its devel.bash file
245 if [ -d ../../ext/gnome-lib ] ; then
246 pushd ../../ext/gnome-lib
247 source ./devel.bash
248 popd
249 fi
250
251 if [ -d ../../../ext/gnome-lib-minimal ] ; then
252 pushd ../../../ext/gnome-lib-minimal
253 source ./devel.bash
254 popd
255 fi
256
257 cd "$PACKAGES/wv"
258 if [ "x$GSDLOS" = "xdarwin" ]; then
259 WV_LDFLAGS="$LDFLAGS -framework CoreFoundation -framework Carbon"
260 else
261 WV_LDFLAGS="$LDFLAGS"
262 fi
263 gzip -dc wv-1.2.4-gs.tar.gz | tar -xf -
264 cd wv-gs && \
265 ./configure $CACHE_FILE --prefix=$PACKAGES/wv --bindir="$bindir" --libdir="$libdir" --datadir="$prefix/etc/packages" $HOSTTARGETFLAGS --disable-shared --enable-static LDFLAGS="$WV_LDFLAGS"
266else
267 echo "wvWare support disabled."
268 echo " add '--enable-wvware' to the configure command to include wvWare support."
269 echo ""
270fi
271
272if test x$? = x1 ;
273then
274 echo "Configuration of wvWare failed."
275 exit 1
276fi
277
278# configure the pdftohtml converter
279echo ""
280echo "Configuring pdftohtml"
281echo ""
282
283cd "$PACKAGES/pdftohtml"
284gzip -dc pdftohtml_0_36_gs.tar.gz | tar -xf -
285cd pdftohtml_gs && \
286./configure $CACHE_FILE --prefix="$prefix" --bindir="$bindir" $HOSTTARGETFLAGS $ENVIRONMENT
287
288if test x$? = x1 ;
289then
290 echo "Configuration of pdftohtml failed."
291 exit 1
292fi
293
294# rtftohtml converter
295echo ""
296echo "Configuring rtftohtml"
297echo ""
298
299cd "$PACKAGES/rtftohtml"
300gzip -dc rtftohtml-gs.tar.gz | tar -xf -
301cd rtftohtml_src && \
302./configure $CACHE_FILE --prefix="$prefix" --bindir="$bindir" $HOSTTARGETFLAGS
303
304if test x$? = x1 ;
305then
306 echo "Configuration of rtftohtml failed."
307 exit 1
308fi
309
310# On darwin, the wget binary that we build (in $GSDLHOME/bin/$GSDLOS/wget)
311# finds a system libiconv, as you'll notice when you run "otool -L wget"
312# That's because we expressly don't compile up libiconv on Macs anymore,
313# as the Mac system will have the right libiconv installed.
314
315# configure wget
316#wget_pkgname=wget-1.15-gs
317wget_pkgname=wget-1.17.1-gs
318#wget_pkgname=wget-1.19-gs
319echo ""
320echo "Configuring wget"
321echo ""
322cd "$PACKAGES/wget"
323gzip -dc $wget_pkgname.tar.gz | tar -xf -
324if test x$crossOS = "xandroid" ;
325then
326 wget_extraargs="gl_cv_header_working_stdint_h=yes ac_cv_func_getopt_long_only=no"
327else
328 wget_extraargs=
329fi
330
331# When compiling wget-1.15-gs without openssl as before:
332#./configure $CACHE_FILE --prefix=$PACKAGES/wget --without-ssl --bindir="$bindir" -disable-nls $HOSTTARGETFLAGS $wget_extraargs
333
334# We weren't compiling up wget statically before either and we still aren't
335# However, to compile up wget (statically or not) with openssl, as we do now to support retrieving from https urls, see
336# https://stackoverflow.com/questions/9817337/compiling-wget-with-static-linking-self-compiled-openssl-library-linking-issu
337# Note: contrary to the instructions at the link, if the cppflags and ldflags are set during the
338# configure stage, as we now do, then the make command needn't additionally set them as well.
339# So just make, make install works thereafter
340
341echo copying "$PACKAGES/wget/wgetrc-gs.in" file to "$bindir/wgetrc"
342cp "$PACKAGES/wget/wgetrc-gs.in" "$bindir/wgetrc"
343echo cd "$PACKAGES/wget/$wget_pkgname"
344
345# for wget-1.15-gs. (can also try adding --localstatedir="$bindir/wget" --enable-iri)
346##echo CPPFLAGS="-I$PACKAGES/openssl/include $CPPFLAGS" LDFLAGS="-L$PACKAGES/openssl/lib $LDFLAGS" ./configure $CACHE_FILE --prefix=$PACKAGES/wget --with-ssl=openssl --bindir="$bindir" -disable-nls $HOSTTARGETFLAGS $wget_extraarg
347##cd "$PACKAGES/wget/$wget_pkgname" && \
348##CPPFLAGS="-I$PACKAGES/openssl/include $CPPFLAGS" LDFLAGS="-L$PACKAGES/openssl/lib $LDFLAGS" ./configure $CACHE_FILE --prefix=$PACKAGES/wget --with-ssl=openssl --bindir="$bindir" -disable-nls $HOSTTARGETFLAGS $wget_extraargs
349
350# for wget-1.17.1-gs and wget-1.19-gs (can also try adding --localstatedir="$bindir/wget" --enable-iri)
351# The following ran in to a problem on a Linux (centos) machine with lib32 and lib64 libraries. It tested for
352# openssl/lib64 when in fact the folder we produce is 'openssl/lib' causing ./configure to bail
353#echo OPENSSL_CFLAGS="-I$PACKAGES/openssl/include" OPENSSL_LIBS="-L$PACKAGES/openssl/lib -lssl -lcrypto" ./configure $CACHE_FILE --prefix=$PACKAGES/wget --with-ssl=openssl --with-openssl=auto --with-libssl-prefix="$PACKAGES/openssl" --bindir="$bindir" -disable-nls $HOSTTARGETFLAGS $wget_extraargs
354#cd "$PACKAGES/wget/$wget_pkgname" && \
355#OPENSSL_CFLAGS="-I$PACKAGES/openssl/include" OPENSSL_LIBS="-L$PACKAGES/openssl/lib -lssl -lcrypto" ./configure $CACHE_FILE --prefix=$PACKAGES/wget --with-ssl=openssl --with-openssl=auto --with-libssl-prefix="$PACKAGES/openssl" --bindir="$bindir" -disable-nls $HOSTTARGETFLAGS $wget_extraargs
356
357
358echo OPENSSL_CFLAGS="-I$PACKAGES/openssl/include" OPENSSL_LIBS="-L$PACKAGES/openssl/lib -lssl -lcrypto -lz -ldl" ./configure $CACHE_FILE --prefix=$PACKAGES/wget --with-ssl=openssl --with-openssl=auto --bindir="$bindir" -disable-nls $HOSTTARGETFLAGS $wget_extraargs
359cd "$PACKAGES/wget/$wget_pkgname" && \
360OPENSSL_CFLAGS="-I$PACKAGES/openssl/include" OPENSSL_LIBS="-L$PACKAGES/openssl/lib -lssl -lcrypto -lz -ldl" ./configure $CACHE_FILE --prefix=$PACKAGES/wget --with-ssl=openssl --with-openssl=auto --bindir="$bindir" -disable-nls $HOSTTARGETFLAGS $wget_extraargs
361
362
363
364if test x$? = x1 ;
365then
366 echo "Configuration of wget failed."
367 exit 1
368fi
369
370# configure XML::Parser perl module
371echo ""
372echo "Configuring XML::Parser"
373echo ""
374cd "$PACKAGES/cpan"
375
376perl_dir=`echo 'my $vn = sprintf("%vd", $^V); $vn =~ s/\.\d+?$//; print "perl-$vn";' | perl`
377
378gzip -dc XML-Parser-2.41.tar.gz | tar -xf -
379cd "$PACKAGES/cpan/XML-Parser-2.41" && \
380
381perl Makefile.PL \
382 PREFIX="$GSDLHOME/perllib/cpan/XML" \
383 INSTALLSITELIB="$GSDLHOME/perllib/cpan/$perl_dir" \
384 INSTALLSITEARCH="$GSDLHOME/perllib/cpan/$perl_dir" \
385 INSTALLMAN1DIR="$GSDLHOME/perllib/cpan/$perl_dir" \
386 INSTALLMAN3DIR="$GSDLHOME/perllib/cpan/$perl_dir" \
387 SITEPREFIX="$GSDLHOME/perllib/cpan" \
388 EXPATINCPATH="$GSDLHOME/common-src/packages/expat/include" \
389 EXPATLIBPATH="$GSDLHOME/common-src/packages/expat/lib"
390
391if test x$? = x1 ;
392then
393 echo "Configuration of XML-Parser failed."
394 exit 1
395fi
396
397cpan_extras=1
398if test $cpan_extras = 1 ;
399then
400
401 for pack in Digest-MD5-2.55 Digest-SHA-5.92 Text-CSV-1.99 ;
402 do
403 cd "$PACKAGES/cpan"
404 gzip -dc $pack.tar.gz | tar -xf -
405 cd "$PACKAGES/cpan/$pack" \
406 && \
407 perl Makefile.PL \
408 PREFIX="$GSDLHOME/perllib/cpan" \
409 INSTALLSITELIB="$GSDLHOME/perllib/cpan/$perl_dir" \
410 INSTALLSITEARCH="$GSDLHOME/perllib/cpan/$perl_dir" \
411 INSTALLMAN1DIR="$GSDLHOME/perllib/cpan/$perl_dir" \
412 INSTALLMAN3DIR="$GSDLHOME/perllib/cpan/$perl_dir" \
413 SITEPREFIX="$GSDLHOME/perllib/cpan"
414
415 if test x$? = x1 ;
416 then
417 echo "Configuration of $pack failed."
418 exit 1
419 fi
420 done
421fi
422
423# configure powerpoint converter
424echo ""
425echo "Configuring xlhtml (powerpoint & excel converter)"
426echo ""
427cd "$PACKAGES/xlhtml"
428gzip -dc xlhtml-0.4.9.0-gs.tar.gz | tar -xf -
429cd xlhtml-0.4.9.0 && \
430./configure $CACHE_FILE --prefix="$prefix" --bindir="$bindir" $HOSTTARGETFLAGS
431
432if test x$? = x1 ;
433then
434 echo "Configuration of xlhtml failed."
435 exit 1
436fi
437
438# configure IsisGdl program
439echo ""
440echo "Configuring IsisGdl (CDS/ISIS database reader)"
441echo ""
442cd "$PACKAGES/isis-gdl" && \
443./configure $CACHE_FILE --prefix="$prefix" --bindir="$bindir" $HOSTTARGETFLAGS $ENVIRONMENT
444
445if test x$? = x1 ;
446then
447 echo "Configuration of IsisGdl failed."
448 exit 1
449fi
450
451# configure HTMLTidy program
452echo ""
453echo "Configuring HTMLTidy"
454echo ""
455cd "$PACKAGES/html-tidy"
456gzip -dc tidy.tgz | tar -xf -
457cd "$PACKAGES/html-tidy/tidy" && \
458./configure $CACHE_FILE --prefix="$prefix" --bindir="$bindir" $HOSTTARGETFLAGS $ENVIRONMENT
459
460if test x$? = x1 ;
461then
462 echo "Configuration of HTMLTidy failed."
463 exit 1
464fi
Note: See TracBrowser for help on using the repository browser.