import leveldb, svn rev 48

LevelDB is a fast key-value storage library written at Google that
provides an ordered mapping from string keys to string values.

Features:
  - Keys and values are arbitrary byte arrays.
  - Data is stored sorted by key.
  - Callers can provide a custom comparison function to override
    the sort order.
  - The basic operations are Put(key,value), Get(key), Delete(key).
  - Multiple changes can be made in one atomic batch.
  - Users can create a transient snapshot to get a consistent view
    of data.
  - Forward and backward iteration is supported over the data.

ok sthen@
This commit is contained in:
jasper 2011-08-19 06:44:00 +00:00
parent 0f007e6279
commit 446a0d0c0f
8 changed files with 192 additions and 0 deletions

View File

@ -0,0 +1,38 @@
# $OpenBSD: Makefile,v 1.1.1.1 2011/08/19 06:44:00 jasper Exp $
COMMENT= fast and lightweight key/value database library
# svn rev 48, use a small version to allow seemless updating when the
# project releases a tarball.
DISTNAME= leveldb-0.0.48
SHARED_LIBS= leveldb 0.0
CATEGORIES= databases
HOMEPAGE= http://leveldb.googlecode.com/
# BSD3
PERMIT_PACKAGE_CDROM= Yes
PERMIT_PACKAGE_FTP= Yes
PERMIT_DISTFILES_CDROM= Yes
PERMIT_DISTFILES_FTP= Yes
MASTER_SITES= http://distfiles.nl/
WANTLIB += m stdc++
USE_GMAKE= Yes
MAKE_ENV+= CC=c++ OPT="${CXXFLAGS}" \
SONAME_MAJOR=${LIBleveldb_VERSION:R} \
SONAME_MINOR=${LIBleveldb_VERSION:E}
REGRESS_TARGET= check
DOC= ${PREFIX}/share/doc/leveldb/
do-install:
${INSTALL_PROGRAM} ${WRKSRC}/libleveldb.{a,so.${LIBleveldb_VERSION}} \
${PREFIX}/lib/
${INSTALL_DATA_DIR} ${DOC}
cd ${WRKSRC}/doc/ && tar cf - . | tar xf - -C ${DOC}
.include <bsd.port.mk>

View File

@ -0,0 +1,5 @@
MD5 (leveldb-0.0.48.tar.gz) = EpwqrYc2JOX3ml3Td4gmnQ==
RMD160 (leveldb-0.0.48.tar.gz) = u1efJYCf33kWh7Bc4HnqHjhKCaA=
SHA1 (leveldb-0.0.48.tar.gz) = CzmBnOP/olwh4pZec8wAjq4363U=
SHA256 (leveldb-0.0.48.tar.gz) = a9D1oDdS0PjXWoEh22r23vRDkaPdzHQjE6xnwMhYQLg=
SIZE (leveldb-0.0.48.tar.gz) = 174794

View File

