root/main/trunk/greenstone2/build-src/packages/configure @ 31829

Revision 31829, 11.0 KB (checked in by ak19, 3 years ago)

Intermediate commit for building wget with openssl. This is a working version, part of incremental commits. For now, we're still using wget-1.15-gs (that always requires --no-check-certificate if running wget), which now uses a wgetrc conf file to turn off the check-certificate default of wget, since without this, wget fails getting https pages that don't yet have a valid security certificate. This commit introduces the template wgetrc-gs.in file, which contains a flag set to not require certificate checks, is copied to gs2build/OS as wgetrc. The WGETRC env var is set in setup.bash to point to the wgetrc file so wget runs smoothly against https urls.

  • 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# 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-1.0.2l
158
159# configure
160# see the INSTALL file for OpenSSL to see config options for openssl
161# If you ever want to have the .a libraries that building openssl generates,
162# then use the --prefix and point it to the $bindir.
163# --prefix indicates where the generated lib, include and bin folders will go
164# --openssldir will contain the manuals and other non-essentials
165# we'll put them into $bindir/openssl for wget to use
166echo ./config --prefix=$bindir/openssl --openssldir=$PACKAGES/openssl no-shared
167./config --prefix=$bindir/openssl --openssldir=$PACKAGES/openssl no-shared
168# make
169echo make
170make
171# make install
172echo make install
173make install
174
175# now move the include, lib and bin folders to the correct place
176
177# configure the wvWare Word document converter
178echo ""
179echo "Configuring wvWare"
180echo ""
181
182# datadir flag is for default location of wvHtml.xml config file
183if test x$USE_WVWARE = xtrue ;
184then
185
186  # Look to see if gnome-lib extension is present and if so, source its devel.bash file
187  if [ -d ../../ext/gnome-lib ] ; then
188    pushd ../../ext/gnome-lib
189    source ./devel.bash
190    popd
191  fi
192
193  if [ -d ../../../ext/gnome-lib-minimal ] ; then
194    pushd ../../../ext/gnome-lib-minimal
195    source ./devel.bash
196    popd
197  fi
198
199  cd "$PACKAGES/wv"
200  if [ "x$GSDLOS" = "xdarwin" ]; then
201    WV_LDFLAGS="$LDFLAGS -framework CoreFoundation -framework Carbon"
202  else
203    WV_LDFLAGS="$LDFLAGS"
204  fi
205  gzip -dc wv-1.2.4-gs.tar.gz | tar -xf - 
206  cd wv-gs && \
207  ./configure $CACHE_FILE --prefix=$PACKAGES/wv --bindir="$bindir" --libdir="$libdir" --datadir="$prefix/etc/packages" $HOSTTARGETFLAGS --disable-shared --enable-static LDFLAGS="$WV_LDFLAGS"
208else
209  echo "wvWare support disabled."
210  echo "  add '--enable-wvware' to the configure command to include wvWare support."
211  echo ""
212fi
213
214if test x$? = x1 ;
215then
216  echo "Configuration of wvWare failed."
217  exit 1
218fi
219
220# configure the pdftohtml converter
221echo ""
222echo "Configuring pdftohtml"
223echo ""
224
225cd "$PACKAGES/pdftohtml"
226gzip -dc pdftohtml_0_36_gs.tar.gz | tar -xf -
227cd pdftohtml_gs && \
228./configure $CACHE_FILE --prefix="$prefix" --bindir="$bindir" $HOSTTARGETFLAGS $ENVIRONMENT
229
230if test x$? = x1 ;
231then
232  echo "Configuration of pdftohtml failed."
233  exit 1
234fi
235
236# rtftohtml converter
237echo ""
238echo "Configuring rtftohtml"
239echo ""
240
241cd "$PACKAGES/rtftohtml"
242gzip -dc rtftohtml-gs.tar.gz | tar -xf -
243cd rtftohtml_src && \
244./configure $CACHE_FILE --prefix="$prefix" --bindir="$bindir" $HOSTTARGETFLAGS
245
246if test x$? = x1 ;
247then
248  echo "Configuration of rtftohtml failed."
249  exit 1
250fi
251
252# configure wget
253wget_pkgname=wget-1.15-gs
254#wget_pkgname=wget-1.17.1-gs
255echo ""
256echo "Configuring wget"
257echo ""
258cd "$PACKAGES/wget"
259gzip -dc $wget_pkgname.tar.gz | tar -xf -
260if test x$crossOS = "xandroid" ;
261then
262  wget_extraargs="gl_cv_header_working_stdint_h=yes ac_cv_func_getopt_long_only=no"
263else
264  wget_extraargs=
265fi
266
267# When compiling wget-1.15-gs without openssl as before:
268#./configure $CACHE_FILE --prefix=$PACKAGES/wget --without-ssl --bindir="$bindir" -disable-nls $HOSTTARGETFLAGS $wget_extraargs
269
270# We weren't compiling up wget statically before either and we still aren't
271# However, to compile up wget (statically or not) with openssl, see
272# https://stackoverflow.com/questions/9817337/compiling-wget-with-static-linking-self-compiled-openssl-library-linking-issu
273# Note: contrary to the instructions at the link, if the cppflags and ldflags are set during the
274# configure stage, as we now do, then the make command needn't additionally set them as well.
275# So just make, make install works thereafter
276
277echo copying "$PACKAGES/wget/wgetrc-gs.in" file to "$bindir/wgetrc"
278cp "$PACKAGES/wget/wgetrc-gs.in" "$bindir/wgetrc"
279echo cd "$PACKAGES/wget/$wget_pkgname"
280
281# for wget-1.15-gs. (can also try adding --localstatedir="$bindir/wget" --enable-iri)
282echo CPPFLAGS="-I/$bindir/openssl/include" LDFLAGS="-L/$bindir/openssl/lib" ./configure $CACHE_FILE --prefix=$PACKAGES/wget --with-ssl=openssl --bindir="$bindir" -disable-nls $HOSTTARGETFLAGS $wget_extraarg
283cd "$PACKAGES/wget/$wget_pkgname" && \
284CPPFLAGS="-I/$bindir/openssl/include" LDFLAGS="-L/$bindir/openssl/lib" ./configure $CACHE_FILE --prefix=$PACKAGES/wget --with-ssl=openssl --bindir="$bindir" -disable-nls $HOSTTARGETFLAGS $wget_extraargs
285
286# for wget-1.17.1-gs. (can also try adding --localstatedir="$bindir/wget" --enable-iri)
287#echo OPENSSL_CFLAGS="-I/$bindir/openssl/include" OPENSSL_LIBS="-L/$bindir/openssl/lib -lssl -lcrypto" ./configure $CACHE_FILE --prefix=$PACKAGES/wget --with-ssl=openssl --with-openssl=auto --with-libssl-prefix="$bindir/openssl" --bindir="$bindir" -disable-nls $HOSTTARGETFLAGS $wget_extraargs
288#cd "$PACKAGES/wget/$wget_pkgname" && \
289#OPENSSL_CFLAGS="-I/$bindir/openssl/include" OPENSSL_LIBS="-L/$bindir/openssl/lib -lssl -lcrypto" ./configure $CACHE_FILE --prefix=$PACKAGES/wget --with-ssl=openssl --with-openssl=auto --with-libssl-prefix="$bindir/openssl" --bindir="$bindir"  -disable-nls $HOSTTARGETFLAGS $wget_extraargs
290
291##
292##CPPFLAGS="-I/Scratch/ak19/gs3-svn-13July2017/gs2build/bin/linux/openssl/include" LDFLAGS="-L/Scratch/ak19/gs3-svn-13July2017/gs2build/bin/linux/openssl/lib" ./configure --prefix=/Scratch/ak19/gs3-svn-13July2017/gs2build/build-src/packages/wget --with-ssl=openssl --bindir="/Scratch/ak19/gs3-svn-13July2017/gs2build/bin/linux" -disable-nls
293##
294##make CPPFLAGS="-I/Scratch/ak19/gs3-svn-13July2017/gs2build/bin/linux/openssl/include" LDFLAGS="-L/Scratch/ak19/gs3-svn-13July2017/gs2build/bin/linux/openssl/lib -static"
295
296if test x$? = x1 ;
297then
298  echo "Configuration of wget failed."
299  exit 1
300fi
301
302# configure XML::Parser perl module
303echo ""
304echo "Configuring XML::Parser"
305echo ""
306cd "$PACKAGES/cpan"
307
308perl_dir=`echo 'my $vn = sprintf("%vd", $^V); $vn =~ s/\.\d+?$//; print "perl-$vn";' | perl`
309
310gzip -dc XML-Parser-2.41.tar.gz | tar -xf -
311cd "$PACKAGES/cpan/XML-Parser-2.41" && \
312
313perl Makefile.PL \
314  PREFIX="$GSDLHOME/perllib/cpan/XML" \
315  INSTALLSITELIB="$GSDLHOME/perllib/cpan/$perl_dir" \
316  INSTALLSITEARCH="$GSDLHOME/perllib/cpan/$perl_dir" \
317  INSTALLMAN1DIR="$GSDLHOME/perllib/cpan/$perl_dir" \
318  INSTALLMAN3DIR="$GSDLHOME/perllib/cpan/$perl_dir" \
319  SITEPREFIX="$GSDLHOME/perllib/cpan" \
320  EXPATINCPATH="$GSDLHOME/common-src/packages/expat/include" \
321  EXPATLIBPATH="$GSDLHOME/common-src/packages/expat/lib"
322
323if test x$? = x1 ;
324then
325  echo "Configuration of XML-Parser failed."
326  exit 1
327fi
328
329# configure powerpoint converter
330echo ""
331echo "Configuring xlhtml (powerpoint & excel converter)"
332echo ""
333cd "$PACKAGES/xlhtml"
334gzip -dc xlhtml-0.4.9.0-gs.tar.gz | tar -xf -
335cd xlhtml-0.4.9.0 && \
336./configure $CACHE_FILE --prefix="$prefix" --bindir="$bindir" $HOSTTARGETFLAGS
337
338if test x$? = x1 ;
339then
340  echo "Configuration of xlhtml failed."
341  exit 1
342fi
343
344# configure IsisGdl program
345echo ""
346echo "Configuring IsisGdl (CDS/ISIS database reader)"
347echo ""
348cd "$PACKAGES/isis-gdl" && \
349./configure $CACHE_FILE --prefix="$prefix" --bindir="$bindir" $HOSTTARGETFLAGS $ENVIRONMENT
350
351if test x$? = x1 ;
352then
353  echo "Configuration of IsisGdl failed."
354  exit 1
355fi
356
357# configure HTMLTidy program
358echo ""
359echo "Configuring HTMLTidy"
360echo ""
361cd "$PACKAGES/html-tidy"
362gzip -dc tidy.tgz | tar -xf -
363cd "$PACKAGES/html-tidy/tidy" && \
364./configure $CACHE_FILE --prefix="$prefix" --bindir="$bindir" $HOSTTARGETFLAGS $ENVIRONMENT
365
366if test x$? = x1 ;
367then
368  echo "Configuration of HTMLTidy failed."
369  exit 1
370fi
Note: See TracBrowser for help on using the browser.