Skip to content

Support arm64v8a and x86_64 (64-bit) in Sqlcipher #151

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 45 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
0ac32a9
Added compiled external libraries (not everything is there - some m…
Oct 16, 2014
8efe0eb
Properties correction
Oct 22, 2014
aaa3fcf
Added compiled external libraries (not everything is there - some m…
Oct 22, 2014
cac2dad
Added binaries for x86_64 from emulator image
Nov 3, 2014
b120eab
libnativehelper submodule
Oct 30, 2014
33a4382
Added native module (IBinder)
Oct 30, 2014
847d724
Renamed old String files to 32 and brought new versions for 64-bit An…
Nov 3, 2014
6125456
Added Lollipop repos for compiling 64-bit versions
Nov 6, 2014
e6b1787
Restored AndroidManifest && project.properties
Nov 6, 2014
22c9fde
Reworked target architecture selection in the external/Android.mk mak…
Nov 7, 2014
ea88891
Updated arm64-v8a shared libraries from android-5.0.0_r6
Nov 18, 2014
df1b115
Merge remote-tracking branch 'sqlcipher/master'
Nov 26, 2014
e521ef8
Merge branch 'master_3_1_0_64_32'
Nov 26, 2014
f0790fc
Added openssl from AOSP once again
Nov 30, 2014
e013d97
Added makefile for building android-aosp with ndk-build
Nov 30, 2014
07bdb1b
Cleanup makefile + add CFLAGS from main openssl module
Nov 30, 2014
72012f7
Added prebuilt libssl and libcrypto static libs for 64-bit libraries
Nov 30, 2014
b6ccbdc
Fixed openssl-aosp makefile.
Dec 1, 2014
d75077c
Fixed Makefile
Dec 6, 2014
8f605cd
Merge remote-tracking branch 'sqlcipher/master'
Jan 16, 2015
e8db4f0
Removed openssl-aosp submodule
Mar 6, 2015
6bd543f
Removed mips64 partial support
Mar 8, 2015
2f855c8
Merge remote-tracking branch 'sqlcipher/master'
Mar 27, 2015
f850b54
Modified the build-openssl-libraries.sh to also build openssl x86_64 …
Mar 28, 2015
681ba39
Modified build script to patch the openssl configure scripts and allo…
Mar 31, 2015
02ec20f
Fixed patching command
Mar 31, 2015
931fce2
Updated libcrypto.a for 64-bit architectures
Mar 31, 2015
c2ccafd
FIxed build-openssl-libraries script (cleanup after builds to prevent…
May 20, 2015
40fea00
Fixed issue
May 22, 2015
b965fb9
Merge branch 'master-sqlcipher'
Aug 1, 2015
cdc43d4
Updated binaries
Aug 1, 2015
f22fec9
Merge remote-tracking branch 'upstream/master'
Sep 29, 2015
0b6633b
Travis stuff
Jan 16, 2016
beafc31
Reduce excessive logging
Jan 16, 2016
6e32f93
Travis script update
Jan 16, 2016
48c75cb
YATSU
Jan 16, 2016
586c05d
Update README.org
gmetal Jan 16, 2016
c4cc397
Update README.org
gmetal Jan 16, 2016
9b81fe5
Update README.org
gmetal Jan 16, 2016
aa5b9cf
YATSU 2
Jan 16, 2016
376a2e2
YATSU 3
Jan 16, 2016
b0882fb
YATSU 4 - More testing with github release
Jan 17, 2016
6d82026
Trying skip_cleanup: true...
Jan 17, 2016
0fbed48
Merge branch 'refs/heads/v3.3.1-2' into v3.3.1.2.64
Jan 21, 2016
1af3087
Add new prebuilt binaries.
Jan 21, 2016
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,16 @@
url = https://github.com/android/platform_frameworks_base.git
[submodule "external/icu4c"]
path = external/icu4c
url = https://github.com/android/platform_external_icu4c.git
url = https://github.com/android/platform_external_icu4c.git
[submodule "external/libnativehelper"]
path = external/libnativehelper
url = https://android.googlesource.com/platform/libnativehelper
[submodule "notepadbot"]
path = dist/SQLCipherForAndroid-SDK/samples/notepadbot
url = https://github.com/guardianproject/notepadbot.git
[submodule "external/android-sqlite_lollipop"]
path = external/android-sqlite_lollipop
url = https://android.googlesource.com/platform/external/sqlite
[submodule "external/platform-system-core-lollipop"]
path = external/platform-system-core-lollipop
url = https://android.googlesource.com/platform/system/core
28 changes: 28 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
language: java
jdk: oraclejdk7
install:
- sudo apt-get update > /dev/null
- sudo apt-get -qq install --force-yes libgd2-xpm ia32-libs ia32-libs-multiarch
- export TERM=dumb
- wget http://dl.google.com/android/android-sdk_r24.4.1-linux.tgz
- tar -zxf android-sdk_r24.4.1-linux.tgz
- export ANDROID_HOME=`pwd`/android-sdk-linux
- export PATH=${PATH}:${ANDROID_HOME}/tools:${ANDROID_HOME}/platform-tools
- wget http://dl.google.com/android/ndk/android-ndk-r10e-linux-x86_64.bin -O ndk.bin
- chmod +x ndk.bin
- "./ndk.bin > /dev/null"
- ln -sf android-ndk-r10e android-ndk
- export ANDROID_NDK_HOME=`pwd`/android-ndk
- export PATH=${PATH}:${ANDROID_HOME}/tools:${ANDROID_HOME}/platform-tools:${ANDROID_NDK_HOME}
- echo "sdk.dir=$ANDROID_HOME" > local.properties
- echo yes | android update sdk -a -t tools,platform-tools,extra-android-support,extra-android-m2repository,android-21,build-tools-21.0.2,extra-google-google_play_services,extra-google-m2repository
--force --no-ui
script: make init && make && zip -r android-sqlcipher-gmetal.zip libs/* assets/*
deploy:
provider: releases
api_key:
secure: cspljT77LBRZpCVq8oF4ltPpBk0Cwk5+DQMvT4fkqM3b+kf3+qBGwxdLO33jDUDwbE2od4xPVZFhFvsgMrl/CJjF0nevFQJzLOc+/35ATqJgWsQ8lujbSG/0J8NtO0cQ7f/gIS/QvPduHyopdmPOGyBEhLnGlSbtZDJWwPdj4h3WkZvPcwFN0rr+9iVYfj4vPby0mLpafvrPYqcOfIrj86qRD5zpSoC/qbBeDR/rahcHOcyw39dpb1mTL8ZcN1v5P6PtMH3e35+eKyBLE0uEEG2xUpocC6bU8tmrM6OsUSUwdpNGC6tpgFfNMRWNi9YvmpTf1aazKA0Xyj5ZJVDVRguI4pfzbjC6pf0b7QtwAMp5O+aSW+NAIP3X2WShTuBuYnJ6L5Ztwhu8a8SYOVhEWHOkpDPgznhd7+KtnZk3wniOLG2gMHvI06iWvrxPnUNSWD1QJBvWPp+HGzopIQz2qlcOD3Hu71lW1+3DshrKrkdRb618v5bsoCtCheWuKus08KI0cOH7ECDEKMufwzVqkpU7ebG/cdQ5mUmtjUEsXcR2cVvbl3WzAIPOu83iCujTYv+GIPnCBnoo3YbZOYcNInX9Vxs+UVAk5nyXZP1H0R64XY8Jx1KIhCduqowv0YZWc/PlmfAKhPpKZJRs/8/ObJ8mpDW4qXjmko4stXAgOmc=
file: android-sqlcipher-gmetal.zip
skip_cleanup: true
on:
repo: gmetal/android-database-sqlcipher
23 changes: 22 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -83,14 +83,21 @@ clean:
-rm ${LIBRARY_ROOT}/armeabi/libsqlcipher_android.so
-rm ${LIBRARY_ROOT}/armeabi/libdatabase_sqlcipher.so
-rm ${LIBRARY_ROOT}/armeabi/libstlport_shared.so
-rm ${LIBRARY_ROOT}/arm64_v8a/libsqlcipher_android.so
-rm ${LIBRARY_ROOT}/arm64_v8a/libdatabase_sqlcipher.so
-rm ${LIBRARY_ROOT}/arm64_v8a/libstlport_shared.so
-rm ${LIBRARY_ROOT}/sqlcipher.jar
-rm ${LIBRARY_ROOT}/x86/libsqlcipher_android.so
-rm ${LIBRARY_ROOT}/x86/libdatabase_sqlcipher.so
-rm ${LIBRARY_ROOT}/x86/libstlport_shared.so
-rm ${LIBRARY_ROOT}/x86_64/libsqlcipher_android.so
-rm ${LIBRARY_ROOT}/x86_64/libdatabase_sqlcipher.so
-rm ${LIBRARY_ROOT}/x86_64/libstlport_shared.so
-rm ${LIBRARY_ROOT}/armeabi-v7a/libsqlcipher_android.so
-rm ${LIBRARY_ROOT}/armeabi-v7a/libdatabase_sqlcipher.so
-rm ${LIBRARY_ROOT}/armeabi-v7a/libstlport_shared.so


copy-libs:
mkdir -p ${LIBRARY_ROOT}/armeabi
cp ${EXTERNAL_DIR}/libs/armeabi/libsqlcipher_android.so \
Expand All @@ -99,13 +106,27 @@ copy-libs:
${LIBRARY_ROOT}/armeabi && \
cp ${EXTERNAL_DIR}/libs/armeabi/libstlport_shared.so \
${LIBRARY_ROOT}/armeabi
mkdir -p ${LIBRARY_ROOT}/arm64-v8a
cp ${EXTERNAL_DIR}/libs/arm64-v8a/libsqlcipher_android.so \
${LIBRARY_ROOT}/arm64-v8a && \
cp ${JNI_DIR}/libs/arm64-v8a/libdatabase_sqlcipher.so \
${LIBRARY_ROOT}/arm64-v8a && \
cp ${EXTERNAL_DIR}/libs/arm64-v8a/libstlport_shared.so \
${LIBRARY_ROOT}/arm64-v8a
mkdir -p ${LIBRARY_ROOT}/x86
cp ${EXTERNAL_DIR}/libs/x86/libsqlcipher_android.so \
${LIBRARY_ROOT}/x86 && \
cp ${JNI_DIR}/libs/x86/libdatabase_sqlcipher.so \
${LIBRARY_ROOT}/x86 && \
cp ${EXTERNAL_DIR}/libs/x86/libstlport_shared.so \
${LIBRARY_ROOT}/x86
mkdir -p ${LIBRARY_ROOT}/x86_64
cp ${EXTERNAL_DIR}/libs/x86_64/libsqlcipher_android.so \
${LIBRARY_ROOT}/x86_64 && \
cp ${JNI_DIR}/libs/x86_64/libdatabase_sqlcipher.so \
${LIBRARY_ROOT}/x86_64 && \
cp ${EXTERNAL_DIR}/libs/x86_64/libstlport_shared.so \
${LIBRARY_ROOT}/x86_64
mkdir -p ${LIBRARY_ROOT}/armeabi-v7a
cp ${EXTERNAL_DIR}/libs/armeabi-v7a/libsqlcipher_android.so \
${LIBRARY_ROOT}/armeabi-v7a && \
Expand All @@ -116,7 +137,7 @@ copy-libs:

copy-libs-dist:
cp ${LIBRARY_ROOT}/*.jar dist/SQLCipherForAndroid-SDK/libs/ && \
cp ${LIBRARY_ROOT}/armeabi/*.so dist/SQLCipherForAndroid-SDK/libs/armeabi/
cp ${LIBRARY_ROOT}/arm64_v8a/*.so dist/SQLCipherForAndroid-SDK/libs/arm64_v8a/

build-openssl-libraries:
./build-openssl-libraries.sh
61 changes: 60 additions & 1 deletion build-openssl-libraries.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,10 @@
esac

rm ../android-libs/armeabi/libcrypto.a \
../android-libs/x86/libcrypto.a
../android-libs/x86/libcrypto.a \
../android-libs/arm64-v8a/libcrypto.a \
../android-libs/x86_64/libcrypto.a


git clean -dfx && git checkout -f
./Configure dist
Expand Down Expand Up @@ -98,4 +101,60 @@
make clean
make build_crypto
mv libcrypto.a ../android-libs/x86/

rm -rf ${ANDROID_TOOLCHAIN_DIR}

make clean
git clean -dfx && git checkout -f

# Patch openssl to support building for arm64-v8a && x86_64
# Note, we only patch the Configure script
patch -p1 < ../../openssl_android_64_bit_support.patch

# arm64-v8a build
ANDROID_PLATFORM_VERSION=android-21
${ANDROID_NDK_ROOT}/build/tools/make-standalone-toolchain.sh \
--platform=${ANDROID_PLATFORM_VERSION} \
--install-dir=${ANDROID_TOOLCHAIN_DIR} \
--system=${TOOLCHAIN_SYSTEM} \
--arch=arm64

export PATH=${ANDROID_TOOLCHAIN_DIR}/bin:$PATH

RANLIB=aarch64-linux-android-ranlib \
AR=aarch64-linux-android-ar \
CC=aarch64-linux-android-gcc \
./Configure android-aarch64 ${OPENSSL_EXCLUSION_LIST}

make build_crypto

mv libcrypto.a ../android-libs/arm64-v8a/

rm -rf ${ANDROID_TOOLCHAIN_DIR}

make clean
git clean -dfx && git checkout -f

patch -p1 < ../../openssl_android_64_bit_support.patch

# x86_64 build
ANDROID_PLATFORM_VERSION=android-21
${ANDROID_NDK_ROOT}/build/tools/make-standalone-toolchain.sh \
--platform=${ANDROID_PLATFORM_VERSION} \
--install-dir=${ANDROID_TOOLCHAIN_DIR} \
--system=${TOOLCHAIN_SYSTEM} \
--arch=x86_64

export PATH=${ANDROID_TOOLCHAIN_DIR}/bin:$PATH

RANLIB=x86_64-linux-android-ranlib \
AR=x86_64-linux-android-ar \
CC=x86_64-linux-android-gcc \
./Configure android-x86_64 ${OPENSSL_EXCLUSION_LIST}

make build_crypto

mv libcrypto.a ../android-libs/x86_64/

rm -rf ${ANDROID_TOOLCHAIN_DIR}
)
42 changes: 29 additions & 13 deletions external/Android.mk
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ sqlcipher/sqlite3.c:
copy-libs-hack: build-local-hack
install -p -m644 libs/armeabi/*.so ../obj/local/armeabi/

project_ldflags:= -Llibs/$(TARGET_ARCH_ABI)/ -Landroid-libs/$(TARGET_ARCH_ABI)/
project_ldflags:= -Llibs/$(TARGET_ARCH_ABI)/ -Landroid-libs/$(TARGET_ARCH_ABI)/ -fuse-ld=bfd

#------------------------------------------------------------------------------#
# libsqlite3
Expand Down Expand Up @@ -63,17 +63,24 @@ include $(PREBUILT_STATIC_LIBRARY)
# libsqlcipher_android (our version of Android's libsqlite_android)

# these are all files from various external git repos
libsqlite3_android_local_src_files := \
libsqlite3_android_local_src_files_32 := \
android-sqlite/android/sqlite3_android.cpp \
android-sqlite/android/PhonebookIndex.cpp \
android-sqlite/android/PhoneNumberUtils.cpp \
android-sqlite/android/OldPhoneNumberUtils.cpp \
android-sqlite/android/PhoneticStringUtils.cpp \
String16.cpp \
String8.cpp
String16_32.cpp \
String8_32.cpp
# android-sqlite/android/PhoneNumberUtilsTest.cpp \
# android-sqlite/android/PhoneticStringUtilsTest.cpp \

libsqlite3_android_local_src_files_64 := \
android-sqlite_lollipop/android/sqlite3_android.cpp \
android-sqlite_lollipop/android/PhoneNumberUtils.cpp \
android-sqlite_lollipop/android/OldPhoneNumberUtils.cpp \
String16_64.cpp \
String8_64.cpp

include $(CLEAR_VARS)

## this might save us linking against the private android shared libraries like
Expand All @@ -87,20 +94,29 @@ LOCAL_STATIC_LIBRARIES := libsqlcipher libicui18n libicuuc static-libcrypto
LOCAL_CFLAGS += $(android_sqlite_cflags) $(sqlite_cflags) \
-DOS_PATH_SEPARATOR="'/'" -DHAVE_SYS_UIO_H

LOCAL_C_INCLUDES := \
$(LOCAL_PATH)/includes \
$(LOCAL_PATH)/sqlcipher \
$(LOCAL_PATH)/icu4c/i18n \
$(LOCAL_PATH)/icu4c/common \
$(LOCAL_PATH)/platform-system-core/include \
$(LOCAL_PATH)/platform-frameworks-base/include

LOCAL_LDFLAGS += -fuse-ld=bfd
LOCAL_LDFLAGS += -L${LOCAL_PATH}/android-libs/$(TARGET_ARCH_ABI)/ -L$(LOCAL_PATH)/libs/$(TARGET_ARCH_ABI)/
LOCAL_LDLIBS := -llog -lutils -lcutils
LOCAL_MODULE := libsqlcipher_android
LOCAL_MODULE_FILENAME := libsqlcipher_android
LOCAL_SRC_FILES := $(libsqlite3_android_local_src_files)

ifeq ($(TARGET_ARCH_ABI), $(filter $(TARGET_ARCH_ABI), armeabi armeabi-v7a x86))
LOCAL_SRC_FILES := $(libsqlite3_android_local_src_files_32)
LOCAL_C_INCLUDES := $(LOCAL_PATH)/includes/arch32 \
$(LOCAL_PATH)/platform-system-core/include

else ifeq ($(TARGET_ARCH_ABI), $(filter $(TARGET_ARCH_ABI), x86_64 arm64-v8a))
LOCAL_SRC_FILES := $(libsqlite3_android_local_src_files_64)
LOCAL_C_INCLUDES := $(LOCAL_PATH)/includes/arch64 \
$(LOCAL_PATH)/platform-system-core-lollipop/include

endif

LOCAL_C_INCLUDES += \
$(LOCAL_PATH)/sqlcipher \
$(LOCAL_PATH)/icu4c/i18n \
$(LOCAL_PATH)/icu4c/common \
$(LOCAL_PATH)/platform-frameworks-base/include

include $(BUILD_SHARED_LIBRARY)

Expand Down
File renamed without changes.
Loading