2011-12-18 20:54:46 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
2013-04-16 15:47:04 +00:00
|
|
|
# /bin/sh on Solaris is not a POSIX compatible shell, but /usr/bin/ksh is.
|
|
|
|
if [ `uname -s` = 'SunOS' -a "${POSIX_SHELL}" != "true" ]; then
|
|
|
|
POSIX_SHELL="true"
|
|
|
|
export POSIX_SHELL
|
|
|
|
exec /usr/bin/ksh $0 $@
|
|
|
|
fi
|
|
|
|
unset POSIX_SHELL # clear it so if we invoke other scripts, they run as ksh as well
|
|
|
|
|
2011-12-18 20:54:46 +00:00
|
|
|
set -e
|
|
|
|
|
2013-04-16 15:47:04 +00:00
|
|
|
WT_REPO=http://github.com/wiredtiger/wiredtiger.git
|
2013-06-18 13:21:58 +00:00
|
|
|
WT_BRANCH=
|
2013-07-17 20:34:10 +00:00
|
|
|
WT_REF="tags/1.6.3"
|
2013-06-18 13:21:58 +00:00
|
|
|
WT_DIR=wiredtiger-`basename $WT_REF`
|
2013-04-16 15:47:04 +00:00
|
|
|
|
|
|
|
SNAPPY_VSN="1.0.4"
|
|
|
|
SNAPPY_DIR=snappy-$SNAPPY_VSN
|
|
|
|
|
2012-04-04 19:20:08 +00:00
|
|
|
[ `basename $PWD` != "c_src" ] && cd c_src
|
2011-12-18 20:54:46 +00:00
|
|
|
|
2013-04-16 15:47:04 +00:00
|
|
|
export BASEDIR="$PWD"
|
|
|
|
|
|
|
|
which gmake 1>/dev/null 2>/dev/null && MAKE=gmake
|
|
|
|
MAKE=${MAKE:-make}
|
|
|
|
|
2013-04-23 19:00:44 +00:00
|
|
|
export CFLAGS="$CFLAGS -I $BASEDIR/system/include"
|
2013-04-16 15:47:04 +00:00
|
|
|
export CXXFLAGS="$CXXFLAGS -I $BASEDIR/system/include"
|
|
|
|
export LDFLAGS="$LDFLAGS -L$BASEDIR/system/lib"
|
|
|
|
export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$BASEDIR/system/lib:$LD_LIBRARY_PATH"
|
|
|
|
|
2013-04-16 20:24:04 +00:00
|
|
|
get_wt ()
|
|
|
|
{
|
|
|
|
if [ -d $BASEDIR/$WT_DIR/.git ]; then
|
|
|
|
(cd $BASEDIR/$WT_DIR && git pull -u) || exit 1
|
|
|
|
else
|
2013-06-18 13:21:58 +00:00
|
|
|
if [ "X$WT_REF" != "X" ]; then
|
2013-06-25 17:31:43 +00:00
|
|
|
git clone ${WT_REPO} ${WT_DIR} && \
|
|
|
|
(cd $BASEDIR/$WT_DIR && git checkout refs/$WT_REF || exit 1)
|
2013-04-16 20:24:04 +00:00
|
|
|
else
|
2013-06-25 17:31:43 +00:00
|
|
|
git clone ${WT_REPO} ${WT_DIR} && \
|
|
|
|
(cd $BASEDIR/$WT_DIR && git checkout -b $WT_BRANCH origin/$WT_BRANCH || exit 1)
|
2013-04-16 20:24:04 +00:00
|
|
|
fi
|
|
|
|
fi
|
|
|
|
[ -d $BASEDIR/$WT_DIR ] || (echo "Missing WiredTiger source directory" && exit 1)
|
|
|
|
(cd $BASEDIR/$WT_DIR
|
|
|
|
[ -e $BASEDIR/wiredtiger-build.patch ] && \
|
|
|
|
(patch -p1 --forward < $BASEDIR/wiredtiger-build.patch || exit 1 )
|
|
|
|
./autogen.sh || exit 1
|
2013-05-28 20:14:19 +00:00
|
|
|
[ -e $BASEDIR/$WT_DIR/build_posix/Makefile ] && \
|
|
|
|
(cd $BASEDIR/$WT_DIR/build_posix && $MAKE distclean)
|
2013-04-26 22:57:17 +00:00
|
|
|
wt_configure;
|
|
|
|
)
|
|
|
|
}
|
|
|
|
|
|
|
|
wt_configure ()
|
|
|
|
{
|
|
|
|
(cd $BASEDIR/$WT_DIR/build_posix
|
2013-04-17 17:19:06 +00:00
|
|
|
../configure --with-pic \
|
|
|
|
--enable-snappy \
|
2013-04-26 22:57:17 +00:00
|
|
|
--prefix=${BASEDIR}/system || exit 1)
|
2013-04-16 20:24:04 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
get_snappy ()
|
|
|
|
{
|
|
|
|
[ -e snappy-$SNAPPY_VSN.tar.gz ] || (echo "Missing Snappy ($SNAPPY_VSN) source package" && exit 1)
|
|
|
|
[ -d $BASEDIR/$SNAPPY_DIR ] || tar -xzf snappy-$SNAPPY_VSN.tar.gz
|
|
|
|
[ -e $BASEDIR/snappy-build.patch ] && \
|
2013-04-17 15:17:13 +00:00
|
|
|
(cd $BASEDIR/$SNAPPY_DIR
|
2013-04-16 20:24:04 +00:00
|
|
|
patch -p1 --forward < $BASEDIR/snappy-build.patch || exit 1)
|
2013-04-17 15:17:13 +00:00
|
|
|
(cd $BASEDIR/$SNAPPY_DIR
|
|
|
|
./configure --with-pic --prefix=$BASEDIR/system || exit 1)
|
2013-04-16 20:24:04 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
get_deps ()
|
|
|
|
{
|
|
|
|
get_wt;
|
|
|
|
get_snappy;
|
|
|
|
}
|
|
|
|
|
|
|
|
update_deps ()
|
|
|
|
{
|
|
|
|
if [ -d $BASEDIR/$WT_DIR/.git ]; then
|
|
|
|
(cd $BASEDIR/$WT_DIR
|
|
|
|
if [ "X$WT_VSN" == "X" ]; then
|
|
|
|
git pull -u || exit 1
|
|
|
|
else
|
|
|
|
git checkout $WT_VSN || exit 1
|
|
|
|
fi
|
|
|
|
)
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2013-04-16 15:47:04 +00:00
|
|
|
build_wt ()
|
|
|
|
{
|
2013-04-26 22:57:17 +00:00
|
|
|
wt_configure;
|
|
|
|
(cd $BASEDIR/$WT_DIR/build_posix && $MAKE -j && $MAKE install)
|
2013-04-16 15:47:04 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
build_snappy ()
|
|
|
|
{
|
|
|
|
(cd $BASEDIR/$SNAPPY_DIR && \
|
|
|
|
$MAKE -j && \
|
|
|
|
$MAKE install
|
|
|
|
)
|
|
|
|
}
|
|
|
|
|
2011-12-18 20:54:46 +00:00
|
|
|
case "$1" in
|
|
|
|
clean)
|
2013-05-28 20:14:19 +00:00
|
|
|
[ -e $BASEDIR/$WT_DIR/build_posix/Makefile ] && \
|
|
|
|
(cd $BASEDIR/$WT_DIR/build_posix && $MAKE distclean)
|
2013-04-26 22:57:17 +00:00
|
|
|
rm -rf system $SNAPPY_DIR
|
2013-04-17 01:46:53 +00:00
|
|
|
rm -f ${BASEDIR}/../priv/wt
|
|
|
|
rm -f ${BASEDIR}/../priv/libwiredtiger-*.so
|
|
|
|
rm -f ${BASEDIR}/../priv/libwiredtiger_*.so
|
|
|
|
rm -f ${BASEDIR}/../priv/libsnappy.so.*
|
2011-12-18 20:54:46 +00:00
|
|
|
;;
|
|
|
|
|
2013-04-16 15:47:04 +00:00
|
|
|
test)
|
|
|
|
(cd $BASEDIR/$WT_DIR && $MAKE -j test)
|
|
|
|
;;
|
|
|
|
|
|
|
|
update-deps)
|
2013-04-16 20:24:04 +00:00
|
|
|
update-deps;
|
2013-04-16 15:47:04 +00:00
|
|
|
;;
|
|
|
|
|
|
|
|
get-deps)
|
2013-04-16 20:24:04 +00:00
|
|
|
get_deps;
|
2013-04-16 15:47:04 +00:00
|
|
|
;;
|
|
|
|
|
|
|
|
*)
|
2013-04-16 20:24:04 +00:00
|
|
|
[ -d $WT_DIR ] || get_wt;
|
|
|
|
[ -d $SNAPPY_DIR ] || get_snappy;
|
|
|
|
|
2013-04-16 15:47:04 +00:00
|
|
|
# Build Snappy
|
2013-04-17 15:17:13 +00:00
|
|
|
[ -d $BASEDIR/$SNAPPY_DIR ] || (echo "Missing Snappy source directory" && exit 1)
|
2013-04-18 14:32:29 +00:00
|
|
|
test -f $BASEDIR/system/lib/libsnappy.so.[0-9].[0-9].[0-9] || build_snappy;
|
2013-04-16 15:47:04 +00:00
|
|
|
|
|
|
|
# Build WiredTiger
|
2013-04-17 15:17:13 +00:00
|
|
|
[ -d $BASEDIR/$WT_DIR ] || (echo "Missing WiredTiger source directory" && exit 1)
|
2013-04-18 14:32:29 +00:00
|
|
|
test -f $BASEDIR/system/lib/libwiredtiger-[0-9].[0-9].[0-9].so \
|
2013-05-02 02:00:43 +00:00
|
|
|
-a -f $BASEDIR/system/lib/libwiredtiger_snappy.so || build_wt;
|
2013-04-16 15:47:04 +00:00
|
|
|
|
|
|
|
[ -d $BASEDIR/../priv ] || mkdir ${BASEDIR}/../priv
|
2013-04-19 15:03:40 +00:00
|
|
|
cp -p -P $BASEDIR/system/bin/wt ${BASEDIR}/../priv
|
|
|
|
cp -p -P $BASEDIR/system/lib/libwiredtiger-[0-9].[0-9].[0-9].so ${BASEDIR}/../priv
|
2013-04-26 14:34:57 +00:00
|
|
|
cp -p -P $BASEDIR/system/lib/libwiredtiger_snappy.so* ${BASEDIR}/../priv
|
2013-04-19 15:03:40 +00:00
|
|
|
cp -p -P $BASEDIR/system/lib/libsnappy.so* ${BASEDIR}/../priv
|
2011-12-18 20:54:46 +00:00
|
|
|
;;
|
|
|
|
esac
|