Annotation of parser3/buildall, revision 1.1
1.1 ! moko 1: #!/bin/sh
! 2: # $Id: buildall,v 1.1 2012-06-26 22:38:31 moko Exp $
! 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")
! 39: echo "usage"
! 40: exit 1
! 41: ;;
! 42: *)
! 43: options="$options $PARAM"
! 44: ;;
! 45: esac
! 46: done
! 47:
! 48: if test "$build_xml" = "yes"; then
! 49: options="$options --with-xml=$project_dir/gnome"
! 50: fi
! 51:
! 52: bits=`getconf LONG_BIT`
! 53: if test "$bits" = "64" -a "$build_apache" = "yes"; then
! 54: cflags="$cflags --with-pic"
! 55: else
! 56: cflags="$cflags --without-pic"
! 57: fi
! 58:
! 59: if test ! "$build_apache" = "yes"; then
! 60: cflags="$cflags --disable-shared"
! 61: fi
! 62:
! 63: download=`which fetch 2>/dev/null`
! 64: if test -f "$download"; then
! 65: download="fetch -p"
! 66: else
! 67: download="wget -c --passive-ftp"
! 68: fi
! 69:
! 70: ############################### Support functions ################################
! 71:
! 72: prepare.gz () {
! 73: cd $project_dir/src
! 74:
! 75: if test ! -f "$lib.tar.gz"; then
! 76: echo "Downloading $1..."
! 77: $download $2
! 78: fi
! 79:
! 80: echo "Unpacking $1..."
! 81: rm -rf $lib
! 82: gunzip -c $lib.tar.gz | tar xf - >/dev/null
! 83: cd $lib
! 84: }
! 85:
! 86: prepare.xz () {
! 87: cd $project_dir/src
! 88:
! 89: if test ! -f "$lib.tar.xz"; then
! 90: echo "Downloading $1..."
! 91: $download $2
! 92: fi
! 93:
! 94: echo "Unpacking $1..."
! 95: rm -rf $lib
! 96: xzcat $lib.tar.xz | tar xf - >/dev/null
! 97: cd $lib
! 98: }
! 99:
! 100: cleanup () {
! 101: cd ..
! 102: rm -rf $lib
! 103: }
! 104:
! 105: #################################### Building ####################################
! 106:
! 107: echo
! 108: mkdir src >/dev/null 2>&1
! 109:
! 110: if test ! -f "$project_dir/gc/lib/libgc.a"; then
! 111: # libgc="gc6.8" # FreeBSD 4.X is not supported in newer gc version
! 112: lib="gc-7.1"
! 113: prepare.gz gc http://www.hpl.hp.com/personal/Hans_Boehm/gc/gc_source/$lib.tar.gz
! 114: echo "Configuring gc..."
! 115: CPPFLAGS="-DUSE_LIBC_PRIVATES -DUSE_MMAP -DDONT_ADD_BYTE_AT_END" \
! 116: ./configure --prefix=$project_dir/gc \
! 117: --disable-threads \
! 118: --disable-shared \
! 119: --silent $cflags
! 120: echo "Building gc..."
! 121: make install
! 122: cleanup
! 123: fi
! 124:
! 125: if test ! -f "$project_dir/pcre/lib/libpcre.a"; then
! 126: lib="pcre-8.30"
! 127: prepare.gz pcre ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/$libpcre.tar.gz
! 128: echo "Configuring pcre..."
! 129: ./configure --prefix="$project_dir/pcre" \
! 130: --with-match-limit-recursion=10000 \
! 131: --enable-utf8 \
! 132: --enable-unicode-properties \
! 133: --disable-shared \
! 134: --disable-cpp \
! 135: --disable-pcregrep-libz \
! 136: --disable-pcregrep-libbz2 \
! 137: --silent $cflags
! 138: echo "Building pcre..."
! 139: make install
! 140: cleanup
! 141: fi
! 142:
! 143: if test "$build_xml" = "yes" -a ! -f "$project_dir/gnome/lib/libxml2.a"; then
! 144: lib="libxml2-2.8.0"
! 145: prepare.gz libxml ftp://xmlsoft.org/libxml2/$lib.tar.gz
! 146: #sax1, output, tree, xinclude[in libxslt], html[in libxslt, mode=html?], xptr[xinclude], pattern -- needed!
! 147: echo "Configuring libxml..."
! 148: ./configure --prefix=$project_dir/gnome \
! 149: --without-catalog \
! 150: --without-iconv \
! 151: --without-threads \
! 152: --without-debug \
! 153: --without-iso8859x \
! 154: --without-legacy \
! 155: --without-push \
! 156: --without-python \
! 157: --without-reader \
! 158: --without-writer \
! 159: --without-readline \
! 160: --without-regexps \
! 161: --without-schemas \
! 162: --without-schematron \
! 163: --without-modules \
! 164: --without-ftp \
! 165: --without-http \
! 166: --without-docbook \
! 167: --without-zlib \
! 168: --without-lzma \
! 169: --disable-shared \
! 170: --silent $cflags
! 171: echo "Building libxml..."
! 172: make install
! 173: cleanup
! 174: fi
! 175:
! 176: if test "$build_xml" = "yes" -a ! -f "$project_dir/gnome/lib/libxslt.a"; then
! 177: lib="libxslt-1.1.26"
! 178: prepare.gz libxslt ftp://xmlsoft.org/libxslt/$libxslt.tar.gz
! 179: echo "Configuring libxslt..."
! 180: ./configure --prefix=$project_dir/gnome \
! 181: --with-libxml-prefix=$project_dir/gnome \
! 182: --without-debug \
! 183: --without-debugger \
! 184: --without-crypto \
! 185: --without-plugins \
! 186: --disable-shared \
! 187: --silent $cflags
! 188: echo "Building libxslt..."
! 189: make install
! 190: cleanup
! 191: fi
! 192:
! 193: if test "$build_gmime" = "yes"; then
! 194:
! 195: glib_ldflags=""
! 196: gmime_cflags=""
! 197: gmime_ldflags="-L$project_dir/gnome/lib/"
! 198:
! 199: os=`uname`
! 200: if test "$os" = "FreeBSD"; then
! 201: gmime_cflags="CFLAGS=-I/usr/local/include CXXFLAGS=-I/usr/local/include"
! 202: glib_ldflags="LDFLAGS=-L/usr/local/lib"
! 203: gmime_ldflags="$gmime_ldflags -L/usr/local/lib"
! 204: fi
! 205:
! 206: if test ! -f "$project_dir/gnome/lib/libglib-2.0.a"; then
! 207: lib="glib-2.28.8"
! 208: prepare.xz glib ftp://ftp.gnome.org/pub/GNOME/sources/glib/2.28/$lib.tar.xz
! 209: echo "Configuring glib..."
! 210: ./configure --prefix=$project_dir/gnome \
! 211: --enable-dtrace=no \
! 212: --enable-debug=no \
! 213: --enable-iconv-cache=no \
! 214: --disable-threads \
! 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"
! 228: prepare.xz gmime ftp://ftp.gnome.org/pub/GNOME/sources/gmime/2.4/$libgmime.tar.xz
! 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
! 244: #if test ! -f "Makefile"; then
! 245: echo "Configuring parser3..."
! 246: ./configure --prefix=$install_directory "--with-sendmail=$sendmail_command" $options --silent $cflags $gmime_cflags
! 247: #fi
! 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: