RN Android uses OpenSSL package (#1405)

This commit is contained in:
Kenneth Geisshirt 2017-10-11 21:58:27 +02:00 committed by GitHub
parent 7526a19c65
commit 270604a347
4 changed files with 53 additions and 1 deletions

View File

@ -15,6 +15,11 @@ X.Y.Z Release notes
* Upgrading to Realm Sync 2.0.0-rc28.
* Upgrading to Realm Object Server 2.0.0-rc.4.
### Internal
* OpenSSL for Android is distributed in a separate package, and the build system needed updates to accommendate this.
* Added `-fvisibility=hidden` to Android builds (reduces size of `.so` file).
2.0.0-rc19 Release notes (2017-10-7)
=============================================================
### Breaking changes

View File

@ -92,6 +92,33 @@ task prepareRealmCore(dependsOn: downloadRealmCore, type:Copy) {
}
}
task downloadOpenSSL_x86(type: Download) {
src "https://static.realm.io/downloads/openssl/1.0.2k/Android/x86/openssl-release-1.0.2k-Android-x86.tar.gz"
onlyIfNewer true
overwrite true
dest new File(downloadsDir, "openssl-release-1.0.2k-Android-x86.tar.gz")
}
task prepareOpenSSL_x86(dependsOn: downloadOpenSSL_x86, type:Copy) {
from tarTree(downloadOpenSSL_x86.dest)
into "$coreDownloadDir/core"
}
task downloadOpenSSL_arm(type: Download) {
src "https://static.realm.io/downloads/openssl/1.0.2k/Android/armeabi-v7a/openssl-release-1.0.2k-Android-armeabi-v7a.tar.gz"
onlyIfNewer true
overwrite true
dest new File(downloadsDir, "openssl-release-1.0.2k-Android-armeabi-v7a.tar.gz")
}
task prepareOpenSSL_arm(dependsOn: downloadOpenSSL_arm, type:Copy) {
from tarTree(downloadOpenSSL_arm.dest)
into "$coreDownloadDir/core"
rename { String fileName ->
fileName.replace("-arm-", "-armeabi-")
}
}
def getDependenciesVersion(keyName) {
def inputFile = new File(buildscript.sourceFile.getParent() + "/../../dependencies.list")
def line
@ -194,7 +221,7 @@ def getNdkBuildFullPath() {
return ndkBuildFullPath
}
task buildReactNdkLib(dependsOn: [downloadJSCHeaders,prepareRealmCore], type: Exec) {
task buildReactNdkLib(dependsOn: [downloadJSCHeaders,prepareRealmCore,prepareOpenSSL_x86,prepareOpenSSL_arm], type: Exec) {
inputs.file('src/main/jni')
outputs.dir("$buildDir/realm-react-ndk/all")
commandLine getNdkBuildFullPath(),

View File

@ -6,6 +6,12 @@ LOCAL_MODULE := realm-android-sync-$(TARGET_ARCH_ABI)
LOCAL_EXPORT_C_INCLUDES := core/include
LOCAL_SRC_FILES := core/librealm-sync-android-$(TARGET_ARCH_ABI).a
include $(PREBUILT_STATIC_LIBRARY)
include $(CLEAR_VARS)
LOCAL_MODULE := crypto-$(TARGET_ARCH_ABI)
LOCAL_EXPORT_C_INCLUDES := core/openssl-release-1.0.2k-Android-$(TARGET_ARCH_ABI)/include
LOCAL_SRC_FILES := core/openssl-release-1.0.2k-Android-$(TARGET_ARCH_ABI)/lib/libcrypto.a
include $(PREBUILT_STATIC_LIBRARY)
endif
include $(CLEAR_VARS)
@ -19,6 +25,12 @@ LOCAL_MODULE := libjsc
LOCAL_EXPORT_C_INCLUDES := jsc
include $(BUILD_SHARED_LIBRARY)
include $(CLEAR_VARS)
LOCAL_MODULE := ssl-$(TARGET_ARCH_ABI)
LOCAL_EXPORT_C_INCLUDES := core/openssl-release-1.0.2k-Android-$(TARGET_ARCH_ABI)/include
LOCAL_SRC_FILES := core/openssl-release-1.0.2k-Android-$(TARGET_ARCH_ABI)/lib/libssl.a
include $(PREBUILT_STATIC_LIBRARY)
include $(CLEAR_VARS)
LOCAL_MODULE := librealmreact
@ -43,6 +55,7 @@ LOCAL_SRC_FILES += src/object-store/src/impl/epoll/external_commit_helper.cpp
LOCAL_SRC_FILES += src/object-store/src/parser/parser.cpp
LOCAL_SRC_FILES += src/object-store/src/parser/query_builder.cpp
LOCAL_SRC_FILES += src/object-store/src/util/format.cpp
LOCAL_SRC_FILES += src/object-store/src/util/uuid.cpp
LOCAL_SRC_FILES += src/object-store/src/binding_callback_thread_observer.cpp
LOCAL_SRC_FILES += src/object-store/src/collection_notifications.cpp
LOCAL_SRC_FILES += src/object-store/src/index_set.cpp
@ -60,6 +73,7 @@ LOCAL_SRC_FILES += src/object-store/src/sync/sync_session.cpp
LOCAL_SRC_FILES += src/object-store/src/sync/sync_user.cpp
LOCAL_SRC_FILES += src/object-store/src/sync/sync_config.cpp
LOCAL_SRC_FILES += src/object-store/src/sync/partial_sync.cpp
LOCAL_SRC_FILES += src/object-store/src/sync/sync_permission.cpp
LOCAL_SRC_FILES += src/object-store/src/sync/impl/sync_file.cpp
LOCAL_SRC_FILES += src/object-store/src/sync/impl/sync_metadata.cpp
endif
@ -75,6 +89,7 @@ LOCAL_C_INCLUDES += $(JAVA_HOME)/include
LOCAL_C_INCLUDES += $(JAVA_HOME)/include/darwin
LOCAL_C_INCLUDES += $(JAVA_HOME)/include/linux
LOCAL_C_INCLUDES += core/include
LOCAL_C_INCLUDES += core/openssl-release-1.0.2k-Android-$(TARGET_ARCH_ABI)/include
ifeq ($(strip $(BUILD_TYPE_SYNC)),1)
LOCAL_C_INCLUDES += src/object-store/src/sync
endif
@ -83,8 +98,11 @@ LOCAL_ALLOW_UNDEFINED_SYMBOLS := true
ifeq ($(strip $(BUILD_TYPE_SYNC)),1)
LOCAL_STATIC_LIBRARIES := realm-android-sync-$(TARGET_ARCH_ABI)
LOCAL_STATIC_LIBRARIES += realm-android-$(TARGET_ARCH_ABI)
LOCAL_STATIC_LIBRARIES += ssl-$(TARGET_ARCH_ABI)
LOCAL_STATIC_LIBRARIES += crypto-$(TARGET_ARCH_ABI)
else
LOCAL_STATIC_LIBRARIES := realm-android-$(TARGET_ARCH_ABI)
LOCAL_STATIC_LIBRARIES += crypto-$(TARGET_ARCH_ABI)
endif

View File

@ -13,11 +13,13 @@ APP_CPPFLAGS += -frtti
APP_CPPFLAGS += -fexceptions
APP_CPPFLAGS += -DREALM_HAVE_CONFIG
APP_CPPFLAGS += -fomit-frame-pointer
APP_CPPFLAGS += -fvisibility=hidden
# Make sure every shared lib includes a .note.gnu.build-id header
APP_LDFLAGS := -Wl,--build-id
APP_LDFLAGS += -llog
APP_LDFLAGS += -landroid
APP_LDFLAGS += -fvisibility=hidden
ifeq ($(strip $(BUILD_TYPE_SYNC)),1)
APP_CPPFLAGS += -DREALM_ENABLE_SYNC=1