Annotation of parser3/buildall, revision 1.5

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

E-mail: