Continue to iterate on the build system to accomodate shared libs.

This commit is contained in:
Gregory Burd 2013-04-16 21:46:53 -04:00
parent 5e80477d4a
commit 1913e7fdf5
5 changed files with 44 additions and 34 deletions

View file

@ -295,7 +295,6 @@ async_nif_worker_fn(void *arg)
req->fn_work(req->env, req->ref, &req->pid, worker_id, req->args);
req->fn_post(req->args);
enif_free(req->args);
enif_free_env(req->env);
enif_free(req);
/* Continue working if more requests are in the queue, otherwise wait

View file

@ -58,6 +58,7 @@ get_wt ()
./autogen.sh || exit 1
cd ./build_posix || exit 1
[ -e Makefile ] && $MAKE distclean
LDFLAGS="-L$BASEDIR/system/lib" CFLAGS="-I$BASEDIR/system/include" \
../configure --with-pic \
--enable-snappy \
--enable-bzip2 \
@ -74,7 +75,6 @@ get_snappy ()
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
)
}
@ -125,14 +125,24 @@ build_snappy ()
build_bzip2 ()
{
(cd $BASEDIR/$BZIP2_DIR && \
$MAKE -j && \
$MAKE install
$MAKE -j -f Makefile-libbz2_so && \
mkdir -p $BASEDIR/system/lib && \
cp -f bzlib.h $BASEDIR/system/include && \
cp -f libbz2.so.1.0.6 $BASEDIR/system/lib && \
ln -s $BASEDIR/system/lib/libbz2.so.1.0.6 $BASEDIR/system/lib/libbz2.so && \
ln -s $BASEDIR/system/lib/libbz2.so.1.0.6 $BASEDIR/system/lib/libbz2-1.so && \
ln -s $BASEDIR/system/lib/libbz2.so.1.0.6 $BASEDIR/system/lib/libbz2-1.0.so
)
}
case "$1" in
clean)
rm -rf system $WT_DIR $SNAPPY_DIR $BZIP2_DIR
rm -f ${BASEDIR}/../priv/wt
rm -f ${BASEDIR}/../priv/libwiredtiger-*.so
rm -f ${BASEDIR}/../priv/libwiredtiger_*.so
rm -f ${BASEDIR}/../priv/libbz2.so.*
rm -f ${BASEDIR}/../priv/libsnappy.so.*
;;
test)
@ -154,21 +164,23 @@ case "$1" in
# 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;
test -f system/lib/libsnappy.so.[0-9].[0-9].[0-9] || build_snappy;
# Build BZIP2
[ -d $BASEDIR/$BZIP2_DIR ] || (echo "Missing BZip2 source directory (did you first get-deps?)" && exit 1)
test -f system/lib/libbz2.a || build_bzip2;
test -f system/lib/libbz2.so.[0-9].[0-9].[0-9] || build_bzip2;
# Build WiredTiger
[ -d $BASEDIR/$WT_DIR ] || (echo "Missing WiredTiger source directory (did you first get-deps?)" && exit 1)
test -f system/lib/libwiredtiger.a -a \
-f system/lib/libwiredtiger_snappy.a -a \
-f system/lib/libwiredtiger_bzip2.a || build_wt;
test -f system/lib/libwiredtiger-[0-9].[0-9].[0-9].so -a \
-f system/lib/libwiredtiger_snappy.so -a \
-f system/lib/libwiredtiger_bzip2.so || build_wt;
[ -d $BASEDIR/../priv ] || mkdir ${BASEDIR}/../priv
cp $BASEDIR/system/bin/wt ${BASEDIR}/../priv
cp $BASEDIR/system/lib/libwiredtiger*.so ${BASEDIR}/../priv
cp $BASEDIR/system/lib/libwiredtiger-[0-9].[0-9].[0-9].so ${BASEDIR}/../priv
cp $BASEDIR/system/lib/libwiredtiger_*.so ${BASEDIR}/../priv
cp $BASEDIR/system/lib/libbz2.so.[0-9].[0-9].[0-9] ${BASEDIR}/../priv
cp $BASEDIR/system/lib/libsnappy.so.[0-9].[0-9].[0-9] ${BASEDIR}/../priv
;;
esac

View file

@ -1,11 +0,0 @@
--- foo/Makefile.orig 2013-04-16 10:25:18.837249297 -0400
+++ foo/Makefile 2013-04-16 10:28:32.113926986 -0400
@@ -24,7 +24,7 @@
CFLAGS=-Wall -Winline -O2 -g $(BIGFILES)
# Where you want it installed when you do 'make install'
-PREFIX=/usr/local
+PREFIX=$(BASEDIR)/system
OBJS= blocksort.o \

View file

@ -1,20 +1,24 @@
diff --git a/ext/compressors/bzip2/Makefile.am b/ext/compressors/bzip2/Makefile.am
index 0aedc2e..9cd96e3 100644
index 0aedc2e..2137b8c 100644
--- a/ext/compressors/bzip2/Makefile.am
+++ b/ext/compressors/bzip2/Makefile.am
@@ -3,4 +3,4 @@ AM_CPPFLAGS = -I$(top_builddir) -I$(top_srcdir)/src/include
@@ -2,5 +2,5 @@ AM_CPPFLAGS = -I$(top_builddir) -I$(top_srcdir)/src/include
lib_LTLIBRARIES = libwiredtiger_bzip2.la
libwiredtiger_bzip2_la_SOURCES = bzip2_compress.c
libwiredtiger_bzip2_la_LDFLAGS = -avoid-version -module
-libwiredtiger_bzip2_la_LDFLAGS = -avoid-version -module
-libwiredtiger_bzip2_la_LIBADD = -lbz2
+libwiredtiger_bzip2_la_LIBADD = -L$(BASEDIR)/system/lib/libbz2.a
+libwiredtiger_bzip2_la_LDFLAGS = -avoid-version -module -Wl,-rpath,.:lib/wterl-0.9.0/priv:lib/wterl/priv:priv
+libwiredtiger_bzip2_la_LIBADD = -lbz2
diff --git a/ext/compressors/snappy/Makefile.am b/ext/compressors/snappy/Makefile.am
index 6d78823..286dc55 100644
index 6d78823..2f2567e 100644
--- a/ext/compressors/snappy/Makefile.am
+++ b/ext/compressors/snappy/Makefile.am
@@ -3,4 +3,4 @@ AM_CPPFLAGS = -I$(top_builddir) -I$(top_srcdir)/src/include
@@ -2,5 +2,5 @@ AM_CPPFLAGS = -I$(top_builddir) -I$(top_srcdir)/src/include
lib_LTLIBRARIES = libwiredtiger_snappy.la
libwiredtiger_snappy_la_SOURCES = snappy_compress.c
libwiredtiger_snappy_la_LDFLAGS = -avoid-version -module
-libwiredtiger_snappy_la_LDFLAGS = -avoid-version -module
-libwiredtiger_snappy_la_LIBADD = -lsnappy
+libwiredtiger_snappy_la_LIBADD = -L$(BASEDIR)/system/lib/libsnappy.a
+libwiredtiger_snappy_la_LDFLAGS = -avoid-version -module -Wl,-rpath,.:lib/wterl-0.9.0/priv:lib/wterl/priv:priv
+libwiredtiger_snappy_la_LIBADD = -lsnappy

View file

@ -588,6 +588,12 @@ conn_test_() ->
ConnRef = open_test_table(ConnRef, "table", [{block_compressor, "snappy"}]),
?assertMatch(ok, verify(ConnRef, "table:test")),
?assertMatch(ok, drop(ConnRef, "table:test"))
end},
{"create, verify, drop a table(btree, bzip2)",
fun() ->
ConnRef = open_test_table(ConnRef, "table", [{block_compressor, "bzip2"}]),
?assertMatch(ok, verify(ConnRef, "table:test")),
?assertMatch(ok, drop(ConnRef, "table:test"))
end}]}
end}.