Annotation of parser3/buildall, revision 1.36

1.1       moko        1: #!/bin/sh
1.36    ! moko        2: # $Id: buildall,v 1.35 2021/01/19 20:19:49 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.34      moko      126:     lib="libatomic_ops-7.6.2"
                    127:     prepare_gz ${lib}.tar.gz http://www.hboehm.info/gc/gc_source/
                    128: 
1.26      moko      129:     lib="gc-8.0.4"
1.19      moko      130:     prepare_gz ${lib}.tar.gz http://www.hboehm.info/gc/gc_source/
                    131: 
1.34      moko      132:     mv ../libatomic_ops-7.6.2 libatomic_ops
                    133: 
1.8       moko      134:     echo "Configuring $lib..."
1.22      moko      135:     CPPFLAGS="-DUSE_MMAP -DDONT_ADD_BYTE_AT_END" \
1.1       moko      136:     ./configure --prefix=$project_dir/gc \
                    137:        --disable-shared \
1.35      moko      138:        --disable-parallel-mark \
1.1       moko      139:        --silent $cflags
1.8       moko      140:     echo "Building $lib..."
1.1       moko      141:     make install
                    142:     cleanup
                    143: fi
                    144: 
                    145: if test ! -f "$project_dir/pcre/lib/libpcre.a"; then
1.26      moko      146:     lib="pcre-8.43"
                    147:     prepare_gz $lib.tar.gz https://ftp.pcre.org/pub/pcre/
1.8       moko      148:     echo "Configuring $lib..."
1.1       moko      149:     ./configure --prefix="$project_dir/pcre" \
                    150:        --with-match-limit-recursion=10000 \
                    151:        --enable-utf8 \
                    152:        --enable-unicode-properties \
                    153:        --disable-shared \
                    154:        --disable-cpp \
                    155:        --disable-pcregrep-libz \
                    156:        --disable-pcregrep-libbz2 \
                    157:        --silent $cflags
1.8       moko      158:     echo "Building $lib..."
1.1       moko      159:     make install
                    160:     cleanup
                    161: fi
                    162: 
                    163: if test "$build_xml" = "yes" -a ! -f "$project_dir/gnome/lib/libxml2.a"; then
1.27      moko      164:     lib="libxml2-2.9.9"
1.8       moko      165:     prepare_gz $lib.tar.gz ftp://xmlsoft.org/libxml2/
1.1       moko      166:     #sax1, output, tree, xinclude[in libxslt], html[in libxslt, mode=html?], xptr[xinclude], pattern -- needed!
1.8       moko      167:     echo "Configuring $lib..."
1.1       moko      168:     ./configure --prefix=$project_dir/gnome \
                    169:        --without-catalog \
                    170:        --without-iconv \
                    171:        --without-debug \
                    172:        --without-iso8859x \
                    173:        --without-legacy \
                    174:        --without-push \
                    175:        --without-python \
                    176:        --without-writer \
                    177:        --without-readline \
                    178:        --without-regexps \
                    179:        --without-schemas \
                    180:        --without-schematron \
                    181:        --without-modules \
                    182:        --without-ftp \
                    183:        --without-http \
                    184:        --without-docbook \
                    185:        --without-zlib \
                    186:        --without-lzma \
                    187:        --disable-shared \
                    188:        --silent $cflags
1.8       moko      189:     echo "Building $lib..."
1.1       moko      190:     make install
                    191:     cleanup
                    192: fi
                    193: 
                    194: if test "$build_xml" = "yes" -a ! -f "$project_dir/gnome/lib/libxslt.a"; then
1.27      moko      195:     lib="libxslt-1.1.34"
1.8       moko      196:     prepare_gz $lib.tar.gz ftp://xmlsoft.org/libxslt/
                    197:     echo "Configuring $lib..."
1.21      moko      198:     CFLAGS="$CFLAGS -D__stub_clock_gettime -Dclock_gettime=choke_me" \
1.1       moko      199:     ./configure --prefix=$project_dir/gnome \
                    200:        --with-libxml-prefix=$project_dir/gnome \
                    201:        --without-debug \
                    202:        --without-debugger \
                    203:        --without-crypto \
                    204:        --without-plugins \
                    205:        --disable-shared \
                    206:        --silent $cflags
