Move things around in the build script to get a bit of reuse.
This commit is contained in:
parent
bd4d852a19
commit
36c1d3f829
3 changed files with 86 additions and 62 deletions
5
Makefile
5
Makefile
|
@ -20,8 +20,9 @@ update-deps:
|
|||
c_src/build_deps.sh update-deps
|
||||
@$(REBAR) update-deps
|
||||
|
||||
c_src/wterl.o: c_src/async_nif.h
|
||||
touch c_src/wterl.c
|
||||
c_src/wterl.c: c_src/async_nif.h
|
||||
|
||||
c_src/wterl.o: c_src/wterl.c
|
||||
|
||||
ebin/app_helper.beam:
|
||||
@echo You need to:
|
||||
|
|
|
@ -37,6 +37,78 @@ 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"
|
||||
|
||||
get_wt ()
|
||||
{
|
||||
if [ -d $BASEDIR/$WT_DIR/.git ]; then
|
||||
(cd $BASEDIR/$WT_DIR && git pull -u) || exit 1
|
||||
else
|
||||
if [ "X$WT_VSN" == "X" ]; then
|
||||
git clone ${WT_REPO} && \
|
||||
(cd $BASEDIR/wiredtiger && git checkout $WT_VSN || exit 1)
|
||||
else
|
||||
git clone -b ${WT_BRANCH} --single-branch ${WT_REPO} && \
|
||||
(cd $BASEDIR/wiredtiger && git checkout -b $WT_BRANCH origin/$WT_BRANCH || exit 1)
|
||||
fi
|
||||
mv wiredtiger $WT_DIR || exit 1
|
||||
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
|
||||
cd ./build_posix || exit 1
|
||||
[ -e Makefile ] && $MAKE distclean
|
||||
../configure --with-pic \
|
||||
--disable-shared \
|
||||
--enable-snappy \
|
||||
--enable-bzip2 \
|
||||
--prefix=${BASEDIR}/system || exit 1
|
||||
)
|
||||
}
|
||||
|
||||
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 ] && \
|
||||
(cd $BASEDIR/$SNAPPY_DIR || exit 1
|
||||
patch -p1 --forward < $BASEDIR/snappy-build.patch || exit 1)
|
||||
(cd $BASEDIR/$SNAPPY_DIR || exit 1
|
||||
./configure --with-pic \
|
||||
--disable-shared \
|
||||
--prefix=$BASEDIR/system || exit 1
|
||||
)
|
||||
}
|
||||
|
||||
get_bzip2 ()
|
||||
{
|
||||
[ -e bzip2-$BZIP2_VSN.tar.gz ] || (echo "Missing bzip2 ($BZIP2_VSN) source package" && exit 1)
|
||||
[ -d $BASEDIR/$BZIP2_DIR ] || tar -xzf bzip2-$BZIP2_VSN.tar.gz
|
||||
[ -e $BASEDIR/bzip2-build.patch ] && \
|
||||
(cd $BASEDIR/$BZIP2_DIR || exit 1
|
||||
patch -p1 --forward < $BASEDIR/bzip2-build.patch || exit 1)
|
||||
}
|
||||
|
||||
get_deps ()
|
||||
{
|
||||
get_wt;
|
||||
get_snappy;
|
||||
get_bzip2;
|
||||
}
|
||||
|
||||
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
|
||||
}
|
||||
|
||||
build_wt ()
|
||||
{
|
||||
(cd $BASEDIR/$WT_DIR/build_posix && \
|
||||
|
@ -66,70 +138,21 @@ case "$1" in
|
|||
|
||||
test)
|
||||
(cd $BASEDIR/$WT_DIR && $MAKE -j test)
|
||||
|
||||
;;
|
||||
|
||||
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
|
||||
update-deps;
|
||||
;;
|
||||
|
||||
get-deps)
|
||||
# WiredTiger
|
||||
if [ -d $BASEDIR/$WT_DIR/.git ]; then
|
||||
(cd $BASEDIR/$WT_DIR && git pull -u) || exit 1
|
||||
else
|
||||
if [ "X$WT_VSN" == "X" ]; then
|
||||
git clone ${WT_REPO} && \
|
||||
(cd $BASEDIR/wiredtiger && git checkout $WT_VSN || exit 1)
|
||||
else
|
||||
git clone -b ${WT_BRANCH} --single-branch ${WT_REPO} && \
|
||||
(cd $BASEDIR/wiredtiger && git checkout -b $WT_BRANCH origin/$WT_BRANCH || exit 1)
|
||||
fi
|
||||
mv wiredtiger $WT_DIR || exit 1
|
||||
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
|
||||
cd ./build_posix || exit 1
|
||||
[ -e Makefile ] && $MAKE distclean
|
||||
../configure --with-pic \
|
||||
--disable-shared \
|
||||
--enable-snappy \
|
||||
--enable-bzip2 \
|
||||
--prefix=${BASEDIR}/system || exit 1
|
||||
)
|
||||
|
||||
# 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 ] && \
|
||||
(cd $BASEDIR/$SNAPPY_DIR || exit 1
|
||||
patch -p1 --forward < $BASEDIR/snappy-build.patch || exit 1)
|
||||
(cd $BASEDIR/$SNAPPY_DIR || exit 1
|
||||
./configure --with-pic \
|
||||
--disable-shared \
|
||||
--prefix=$BASEDIR/system || exit 1
|
||||
)
|
||||
|
||||
# BZip2
|
||||
[ -e bzip2-$BZIP2_VSN.tar.gz ] || (echo "Missing bzip2 ($BZIP2_VSN) source package" && exit 1)
|
||||
[ -d $BASEDIR/$BZIP2_DIR ] || tar -xzf bzip2-$BZIP2_VSN.tar.gz
|
||||
[ -e $BASEDIR/bzip2-build.patch ] && \
|
||||
(cd $BASEDIR/$BZIP2_DIR || exit 1
|
||||
patch -p1 --forward < $BASEDIR/bzip2-build.patch || exit 1)
|
||||
get_deps;
|
||||
;;
|
||||
|
||||
*)
|
||||
[ -d $WT_DIR ] || get_wt;
|
||||
[ -d $SNAPPY_DIR ] || get_snappy;
|
||||
[ -d $BZIP2_DIR ] || get_bzip2;
|
||||
|
||||
# Build Snappy
|
||||
[ -d $BASEDIR/$SNAPPY_DIR ] || (echo "Missing Snappy source directory (did you first get-deps?)" && exit 1)
|
||||
test -f system/lib/libsnappy.a || build_snappy;
|
||||
|
|
|
@ -330,13 +330,13 @@ callback(_Ref, _Msg, State) ->
|
|||
%% ===================================================================
|
||||
|
||||
%% @private
|
||||
max_sessions(Config) -> % TODO: review this logic
|
||||
max_sessions(Config) ->
|
||||
RingSize =
|
||||
case app_helper:get_prop_or_env(ring_creation_size, Config, riak_core) of
|
||||
undefined -> 1024;
|
||||
Size -> Size
|
||||
end,
|
||||
10 * (RingSize * erlang:system_info(schedulers)).
|
||||
1000 * (RingSize * erlang:system_info(schedulers)). % TODO: review/fix this logic
|
||||
|
||||
%% @private
|
||||
establish_utility_cursors(Connection, Table) ->
|
||||
|
@ -371,7 +371,7 @@ establish_connection(Config, Type) ->
|
|||
false ->
|
||||
app_helper:get_prop_or_env(checkpoint, Config, wterl, [{wait, 10}])
|
||||
end,
|
||||
RequestedCacheSize = app_helper:get_prop_or_env(cache_size, Config, wterl),
|
||||
RequestedCacheSize = app_helper:get_prop_or_env(cache_size, Config, wterl),
|
||||
ConnectionOpts =
|
||||
orddict:from_list(
|
||||
[ wterl:config_value(create, Config, true),
|
||||
|
@ -381,7 +381,7 @@ establish_connection(Config, Type) ->
|
|||
wterl:config_value(session_max, Config, max_sessions(Config)),
|
||||
wterl:config_value(cache_size, Config, size_cache(RequestedCacheSize)),
|
||||
wterl:config_value(statistics_log, Config, [{wait, 30}]), % sec
|
||||
wterl:config_value(verbose, Config, [
|
||||
wterl:config_value(verbose, Config, [
|
||||
%"ckpt" "block", "shared_cache", "evictserver", "fileops",
|
||||
%"hazard", "mutex", "read", "readserver", "reconcile",
|
||||
%"salvage", "verify", "write", "evict", "lsm"
|
||||
|
@ -396,7 +396,7 @@ establish_connection(Config, Type) ->
|
|||
{ok, Connection} ->
|
||||
{ok, Connection};
|
||||
{error, Reason2} ->
|
||||
lager:error("Failed to establish a WiredTiger connection, wterl backend unable to start: ~p\n", [Reason2]),
|
||||
lager:error("Failed to establish a WiredTiger connection, wterl backend unable to start: ~p\n", [Reason2]),
|
||||
{error, Reason2}
|
||||
end
|
||||
end.
|
||||
|
|
Loading…
Reference in a new issue