Commit ed2346e6 authored by Steve James's avatar Steve James Committed by Thomas Petazzoni
Browse files

leveldb: new package



[Thomas:
  - remove 003-allow-flags-from-environment.patch, and pass
    TARGET_CONFIGURE_OPTS in the environment instead.
  - convert the patches to Git formatted patches.
  - use the v1.18 tag instead of a commit hash.
  - do not pass TARGET_CONFIGURE_OPTS at install time, this is not
    needed.]

Signed-off-by: default avatarSteve James <ste@junkomatic.net>
Signed-off-by: default avatarThomas Petazzoni <thomas.petazzoni@free-electrons.com>
parent ccaea6eb
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -698,6 +698,7 @@ menu "Database"
	source "package/berkeleydb/Config.in"
	source "package/cppdb/Config.in"
	source "package/gdbm/Config.in"
	source "package/leveldb/Config.in"
	source "package/mysql/Config.in"
	source "package/postgresql/Config.in"
	source "package/redis/Config.in"
+31 −0
Original line number Diff line number Diff line
From 8a8016f6d2af335ab205aa40d5274fc9b0c7a566 Mon Sep 17 00:00:00 2001
From: Steve James <ste@junkomatic.net>
Date: Sun, 5 Apr 2015 16:29:51 +0200
Subject: [PATCH 1/2] Fix compilation with g++ 4.8.2

Where db_iter.cc fails to get a typedef for ssize_t when compiled by
GCC.

Upstream-Status: Submitted [https://github.com/google/leveldb/issues/233]

Signed-off-by: Steve James <ste@junkomatic.net>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
---
 db/db_iter.cc | 1 +
 1 file changed, 1 insertion(+)

diff --git a/db/db_iter.cc b/db/db_iter.cc
index 3b2035e..c2e5f35 100644
--- a/db/db_iter.cc
+++ b/db/db_iter.cc
@@ -13,6 +13,7 @@
 #include "util/logging.h"
 #include "util/mutexlock.h"
 #include "util/random.h"
+#include <sys/types.h> // for ssize_t
 
 namespace leveldb {
 
-- 
2.1.0
+40 −0
Original line number Diff line number Diff line
From 818d59f093100d5f39db34d5686a9d983172d307 Mon Sep 17 00:00:00 2001
From: Steve James <ste@junkomatic.net>
Date: Sun, 5 Apr 2015 16:30:46 +0200
Subject: [PATCH 2/2] Add install recipe

Upstream-Status: Submitted [https://github.com/google/leveldb/pull/276]

Signed-off-by: Steve James <ste@junkomatic.net>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
---
 Makefile | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/Makefile b/Makefile
index 2bd2cad..530f2c3 100644
--- a/Makefile
+++ b/Makefile
@@ -225,3 +225,19 @@ else
 .c.o:
 	$(CC) $(CFLAGS) -c $< -o $@
 endif
+
+INSTALL_ROOT = /
+INSTALL_PREFIX= usr/local
+
+install: $(SHARED) $(LIBRARY)
+	install -d -m 0755 $(INSTALL_ROOT)$(INSTALL_PREFIX)/include/leveldb
+	install -D -m 0644 include/leveldb/*.h $(INSTALL_ROOT)$(INSTALL_PREFIX)/include/leveldb
+	install -d -m 0755 $(INSTALL_ROOT)$(INSTALL_PREFIX)/lib
+  ifneq (,$(LIBRARY))
+	install -m 0644 $(LIBRARY) $(INSTALL_ROOT)$(INSTALL_PREFIX)/lib
+  endif
+  ifneq (,$(SHARED))
+	install -m 0755 $(SHARED3) $(INSTALL_ROOT)$(INSTALL_PREFIX)/lib
+	ln -sf $(SHARED3) $(INSTALL_ROOT)$(INSTALL_PREFIX)/lib/$(SHARED1)
+	ln -sf $(SHARED3) $(INSTALL_ROOT)$(INSTALL_PREFIX)/lib/$(SHARED2)
+  endif
-- 
2.1.0
+13 −0
Original line number Diff line number Diff line
config BR2_PACKAGE_LEVELDB
	bool "leveldb"
	depends on BR2_INSTALL_LIBSTDCPP
	depends on BR2_TOOLCHAIN_HAS_THREADS
	select BR2_PACKAGE_SNAPPY
	help
	  LevelDB is a fast key-value storage library written at Google that
	  provides an ordered mapping from string keys to string values.

	  https://github.com/google/leveldb

comment "leveldb needs a toolchain w/ C++, threads"
	depends on !BR2_INSTALL_LIBSTDCPP || !BR2_TOOLCHAIN_HAS_THREADS
+44 −0
Original line number Diff line number Diff line
################################################################################
#
# leveldb
#
################################################################################

LEVELDB_VERSION = v1.18
LEVELDB_SITE = $(call github,google,leveldb,$(LEVELDB_VERSION))
LEVELDB_LICENSE = BSD-3c
LEVELDB_LICENSE_FILES = LICENSE
LEVELDB_INSTALL_STAGING = YES
LEVELDB_DEPENDENCIES = snappy

# We will pass optimisation level via CFLAGS so remove leveldb default
LEVELDB_MAKE_ARGS += OPTIM=

# Disable the static library for shared only build
ifeq ($(BR2_SHARED_LIBS),y)
LEVELDB_MAKE_ARGS += LIBRARY=
endif

# Disable the shared library for static only build
ifeq ($(BR2_STATIC_LIBS),y)
LEVELDB_MAKE_ARGS += SHARED=
endif

define LEVELDB_BUILD_CMDS
	$(TARGET_MAKE_ENV) $(TARGET_CONFIGURE_OPTS) $(MAKE) \
		$(LEVELDB_MAKE_ARGS) -C $(@D)
endef

define LEVELDB_INSTALL_STAGING_CMDS
	$(TARGET_MAKE_ENV) $(MAKE) \
		INSTALL_ROOT=$(STAGING_DIR) INSTALL_PREFIX=/usr \
		$(LEVELDB_MAKE_ARGS) -C $(@D) install
endef

define LEVELDB_INSTALL_TARGET_CMDS
	$(TARGET_MAKE_ENV) $(MAKE) \
		INSTALL_ROOT=$(TARGET_DIR) INSTALL_PREFIX=/usr \
		$(LEVELDB_MAKE_ARGS) -C $(@D) install
endef

$(eval $(generic-package))