Merge "Add a build rule for a minimal static library version of sqlite3."
am: 382b7beebe

* commit '382b7beebed97d38f55c7703b1af879c5c323d7c':
  Add a build rule for a minimal static library version of sqlite3.
diff --git a/dist/Android.mk b/dist/Android.mk
index 44a3173..bf277d2 100644
--- a/dist/Android.mk
+++ b/dist/Android.mk
@@ -10,7 +10,7 @@
 #   SQLITE_TEMP_STORE=3 causes all TEMP files to go into RAM. and thats the behavior we want
 #   SQLITE_ENABLE_FTS3   enables usage of FTS3 - NOT FTS1 or 2.
 #   SQLITE_DEFAULT_AUTOVACUUM=1  causes the databases to be subject to auto-vacuum
-common_sqlite_flags := \
+minimal_sqlite_flags := \
 	-DNDEBUG=1 \
 	-DHAVE_USLEEP=1 \
 	-DSQLITE_HAVE_ISNAN \
@@ -29,15 +29,13 @@
 	-DSQLITE_OMIT_LOAD_EXTENSION \
 	-DSQLITE_DEFAULT_FILE_PERMISSIONS=0600
 
-device_sqlite_flags := $(common_sqlite_flags) \
+device_sqlite_flags := $(minimal_sqlite_flags) \
     -DSQLITE_ENABLE_ICU \
     -DUSE_PREAD64 \
     -Dfdatasync=fdatasync \
     -DHAVE_MALLOC_H=1 \
     -DHAVE_MALLOC_USABLE_SIZE
 
-host_sqlite_flags := $(common_sqlite_flags)
-
 common_src_files := sqlite3.c
 
 # the device library
@@ -68,7 +66,7 @@
 include $(CLEAR_VARS)
 LOCAL_SRC_FILES := $(common_src_files)
 LOCAL_LDLIBS += -lpthread -ldl
-LOCAL_CFLAGS += $(host_sqlite_flags)
+LOCAL_CFLAGS += $(minimal_sqlite_flags)
 LOCAL_MODULE:= libsqlite
 LOCAL_SHARED_LIBRARIES += libicuuc-host libicui18n-host
 LOCAL_STATIC_LIBRARIES := liblog libutils libcutils
@@ -122,7 +120,7 @@
 include $(CLEAR_VARS)
 
 LOCAL_SRC_FILES := $(common_src_files) shell.c
-LOCAL_CFLAGS += $(host_sqlite_flags) \
+LOCAL_CFLAGS += $(minimal_sqlite_flags) \
     -DNO_ANDROID_FUNCS=1
 
 # sqlite3MemsysAlarm uses LOG()
@@ -136,3 +134,20 @@
 LOCAL_MODULE := sqlite3
 
 include $(BUILD_HOST_EXECUTABLE)
+
+# Build a minimal version of sqlite3 without any android specific
+# features against the NDK. This is used by libcore's JDBC related
+# unit tests.
+include $(CLEAR_VARS)
+LOCAL_SRC_FILES := $(common_src_files)
+LOCAL_CFLAGS += $(minimal_sqlite_flags)
+LOCAL_MODULE:= libsqlite_static_minimal
+LOCAL_SDK_VERSION := 23
+include $(BUILD_STATIC_LIBRARY)
+
+# Same as libsqlite_static_minimal, except that this is for the host.
+include $(CLEAR_VARS)
+LOCAL_SRC_FILES := $(common_src_files)
+LOCAL_CFLAGS += $(minimal_sqlite_flags)
+LOCAL_MODULE:= libsqlite_static_minimal
+include $(BUILD_HOST_STATIC_LIBRARY)