Skip to content

Commit

Permalink
Import LMDB support code.
Browse files Browse the repository at this point in the history
  • Loading branch information
Marco van Wieringen committed Feb 17, 2015
1 parent b8cb5b2 commit 080d375
Show file tree
Hide file tree
Showing 10 changed files with 10,833 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Makefile.in
Expand Up @@ -18,7 +18,7 @@ first_rule: all
dummy:

# --client-only directories
fd_subdirs = src scripts src/lib src/findlib src/filed \
fd_subdirs = src scripts src/lib src/findlib @LMDB_DIR@ src/filed \
@READLINE_SRC@ @BAT_DIR@ @TRAY_MONITOR_DIR@ src/console @FD_PLUGIN_DIR@

# Non-client-only directores
Expand Down
35 changes: 35 additions & 0 deletions autoconf/configure.in
Expand Up @@ -66,6 +66,12 @@ LIBBAREOSNDMP_LT_RELEASE=`sed -n -e 's/^#.*LIBBAREOSNDMP_LT_RELEASE.*"\(.*\)"$/\
LIBBAREOSNDMP_LT_RELEASE=${LIBBAREOSNDMP_LT_RELEASE:-$VERSION}
AC_SUBST(LIBBAREOSNDMP_LT_RELEASE)dnl

dnl src/lmdb
dnl can be overwritten by specific values from version.h
LIBBAREOSLMDB_LT_RELEASE=`sed -n -e 's/^#.*LIBBAREOSLMDB_LT_RELEASE.*"\(.*\)"$/\1/p' ${srcdir}/src/include/version.h`
LIBBAREOSLMDB_LT_RELEASE=${LIBBAREOSLMDB_LT_RELEASE:-$VERSION}
AC_SUBST(LIBBAREOSLMDB_LT_RELEASE)dnl

echo "configuring for ${BAREOS} $VERSION ($DATE)"

dnl -------------------------------------------------------
Expand Down Expand Up @@ -360,6 +366,7 @@ build_stored=yes
db_backends=""
batch_insert_db_backends=""
support_lockmgr=no
support_lmdb=no
support_ndmp=no

dnl --------------------------------------------------------------------------
Expand Down Expand Up @@ -1749,6 +1756,32 @@ AC_SUBST(NDMP_DIR)
AC_SUBST(NDMP_LIBS)
AC_SUBST(NDMP_DEPS)

dnl -------------------------------------------
dnl LMDB (default off)
dnl -------------------------------------------
AC_ARG_ENABLE(lmdb,
AC_HELP_STRING([--enable-lmdb], [enable build of LMDB support @<:@default=no@:>@]),
[
if test x$enableval = xyes; then
AC_DEFINE(HAVE_LMDB, 1, [Define to 1 if LMDB support should be enabled])
support_lmdb=yes
fi
]
)

if test x$support_lmdb = xyes; then
LMDB_DIR="src/lmdb"
LMDB_LIBS="-L../lmdb -lbareoslmdb"
LMDB_DEPS="../lmdb/libbareoslmdb\$(DEFAULT_ARCHIVE_TYPE)"
else
LMDB_DIR=""
LMDB_LIBS=""
LMDB_DEPS=""
fi
AC_SUBST(LMDB_DIR)
AC_SUBST(LMDB_LIBS)
AC_SUBST(LMDB_DEPS)

dnl -------------------------------------------
dnl enable batch attribute DB insert (default on)
dnl -------------------------------------------
Expand Down Expand Up @@ -3997,6 +4030,7 @@ src/cats/drop_bareos_tables \
src/cats/drop_bareos_database \
src/cats/install-default-backend \
src/findlib/Makefile \
src/lmdb/Makefile \
src/ndmp/Makefile \
src/tests/Makefile \
src/tools/Makefile \
Expand Down Expand Up @@ -4162,6 +4196,7 @@ Configuration on `date`:
ZLIB support: ${have_zlib}
LZO support: ${have_lzo}
FASTLZ support: ${have_fastlz}
LMDB support: ${support_lmdb}
NDMP support: ${support_ndmp}
enable-smartalloc: ${support_smartalloc}
enable-lockmgr: ${support_lockmgr}
Expand Down
1 change: 1 addition & 0 deletions src/include/version.h
Expand Up @@ -37,6 +37,7 @@
/* #define LIBBAREOSCATS_LT_RELEASE "14.1.0" */
/* #define LIBBAREOSCATS_LT_RELEASE "14.1.0" */
/* #define LIBBAREOSNDMP_LT_RELEASE "14.1.0" */
/* #define LIBBAREOSLMDB_LT_RELEASE "14.1.0" */

/* Debug flags */
#undef DEBUG
Expand Down
20 changes: 20 additions & 0 deletions src/lmdb/COPYRIGHT
@@ -0,0 +1,20 @@
Copyright 2011-2013 Howard Chu, Symas Corp.
All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted only as authorized by the OpenLDAP
Public License.

A copy of this license is available in the file LICENSE in the
top-level directory of the distribution or, alternatively, at
<http://www.OpenLDAP.org/license.html>.

OpenLDAP is a registered trademark of the OpenLDAP Foundation.

Individual files and/or contributed packages may be copyright by
other parties and/or subject to additional restrictions.

This work also contains materials derived from public sources.

Additional information about OpenLDAP can be obtained at
<http://www.openldap.org/>.
47 changes: 47 additions & 0 deletions src/lmdb/LICENSE
@@ -0,0 +1,47 @@
The OpenLDAP Public License
Version 2.8, 17 August 2003

Redistribution and use of this software and associated documentation
("Software"), with or without modification, are permitted provided
that the following conditions are met:

1. Redistributions in source form must retain copyright statements
and notices,

2. Redistributions in binary form must reproduce applicable copyright
statements and notices, this list of conditions, and the following
disclaimer in the documentation and/or other materials provided
with the distribution, and

3. Redistributions must contain a verbatim copy of this document.

The OpenLDAP Foundation may revise this license from time to time.
Each revision is distinguished by a version number. You may use
this Software under terms of this license revision or under the
terms of any subsequent revision of the license.

THIS SOFTWARE IS PROVIDED BY THE OPENLDAP FOUNDATION AND ITS
CONTRIBUTORS ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
SHALL THE OPENLDAP FOUNDATION, ITS CONTRIBUTORS, OR THE AUTHOR(S)
OR OWNER(S) OF THE SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.

The names of the authors and copyright holders must not be used in
advertising or otherwise to promote the sale, use or other dealing
in this Software without specific, written prior permission. Title
to copyright in this Software shall at all times remain with copyright
holders.

OpenLDAP is a registered trademark of the OpenLDAP Foundation.

Copyright 1999-2003 The OpenLDAP Foundation, Redwood City,
California, USA. All Rights Reserved. Permission to copy and
distribute verbatim copies of this document is granted.
126 changes: 126 additions & 0 deletions src/lmdb/Makefile.in
@@ -0,0 +1,126 @@
#

@MCOMMON@

LIBTOOL_TAG = CC

# Define library versions
LIBBAREOSLMDB_LT_RELEASE = @LIBBAREOSLMDB_LT_RELEASE@

srcdir = @srcdir@
VPATH = @srcdir@
.PATH: @srcdir@

# one up
basedir = ..
# top dir
topdir = ../..
# this dir relative to top dir
thisdir = src/lmdb

DEBUG = @DEBUG@

first_rule: all
dummy:

#
# include files installed when using libtool
#
INCLUDE_FILES = lmdb.h midl.h

#
# libbareoslmdb
#
LIBBAREOSLMDB_SRCS = mdb.c midl.c
LIBBAREOSLMDB_OBJS = $(LIBBAREOSLMDB_SRCS:.c=.o)
LIBBAREOSLMDB_LOBJS = $(LIBBAREOSLMDB_SRCS:.c=.lo)

INCLUDES += -I. -I$(srcdir) -I$(basedir) -I$(basedir)/include

.SUFFIXES: .c .cc .o .lo .ch .dvi .pdf .tex .view .w .1
.PHONY:
.DONTCARE:

# inference rules
.c.o:
@echo "Compiling $<"
$(NO_ECHO)$(CC) $(DEFS) $(DEBUG) -c $(WCFLAGS) $(CPPFLAGS) $(INCLUDES) $(DINCLUDE) $(CFLAGS) $<

.c.lo:
@echo "Compiling $<"
$(NO_ECHO)$(LIBTOOL_COMPILE) $(CC) $(DEFS) $(DEBUG) -c $(WCFLAGS) $(CPPFLAGS) $(INCLUDES) $(DINCLUDE) $(CFLAGS) $<

.cc.o:
@echo "Compiling $<"
$(NO_ECHO)$(CXX) $(DEFS) $(DEBUG) -c $(WCFLAGS) $(CPPFLAGS) $(INCLUDES) $(DINCLUDE) $(CXXFLAGS) $<

.cc.lo:
@echo "Compiling $<"
$(NO_ECHO)$(LIBTOOL_COMPILE) $(CXX) $(DEFS) $(DEBUG) -c $(WCFLAGS) $(CPPFLAGS) $(INCLUDES) $(DINCLUDE) $(CXXFLAGS) $<

#-------------------------------------------------------------------------
all: Makefile libbareoslmdb$(DEFAULT_ARCHIVE_TYPE)
@echo "==== Make of lib is good ===="
@echo " "

libbareoslmdb.a: $(LIBBAREOSLMDB_OBJS)
@echo "Making $@ ..."
$(AR) rc $@ $(LIBBAREOSLMDB_OBJS)
$(RANLIB) $@

libbareoslmdb.la: Makefile $(LIBBAREOSLMDB_LOBJS)
@echo "Making $@ ..."
$(LIBTOOL_LINK) $(CC) $(DEFS) $(DEBUG) $(LDFLAGS) -o $@ $(LIBBAREOSLMDB_LOBJS) -export-dynamic -rpath $(libdir) -release $(LIBBAREOSLMDB_LT_RELEASE) $(LIBS)

Makefile: $(srcdir)/Makefile.in $(topdir)/config.status
cd $(topdir) \
&& CONFIG_FILES=$(thisdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status

install-includes:
$(MKDIR) $(DESTDIR)/$(includedir)/bareos/lmdb
for I in $(INCLUDE_FILES); do \
$(INSTALL_DATA) $$I $(DESTDIR)$(includedir)/bareos/lmdb/`basename $$I`; \
done

libtool-install: all
$(MKDIR) $(DESTDIR)$(libdir)
$(LIBTOOL_INSTALL_FINISH) $(INSTALL_LIB) libbareoslmdb.la $(DESTDIR)$(libdir)

install: @LIBTOOL_INSTALL_TARGET@ @INCLUDE_INSTALL_TARGET@

libtool-clean:
@find . -name '*.lo' -print | xargs $(LIBTOOL_CLEAN) $(RMF)
@$(RMF) *.la
@$(RMF) -r .libs _libs

clean: libtool-clean
@$(RMF) core a.out *.o *.bak *.tex *.pdf *~ *.intpro *.extpro 1 2 3

realclean: clean
@$(RMF) tags

distclean: realclean
if test $(srcdir) = .; then $(MAKE) realclean; fi
(cd $(srcdir); $(RMF) Makefile)

# Semi-automatic generation of dependencies:
# # Use cc -M because X11 `makedepend' doesn't work on all systems
# # and it also includes system headers.
# # `semi'-automatic since dependencies are generated at distribution time.

depend:
@$(MV) Makefile Makefile.bak
@$(SED) "/^# DO NOT DELETE:/,$$ d" Makefile.bak > Makefile
@$(ECHOCMD) "# DO NOT DELETE: nice dependency list follows" >> Makefile
@for src in $(LIBBAREOSLMDB_SRCS) ; do \
$(CC) -S -M -MT `basename $$src .c`$(DEFAULT_OBJECT_TYPE) $(CPPFLAGS) $(XINC) $(INCLUDES) $$src >> Makefile; \
done
@if test -f Makefile ; then \
$(RMF) Makefile.bak; \
else \
$(MV) Makefile.bak Makefile; \
echo " ======= Something went wrong with make depend. ======="; \
fi

# -----------------------------------------------------------------------
# # DO NOT DELETE: nice dependency list follows

0 comments on commit 080d375

Please sign in to comment.