summaryrefslogtreecommitdiff
path: root/indra
diff options
context:
space:
mode:
authorErik Kundiman <erik@megapahit.org>2024-08-25 14:59:55 +0800
committerErik Kundiman <erik@megapahit.org>2024-08-25 14:59:55 +0800
commit46724f7207638b540ddf45bee91b3c20cec87bc4 (patch)
tree834dbc0b120c608e733c18dc135238d5520e0833 /indra
parentbfcf0d1d2cd754018e922d70e2d8ab0e7c6cc395 (diff)
Darwin prebuilt OpenSSL binary
Diffstat (limited to 'indra')
-rw-r--r--indra/cmake/OpenSSL.cmake55
1 files changed, 38 insertions, 17 deletions
diff --git a/indra/cmake/OpenSSL.cmake b/indra/cmake/OpenSSL.cmake
index 4481b3460f..118ca84132 100644
--- a/indra/cmake/OpenSSL.cmake
+++ b/indra/cmake/OpenSSL.cmake
@@ -7,8 +7,40 @@ add_library( ll::openssl INTERFACE IMPORTED )
if (NOT USESYSTEMLIBS)
use_system_binary(openssl)
endif (NOT USESYSTEMLIBS)
-if (CMAKE_OSX_ARCHITECTURES MATCHES x86_64 OR LINUX OR NOT USESYSTEMLIBS)
+if (DARWIN OR LINUX OR NOT USESYSTEMLIBS)
use_prebuilt_binary(openssl)
+ if (DARWIN)
+ execute_process(
+ COMMAND lipo -archs libcrypto.a
+ WORKING_DIRECTORY ${LIBS_PREBUILT_DIR}/lib/release
+ OUTPUT_VARIABLE crypto_archs
+ OUTPUT_STRIP_TRAILING_WHITESPACE
+ )
+ if (NOT ${crypto_archs} STREQUAL ${CMAKE_OSX_ARCHITECTURES})
+ execute_process(
+ COMMAND lipo
+ libcrypto.a
+ -thin ${CMAKE_OSX_ARCHITECTURES}
+ -output libcrypto.a
+ WORKING_DIRECTORY ${LIBS_PREBUILT_DIR}/lib/release
+ )
+ endif (NOT ${crypto_archs} STREQUAL ${CMAKE_OSX_ARCHITECTURES})
+ execute_process(
+ COMMAND lipo -archs libssl.a
+ WORKING_DIRECTORY ${LIBS_PREBUILT_DIR}/lib/release
+ OUTPUT_VARIABLE ssl_archs
+ OUTPUT_STRIP_TRAILING_WHITESPACE
+ )
+ if (NOT ${ssl_archs} STREQUAL ${CMAKE_OSX_ARCHITECTURES})
+ execute_process(
+ COMMAND lipo
+ libssl.a
+ -thin ${CMAKE_OSX_ARCHITECTURES}
+ -output libssl.a
+ WORKING_DIRECTORY ${LIBS_PREBUILT_DIR}/lib/release
+ )
+ endif (NOT ${ssl_archs} STREQUAL ${CMAKE_OSX_ARCHITECTURES})
+ endif (DARWIN)
elseif (${PREBUILD_TRACKING_DIR}/sentinel_installed IS_NEWER_THAN ${PREBUILD_TRACKING_DIR}/openssl_installed OR NOT ${openssl_installed} EQUAL 0)
if (NOT EXISTS ${CMAKE_BINARY_DIR}/3p-openssl-1.1.1q.de53f55.tar.gz)
file(DOWNLOAD
@@ -20,26 +52,15 @@ elseif (${PREBUILD_TRACKING_DIR}/sentinel_installed IS_NEWER_THAN ${PREBUILD_TRA
INPUT ${CMAKE_BINARY_DIR}/3p-openssl-1.1.1q.de53f55.tar.gz
DESTINATION ${CMAKE_BINARY_DIR}
)
- if (CMAKE_OSX_ARCHITECTURES MATCHES arm64)
- set(ENV{CFLAGS} "-mmacosx-version-min=11.0")
- execute_process(
- COMMAND ./Configure no-shared darwin64-arm64-cc
- WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/3p-openssl-1.1.1q.de53f55/openssl
- )
- else (CMAKE_OSX_ARCHITECTURES MATCHES arm64)
- execute_process(
- COMMAND ./config no-shared
- WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/3p-openssl-1.1.1q.de53f55/openssl
- )
- endif (CMAKE_OSX_ARCHITECTURES MATCHES arm64)
+ execute_process(
+ COMMAND ./config no-shared
+ WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/3p-openssl-1.1.1q.de53f55/openssl
+ )
execute_process(
COMMAND make -j${MAKE_JOBS}
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/3p-openssl-1.1.1q.de53f55/openssl
RESULT_VARIABLE openssl_installed
)
- if (CMAKE_OSX_ARCHITECTURES MATCHES arm64)
- unset(ENV{CFLAGS})
- endif (CMAKE_OSX_ARCHITECTURES MATCHES arm64)
file(
COPY
${CMAKE_BINARY_DIR}/3p-openssl-1.1.1q.de53f55/openssl/include/openssl/aes.h
@@ -155,7 +176,7 @@ elseif (${PREBUILD_TRACKING_DIR}/sentinel_installed IS_NEWER_THAN ${PREBUILD_TRA
DESTINATION ${LIBS_PREBUILT_DIR}/lib/release
)
file(WRITE ${PREBUILD_TRACKING_DIR}/openssl_installed "${openssl_installed}")
-endif (CMAKE_OSX_ARCHITECTURES MATCHES x86_64 OR LINUX OR NOT USESYSTEMLIBS)
+endif (DARWIN OR LINUX OR NOT USESYSTEMLIBS)
if (WINDOWS)
target_link_libraries(ll::openssl INTERFACE libssl libcrypto)
elseif (LINUX)