- Add leveldb 1.2.20111024

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.
- Data is automatically compressed using the Snappy compression library.
- External activity (file system operations etc.) is relayed through a virtual
  interface so users can customize the operating system interactions.
- Detailed documentation about how to use the library is included with the
  source code.

Limitations:
- This is not a SQL database. It does not have a relational data model, it does
  not support SQL queries, and it has no support for indexes.
- Only a single process (possibly multi-threaded) can access a particular
  database at a time.
- There is no client-server support builtin to the library. An application that
  needs such support will have to wrap their own server around the library.

WWW: http://code.google.com/p/leveldb/
This commit is contained in:
Sunpoet Po-Chuan Hsieh 2011-10-28 10:54:30 +00:00
parent 5bc148fb49
commit 65aafbcdb6
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=284517
6 changed files with 156 additions and 0 deletions

View file

@ -142,6 +142,7 @@
SUBDIR += kumofs
SUBDIR += kyotocabinet
SUBDIR += ldb
SUBDIR += leveldb
SUBDIR += libdbi
SUBDIR += libdbi-drivers
SUBDIR += libdrizzle

View file

@ -0,0 +1,49 @@
# New ports collection makefile for: leveldb
# Date created: 2011-10-04
# Whom: Sunpoet Po-Chuan Hsieh <sunpoet@FreeBSD.org>
#
# $FreeBSD$
#
PORTNAME= leveldb
PORTVERSION= 1.2.20111024
CATEGORIES= databases
MASTER_SITES= LOCAL/sunpoet
MAINTAINER= sunpoet@FreeBSD.org
COMMENT= A fast and lightweight key/value database library by Google
OPTIONS= PERFTOOLS "Build with Google perftools" on \
SNAPPY "Build with snappy" on
USE_GMAKE= yes
USE_LDCONFIG= yes
USE_XZ= yes
.include <bsd.port.options.mk>
.if !defined(WITHOUT_PERFTOOLS)
LIB_DEPENDS+= tcmalloc:${PORTSDIR}/devel/google-perftools
.endif
.if !defined(WITHOUT_SNAPPY)
LIB_DEPENDS+= snappy:${PORTSDIR}/archivers/snappy
.endif
post-patch:
@${REINPLACE_CMD} -e 's|-lpthread|${PTHREAD_LIBS}|' ${WRKSRC}/build_detect_platform
.if defined(WITHOUT_PERFTOOLS)
@${REINPLACE_CMD} -e '/^LDFLAGS=/ s| $$(GOOGLE_PERFTOOLS_LDFLAGS)||' ${WRKSRC}/Makefile
.endif
.if defined(WITHOUT_SNAPPY)
@${REINPLACE_CMD} -e '/^LDFLAGS=/ s| $$(SNAPPY_LDFLAGS)||' ${WRKSRC}/Makefile
.endif
do-install:
${MKDIR} ${PREFIX}/include/leveldb/ ${DATADIR}/
${INSTALL_DATA} ${WRKSRC}/include/leveldb/* ${PREFIX}/include/leveldb/
${INSTALL_LIB} ${WRKSRC}/libleveldb.* ${PREFIX}/lib/
${INSTALL_DATA} ${WRKSRC}/build_config.mk ${DATADIR}/
${LN} -s libleveldb.so.0 ${PREFIX}/lib/libleveldb.so
.include <bsd.port.mk>

View file

@ -0,0 +1,2 @@
SHA256 (leveldb-1.2.20111024.tar.xz) = bf035a366f6a6839b0abd2afa33d17a96a50f1a25c72784c4bbcd19100510313
SIZE (leveldb-1.2.20111024.tar.xz) = 142316

View file

@ -0,0 +1,60 @@
--- Makefile.orig 2011-10-24 18:02:13.000000000 +0800
+++ Makefile 2011-10-27 18:37:46.857260892 +0800
@@ -2,13 +2,13 @@
# 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++
#-----------------------------------------------
# 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 +36,7 @@
GOOGLE_PERFTOOLS_LDFLAGS=
endif
-CFLAGS = -c -I. -I./include $(PORT_CFLAGS) $(PLATFORM_CFLAGS) $(OPT) $(SNAPPY_CFLAGS)
+CFLAGS += -c -fPIC -I. -I./include $(PORT_CFLAGS) $(PLATFORM_CFLAGS) $(OPT) $(SNAPPY_CFLAGS)
LDFLAGS=$(PLATFORM_LDFLAGS) $(SNAPPY_LDFLAGS) $(GOOGLE_PERFTOOLS_LDFLAGS)
@@ -103,15 +103,19 @@
BENCHMARKS = db_bench_sqlite3 db_bench_tree_db
LIBRARY = libleveldb.a
+SHARED_LIBRARY = libleveldb.so
+SHARED_LIBRARY_VER = 0
MEMENVLIBRARY = libmemenv.a
-all: $(LIBRARY)
+SHARED_LIBOBJECTS = $(LIBOBJECTS:.o=.so)
+
+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) $(MEMENVLIBRARY) */*.o */*/*.o ios-x86/*/*.o ios-arm/*/*.o
+ -rm -f $(PROGRAMS) $(BENCHMARKS) $(LIBRARY) $(SHARED_LIBRARY) $(MEMENVLIBRARY) */*.o */*/*.o ios-x86/*/*.o ios-arm/*/*.o
-rm -rf ios-x86/* ios-arm/*
-rm build_config.mk
@@ -119,6 +123,10 @@
rm -f $@
$(AR) -rs $@ $(LIBOBJECTS)
+$(SHARED_LIBRARY): $(LIBOBJECTS)
+ rm -f $@
+ $(CC) -shared -Wl,-soname,$@.$(SHARED_LIBRARY_VER) -o $@.$(SHARED_LIBRARY_VER) $(LDFLAGS) $(LIBOBJECTS)
+
db_bench: db/db_bench.o $(LIBOBJECTS) $(TESTUTIL)
$(CC) $(LDFLAGS) db/db_bench.o $(LIBOBJECTS) $(TESTUTIL) -o $@

View file

@ -0,0 +1,26 @@
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.
- Data is automatically compressed using the Snappy compression library.
- External activity (file system operations etc.) is relayed through a virtual
interface so users can customize the operating system interactions.
- Detailed documentation about how to use the library is included with the
source code.
Limitations:
- This is not a SQL database. It does not have a relational data model, it does
not support SQL queries, and it has no support for indexes.
- Only a single process (possibly multi-threaded) can access a particular
database at a time.
- There is no client-server support builtin to the library. An application that
needs such support will have to wrap their own server around the library.
WWW: http://code.google.com/p/leveldb/

View file

@ -0,0 +1,18 @@
include/leveldb/c.h
include/leveldb/cache.h
include/leveldb/comparator.h
include/leveldb/db.h
include/leveldb/env.h
include/leveldb/iterator.h
include/leveldb/options.h
include/leveldb/slice.h
include/leveldb/status.h
include/leveldb/table.h
include/leveldb/table_builder.h
include/leveldb/write_batch.h
lib/libleveldb.a
lib/libleveldb.so
lib/libleveldb.so.0
%%DATADIR%%/build_config.mk
@dirrm %%DATADIR%%
@dirrm include/leveldb