Annotation of parser3/buildall, revision 1.11
1.1 moko 1: #!/bin/sh
1.11 ! moko 2: # $Id: buildall,v 1.10 2013/10/15 22:23:02 moko Exp $
1.1 moko 3:
4: install_directory=$HOME/parser3install
5: sendmail_command="/usr/sbin/sendmail -i -t -f postmaster"
6:
7: parser3_dir=`pwd`
8: cd ..
9: project_dir=`pwd`
10:
11: build_xml="yes"
12: build_gmime=""
13: build_apache=""
1.6 moko 14: build_stripped=""
1.1 moko 15:
16: options="--with-included-ltdl"
17: options="$options --with-gc=$project_dir/gc/lib"
18: options="$options --with-pcre=$project_dir/pcre"
19: #options="$options --disable-stringstream"
20:
1.7 moko 21: echo "Building statically linked parser3\c"
22: for PARAM in "$@"; do
1.1 moko 23: case "$PARAM" in
24: "--without-xml")
1.7 moko 25: echo ", without xml\c"
1.1 moko 26: build_xml=""
27: ;;
28: "--with-apache")
1.7 moko 29: echo ", with apache module\c"
1.1 moko 30: options="$options --with-apache"
31: build_apache="yes"
32: ;;
33: "--with-mailreceive")
1.7 moko 34: echo ", with mail receiving\c"
1.1 moko 35: options="$options --with-mailreceive=$project_dir/gnome"
36: build_gmime="yes"
37: ;;
1.6 moko 38: "--strip")
1.7 moko 39: echo ", without debug information\c"
1.6 moko 40: build_stripped="yes"
41: ;;
1.1 moko 42: "--help")
1.2 moko 43: echo
1.6 moko 44: echo "Usage: buildall [--without-xml] [--with-apache] [--with-mailreceive] [--strip] [--disable-safe-mode] [other configure options ...]"
1.1 moko 45: exit 1
46: ;;
47: *)
48: options="$options $PARAM"
49: ;;
50: esac
51: done
52:
53: if test "$build_xml" = "yes"; then
54: options="$options --with-xml=$project_dir/gnome"
55: fi
56:
57: bits=`getconf LONG_BIT`
1.9 moko 58: if test "$bits" = "64" -o "$build_apache" = "yes"; then
1.1 moko 59: cflags="$cflags --with-pic"
60: else
61: cflags="$cflags --without-pic"
62: fi
63:
64: if test ! "$build_apache" = "yes"; then
65: cflags="$cflags --disable-shared"
66: fi
67:
68: download=`which fetch 2>/dev/null`
69: if test -f "$download"; then
70: download="fetch -p"
71: else
72: download="wget -c --passive-ftp"
73: fi
74:
75: ############################### Support functions ################################
76:
1.4 moko 77: prepare_gz () {
1.1 moko 78: cd $project_dir/src
79:
1.8 moko 80: if test ! -f "$1"; then
81: echo "Downloading $lib..."
82: $download $2$1
1.1 moko 83: fi
84:
1.8 moko 85: echo "Unpacking $lib..."
1.1 moko 86: rm -rf $lib
1.8 moko 87: gunzip -c $1 | tar xf - >/dev/null
1.1 moko 88: cd $lib
89: }
90:
1.4 moko 91: prepare_xz () {
1.1 moko 92: cd $project_dir/src
93:
1.8 moko 94: if test ! -f "$1"; then
95: echo "Downloading $lib..."
96: $download $2$1
1.1 moko 97: fi
98:
1.8 moko 99: echo "Unpacking $lib..."
1.1 moko 100: rm -rf $lib
1.8 moko 101: xzcat $1 | tar xf - >/dev/null
1.1 moko 102: cd $lib
103: }
104:
105: cleanup () {
106: cd ..
107: rm -rf $lib
108: }
109:
110: #################################### Building ####################################
111:
112: echo
113: mkdir src >/dev/null 2>&1
114:
115: if test ! -f "$project_dir/gc/lib/libgc.a"; then
116: # libgc="gc6.8" # FreeBSD 4.X is not supported in newer gc version
1.8 moko 117: lib="gc-7.2"
118: prepare_gz ${lib}d.tar.gz http://www.hpl.hp.com/personal/Hans_Boehm/gc/gc_source/
119: echo "Configuring $lib..."
1.1 moko 120: CPPFLAGS="-DUSE_LIBC_PRIVATES -DUSE_MMAP -DDONT_ADD_BYTE_AT_END" \
121: ./configure --prefix=$project_dir/gc \
122: --disable-threads \
123: --disable-shared \
124: --silent $cflags
1.8 moko 125: echo "Building $lib..."
1.1 moko 126: make install
127: cleanup
128: fi
129:
130: if test ! -f "$project_dir/pcre/lib/libpcre.a"; then
1.10 moko 131: lib="pcre-8.33"
1.8 moko 132: prepare_gz $lib.tar.gz ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/
133: echo "Configuring $lib..."
1.1 moko 134: ./configure --prefix="$project_dir/pcre" \
135: --with-match-limit-recursion=10000 \
136: --enable-utf8 \
137: --enable-unicode-properties \
138: --disable-shared \
139: --disable-cpp \
140: --disable-pcregrep-libz \
141: --disable-pcregrep-libbz2 \
142: --silent $cflags
1.8 moko 143: echo "Building $lib..."
1.1 moko 144: make install
145: cleanup
146: fi
147:
148: if test "$build_xml" = "yes" -a ! -f "$project_dir/gnome/lib/libxml2.a"; then
1.10 moko 149: lib="libxml2-2.9.1"
1.8 moko 150: prepare_gz $lib.tar.gz ftp://xmlsoft.org/libxml2/
1.1 moko 151: #sax1, output, tree, xinclude[in libxslt], html[in libxslt, mode=html?], xptr[xinclude], pattern -- needed!
1.8 moko 152: echo "Configuring $lib..."
1.1 moko 153: ./configure --prefix=$project_dir/gnome \
154: --without-catalog \
155: --without-iconv \
156: --without-threads \
157: --without-debug \
158: --without-iso8859x \
159: --without-legacy \
160: --without-push \
161: --without-python \
162: --without-writer \
163: --without-readline \
164: --without-regexps \
165: --without-schemas \
166: --without-schematron \
167: --without-modules \
168: --without-ftp \
169: --without-http \
170: --without-docbook \
171: --without-zlib \
172: --without-lzma \
173: --disable-shared \
174: --silent $cflags
1.8 moko 175: echo "Building $lib..."
1.1 moko 176: make install
177: cleanup
178: fi
179:
180: if test "$build_xml" = "yes" -a ! -f "$project_dir/gnome/lib/libxslt.a"; then
1.10 moko 181: lib="libxslt-1.1.28"
1.8 moko 182: prepare_gz $lib.tar.gz ftp://xmlsoft.org/libxslt/
183: echo "Configuring $lib..."
1.1 moko 184: ./configure --prefix=$project_dir/gnome \
185: --with-libxml-prefix=$project_dir/gnome \
186: --without-debug \
187: --without-debugger \
188: --without-crypto \
189: --without-plugins \
190: --disable-shared \
191: --silent $cflags
1.8 moko 192: echo "Building $lib..."
1.1 moko 193: make install
194: cleanup
195: fi
196:
197: if test "$build_gmime" = "yes"; then
198:
199: glib_ldflags=""
200: gmime_cflags=""
201: gmime_ldflags="-L$project_dir/gnome/lib/"
202:
203: os=`uname`
204: if test "$os" = "FreeBSD"; then
205: gmime_cflags="CFLAGS=-I/usr/local/include CXXFLAGS=-I/usr/local/include"
206: glib_ldflags="LDFLAGS=-L/usr/local/lib"
207: gmime_ldflags="$gmime_ldflags -L/usr/local/lib"
208: fi
209:
210: if test ! -f "$project_dir/gnome/lib/libglib-2.0.a"; then
211: lib="glib-2.28.8"
1.8 moko 212: prepare_xz $lib.tar.xz ftp://ftp.gnome.org/pub/GNOME/sources/glib/2.28/
213: echo "Configuring $lib..."
1.1 moko 214: ./configure --prefix=$project_dir/gnome \
215: --enable-dtrace=no \
216: --enable-debug=no \
217: --enable-iconv-cache=no \
218: --disable-fam \
219: --disable-selinux \
220: --disable-xattr \
221: --disable-shared \
222: --enable-static \
223: --silent $cflags $gmime_cflags $glib_ldflags
1.8 moko 224: echo "Building $lib..."
1.1 moko 225: make install
226: cleanup
227: fi
228:
229: if test ! -f "$project_dir/gnome/lib/libgmime-2.4.a"; then
230: lib="gmime-2.4.32"
1.8 moko 231: prepare_xz $lib.tar.xz ftp://ftp.gnome.org/pub/GNOME/sources/gmime/2.4/
232: echo "Configuring $lib..."
1.1 moko 233: ./configure --prefix=$project_dir/gnome \
234: --disable-glibtest \
235: --disable-mono \
236: --disable-shared \
237: --enable-static \
238: --silent $cflags $gmime_cflags LDFLAGS="$gmime_ldflags" PKG_CONFIG_PATH="$project_dir/gnome/lib/pkgconfig"
1.8 moko 239: echo "Building $lib..."
1.1 moko 240: make install
241: cleanup
242: fi
243:
244: fi
245:
246: cd $parser3_dir
1.3 moko 247: if test ! -f "Makefile"; then
1.1 moko 248: echo "Configuring parser3..."
249: ./configure --prefix=$install_directory "--with-sendmail=$sendmail_command" $options --silent $cflags $gmime_cflags
1.3 moko 250: fi
1.1 moko 251:
252: echo "Building parser3..."
253: make install
254: if test $? -ne 0; then exit 1; fi
255:
1.6 moko 256: if test "$build_stripped" = "yes"; then
257: strip ${install_directory}/bin/parser3
258: fi
1.1 moko 259:
260: echo "DONE"
261: echo
262: echo "********************************************************************************************************"
263: echo "Now you can copy $install_directory/bin to your cgi-bin directory"
264: echo "Read more about installing Parser here:"
265: echo " http://www.parser.ru/en/docs/lang/install4apachecgi.htm in English"
266: echo " http://www.parser.ru/docs/lang/install4apachecgi.htm in Russian"
267: echo "********************************************************************************************************"
268:
E-mail: