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