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