Annotation of parser3/buildall, revision 1.21
1.1 moko 1: #!/bin/sh
1.21 ! moko 2: # $Id: buildall,v 1.20 2017/05/22 16:15:30 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
1.16 moko 81: echo "Downloading $lib (master at $2)..."
1.18 moko 82: $download https://www.parser.ru/off-line/download/libs/$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
1.16 moko 95: echo "Downloading $lib (master at $2)..."
1.20 moko 96: $download https://www.parser.ru/off-line/download/libs/$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
1.19 moko 116: lib="libatomic_ops-7.4.4"
117: prepare_gz ${lib}.tar.gz http://www.hboehm.info/gc/gc_source/
118: lib="gc-7.6.0"
119: prepare_gz ${lib}.tar.gz http://www.hboehm.info/gc/gc_source/
120:
121: mv ../libatomic_ops-7.4.4 libatomic_ops
122:
1.8 moko 123: echo "Configuring $lib..."
1.1 moko 124: CPPFLAGS="-DUSE_LIBC_PRIVATES -DUSE_MMAP -DDONT_ADD_BYTE_AT_END" \
125: ./configure --prefix=$project_dir/gc \
126: --disable-threads \
127: --disable-shared \
128: --silent $cflags
1.8 moko 129: echo "Building $lib..."
1.1 moko 130: make install
131: cleanup
132: fi
133:
134: if test ! -f "$project_dir/pcre/lib/libpcre.a"; then
1.18 moko 135: lib="pcre-8.40"
1.8 moko 136: prepare_gz $lib.tar.gz ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/
137: echo "Configuring $lib..."
1.1 moko 138: ./configure --prefix="$project_dir/pcre" \
139: --with-match-limit-recursion=10000 \
140: --enable-utf8 \
141: --enable-unicode-properties \
142: --disable-shared \
143: --disable-cpp \
144: --disable-pcregrep-libz \
145: --disable-pcregrep-libbz2 \
146: --silent $cflags
1.8 moko 147: echo "Building $lib..."
1.1 moko 148: make install
149: cleanup
150: fi
151:
152: if test "$build_xml" = "yes" -a ! -f "$project_dir/gnome/lib/libxml2.a"; then
1.18 moko 153: lib="libxml2-2.9.4"
1.8 moko 154: prepare_gz $lib.tar.gz ftp://xmlsoft.org/libxml2/
1.1 moko 155: #sax1, output, tree, xinclude[in libxslt], html[in libxslt, mode=html?], xptr[xinclude], pattern -- needed!
1.8 moko 156: echo "Configuring $lib..."
1.1 moko 157: ./configure --prefix=$project_dir/gnome \
158: --without-catalog \
159: --without-iconv \
160: --without-threads \
161: --without-debug \
162: --without-iso8859x \
163: --without-legacy \
164: --without-push \
165: --without-python \
166: --without-writer \
167: --without-readline \
168: --without-regexps \
169: --without-schemas \
170: --without-schematron \
171: --without-modules \
172: --without-ftp \
173: --without-http \
174: --without-docbook \
175: --without-zlib \
176: --without-lzma \
177: --disable-shared \
178: --silent $cflags
1.8 moko 179: echo "Building $lib..."
1.1 moko 180: make install
181: cleanup
182: fi
183:
184: if test "$build_xml" = "yes" -a ! -f "$project_dir/gnome/lib/libxslt.a"; then
1.18 moko 185: lib="libxslt-1.1.29"
1.8 moko 186: prepare_gz $lib.tar.gz ftp://xmlsoft.org/libxslt/
187: echo "Configuring $lib..."
1.21 ! moko 188: CFLAGS="$CFLAGS -D__stub_clock_gettime -Dclock_gettime=choke_me" \
1.1 moko 189: ./configure --prefix=$project_dir/gnome \
190: --with-libxml-prefix=$project_dir/gnome \
191: --without-debug \
192: --without-debugger \
193: --without-crypto \
194: --without-plugins \
195: --disable-shared \
196: --silent $cflags
1.8 moko 197: echo "Building $lib..."
1.1 moko 198: make install
199: cleanup
200: fi
201:
202: if test "$build_gmime" = "yes"; then
203:
204: glib_ldflags=""
205: gmime_cflags=""
206: gmime_ldflags="-L$project_dir/gnome/lib/"
207:
208: os=`uname`
209: if test "$os" = "FreeBSD"; then
210: gmime_cflags="CFLAGS=-I/usr/local/include CXXFLAGS=-I/usr/local/include"
211: glib_ldflags="LDFLAGS=-L/usr/local/lib"
212: gmime_ldflags="$gmime_ldflags -L/usr/local/lib"
213: fi
214:
215: if test ! -f "$project_dir/gnome/lib/libglib-2.0.a"; then
216: lib="glib-2.28.8"
1.8 moko 217: prepare_xz $lib.tar.xz ftp://ftp.gnome.org/pub/GNOME/sources/glib/2.28/
218: echo "Configuring $lib..."
1.1 moko 219: ./configure --prefix=$project_dir/gnome \
220: --enable-dtrace=no \
221: --enable-debug=no \
222: --enable-iconv-cache=no \
223: --disable-fam \
224: --disable-selinux \
225: --disable-xattr \
226: --disable-shared \
227: --enable-static \
228: --silent $cflags $gmime_cflags $glib_ldflags
1.8 moko 229: echo "Building $lib..."
1.1 moko 230: make install
231: cleanup
232: fi
233:
234: if test ! -f "$project_dir/gnome/lib/libgmime-2.4.a"; then
235: lib="gmime-2.4.32"
1.8 moko 236: prepare_xz $lib.tar.xz ftp://ftp.gnome.org/pub/GNOME/sources/gmime/2.4/
237: echo "Configuring $lib..."
1.1 moko 238: ./configure --prefix=$project_dir/gnome \
239: --disable-glibtest \
240: --disable-mono \
241: --disable-shared \
242: --enable-static \
243: --silent $cflags $gmime_cflags LDFLAGS="$gmime_ldflags" PKG_CONFIG_PATH="$project_dir/gnome/lib/pkgconfig"
1.8 moko 244: echo "Building $lib..."
1.1 moko 245: make install
246: cleanup
247: fi
248:
249: fi
250:
251: cd $parser3_dir
1.3 moko 252: if test ! -f "Makefile"; then
1.1 moko 253: echo "Configuring parser3..."
254: ./configure --prefix=$install_directory "--with-sendmail=$sendmail_command" $options --silent $cflags $gmime_cflags
1.3 moko 255: fi
1.1 moko 256:
257: echo "Building parser3..."
258: make install
259: if test $? -ne 0; then exit 1; fi
260:
1.6 moko 261: if test "$build_stripped" = "yes"; then
262: strip ${install_directory}/bin/parser3
263: fi
1.1 moko 264:
265: echo "DONE"
266: echo
267: echo "********************************************************************************************************"
268: echo "Now you can copy $install_directory/bin to your cgi-bin directory"
269: echo "Read more about installing Parser here:"
270: echo " http://www.parser.ru/en/docs/lang/install4apachecgi.htm in English"
271: echo " http://www.parser.ru/docs/lang/install4apachecgi.htm in Russian"
272: echo "********************************************************************************************************"
273:
E-mail: