openssl from prefab (google) (#3429)
Summary: Pull Request resolved: https://github.com/facebook/flipper/pull/3429 Instead of downloading/patching/building openssl, use the prefab package prepared by Google. changelog: Consume openssl from maven (prefab) Reviewed By: passy Differential Revision: D34143349 fbshipit-source-id: 0ca92be6628b1b27a59b3e4ad8278cf8fef6d5d8
This commit is contained in:
committed by
Facebook GitHub Bot
parent
9973014116
commit
c8c40bca17
43
android/third-party/native.gradle
vendored
43
android/third-party/native.gradle
vendored
@@ -193,48 +193,6 @@ task finalizeLibEvent(dependsOn: [prepareLibEvent2], type: Copy) {
|
||||
into "$externalDir/LibEvent/libevent-2.1.11-stable/"
|
||||
}
|
||||
|
||||
task downloadOpenSSLSource(dependsOn: [], type: Download) {
|
||||
onlyIf { isCacheOutOfDate(CACHE_REVISION) }
|
||||
src 'https://github.com/passy/openssl-android/releases/download/1.1.1k/openssl-1.1.1k.tar.gz'
|
||||
onlyIfNewer true
|
||||
overwrite false
|
||||
dest new File(downloadsDir, getDownloadFileName(src))
|
||||
}
|
||||
|
||||
task downloadOpenSSLLibs(dependsOn: [], type: Download) {
|
||||
onlyIf { isCacheOutOfDate(CACHE_REVISION) }
|
||||
src 'https://github.com/passy/openssl-android/releases/download/1.1.1k/openssl-1.1.1k-prebuilt.tar.gz'
|
||||
onlyIfNewer true
|
||||
overwrite false
|
||||
dest new File(downloadsDir, getDownloadFileName(src))
|
||||
}
|
||||
|
||||
task prepareOpenSSL(dependsOn: [downloadOpenSSLSource, downloadOpenSSLLibs], type: Copy) {
|
||||
onlyIf { isCacheOutOfDate(CACHE_REVISION) }
|
||||
from tarTree(downloadOpenSSLSource.dest)
|
||||
from tarTree(downloadOpenSSLLibs.dest)
|
||||
from './overrides/OpenSSL/'
|
||||
include 'openssl-1.1.1k/**/*'
|
||||
include 'libs/**/*'
|
||||
includeEmptyDirs = false
|
||||
into "$externalDir/OpenSSL/"
|
||||
}
|
||||
|
||||
task configureOpenSSL(dependsOn: [prepareOpenSSL], type: Exec) {
|
||||
onlyIf { isCacheOutOfDate(CACHE_REVISION) }
|
||||
workingDir "$externalDir/OpenSSL/openssl-1.1.1k/"
|
||||
// This is only to generate a buildconfig.h in the next step. I **believe**
|
||||
// that the options here don't really matter for that file.
|
||||
commandLine './Configure', 'linux-generic64'
|
||||
}
|
||||
|
||||
task finalizeOpenSSL(dependsOn: [configureOpenSSL], type: Exec) {
|
||||
onlyIf { isCacheOutOfDate(CACHE_REVISION) }
|
||||
workingDir "$externalDir/OpenSSL/openssl-1.1.1k/"
|
||||
commandLine 'make', 'build_generated'
|
||||
onlyIf { !file("$externalDir/OpenSSL/openssl-1.1.1k/include/openssl/opensslconf.h").exists() }
|
||||
}
|
||||
|
||||
task downloadRSocket(dependsOn: [], type: Download) {
|
||||
onlyIf { isCacheOutOfDate(CACHE_REVISION) }
|
||||
src 'https://github.com/priteshrnandgaonkar/rsocket-cpp/archive/0.10.7.tar.gz'
|
||||
@@ -265,7 +223,6 @@ def allTasks = [
|
||||
prepareBoost,
|
||||
finalizeFolly,
|
||||
finalizeLibEvent,
|
||||
finalizeOpenSSL,
|
||||
prepareRSocket,
|
||||
writeCacheRevision,
|
||||
]
|
||||
|
||||
@@ -16,7 +16,6 @@ list(APPEND dir_list ${FOLLY_DIR}/memory/detail)
|
||||
|
||||
set(BOOST_DIR ../boost/boost_1_63_0/)
|
||||
set(GLOG_DIR ../glog/)
|
||||
set(OPENSSL_DIR ../OpenSSL/openssl-1.1.1k/)
|
||||
set(LIBEVENT_DIR ../LibEvent/libevent-2.1.11-stable/)
|
||||
set(DOUBLECONVERSION_DIR ../double-conversion/double-conversion-3.0.0/)
|
||||
|
||||
@@ -24,7 +23,6 @@ list(APPEND dir_list ${BOOST_DIR})
|
||||
list(APPEND dir_list ${BOOST_DIR}/../)
|
||||
list(APPEND dir_list ${LIBEVENT_DIR}/)
|
||||
list(APPEND dir_list ${LIBEVENT_DIR}/include/)
|
||||
list(APPEND dir_list ${OPENSSL_DIR}/include/)
|
||||
|
||||
include_directories(${dir_list})
|
||||
|
||||
@@ -121,22 +119,18 @@ set(libevent_build_DIR ${build_DIR}/libevent/${ANDROID_ABI})
|
||||
|
||||
|
||||
file(MAKE_DIRECTORY ${build_DIR})
|
||||
find_package(openssl REQUIRED CONFIG)
|
||||
|
||||
add_subdirectory(${GLOG_DIR} ${libglog_build_DIR})
|
||||
add_subdirectory(${DOUBLECONVERSION_DIR} ${doubleconversion_build_DIR})
|
||||
add_subdirectory(${LIBEVENT_DIR} ${libevent_build_DIR})
|
||||
target_include_directories(${PACKAGE_NAME} PRIVATE
|
||||
${OPENSSL_DIR}/include/
|
||||
${BOOST_DIR}
|
||||
${BOOST_DIR}/../
|
||||
${GLOG_DIR}/../
|
||||
${GLOG_DIR}/glog-0.3.5/src/
|
||||
${DOUBLECONVERSION_DIR})
|
||||
|
||||
|
||||
set(OPENSSL_LINK_DIRECTORIES ${PROJECT_SOURCE_DIR}/../OpenSSL/libs/${ANDROID_ABI}/)
|
||||
find_path(OPENSSL_LIBRARY libssl.a HINTS ${OPENSSL_LINK_DIRECTORIES})
|
||||
|
||||
install(TARGETS ${PACKAGE_NAME} DESTINATION ./build/)
|
||||
|
||||
target_link_libraries(${PACKAGE_NAME} glog double-conversion ${OPENSSL_LINK_DIRECTORIES}/libssl.a ${OPENSSL_LINK_DIRECTORIES}/libcrypto.a event event_extra event_core)
|
||||
target_link_libraries(${PACKAGE_NAME} glog double-conversion openssl::ssl openssl::crypto event event_extra event_core)
|
||||
|
||||
@@ -23,23 +23,30 @@ android {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
lintOptions {
|
||||
abortOnError false
|
||||
}
|
||||
|
||||
sourceSets {
|
||||
main {
|
||||
manifest.srcFile './ApplicationManifest.xml'
|
||||
}
|
||||
}
|
||||
|
||||
externalNativeBuild {
|
||||
cmake {
|
||||
path './CMakeLists.txt'
|
||||
}
|
||||
}
|
||||
|
||||
buildFeatures {
|
||||
prefab true
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation project(':glog')
|
||||
implementation project(':doubleconversion')
|
||||
|
||||
implementation deps.openssl
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,11 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
~ Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
~
|
||||
~ This source code is licensed under the MIT license found in the LICENSE
|
||||
~ file in the root directory of this source tree.
|
||||
-->
|
||||
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.openssl">
|
||||
</manifest>
|
||||
@@ -1,39 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
apply plugin: 'com.android.library'
|
||||
|
||||
android {
|
||||
compileSdkVersion rootProject.compileSdkVersion
|
||||
buildToolsVersion rootProject.buildToolsVersion
|
||||
ndkVersion rootProject.ndkVersion
|
||||
|
||||
defaultConfig {
|
||||
minSdkVersion rootProject.minSdkVersion
|
||||
targetSdkVersion rootProject.targetSdkVersion
|
||||
externalNativeBuild {
|
||||
ndkBuild {
|
||||
arguments "NDK_APPLICATION_MK:=$projectDir/jni/Application.mk",
|
||||
"NDK_TOOLCHAIN_VERSION:=clang"
|
||||
cppFlags "-std=c++11"
|
||||
}
|
||||
}
|
||||
}
|
||||
externalNativeBuild {
|
||||
ndkBuild {
|
||||
path "$projectDir/jni/Android.mk"
|
||||
}
|
||||
}
|
||||
lintOptions {
|
||||
abortOnError false
|
||||
}
|
||||
sourceSets {
|
||||
main {
|
||||
manifest.srcFile './ApplicationManifest.xml'
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -12,7 +12,6 @@ set(glog_DIR ${third_party_ndk}/glog)
|
||||
set(BOOST_DIR ${third_party_ndk}/boost/boost_1_63_0/)
|
||||
set(LIBEVENT_DIR ${third_party_ndk}/LibEvent/libevent-2.1.11-stable/)
|
||||
set(DOUBLECONVERSION_DIR ${third_party_ndk}/double-conversion/double-conversion-3.0.0/)
|
||||
set(OPENSSL_DIR ${third_party_ndk}/OpenSSL/openssl-1.1.1k/)
|
||||
|
||||
set(RSOCKET_ROOT_DIR ${PROJECT_SOURCE_DIR}/rsocket-cpp-${RSOCKET_VERSION})
|
||||
set(RSOCKET_DIR ${PROJECT_SOURCE_DIR}/rsocket-cpp-${RSOCKET_VERSION}/rsocket)
|
||||
@@ -61,6 +60,8 @@ add_compile_options(
|
||||
-Wno-tautological-constant-compare
|
||||
)
|
||||
|
||||
find_package(openssl REQUIRED CONFIG)
|
||||
|
||||
add_library(${PACKAGE_NAME} STATIC ${SRC_FILES})
|
||||
|
||||
set(build_DIR ${CMAKE_SOURCE_DIR}/build)
|
||||
@@ -77,15 +78,9 @@ target_include_directories(${PACKAGE_NAME} PRIVATE
|
||||
${LIBEVENT_DIR}/
|
||||
${LIBEVENT_DIR}/include/
|
||||
${LIBEVENT_DIR}/include/event2
|
||||
${OPENSSL_DIR}/include/
|
||||
${glog_DIR}
|
||||
${glog_DIR}/../
|
||||
${glog_DIR}/glog-0.3.5/src/
|
||||
)
|
||||
|
||||
|
||||
set(OPENSSL_LINK_DIRECTORIES ${third_party_ndk}/OpenSSL/libs/${ANDROID_ABI}/)
|
||||
|
||||
find_path(OPENSSL_LIBRARY libssl.a HINTS ${OPENSSL_LINK_DIRECTORIES})
|
||||
|
||||
target_link_libraries(${PACKAGE_NAME} folly glog double-conversion log event ${OPENSSL_LINK_DIRECTORIES}/libssl.a ${OPENSSL_LINK_DIRECTORIES}/libcrypto.a)
|
||||
target_link_libraries(${PACKAGE_NAME} folly glog double-conversion log event openssl::ssl openssl::crypto)
|
||||
|
||||
@@ -17,7 +17,7 @@ android {
|
||||
targetSdkVersion rootProject.targetSdkVersion
|
||||
externalNativeBuild {
|
||||
cmake {
|
||||
arguments '-DANDROID_TOOLCHAIN=clang'
|
||||
arguments '-DANDROID_TOOLCHAIN=clang', '-DANDROID_STL=c++_shared'
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -29,9 +29,18 @@ android {
|
||||
manifest.srcFile './ApplicationManifest.xml'
|
||||
}
|
||||
}
|
||||
|
||||
externalNativeBuild {
|
||||
cmake {
|
||||
path './CMakeLists.txt'
|
||||
}
|
||||
}
|
||||
|
||||
buildFeatures {
|
||||
prefab true
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation deps.openssl
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user