@ -0,0 +1,67 @@
$OpenBSD: patch-Makefile,v 1.1.1.1 2011/08/19 06:44:00 jasper Exp $
- Allow ${CC} and ${OPT} to be overriden, to help packagers.
http://code.google.com/p/leveldb/issues/detail?id=32
- Provide a shared library
http://code.google.com/p/leveldb/issues/detail?id=27
--- Makefile.orig Fri Aug 5 22:40:49 2011
+++ Makefile Thu Aug 18 17:18:19 2011
@@ -2,13 +2,15 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file. See the AUTHORS file for names of contributors.
-CC = g++
+CC ?= g++
+SONAME_MAJOR?=0
+SONAME_MINOR?=0
#-----------------------------------------------
# Uncomment exactly one of the lines labelled (A), (B), and (C) below
# to switch between compilation modes.
-OPT = -O2 -DNDEBUG # (A) Production use (optimized mode)
+OPT ?= -O2 -DNDEBUG # (A) Production use (optimized mode)
# OPT = -g2 # (B) Debug mode, w/ full line-level debugging symbols
# OPT = -O2 -g2 -DNDEBUG # (C) Profiling mode: opt, but w/debugging symbols
#-----------------------------------------------
@@ -36,7 +38,7 @@ else
GOOGLE_PERFTOOLS_LDFLAGS=
endif
-CFLAGS = -c -I. -I./include $(PORT_CFLAGS) $(PLATFORM_CFLAGS) $(OPT) $(SNAPPY_CFLAGS)
+CFLAGS += -c -I. -I./include $(PORT_CFLAGS) $(PLATFORM_CFLAGS) $(OPT) $(SNAPPY_CFLAGS) -fPIC
LDFLAGS=$(PLATFORM_LDFLAGS) $(SNAPPY_LDFLAGS) $(GOOGLE_PERFTOOLS_LDFLAGS)
@@ -102,20 +104,28 @@ PROGRAMS = db_bench $(TESTS)
BENCHMARKS = db_bench_sqlite3 db_bench_tree_db
LIBRARY = libleveldb.a
+SHARED_LIBRARY = libleveldb.so
-all: $(LIBRARY)
+all: $(LIBRARY) $(SHARED_LIBRARY)
check: $(PROGRAMS) $(TESTS)
for t in $(TESTS); do echo "***** Running $$t"; ./$$t || exit 1; done
clean:
-rm -f $(PROGRAMS) $(BENCHMARKS) $(LIBRARY) */*.o */*/*.o ios-x86/*/*.o ios-arm/*/*.o
+ -rm -f $(SHARED_LIBRARY).* $(SHARED_LIBRARY)
-rm -rf ios-x86/* ios-arm/*
-rm build_config.mk
$(LIBRARY): $(LIBOBJECTS)
rm -f $@
$(AR) -rs $@ $(LIBOBJECTS)
+
+$(SHARED_LIBRARY): $(LIBOBJECTS)
+ rm -f $@
+ $(CC) -shared -Wl,-soname -Wl,$@.$(SONAME_MAJOR) $(LIBOBJECTS) $(LDFLAGS) -o $@.$(SONAME_MAJOR).$(SONAME_MINOR)
+ ln -s $@.$(SONAME_MAJOR).$(SONAME_MINOR) $@.$(SONAME_MAJOR)
+ ln -s $@.$(SONAME_MAJOR).$(SONAME_MINOR) $@
db_bench: db/db_bench.o $(LIBOBJECTS) $(TESTUTIL)
$(CC) $(LDFLAGS) db/db_bench.o $(LIBOBJECTS) $(TESTUTIL) -o $@

View File

@ -0,0 +1,18 @@
$OpenBSD: patch-build_detect_platform,v 1.1.1.1 2011/08/19 06:44:00 jasper Exp $
Add OpenBSD support: http://code.google.com/p/leveldb/issues/detail?id=31
--- build_detect_platform.orig Wed Jul 27 03:46:25 2011
+++ build_detect_platform Thu Aug 18 17:06:57 2011
@@ -35,6 +35,11 @@ case `uname -s` in
echo "PLATFORM_CFLAGS=-D_REENTRANT -DOS_FREEBSD" >> build_config.mk
echo "PLATFORM_LDFLAGS=-lpthread" >> build_config.mk
;;
+ OpenBSD)
+ PLATFORM=OS_OPENBSD
+ echo "PLATFORM_CFLAGS=-D_REENTRANT -DOS_OPENBSD" >> build_config.mk
+ echo "PLATFORM_LDFLAGS=-pthread" >> build_config.mk
+ ;;
*)
echo "Unknown platform!"
exit 1

View File

@ -0,0 +1,36 @@
$OpenBSD: patch-port_port_posix_h,v 1.1.1.1 2011/08/19 06:44:00 jasper Exp $
Add OpenBSD support: http://code.google.com/p/leveldb/issues/detail?id=31
--- port/port_posix.h.orig Wed Jul 27 03:46:25 2011
+++ port/port_posix.h Thu Aug 18 17:06:57 2011
@@ -7,7 +7,11 @@
#ifndef STORAGE_LEVELDB_PORT_PORT_POSIX_H_
#define STORAGE_LEVELDB_PORT_PORT_POSIX_H_
-#if defined(OS_MACOSX) || defined(OS_FREEBSD)
+#if defined(OS_OPENBSD)
+ #include <sys/types.h>
+#endif
+
+#if defined(OS_MACOSX) || defined(OS_FREEBSD) || defined(OS_OPENBSD)
#include <machine/endian.h>
#elif defined(OS_SOLARIS)
#include <sys/isa_defs.h>
@@ -33,13 +37,14 @@
#define IS_LITTLE_ENDIAN (__BYTE_ORDER == __LITTLE_ENDIAN)
#endif
-#if defined(OS_MACOSX) || defined(OS_SOLARIS) || defined(OS_FREEBSD)
+#if defined(OS_MACOSX) || defined(OS_SOLARIS) || defined(OS_FREEBSD) || \
+ defined(OS_OPENBSD)
#define fread_unlocked fread
#define fwrite_unlocked fwrite
#define fflush_unlocked fflush
#endif
-#if defined(OS_MACOSX) || defined(OS_FREEBSD)
+#if defined(OS_MACOSX) || defined(OS_FREEBSD) || defined(OS_OPENBSD)
#define fdatasync fsync
#endif

View File

@ -0,0 +1,13 @@
LevelDB is a fast key-value storage library written at Google that
provides an ordered mapping from string keys to string values.
Features:
- Keys and values are arbitrary byte arrays.
- Data is stored sorted by key.
- Callers can provide a custom comparison function to override
the sort order.
- The basic operations are Put(key,value), Get(key), Delete(key).
- Multiple changes can be made in one atomic batch.
- Users can create a transient snapshot to get a consistent view
of data.
- Forward and backward iteration is supported over the data.

View File

@ -0,0 +1,2 @@
@comment $OpenBSD: PFRAG.shared,v 1.1.1.1 2011/08/19 06:44:00 jasper Exp $
@lib lib/libleveldb.so.${LIBleveldb_VERSION}

View File

@ -0,0 +1,13 @@
@comment $OpenBSD: PLIST,v 1.1.1.1 2011/08/19 06:44:00 jasper Exp $
%%SHARED%%
lib/libleveldb.a
share/doc/leveldb/
share/doc/leveldb/bench/
share/doc/leveldb/bench/db_bench_sqlite3.cc
share/doc/leveldb/bench/db_bench_tree_db.cc
share/doc/leveldb/benchmark.html
share/doc/leveldb/doc.css
share/doc/leveldb/impl.html
share/doc/leveldb/index.html
share/doc/leveldb/log_format.txt
share/doc/leveldb/table_format.txt