Annotation of parser3/buildall, revision 1.10
1.1 moko 1: #!/bin/sh
1.10 ! moko 2: # $Id: buildall,v 1.9 2013/08/26 20:05:57 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-reader \
163: --without-writer \
164: --without-readline \
165: --without-regexps \
166: --without-schemas \
167: --without-schematron \
168: --without-modules \
169: --without-ftp \
170: --without-http \
171: --without-docbook \
172: --without-zlib \
173: --without-lzma \
174: --disable-shared \
175: --silent $cflags
1.8 moko 176: echo "Building $lib..."
1.1 moko 177: make install
178: cleanup
179: fi
180:
181: if test "$build_xml" = "yes" -a ! -f "$project_dir/gnome/lib/libxslt.a"; then
1.10 ! moko 182: lib="libxslt-1.1.28"
1.8 moko 183: prepare_gz $lib.tar.gz ftp://xmlsoft.org/libxslt/
184: echo "Configuring $lib..."
1.1 moko 185: ./configure --prefix=$project_dir/gnome \
186: --with-libxml-prefix=$project_dir/gnome \
187: --without-debug \
188: --without-debugger \
189: --without-crypto \
190: --without-plugins \
191: --disable-shared \
192: --silent $cflags
1.8 moko 193: echo "Building $lib..."
1.1 moko 194: make install
195: cleanup
196: fi
197:
198: if test "$build_gmime" = "yes"; then
199:
200: glib_ldflags=""
201: gmime_cflags=""
202: gmime_ldflags="-L$project_dir/gnome/lib/"
203:
204: os=`uname`
205: if test "$os" = "FreeBSD"; then
206: gmime_cflags="CFLAGS=-I/usr/local/include CXXFLAGS=-I/usr/local/include"
207: glib_ldflags="LDFLAGS=-L/usr/local/lib"
208: gmime_ldflags="$gmime_ldflags -L/usr/local/lib"
209: fi
210:
211: if test ! -f "$project_dir/gnome/lib/libglib-2.0.a"; then
212: lib="glib-2.28.8"
1.8 moko 213: prepare_xz $lib.tar.xz ftp://ftp.gnome.org/pub/GNOME/sources/glib/2.28/
214: echo "Configuring $lib..."
1.1 moko 215: ./configure --prefix=$project_dir/gnome \
216: --enable-dtrace=no \
217: --enable-debug=no \
218: --enable-iconv-cache=no \
219: --disable-fam \
220: --disable-selinux \
221: --disable-xattr \
222: --disable-shared \
223: --enable-static \
224: --silent $cflags $gmime_cflags $glib_ldflags
1.8 moko 225: echo "Building $lib..."
1.1 moko 226: make install
227: cleanup
228: fi
229:
230: if test ! -f "$project_dir/gnome/lib/libgmime-2.4.a"; then
231: lib="gmime-2.4.32"
1.8 moko 232: prepare_xz $lib.tar.xz ftp://ftp.gnome.org/pub/GNOME/sources/gmime/2.4/
233: echo "Configuring $lib..."
1.1 moko 234: ./configure --prefix=$project_dir/gnome \
235: --disable-glibtest \
236: --disable-mono \
237: --disable-shared \
238: --enable-static \
239: --silent $cflags $gmime_cflags LDFLAGS="$gmime_ldflags" PKG_CONFIG_PATH="$project_dir/gnome/lib/pkgconfig"
1.8 moko 240: echo "Building $lib..."
1.1 moko 241: make install
242: cleanup
243: fi
244:
245: fi
246:
247: cd $parser3_dir
1.3 moko 248: if test ! -f "Makefile"; then
1.1 moko 249: echo "Configuring parser3..."
250: ./configure --prefix=$install_directory "--with-sendmail=$sendmail_command" $options --silent $cflags $gmime_cflags
1.3 moko 251: fi
1.1 moko 252:
253: echo "Building parser3..."
254: make install
255: if test $? -ne 0; then exit 1; fi
256:
1.6 moko 257: if test "$build_stripped" = "yes"; then
258: strip ${install_directory}/bin/parser3
259: fi
1.1 moko 260:
261: echo "DONE"
262: echo
263: echo "********************************************************************************************************"
264: echo "Now you can copy $install_directory/bin to your cgi-bin directory"
265: echo "Read more about installing Parser here:"
266: echo " http://www.parser.ru/en/docs/lang/install4apachecgi.htm in English"
267: echo " http://www.parser.ru/docs/lang/install4apachecgi.htm in Russian"
268: echo "********************************************************************************************************"
269:
E-mail: