summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGabor Cselle <gabor@google.com>2011-09-01 13:31:52 -0700
committerGabor Cselle <gabor@google.com>2011-09-01 13:31:52 -0700
commitadf4a95904d875a6d371cd62f55c9627785ce186 (patch)
tree8fc5d018bba48cd24a174d76b9a939952c79dab1
parent72630236513e7384cb0a2e8fffcae232135a5adc (diff)
downloadleveldb-android.tar.gz
Android NDK port for LevelDB.android
-rw-r--r--Makefile42
-rw-r--r--README12
-rw-r--r--common.mk44
-rw-r--r--jni/Android.mk17
-rw-r--r--jni/Application.mk4
5 files changed, 82 insertions, 37 deletions
diff --git a/Makefile b/Makefile
index 86e24e8..27c4f07 100644
--- a/Makefile
+++ b/Makefile
@@ -18,6 +18,9 @@ $(shell sh ./build_detect_platform)
# this file is generated by build_detect_platform to set build flags
include build_config.mk
+# Read in common build variable definitions and source file list.
+include common.mk
+
# If Snappy is installed, add compilation and linker flags
# (see http://code.google.com/p/snappy/)
ifeq ($(SNAPPY), 1)
@@ -36,46 +39,11 @@ else
GOOGLE_PERFTOOLS_LDFLAGS=
endif
-CFLAGS = -c -I. -I./include $(PORT_CFLAGS) $(PLATFORM_CFLAGS) $(OPT) $(SNAPPY_CFLAGS)
+CFLAGS = -c $(C_INCLUDES:%=-I%) $(PORT_CFLAGS) $(PLATFORM_CFLAGS) $(OPT) $(SNAPPY_CFLAGS)
LDFLAGS=$(PLATFORM_LDFLAGS) $(SNAPPY_LDFLAGS) $(GOOGLE_PERFTOOLS_LDFLAGS)
-LIBOBJECTS = \
- ./db/builder.o \
- ./db/c.o \
- ./db/db_impl.o \
- ./db/db_iter.o \
- ./db/filename.o \
- ./db/dbformat.o \
- ./db/log_reader.o \
- ./db/log_writer.o \
- ./db/memtable.o \
- ./db/repair.o \
- ./db/table_cache.o \
- ./db/version_edit.o \
- ./db/version_set.o \
- ./db/write_batch.o \
- ./port/port_posix.o \
- ./table/block.o \
- ./table/block_builder.o \
- ./table/format.o \
- ./table/iterator.o \
- ./table/merger.o \
- ./table/table.o \
- ./table/table_builder.o \
- ./table/two_level_iterator.o \
- ./util/arena.o \
- ./util/cache.o \
- ./util/coding.o \
- ./util/comparator.o \
- ./util/crc32c.o \
- ./util/env.o \
- ./util/env_posix.o \
- ./util/hash.o \
- ./util/histogram.o \
- ./util/logging.o \
- ./util/options.o \
- ./util/status.o
+LIBOBJECTS = $(SOURCES:.cc=.o) port/port_posix.o
TESTUTIL = ./util/testutil.o
TESTHARNESS = ./util/testharness.o $(TESTUTIL)
diff --git a/README b/README
index 3618ade..f23cbc7 100644
--- a/README
+++ b/README
@@ -1,3 +1,15 @@
+Android NDK port for LevelDB.
+
+This git branch contains a make system to build LevelDB
+against the Android NDK: http://developer.android.com/sdk/ndk/index.html
+
+To build:
+- Download install the Android NDK
+- cd into this directory
+- $ ndk-build
+
+====
+
leveldb: A key-value store
Authors: Sanjay Ghemawat (sanjay@google.com) and Jeff Dean (jeff@google.com)
diff --git a/common.mk b/common.mk
new file mode 100644
index 0000000..45c3450
--- /dev/null
+++ b/common.mk
@@ -0,0 +1,44 @@
+# Copyright (c) 2011 The LevelDB Authors. All rights reserved.
+# 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.
+
+# Definitions of build variable common between Android and non-Android builds.
+
+# Also add /include directory for extra leveldb includes.
+C_INCLUDES = . ./include
+
+SOURCES = \
+ ./db/builder.cc \
+ ./db/c.cc \
+ ./db/db_impl.cc \
+ ./db/db_iter.cc \
+ ./db/filename.cc \
+ ./db/dbformat.cc \
+ ./db/log_reader.cc \
+ ./db/log_writer.cc \
+ ./db/memtable.cc \
+ ./db/repair.cc \
+ ./db/table_cache.cc \
+ ./db/version_edit.cc \
+ ./db/version_set.cc \
+ ./db/write_batch.cc \
+ ./table/block.cc \
+ ./table/block_builder.cc \
+ ./table/format.cc \
+ ./table/iterator.cc \
+ ./table/merger.cc \
+ ./table/table.cc \
+ ./table/table_builder.cc \
+ ./table/two_level_iterator.cc \
+ ./util/arena.cc \
+ ./util/cache.cc \
+ ./util/coding.cc \
+ ./util/comparator.cc \
+ ./util/crc32c.cc \
+ ./util/env.cc \
+ ./util/env_posix.cc \
+ ./util/hash.cc \
+ ./util/histogram.cc \
+ ./util/logging.cc \
+ ./util/options.cc \
+ ./util/status.cc
diff --git a/jni/Android.mk b/jni/Android.mk
new file mode 100644
index 0000000..47cef43
--- /dev/null
+++ b/jni/Android.mk
@@ -0,0 +1,17 @@
+# Copyright (c) 2011 The LevelDB Authors. All rights reserved. # 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.
+
+# To build for Android, add the Android NDK to your path and type 'ndk-build'.
+
+LOCAL_PATH := $(call my-dir)
+
+include $(CLEAR_VARS)
+
+include common.mk
+
+LOCAL_MODULE := leveldb
+LOCAL_C_INCLUDES := $(C_INCLUDES)
+LOCAL_CPP_EXTENSION := .cc
+LOCAL_CFLAGS := -DLEVELDB_PLATFORM_ANDROID -std=gnu++0x
+LOCAL_SRC_FILES := $(SOURCES:%.cc=../%.cc) ../port/port_android.cc
+
+include $(BUILD_SHARED_LIBRARY)
diff --git a/jni/Application.mk b/jni/Application.mk
new file mode 100644
index 0000000..12d72f2
--- /dev/null
+++ b/jni/Application.mk
@@ -0,0 +1,4 @@
+# Copyright (c) 2011 The LevelDB Authors. All rights reserved. # 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.
+
+APP_ABI := armeabi-v7a
+APP_STL := gnustl_static