Annotation of parser3/buildall, revision 1.34

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

E-mail: