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