Skip to content

Commit 68cffd1

Browse files
Fix 32-bit native targets to use mmap instead of mmap64
1 parent ebf41e3 commit 68cffd1

File tree

6 files changed

+34
-7
lines changed

6 files changed

+34
-7
lines changed

android-database-sqlcipher/build-openssl-libraries.sh

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@ MINIMUM_ANDROID_64_BIT_SDK_VERSION=$2
5050
esac
5151

5252
rm -rf ${ANDROID_LIB_ROOT}
53-
#git clean -dfx && git checkout -f
5453
./Configure dist
5554

5655
for SQLCIPHER_TARGET_PLATFORM in armeabi armeabi-v7a x86 x86_64 arm64-v8a
@@ -63,34 +62,39 @@ MINIMUM_ANDROID_64_BIT_SDK_VERSION=$2
6362
CONFIGURE_ARCH=android
6463
PLATFORM_OUTPUT_DIR=armeabi
6564
ANDROID_API_VERSION=${MINIMUM_ANDROID_SDK_VERSION}
65+
OFFSET_BITS=32
6666
;;
6767
armeabi-v7a)
6868
TOOLCHAIN_ARCH=arm
6969
TOOLCHAIN_PREFIX=arm-linux-androideabi
7070
CONFIGURE_ARCH=android -march=armv7-a
7171
PLATFORM_OUTPUT_DIR=armeabi-v7a
7272
ANDROID_API_VERSION=${MINIMUM_ANDROID_SDK_VERSION}
73+
OFFSET_BITS=32
7374
;;
7475
x86)
7576
TOOLCHAIN_ARCH=x86
7677
TOOLCHAIN_PREFIX=i686-linux-android
7778
CONFIGURE_ARCH=android-x86
7879
PLATFORM_OUTPUT_DIR=x86
7980
ANDROID_API_VERSION=${MINIMUM_ANDROID_SDK_VERSION}
81+
OFFSET_BITS=32
8082
;;
8183
x86_64)
8284
TOOLCHAIN_ARCH=x86_64
8385
TOOLCHAIN_PREFIX=x86_64-linux-android
8486
CONFIGURE_ARCH=android64
8587
PLATFORM_OUTPUT_DIR=x86_64
8688
ANDROID_API_VERSION=${MINIMUM_ANDROID_64_BIT_SDK_VERSION}
89+
OFFSET_BITS=64
8790
;;
8891
arm64-v8a)
8992
TOOLCHAIN_ARCH=arm64
9093
TOOLCHAIN_PREFIX=aarch64-linux-android
9194
CONFIGURE_ARCH=android64-aarch64
9295
PLATFORM_OUTPUT_DIR=arm64-v8a
9396
ANDROID_API_VERSION=${MINIMUM_ANDROID_64_BIT_SDK_VERSION}
97+
OFFSET_BITS=64
9498
;;
9599
*)
96100
echo "Unsupported build platform:${SQLCIPHER_TARGET_PLATFORM}"
@@ -118,6 +122,7 @@ MINIMUM_ANDROID_64_BIT_SDK_VERSION=$2
118122
CC=${TOOLCHAIN_PREFIX}-gcc \
119123
./Configure "${CONFIGURE_ARCH}" \
120124
-D__ANDROID_API__=${ANDROID_API_VERSION} \
125+
-D_FILE_OFFSET_BITS=${OFFSET_BITS} \
121126
"${OPENSSL_CONFIGURE_OPTIONS}"
122127

123128
if [ $? -ne 0 ]; then

android-database-sqlcipher/native.gradle

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,25 @@ task buildNative() {
3232
description "Build the native SQLCipher binaries"
3333
doLast {
3434
executeNdkBuild(
35-
"${nativeRootOutputDir}/libs",
35+
"${nativeRootOutputDir}/libs32",
3636
file("src/main/cpp").absolutePath,
37-
file("src/main/cpp/Application.mk").absolutePath,
37+
file("src/main/cpp/Application32.mk").absolutePath,
3838
"${sqlcipherCFlags}")
39+
executeNdkBuild(
40+
"${nativeRootOutputDir}/libs64",
41+
file("src/main/cpp").absolutePath,
42+
file("src/main/cpp/Application64.mk").absolutePath,
43+
"${sqlcipherCFlags}")
44+
exec {
45+
workingDir "${nativeRootOutputDir}"
46+
commandLine "mkdir", "-p", "libs"
47+
}
48+
copy {
49+
from fileTree("${nativeRootOutputDir}/libs32").include("*/*")
50+
into "${nativeRootOutputDir}/libs"
51+
from fileTree("${nativeRootOutputDir}/libs64").include("*/*")
52+
into "${nativeRootOutputDir}/libs"
53+
}
3954
}
4055
}
4156

@@ -59,7 +74,7 @@ task cleanNative() {
5974
description "Clean the native (JNI) build artifacts"
6075
doLast {
6176
logger.info "Cleaning native build artifacts"
62-
["libs", "obj"].each {
77+
["libs", "libs32", "libs64", "obj"].each {
6378
File file = new File("${projectDir}/src/main/${it}")
6479
if(file.exists()){
6580
file.deleteDir()
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
APP_PROJECT_PATH := $(shell pwd)
2+
APP_ABI := armeabi armeabi-v7a x86
3+
APP_PLATFORM := android-21
4+
APP_BUILD_SCRIPT := $(APP_PROJECT_PATH)/Android.mk
5+
APP_STL := stlport_static
6+
APP_CFLAGS := -D_FILE_OFFSET_BITS=32
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
APP_PROJECT_PATH := $(shell pwd)
2-
APP_ABI := armeabi armeabi-v7a x86 x86_64 arm64-v8a
2+
APP_ABI := x86_64 arm64-v8a
33
APP_PLATFORM := android-21
44
APP_BUILD_SCRIPT := $(APP_PROJECT_PATH)/Android.mk
55
APP_STL := stlport_static
6+
APP_CFLAGS := -D_FILE_OFFSET_BITS=64

android-database-sqlcipher/src/main/java/net/sqlcipher/database/SQLiteDatabase.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ public class SQLiteDatabase extends SQLiteClosable {
7878
/**
7979
* The version number of the SQLCipher for Android Java client library.
8080
*/
81-
public static final String SQLCIPHER_ANDROID_VERSION = "3.5.8";
81+
public static final String SQLCIPHER_ANDROID_VERSION = "3.5.9";
8282

8383
// Stores reference to all databases opened in the current process.
8484
// (The referent Object is not used at this time.)

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ allprojects {
1616
}
1717

1818
ext {
19-
clientVersionNumber = "3.5.8"
19+
clientVersionNumber = "3.5.9"
2020
mavenPackaging = "aar"
2121
mavenGroup = "net.zetetic"
2222
mavenArtifactId = "android-database-sqlcipher"

0 commit comments

Comments
 (0)