Skip to content

Commit 3eadd70

Browse files
committed
Merge branch 'android' of https://code.google.com/p/leveldb into android
2 parents 239ac9d + adf4a95 commit 3eadd70

File tree

5 files changed

+82
-37
lines changed

5 files changed

+82
-37
lines changed

Makefile

+5-37
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@ $(shell sh ./build_detect_platform)
1919
# this file is generated by build_detect_platform to set build flags
2020
include build_config.mk
2121

22+
# Read in common build variable definitions and source file list.
23+
include common.mk
24+
2225
# If Snappy is installed, add compilation and linker flags
2326
# (see http://code.google.com/p/snappy/)
2427
ifeq ($(SNAPPY), 1)
@@ -37,46 +40,11 @@ else
3740
GOOGLE_PERFTOOLS_LDFLAGS=
3841
endif
3942

40-
CFLAGS = -c -I. -I./include $(PORT_CFLAGS) $(PLATFORM_CFLAGS) $(OPT) $(SNAPPY_CFLAGS)
43+
CFLAGS = -c $(C_INCLUDES:%=-I%) $(PORT_CFLAGS) $(PLATFORM_CFLAGS) $(OPT) $(SNAPPY_CFLAGS)
4144

4245
LDFLAGS += $(PLATFORM_LDFLAGS) $(SNAPPY_LDFLAGS) $(GOOGLE_PERFTOOLS_LDFLAGS)
4346

44-
LIBOBJECTS = \
45-
./db/builder.o \
46-
./db/c.o \
47-
./db/db_impl.o \
48-
./db/db_iter.o \
49-
./db/filename.o \
50-
./db/dbformat.o \
51-
./db/log_reader.o \
52-
./db/log_writer.o \
53-
./db/memtable.o \
54-
./db/repair.o \
55-
./db/table_cache.o \
56-
./db/version_edit.o \
57-
./db/version_set.o \
58-
./db/write_batch.o \
59-
./port/port_posix.o \
60-
./table/block.o \
61-
./table/block_builder.o \
62-
./table/format.o \
63-
./table/iterator.o \
64-
./table/merger.o \
65-
./table/table.o \
66-
./table/table_builder.o \
67-
./table/two_level_iterator.o \
68-
./util/arena.o \
69-
./util/cache.o \
70-
./util/coding.o \
71-
./util/comparator.o \
72-
./util/crc32c.o \
73-
./util/env.o \
74-
./util/env_posix.o \
75-
./util/hash.o \
76-
./util/histogram.o \
77-
./util/logging.o \
78-
./util/options.o \
79-
./util/status.o
47+
LIBOBJECTS = $(SOURCES:.cc=.o) port/port_posix.o
8048

8149
TESTUTIL = ./util/testutil.o
8250
TESTHARNESS = ./util/testharness.o $(TESTUTIL)

README

+12
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,15 @@
1+
Android NDK port for LevelDB.
2+
3+
This git branch contains a make system to build LevelDB
4+
against the Android NDK: http://developer.android.com/sdk/ndk/index.html
5+
6+
To build:
7+
- Download install the Android NDK
8+
- cd into this directory
9+
- $ ndk-build
10+
11+
====
12+
113
leveldb: A key-value store
214
Authors: Sanjay Ghemawat ([email protected]) and Jeff Dean ([email protected])
315

common.mk

+44
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
# Copyright (c) 2011 The LevelDB Authors. All rights reserved.
2+
# Use of this source code is governed by a BSD-style license that can be
3+
# found in the LICENSE file. See the AUTHORS file for names of contributors.
4+
5+
# Definitions of build variable common between Android and non-Android builds.
6+
7+
# Also add /include directory for extra leveldb includes.
8+
C_INCLUDES = . ./include
9+
10+
SOURCES = \
11+
./db/builder.cc \
12+
./db/c.cc \
13+
./db/db_impl.cc \
14+
./db/db_iter.cc \
15+
./db/filename.cc \
16+
./db/dbformat.cc \
17+
./db/log_reader.cc \
18+
./db/log_writer.cc \
19+
./db/memtable.cc \
20+
./db/repair.cc \
21+
./db/table_cache.cc \
22+
./db/version_edit.cc \
23+
./db/version_set.cc \
24+
./db/write_batch.cc \
25+
./table/block.cc \
26+
./table/block_builder.cc \
27+
./table/format.cc \
28+
./table/iterator.cc \
29+
./table/merger.cc \
30+
./table/table.cc \
31+
./table/table_builder.cc \
32+
./table/two_level_iterator.cc \
33+
./util/arena.cc \
34+
./util/cache.cc \
35+
./util/coding.cc \
36+
./util/comparator.cc \
37+
./util/crc32c.cc \
38+
./util/env.cc \
39+
./util/env_posix.cc \
40+
./util/hash.cc \
41+
./util/histogram.cc \
42+
./util/logging.cc \
43+
./util/options.cc \
44+
./util/status.cc

jni/Android.mk

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# 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.
2+
3+
# To build for Android, add the Android NDK to your path and type 'ndk-build'.
4+
5+
LOCAL_PATH := $(call my-dir)
6+
7+
include $(CLEAR_VARS)
8+
9+
include common.mk
10+
11+
LOCAL_MODULE := leveldb
12+
LOCAL_C_INCLUDES := $(C_INCLUDES)
13+
LOCAL_CPP_EXTENSION := .cc
14+
LOCAL_CFLAGS := -DLEVELDB_PLATFORM_ANDROID -std=gnu++0x
15+
LOCAL_SRC_FILES := $(SOURCES:%.cc=../%.cc) ../port/port_android.cc
16+
17+
include $(BUILD_SHARED_LIBRARY)

jni/Application.mk

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# 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.
2+
3+
APP_ABI := armeabi-v7a
4+
APP_STL := gnustl_static

0 commit comments

Comments
 (0)