debian/0000755000000000000000000000000012307374340007171 5ustar debian/get-git-source.sh0000755000000000000000000000142112207060031012350 0ustar #!/bin/sh PACKAGE=leveldb BASE_REL=$(dpkg-parsechangelog 2>/dev/null | sed -ne 's/Version: \([0-9.]\+\)\+.*/\1/p') OLDDIR=${PWD} GOS_DIR=${OLDDIR}/get-orig-source GIT_COMMIT_STR='git log --no-color -1 --oneline | cut -d" " -f1' GIT_DATE_STR='git log --no-color -1 --date=iso | sed -ne "s/Date:\s\+\(.*\).*/\1/p" | cut -d" " -f1 | tr -d "-"' if [ -z ${BASE_REL} ]; then echo 'Please run this script from the sources root directory.' exit 1 fi rm -rf ${GOS_DIR} mkdir ${GOS_DIR} && cd ${GOS_DIR} git clone http://code.google.com/p/leveldb/ ${PACKAGE} cd ${PACKAGE}/ GIT_COMMIT=$(eval "${GIT_COMMIT_STR}") GIT_DATE=$(eval "${GIT_DATE_STR}") cd .. && tar cjf \ ${OLDDIR}/${PACKAGE}_${BASE_REL}+${GIT_DATE}.git${GIT_COMMIT}.orig.tar.bz2 \ ${PACKAGE} --exclude-vcs rm -rf ${GOS_DIR} debian/tests/0000755000000000000000000000000012207060031010317 5ustar debian/tests/control0000644000000000000000000000010512207060031011716 0ustar Tests: build Depends: build-essential, libleveldb-dev, libsnappy-dev debian/tests/build0000644000000000000000000000304612207060031011344 0ustar #!/bin/sh # autopkgtest check: Builds a small application against leveldb, checking # if it compiles, links and runs successfully. # Author: Alessio Treglia set -e WORKDIR=$(mktemp -d) trap "rm -rf $WORKDIR" 0 INT QUIT ABRT PIPE TERM cd $WORKDIR cat < build_test.cpp #include #include #include #include #include "leveldb/db.h" using namespace std; int main(int argc, char **argv) { leveldb::DB *db; leveldb::Options opts; leveldb::ReadOptions r_opts; leveldb::WriteOptions w_opts; std::string value; opts.create_if_missing = true; // Create a new db leveldb::Status s = leveldb::DB::Open(opts, "./build_test_db", &db); assert (s.ok() == true); // Check if the db is empty s = db->Get(r_opts, "test_key1", &value); assert (s.IsNotFound() == true); // Add such new key to the db s = db->Put(w_opts, "test_key1", "test_value1"); assert (s.ok() == true); // Get the new key s = db->Get(r_opts, "test_key1", &value); assert (s.ok() == true); // Check the return value assert (value.compare("test_value1") == 0); // Delete the key s = db->Delete(w_opts, "test_key1"); assert (s.ok() == true); // Check if the deletion's gone well s = db->Get(r_opts, "test_key1", &value); assert (s.IsNotFound() == true); // Close the db delete db; return 0; } EOF g++ -o build_test build_test.cpp -pthread -lleveldb -lsnappy echo "build: OK" [ -x build_test ] ./build_test echo "run: OK" debian/watch0000644000000000000000000000025512207060031010210 0ustar version=3 opts=downloadurlmangle=s%.*/%http://leveldb.googlecode.com/files/% \ http://code.google.com/p/leveldb/downloads/list .*/leveldb-(\d.*)\.(?:tgz|tar\.(?:gz|bz2|xz)) debian/libleveldb1.install0000644000000000000000000000002112207060031012723 0ustar usr/lib/*/*.so.* debian/copyright0000644000000000000000000000343212272212320011114 0ustar Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ Upstream-Name: LevelDB Source: http://leveldb.googlecode.com/svn/trunk/ Files: * Copyright: 2011-2012 The LevelDB Authors License: BSD-3-clause Files: debian/* Copyright: 2011-2014 Alessio Treglia License: BSD-3-clause License: BSD-3-clause Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: . * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of Google Inc. nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. . THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS 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 COPYRIGHT OWNER OR CONTRIBUTORS 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. debian/leveldb-doc.changelogs0000644000000000000000000000000512207060031013364 0ustar NEWS debian/leveldb-doc.doc-base0000644000000000000000000000063712207060031012742 0ustar Document: leveldb-doc Title: LevelDB documentation Author: Jeff Dean, Sanjay Ghemawat Abstract: The leveldb library provides a persistent key value store. Keys and values are arbitrary byte arrays. The keys are ordered within the key value store according to a user-specified comparator function. Section: Programming Format: HTML Index: /usr/share/doc/leveldb-doc/index.html Files: /usr/share/doc/leveldb-doc/* debian/changelog0000644000000000000000000002220512307374340011044 0ustar leveldb (1.15.0-2) unstable; urgency=low * Allow tests to fail on mips only. Thanks to Dmitry Smirnov for the hint. (Closes: #735515) -- Alessio Treglia Mon, 10 Mar 2014 17:39:33 +0000 leveldb (1.15.0-1) unstable; urgency=low * New upstream release. * Update Standards. * Refresh patches. * Multiarchify the -DBG runtime. * Update copyright holders information. -- Alessio Treglia Wed, 29 Jan 2014 14:49:30 +0000 leveldb (1.14.0-3) unstable; urgency=low [ paul cannon ] * Ship leveldb-dbg package. (Closes: #728916) -- Alessio Treglia Thu, 07 Nov 2013 09:35:19 +0000 leveldb (1.14.0-2) unstable; urgency=low * Inject CPPFLAGS into CFLAGS for hardening. * Don't fail when tests fail (temporary workaround, tests are buggy). -- Alessio Treglia Wed, 16 Oct 2013 15:51:41 +0100 leveldb (1.14.0-1) unstable; urgency=low * New upstream release. * Remove 1003-sparc_alignment.patch, fixed upstream. * Refresh patches. -- Alessio Treglia Fri, 20 Sep 2013 13:19:10 +0100 leveldb (1.13.0-2) unstable; urgency=low * Fix FTBFS on sparc{,64}. Thanks to Hilko Bengen for the patch. (Closes: #681946) -- Alessio Treglia Tue, 27 Aug 2013 09:26:13 +0100 leveldb (1.13.0-1) unstable; urgency=low * New upstream release. (Closes: #720609) * Refresh patches. * Update debian/copyright. -- Alessio Treglia Sat, 24 Aug 2013 17:10:29 +0100 leveldb (1.12.0-1) unstable; urgency=low [ Alessio Treglia ] * New upstream release. * Refresh patches. [ Martin Pitt ] * debian/tests/build: Fix typo in file name passed to g++, to make the test actually work. -- Alessio Treglia Thu, 27 Jun 2013 23:49:32 +0100 leveldb (1.10.0-1) unstable; urgency=low * New upstream release. * debian/patches/0113-makefile_memenv.patch: Install missing component "memenv" (Closes: #701075). Thanks to Dmitry Smirnov for the report and patch. * Fix VCS fields. * Refresh patches. -- Alessio Treglia Mon, 27 May 2013 04:55:01 +0200 leveldb (1.9.0-3) unstable; urgency=low * Upload to unstable. -- Alessio Treglia Mon, 06 May 2013 11:11:33 +0200 leveldb (1.9.0-2) experimental; urgency=low * Improve get-orig-source mechanism. * Add autopkgtest support. * Bump Standards. -- Alessio Treglia Mon, 25 Mar 2013 18:29:52 +0000 leveldb (1.9.0-1) experimental; urgency=low * New upstream release. -- Alessio Treglia Sat, 12 Jan 2013 14:34:08 +0000 leveldb (1.8.0-1) experimental; urgency=low * New upstream release (Closes: #696956) * Refresh 1002-cstdatomic_renaming.patch patch. * Fix debian/watch file. Thanks to Bart Martens for the fix. -- Alessio Treglia Sat, 29 Dec 2012 23:54:14 +0000 leveldb (1.7.0-1) experimental; urgency=low * New upstream release: - Fix shared library building. - Reorganize linking commands so flags like --as-needed can be passed. - C binding exports version numbers. - Fix small typos in documentation. * Drop 0101-as_needed.patch, applied upstream. * Refresh patches. * Change tarball compression to gzip. -- Alessio Treglia Sun, 18 Nov 2012 15:18:45 +0000 leveldb (0+20121012.git946e5b5-2) experimental; urgency=low * Merge Debian ports patches into an all-in-one 0001-debian-ports.patch patch. * debian/patches/1002-cstdatomic_renaming.patch: - has been renamed to , fix #include statements. * Append CPPFLAGS to CXXFLAGS as the buildsystem doesn't handle it. * Disable MIPS implementation for now, the atomic_pointer implementation doesn't work. -- Alessio Treglia Mon, 15 Oct 2012 11:26:21 +0100 leveldb (0+20121012.git946e5b5-1) experimental; urgency=low * Update to leveldb 1.6. * debian/get-git-source.sh - Use HTTP instead of HTTPS to workaround issues with proxies. * Refresh patches. -- Alessio Treglia Sat, 13 Oct 2012 17:14:51 +0100 leveldb (0+20120530.gitdd0d562-2) unstable; urgency=low * debian/patches/1001-fix_bloom_test.patch: - Increase false positive threshold by 1% to fix FTBFS on big endian archs. Patch taken from upstream mailing list. (Closes: #677645) (LP: #1021560) -- Alessio Treglia Tue, 17 Jul 2012 15:38:29 +0200 leveldb (0+20120530.gitdd0d562-1) unstable; urgency=low * Imported Upstream version 0+20120530.gitdd0d562 * Update patch for SuperH. Thanks to Nobuhiro Iwamatsu for the great work. (Closes: #671808) * Drop 0111-soname_fix.patch, applied upstream. * Refresh patches. * Update debian/copyright. -- Alessio Treglia Thu, 14 Jun 2012 10:38:40 +0200 leveldb (0+20120417.git85584d4-1) unstable; urgency=low * New upstream snapshot 20120417.git85584d4: - Added bloom filter support. - Updated version number to 1.4. - Some build tweaks. - C binding for CompactRange. - Few more benchmarks. * debian/patches/0102-kfreebsd.patch - Compile port/port_posix.cc to fix FTBFS on kfreebsd. (Closes: #669305) * debian/patches/0103-hurd.patch - Compile port/port_posix.cc on hurd. * Refresh the whole patchset. -- Alessio Treglia Fri, 20 Apr 2012 11:30:42 +0200 leveldb (0+20120330.gitbc1ee4d-1) unstable; urgency=low * Imported upstream snapshot 20120330.gitbc1ee4d. * Remove 1001-buildsystem.patch, no longer needed. * Refresh patches: - debian/patches/0101-as_needed.patch - debian/patches/0102-kfreebsd.patch - debian/patches/0103-hurd.patch * Remove 0010-shared_object.patch, solved by upstream. * debian/patches/0111-soname_fix.patch: - Fix SONAME, don't prepend soname with any path. * debian/patches/0112-makefile_install.patch: - Add install target to the makefile. * Introduce leveldb1 to provide the shared library. * Convert to Multi-Arch. * Don't pass --link-doc to dh_installdocs to avoid non-multiarchified dependencies on leveldb-doc. * Update debian/copyright to copyright format 1.0. * Bump Standards. -- Alessio Treglia Fri, 13 Apr 2012 11:22:27 +0200 leveldb (0+20120125.git3c8be10-1) unstable; urgency=low * New upstream snapshot. * Build with snappy. (Closes: #654291) -- Alessio Treglia Thu, 02 Feb 2012 13:21:01 +0100 leveldb (0+20111130.gitc8c5866-1) unstable; urgency=low [ Alessio Treglia ] * New upstream snapshot. * Refresh patches. * debian/rules: Support "noopt" flag. [ Pino Toscano ] * Add preliminary support for GNU/Hurd. -- Alessio Treglia Mon, 02 Jan 2012 09:44:04 +0100 leveldb (0+20111031.git36a5f8e-2) unstable; urgency=low * Fix build failure with --as-needed flag enabled (Closes: #647105). * Re-introduce Cristoph Egger's patch to allow compilation on kFreeBSD (Closes: #648248). -- Alessio Treglia Wed, 30 Nov 2011 12:06:07 +0100 leveldb (0+20111031.git36a5f8e-1) unstable; urgency=low * Imported Upstream snapshot 0+20111031.git36a5f8e. * Refresh patches. -- Alessio Treglia Tue, 08 Nov 2011 15:07:24 +0100 leveldb (0+20110926.git26db4d9-2) unstable; urgency=low * debian/patches/0005-Add-support-S390.patch: - Small fix to prevent FTBFS (Closes: #644336). -- Alessio Treglia Wed, 05 Oct 2011 17:45:43 +0200 leveldb (0+20110926.git26db4d9-1) unstable; urgency=low * Imported snapshot from upstream's git: - Fix GCC -Wshadow warnings in public header files. - Add in-memory implementation, users are now allowed to create LevelDBs in-memory. - Fix a Valgrind warning. - Code clean-up. - Add GNU/kFreeBSD support. - Use uint64_t instead of size_t in MemEnvTest. * Add support for the following architectures, a big "thank you!" goes to Nobuhiro Iwamatsu for the great work (Closes: #643622): - PowerPC - IA64 - Alpha - Sparc - S390 - MIPS - SuperH - PARISC * Drop 1002-kfreebsd.patch, accepted upstream. * Update get-git-source.sh script. -- Alessio Treglia Tue, 04 Oct 2011 19:07:11 +0200 leveldb (0+20110901.git7263023-2) unstable; urgency=low * Attempt to compile on kFreeBSD, thanks to Christoph Egger for the patch (Closes: #640378). -- Alessio Treglia Mon, 05 Sep 2011 09:59:38 +0200 leveldb (0+20110901.git7263023-1) unstable; urgency=low * New upstream release. * Drop libgoogle-perftools-dev,libsnappy-dev from Build-Depends. * Small fix in debian/copyright. -- Alessio Treglia Sun, 04 Sep 2011 09:52:36 +0200 leveldb (0~svn47-2) unstable; urgency=low * Compile with -fPIC. -- Alessio Treglia Sat, 13 Aug 2011 13:21:34 +0200 leveldb (0~svn47-1) unstable; urgency=low * New upstream snapshot. -- Alessio Treglia Sat, 13 Aug 2011 12:52:11 +0200 leveldb (0~svn45-1) unstable; urgency=low * Initial release. (Closes: #636695) -- Alessio Treglia Fri, 05 Aug 2011 13:50:34 +0200 debian/leveldb-doc.docs0000644000000000000000000000000612207060031012203 0ustar doc/* debian/control0000644000000000000000000000610412272213465010576 0ustar Source: leveldb Section: database Priority: optional Maintainer: Alessio Treglia Build-Depends: debhelper (>= 9), libsnappy-dev XS-Testsuite: autopkgtest Standards-Version: 3.9.5 Homepage: http://code.google.com/p/leveldb/ Vcs-Git: git://anonscm.debian.org/collab-maint/leveldb.git Vcs-Browser: http://anonscm.debian.org/gitweb/?p=collab-maint/leveldb.git Package: libleveldb1 Section: libs Architecture: any Multi-Arch: same Pre-Depends: ${misc:Pre-Depends} Depends: ${misc:Depends}, ${shlibs:Depends} Description: fast key-value storage library 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. . This package provides the shared library. Package: libleveldb-dev Section: libdevel Architecture: any Multi-Arch: same Depends: libleveldb1 (= ${binary:Version}), ${misc:Depends}, ${shlibs:Depends} Suggests: leveldb-doc Description: fast key-value storage library (development files) LevelDB is a fast key-value storage library written at Google that provides an ordered mapping from string keys to string values. . This package provides the development files. Package: libleveldb-dbg Section: debug Architecture: any Multi-Arch: same Pre-Depends: ${misc:Pre-Depends} Depends: libleveldb1 (= ${binary:Version}), ${misc:Depends}, ${shlibs:Depends} Priority: extra Description: fast key-value storage library (debug symbols) LevelDB is a fast key-value storage library written at Google that provides an ordered mapping from string keys to string values. . This package provides the debugging symbols. Package: leveldb-doc Section: doc Architecture: all Depends: ${misc:Depends} Description: LevelDB documentation LevelDB is a fast key-value storage library written at Google that provides an ordered mapping from string keys to string values. . This package provides the developers reference for LevelDB. debian/libleveldb-dev.install0000644000000000000000000000005112207060031013421 0ustar usr/include usr/lib/*/*.a usr/lib/*/*.so debian/compat0000644000000000000000000000000212207060031010353 0ustar 9 debian/rules0000755000000000000000000000141012307374201010241 0ustar #!/usr/bin/make -f DEB_HOST_MULTIARCH ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH) CPPFLAGS:=$(shell dpkg-buildflags --get CPPFLAGS) CXXFLAGS:=$(shell dpkg-buildflags --get CXXFLAGS) CFLAGS:=$(shell dpkg-buildflags --get CFLAGS) export CXXFLAGS+=$(CPPFLAGS) export CFLAGS+=$(CPPFLAGS) export DESTDIR=debian/tmp export PREFIX=/usr export LIBDIR=lib/$(DEB_HOST_MULTIARCH) ifneq (,$(filter noopt,$(DEB_BUILD_OPTIONS))) OPT=-O0 else OPT=-O2 endif export OPT += -g -DNDEBUG %: dh $@ --parallel override_dh_auto_test: ifeq ($(DEB_BUILD_ARCH),mips) @echo "======== will not abort on test(s) failure ========" dh_auto_test || true else dh_auto_test endif get-orig-source: debian/get-git-source.sh override_dh_strip: dh_strip --dbg-package=libleveldb-dbg debian/source/0000755000000000000000000000000012207060031010455 5ustar debian/source/format0000644000000000000000000000001412207060031011663 0ustar 3.0 (quilt) debian/gbp.conf0000644000000000000000000000003612207060031010573 0ustar [DEFAULT] pristine-tar = True debian/patches/0000755000000000000000000000000012272212205010610 5ustar debian/patches/1002-cstdatomic_renaming.patch0000644000000000000000000000151612272212205016226 0ustar Description: cstdatomic has been renamed to atomic, fix #include statements. Bug: http://code.google.com/p/leveldb/issues/detail?id=3 --- build_detect_platform | 2 +- port/atomic_pointer.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) --- leveldb.orig/build_detect_platform +++ leveldb/build_detect_platform @@ -185,7 +185,7 @@ else # If -std=c++0x works, use . Otherwise use port_posix.h. $CXX $CXXFLAGS -std=c++0x -x c++ - -o $CXXOUTPUT 2>/dev/null < + #include int main() {} EOF if [ "$?" = 0 ]; then --- leveldb.orig/port/atomic_pointer.h +++ leveldb/port/atomic_pointer.h @@ -21,7 +21,7 @@ #include #ifdef LEVELDB_CSTDATOMIC_PRESENT -#include +#include #endif #ifdef OS_WIN #include debian/patches/series0000644000000000000000000000025412217036344012035 0ustar 0001-debian-ports.patch 0102-kfreebsd.patch 0103-hurd.patch 0112-makefile_install.patch 0113-makefile_memenv.patch 1001-fix_bloom_test.patch 1002-cstdatomic_renaming.patch debian/patches/0102-kfreebsd.patch0000644000000000000000000000126212272174134014007 0ustar Description: Allow compilation on kFreeBSD. From: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=640378 Forwarded: http://code.google.com/p/leveldb/issues/detail?id=38 --- build_detect_platform | 6 ++++++ 1 file changed, 6 insertions(+) --- leveldb.orig/build_detect_platform +++ leveldb/build_detect_platform @@ -141,6 +141,12 @@ case "$TARGET_OS" in PLATFORM_SHARED_CFLAGS= PLATFORM_SHARED_VERSIONED= ;; + GNU/kFreeBSD) + PLATFORM=OS_FREEBSD + PLATFORM_CFLAGS="-pthread -DOS_FREEBSD" + PLATFORM_LIBS="-lpthread -lrt" + PORT_FILE=port/port_posix.cc + ;; *) echo "Unknown platform!" >&2 exit 1 debian/patches/0001-debian-ports.patch0000644000000000000000000001340012272174127014606 0ustar Description: Add support for most of Debian architectures Author: Nobuhiro Iwamatsu --- port/atomic_pointer.h | 136 ++++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 126 insertions(+), 10 deletions(-) --- leveldb.orig/port/atomic_pointer.h +++ leveldb/port/atomic_pointer.h @@ -38,6 +38,18 @@ #define ARCH_CPU_ARM_FAMILY 1 #elif defined(__ppc__) || defined(__powerpc__) || defined(__powerpc64__) #define ARCH_CPU_PPC_FAMILY 1 +#elif defined(__ia64__) +#define ARCH_CPU_IA64_FAMILY 1 +#elif defined(__alpha__) +#define ARCH_CPU_ALPHA_FAMILY 1 +#elif defined(__s390x__) || defined(__s390__) +#define ARCH_CPU_S390_FAMILY 1 +#elif defined(__sparc__) || defined(__sparc64__) +#define ARCH_CPU_SPARC_FAMILY 1 +#elif defined(__sh__) +#define ARCH_CPU_SH_FAMILY 1 +#elif defined(__hppa__) || defined(__parisc__) +#define ARCH_CPU_PARISC_FAMILY 1 #endif namespace leveldb { @@ -52,14 +64,25 @@ namespace port { // Mac OS #elif defined(OS_MACOSX) -inline void MemoryBarrier() { +inline void ReadMemoryBarrier() { + OSMemoryBarrier(); +} +inline void WriteMemoryBarrier() { OSMemoryBarrier(); } #define LEVELDB_HAVE_MEMORY_BARRIER +#define ReadMemoryBarrier MemoryBarrier() +#define WriteMemoryBarrier MemoryBarrier() + // Gcc on x86 #elif defined(ARCH_CPU_X86_FAMILY) && defined(__GNUC__) -inline void MemoryBarrier() { +inline void ReadMemoryBarrier() { + // See http://gcc.gnu.org/ml/gcc/2003-04/msg01180.html for a discussion on + // this idiom. Also see http://en.wikipedia.org/wiki/Memory_ordering. + __asm__ __volatile__("" : : : "memory"); +} +inline void WriteMemoryBarrier() { // See http://gcc.gnu.org/ml/gcc/2003-04/msg01180.html for a discussion on // this idiom. Also see http://en.wikipedia.org/wiki/Memory_ordering. __asm__ __volatile__("" : : : "memory"); @@ -68,7 +91,12 @@ inline void MemoryBarrier() { // Sun Studio #elif defined(ARCH_CPU_X86_FAMILY) && defined(__SUNPRO_CC) -inline void MemoryBarrier() { +inline void ReadMemoryBarrier() { + // See http://gcc.gnu.org/ml/gcc/2003-04/msg01180.html for a discussion on + // this idiom. Also see http://en.wikipedia.org/wiki/Memory_ordering. + asm volatile("" : : : "memory"); +} +inline void WriteMemoryBarrier() { // See http://gcc.gnu.org/ml/gcc/2003-04/msg01180.html for a discussion on // this idiom. Also see http://en.wikipedia.org/wiki/Memory_ordering. asm volatile("" : : : "memory"); @@ -88,17 +116,99 @@ typedef void (*LinuxKernelMemoryBarrierF // shows that the extra function call cost is completely negligible on // multi-core devices. // -inline void MemoryBarrier() { +inline void ReadMemoryBarrier() { + (*(LinuxKernelMemoryBarrierFunc)0xffff0fa0)(); +} +inline void WriteMemoryBarrier() { (*(LinuxKernelMemoryBarrierFunc)0xffff0fa0)(); } #define LEVELDB_HAVE_MEMORY_BARRIER // PPC #elif defined(ARCH_CPU_PPC_FAMILY) && defined(__GNUC__) -inline void MemoryBarrier() { - // TODO for some powerpc expert: is there a cheaper suitable variant? - // Perhaps by having separate barriers for acquire and release ops. - asm volatile("sync" : : : "memory"); + +inline void ReadMemoryBarrier() { +#ifdef __powerpc64__ + __asm__ __volatile__ ("lwsync" : : : "memory"); +#else + __asm__ __volatile__ ("sync" : : : "memory"); +#endif +} +inline void WriteMemoryBarrier() { + __asm__ __volatile__ ("sync" : : : "memory"); +} +#define LEVELDB_HAVE_MEMORY_BARRIER + +// IA64 +#elif defined(ARCH_CPU_IA64_FAMILY) +inline void ReadMemoryBarrier() { + __asm__ __volatile__ ("mf" : : : "memory"); +} +inline void WriteMemoryBarrier() { + __asm__ __volatile__ ("mf" : : : "memory"); +} +#define LEVELDB_HAVE_MEMORY_BARRIER + +// ALPHA +#elif defined(ARCH_CPU_ALPHA_FAMILY) + +inline void ReadMemoryBarrier() { + __asm__ __volatile__("mb" : : : "memory"); +} +inline void WriteMemoryBarrier() { + __asm__ __volatile__("wmb" : : : "memory"); +} +#define LEVELDB_HAVE_MEMORY_BARRIER + +// S390 +#elif defined(ARCH_CPU_S390_FAMILY) + +inline void ReadMemoryBarrier() { + asm volatile("bcr 15,0" : : : "memory"); +} +inline void WriteMemoryBarrier() { + asm volatile("bcr 15,0" : : : "memory"); +} +#define LEVELDB_HAVE_MEMORY_BARRIER + +// SPARC +#elif defined(ARCH_CPU_SPARC_FAMILY) + +inline void ReadMemoryBarrier() { + __asm__ __volatile__("" : : : "memory"); +} +inline void WriteMemoryBarrier() { + __asm__ __volatile__("" : : : "memory"); +} +#define LEVELDB_HAVE_MEMORY_BARRIER + +// SH +#elif defined(ARCH_CPU_SH_FAMILY) +#if defined(__SH4A__) || defined(__SH5__) +inline void ReadMemoryBarrier() { + __asm__ __volatile__ ("synco": : :"memory"); +} +inline void WriteMemoryBarrier() { + __asm__ __volatile__ ("synco": : :"memory"); +} +#else +inline void ReadMemoryBarrier() { + __asm__ __volatile__ ("": : :"memory"); +} +inline void WriteMemoryBarrier() { + __asm__ __volatile__ ("": : :"memory"); +} +#endif +#define LEVELDB_HAVE_MEMORY_BARRIER + +// PARISC +#elif defined(ARCH_CPU_PARISC_FAMILY) + +inline void ReadMemoryBarrier() { + __asm__ __volatile__("" : : : "memory") +} +inline void WriteMemoryBarrier() { + __asm__ __volatile__("" : : : "memory") } #define LEVELDB_HAVE_MEMORY_BARRIER @@ -116,11 +226,11 @@ class AtomicPointer { inline void NoBarrier_Store(void* v) { rep_ = v; } inline void* Acquire_Load() const { void* result = rep_; - MemoryBarrier(); + ReadMemoryBarrier(); return result; } inline void Release_Store(void* v) { - MemoryBarrier(); + WriteMemoryBarrier(); rep_ = v; } }; @@ -217,6 +327,12 @@ class AtomicPointer { #undef ARCH_CPU_X86_FAMILY #undef ARCH_CPU_ARM_FAMILY #undef ARCH_CPU_PPC_FAMILY +#undef ARCH_CPU_IA64_FAMILY +#undef ARCH_CPU_ALPHA_FAMILY +#undef ARCH_CPU_S390_FAMILY +#undef ARCH_CPU_SPARC_FAMILY +#undef ARCH_CPU_SH_FAMILY +#undef ARCH_CPU_PARISC_FAMILY } // namespace port } // namespace leveldb debian/patches/0103-hurd.patch0000644000000000000000000000145112272212176013164 0ustar Author: Pino Toscano Description: Support for GNU/Hurd This adds support for GNU/Hurd: - detect the correct platform - ignore msync() errors when they are ENOSYS, like currently it happens on GNU/Hurd (not something that can be sent upstream, though) Last-Update: 2011-12-01 --- build_detect_platform | 6 ++++++ 1 file changed, 6 insertions(+) --- leveldb.orig/build_detect_platform +++ leveldb/build_detect_platform @@ -147,6 +147,12 @@ case "$TARGET_OS" in PLATFORM_LIBS="-lpthread -lrt" PORT_FILE=port/port_posix.cc ;; + GNU) + PLATFORM=OS_HURD + PLATFORM_CFLAGS="-pthread -DOS_HURD" + PLATFORM_LIBS="-lpthread" + PORT_FILE=port/port_posix.cc + ;; *) echo "Unknown platform!" >&2 exit 1 debian/patches/0112-makefile_install.patch0000644000000000000000000000262412227523721015531 0ustar Description: Improvements to the Makefile. Replace INSTALL_PATH with the most commonly use DESTDIR variable. Add an 'install' target. Author: Alessio Treglia Forwarded: http://code.google.com/p/leveldb/issues/detail?id=27 --- Makefile | 15 +++++++++++++++ 1 file changed, 15 insertions(+) --- leveldb.orig/Makefile +++ leveldb/Makefile @@ -2,6 +2,10 @@ # 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. +PREFIX ?= /usr/local +LIBDIR ?= lib +INCLUDEDIR ?= include + #----------------------------------------------- # Uncomment exactly one of the lines labelled (A), (B), and (C) below # to switch between compilation modes. @@ -90,6 +94,17 @@ endif # PLATFORM_SHARED_EXT all: $(SHARED) $(LIBRARY) +install: all + install -d $(DESTDIR)$(PREFIX)/$(LIBDIR) + install -d $(DESTDIR)$(PREFIX)/$(INCLUDEDIR)/leveldb + install -m 0644 $(LIBRARY) $(DESTDIR)$(PREFIX)/$(LIBDIR) +ifneq ($(PLATFORM_SHARED_EXT),) + install -m 0644 $(SHARED3) $(DESTDIR)$(PREFIX)/$(LIBDIR) + cd $(DESTDIR)$(PREFIX)/$(LIBDIR) && ln -sf $(SHARED3) $(SHARED2) + cd $(DESTDIR)$(PREFIX)/$(LIBDIR) && ln -sf $(SHARED3) $(SHARED1) +endif + install -m 0644 include/leveldb/* $(DESTDIR)$(PREFIX)/$(INCLUDEDIR)/leveldb + check: all $(PROGRAMS) $(TESTS) for t in $(TESTS); do echo "***** Running $$t"; ./$$t || exit 1; done debian/patches/1001-fix_bloom_test.patch0000644000000000000000000000146412272212203015230 0ustar Subject: Increase false positive rate to deal with testing on big-endians. Bug: http://code.google.com/p/leveldb/issues/detail?id=84 Bug-Debian: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=677645 Bug-Ubuntu: https://launchpad.net/bugs/1021560 --- util/bloom_test.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- leveldb.orig/util/bloom_test.cc +++ leveldb/util/bloom_test.cc @@ -141,7 +141,7 @@ TEST(BloomTest, VaryingLengths) { fprintf(stderr, "False positives: %5.2f%% @ length = %6d ; bytes = %6d\n", rate*100.0, length, static_cast(FilterSize())); } - ASSERT_LE(rate, 0.02); // Must not be over 2% + ASSERT_LE(rate, 0.03); // Must not be over 3% if (rate > 0.0125) mediocre_filters++; // Allowed, but not too often else good_filters++; } debian/patches/0113-makefile_memenv.patch0000644000000000000000000000244012217036215015343 0ustar Last-Update: 2013-02-21 Forwarded: no Author: Dmitry Smirnov Description: install "memenv" component. This patch will install two additional files to libleveldb-dev: + include/helpers/memenv.h + lib/*/libmemenv.a --- Makefile | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) --- leveldb.orig/Makefile +++ leveldb/Makefile @@ -92,18 +92,20 @@ $(SHARED3): endif # PLATFORM_SHARED_EXT -all: $(SHARED) $(LIBRARY) +all: $(SHARED) $(LIBRARY) $(MEMENVLIBRARY) install: all install -d $(DESTDIR)$(PREFIX)/$(LIBDIR) - install -d $(DESTDIR)$(PREFIX)/$(INCLUDEDIR)/leveldb + install -d $(DESTDIR)$(PREFIX)/$(INCLUDEDIR)/leveldb/helpers install -m 0644 $(LIBRARY) $(DESTDIR)$(PREFIX)/$(LIBDIR) + install -m 0644 $(MEMENVLIBRARY) $(DESTDIR)$(PREFIX)/$(LIBDIR) ifneq ($(PLATFORM_SHARED_EXT),) install -m 0644 $(SHARED3) $(DESTDIR)$(PREFIX)/$(LIBDIR) cd $(DESTDIR)$(PREFIX)/$(LIBDIR) && ln -sf $(SHARED3) $(SHARED2) cd $(DESTDIR)$(PREFIX)/$(LIBDIR) && ln -sf $(SHARED3) $(SHARED1) endif install -m 0644 include/leveldb/* $(DESTDIR)$(PREFIX)/$(INCLUDEDIR)/leveldb + install -m 0644 helpers/memenv/*.h $(DESTDIR)$(PREFIX)/$(INCLUDEDIR)/leveldb/helpers check: all $(PROGRAMS) $(TESTS) for t in $(TESTS); do echo "***** Running $$t"; ./$$t || exit 1; done