1.8       moko      207:     echo "Building $lib..."
1.1       moko      208:     make install
                    209:     cleanup
                    210: fi
                    211: 
                    212: if test "$build_gmime" = "yes"; then
                    213: 
                    214: glib_ldflags=""
                    215: gmime_cflags=""
                    216: gmime_ldflags="-L$project_dir/gnome/lib/"
                    217: 
                    218: os=`uname`
                    219: if test "$os" = "FreeBSD"; then
                    220:     gmime_cflags="CFLAGS=-I/usr/local/include CXXFLAGS=-I/usr/local/include"
                    221:     glib_ldflags="LDFLAGS=-L/usr/local/lib"
                    222:     gmime_ldflags="$gmime_ldflags -L/usr/local/lib"
                    223: fi
                    224: 
                    225: if test ! -f "$project_dir/gnome/lib/libglib-2.0.a"; then
                    226:     lib="glib-2.28.8"
1.8       moko      227:     prepare_xz $lib.tar.xz ftp://ftp.gnome.org/pub/GNOME/sources/glib/2.28/
                    228:     echo "Configuring $lib..."
1.1       moko      229:     ./configure --prefix=$project_dir/gnome \
                    230:        --enable-dtrace=no \
                    231:        --enable-debug=no \
                    232:        --enable-iconv-cache=no \
                    233:        --disable-fam \
                    234:        --disable-selinux \
                    235:        --disable-xattr \
                    236:        --disable-shared \
                    237:        --enable-static \
                    238:        --silent $cflags $gmime_cflags $glib_ldflags
1.8       moko      239:     echo "Building $lib..."
1.1       moko      240:     make install
                    241:     cleanup
                    242: fi
                    243: 
                    244: if test ! -f "$project_dir/gnome/lib/libgmime-2.4.a"; then
                    245:     lib="gmime-2.4.32"
1.8       moko      246:     prepare_xz $lib.tar.xz ftp://ftp.gnome.org/pub/GNOME/sources/gmime/2.4/
                    247:     echo "Configuring $lib..."
1.1       moko      248:     ./configure --prefix=$project_dir/gnome \
                    249:        --disable-glibtest \
                    250:        --disable-mono \
                    251:        --disable-shared \
                    252:        --enable-static \
                    253:        --silent $cflags $gmime_cflags LDFLAGS="$gmime_ldflags" PKG_CONFIG_PATH="$project_dir/gnome/lib/pkgconfig"
1.8       moko      254:     echo "Building $lib..."
1.1       moko      255:     make install
                    256:     cleanup
                    257: fi
                    258: 
                    259: fi
                    260: 
                    261: cd $parser3_dir
1.3       moko      262: if test ! -f "Makefile"; then
1.1       moko      263:     echo "Configuring parser3..."
1.32      moko      264:     ./configure --prefix=$install_directory \
                    265:        --sysconfdir=$install_directory/bin \
                    266:        --datadir=$install_directory/bin \
1.36    ! moko      267:        --datarootdir="\$confdir" \
        !           268:        --libdir="\$confdir/lib" \
1.32      moko      269:        --with-sendmail="$sendmail_command" \
                    270:        $options $cflags $gmime_cflags
1.3       moko      271: fi
1.1       moko      272: 
                    273: echo "Building parser3..."
                    274: make install
                    275: if test $? -ne 0; then exit 1; fi
                    276: 
1.6       moko      277: if test "$build_stripped" = "yes"; then
                    278:     strip ${install_directory}/bin/parser3
                    279: fi
1.1       moko      280: 
                    281: echo "DONE"
                    282: echo
                    283: echo "********************************************************************************************************"
                    284: echo "Now you can copy $install_directory/bin to your cgi-bin directory"
                    285: echo "Read more about installing Parser here:"
                    286: echo "  http://www.parser.ru/en/docs/lang/install4apachecgi.htm in English"
                    287: echo "  http://www.parser.ru/docs/lang/install4apachecgi.htm in Russian"
                    288: echo "********************************************************************************************************"
                    289: 

E-mail: