8000 Pass CFLAGS from makefile to NDK build · oneNF/android-database-sqlcipher@b69421b · GitHub
[go: up one dir, main page]

Skip to content

Commit b69421b

Browse files
Pass CFLAGS from makefile to NDK build
1 parent 87635b3 commit b69421b

File tree

7 files changed

+42
-1
lines changed

7 files changed

+42
-1
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
build.xml
22
proguard-project.txt
33
local.properties
4+
external/android-libs
10000 5+
obj

Makefile

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
.DEFAULT_GOAL := all
2+
JNI_DIR := ${CURDIR}/jni
3+
EXTERNAL_DIR := ${CURDIR}/external
24
SQLCIPHER_DIR := ${CURDIR}/external/sqlcipher
35
SQLCIPHER_CFLAGS := -DHAVE_USLEEP=1 -DSQLITE_HAS_CODEC \
46
-DSQLITE_DEFAULT_JOURNAL_SIZE_LIMIT=1048576 -DSQLITE_THREADSAFE=1 -DNDEBUG=1 \
@@ -25,4 +27,18 @@ build-amalgamation:
2527
CFLAGS="${SQLCIPHER_CFLAGS}" && \
2628
make sqlite3.c
2729

28-
all:
30+
build-native:
31+
cd ${JNI_DIR} && \
32+
ndk-build --environment-overrides NDK_LIBS_OUT=$(JNI_DIR)/libs \
33+
SQLCIPHER_CFLAGS="${SQLCIPHER_CFLAGS}"
34+
35+
clean:
36+
cd ${SQLCIPHER_DIR} && \
37+
make clean
38+
cd ${JNI_DIR} && \
39+
ndk-build clean
40+
41+
distclean: clean
42+
rm -rf ${EXTERNAL_DIR}/android-libs
43+
44+
all: build-amalgamation build-native

jni/Android.mk

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
LOCAL_PATH := $(call my-dir)
2+
MY_PATH := $(LOCAL_PATH)
3+
include $(CLEAR_VARS)
4+
LOCAL_PATH := $(MY_PATH)
5+
SQLCIPHER_DIR := ../external/sqlcipher
6+
SQLCIPHER_SRC := $(SQLCIPHER_DIR)/sqlite3.c
7+
8+
LOCAL_CFLAGS += $(SQLCIPHER_CFLAGS)
9+
LOCAL_LDFLAGS += -L$(LOCAL_PATH)/android-libs/$(TARGET_ARCH_ABI)
10+
LOCAL_STATIC_LIBRARIES += static-libcrypto
11+
LOCAL_MODULE := libsqlcipher
12+
LOCAL_SRC_FILES := $(SQLCIPHER_SRC)
13+
14+
include $(BUILD_SHARED_LIBRARY)
15+
16+
include $(CLEAR_VARS)
17+
LOCAL_MODULE := static-libcrypto
18+
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/../external/openssl/include
19+
LOCAL_SRC_FILES := $(LOCAL_PATH)/../external/android-libs/$(TARGET_ARCH_ABI)/libcrypto.a
20+
include $(PREBUILT_STATIC_LIBRARY)

jni/Application.mk

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
APP_PROJECT_PATH := $(shell pwd)
2+
APP_ABI := armeabi armeabi-v7a x86
3+
APP_BUILD_SCRIPT := $(APP_PROJECT_PATH)/Android.mk

jni/libs/armeabi-v7a/libsqlcipher.so

1.14 MB
Binary file not shown.

jni/libs/armeabi/libsqlcipher.so

1.16 MB
Binary file not shown.

jni/libs/x86/libsqlcipher.so

1.81 MB
Binary file not shown.

0 commit comments

Comments
 (0)
0