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