diff --git a/CMakeLists.txt b/CMakeLists.txt index 101cfda5a..e2ad78687 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -22,7 +22,7 @@ SQLite3_UnicodeSN - The snowball tokenizer library for SQLite This project is built for the following platforms at Couchbase: - Windows 10 - UWP -- macOS 10.14 +- macOS 12.0 - CentOS 7 (gcc 7.x+) - Android API 22+ @@ -42,7 +42,7 @@ cmake_policy(VERSION 3.9) cmake_policy(SET CMP0057 NEW) # Mac/apple setup -- must appear before the first "project()" line" -set(CMAKE_OSX_DEPLOYMENT_TARGET "10.14") +set(CMAKE_OSX_DEPLOYMENT_TARGET "12.0") if(NOT DEFINED CMAKE_OSX_SYSROOT) # Tells Mac builds to use the current SDK's headers & libs, not what's in the OS. set(CMAKE_OSX_SYSROOT macosx) diff --git a/Crypto/PublicKey+Apple.mm b/Crypto/PublicKey+Apple.mm index 38eeccbad..c37e5e3ca 100644 --- a/Crypto/PublicKey+Apple.mm +++ b/Crypto/PublicKey+Apple.mm @@ -337,7 +337,10 @@ virtual int _sign(int/*mbedtls_md_type_t*/ mbedDigestAlgorithm, if (@available(macOS 11.0, iOS 14.0, *)) { publicKeyRef = SecTrustCopyKey(trustRef); } else { +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated-declarations" publicKeyRef = SecTrustCopyPublicKey(trustRef); +#pragma clang diagnostic pop } CFRelease(policyRef); CFRelease(trustRef); @@ -536,21 +539,12 @@ virtual int _sign(int/*mbedtls_md_type_t*/ mbedDigestAlgorithm, SecTrustResultType result; // Result will be ignored. OSStatus err; - if (@available(iOS 12.0, *)) { - CFErrorRef cferr; - if (!SecTrustEvaluateWithError(trustRef, &cferr)) { - auto error = (__bridge NSError*)cferr; - LogVerbose(TLSLogDomain, "SecTrustEvaluateWithError failed: %s", error.description.UTF8String); - } - err = SecTrustGetTrustResult(trustRef, &result); - } else { -#if TARGET_OS_MACCATALYST - LogError(TLSLogDomain, "Catalyst:SecTrustEvaluateWithError not available, macOS < 10.14, iOS < 12"); - error::_throw(error::UnsupportedOperation, "Catalyst:SecTrustEvaluateWithError not available, macOS < 10.14, iOS < 12"); -#else - err = SecTrustEvaluate(trustRef, &result); -#endif + CFErrorRef cferr; + if (!SecTrustEvaluateWithError(trustRef, &cferr)) { + auto error = (__bridge NSError*)cferr; + LogVerbose(TLSLogDomain, "SecTrustEvaluateWithError failed: %s", error.description.UTF8String); } + err = SecTrustGetTrustResult(trustRef, &result); checkOSStatus(err, "SecTrustEvaluate", "Couldn't evaluate the trust to get certificate chain" ); @@ -569,7 +563,10 @@ virtual int _sign(int/*mbedtls_md_type_t*/ mbedDigestAlgorithm, #endif { for (CFIndex i = 1; i < count; i++) { +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated-declarations" SecCertificateRef ref = SecTrustGetCertificateAtIndex(trustRef, i); +#pragma clang diagnostic pop NSData* data = (NSData*) CFBridgingRelease(SecCertificateCopyData(ref)); cert->append(new Cert(slice(data))); } @@ -639,7 +636,10 @@ virtual int _sign(int/*mbedtls_md_type_t*/ mbedDigestAlgorithm, LogError(TLSLogDomain, "Catalyst:SecTrustEvaluateWithError not available, macOS < 10.14 and iOS < 12"); error::_throw(error::UnsupportedOperation, "Catalyst:SecTrustEvaluateWithError not available, macOS < 10.14 and iOS < 12"); #else +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated-declarations" err = SecTrustEvaluate(trustRef, &result); +#pragma clang diagnostic pop #endif } @@ -694,7 +694,10 @@ virtual int _sign(int/*mbedtls_md_type_t*/ mbedDigestAlgorithm, #endif { for (CFIndex i = count - 1; i >= 0; i--) { +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated-declarations" SecCertificateRef ref = SecTrustGetCertificateAtIndex(trustRef, i); +#pragma clang diagnostic pop if (getChildCertCount(ref) < 2) { NSDictionary* params = @{ (id)kSecClass: (id)kSecClassCertificate, @@ -755,21 +758,12 @@ virtual int _sign(int/*mbedtls_md_type_t*/ mbedDigestAlgorithm, SecTrustResultType result; OSStatus err; - if (@available(iOS 12.0, *)) { - CFErrorRef cferr; - if (!SecTrustEvaluateWithError(trust, &cferr)) { - auto error = (__bridge NSError*)cferr; - LogVerbose(TLSLogDomain, "SecTrustEvaluateWithError failed: %s", error.description.UTF8String); - } - err = SecTrustGetTrustResult(trust, &result); - } else { -#if TARGET_OS_MACCATALYST - LogError(TLSLogDomain, "Catalyst:SecTrustEvaluateWithError not available, macOS < 10.14, iOS < 12.0"); - error::_throw(error::UnsupportedOperation, "Catalyst:SecTrustEvaluateWithError not available, macOS < 10.14, iOS < 12.0"); -#else - err = SecTrustEvaluate(trust, &result); -#endif + CFErrorRef cferr; + if (!SecTrustEvaluateWithError(trust, &cferr)) { + auto error = (__bridge NSError*)cferr; + LogVerbose(TLSLogDomain, "SecTrustEvaluateWithError failed: %s", error.description.UTF8String); } + err = SecTrustGetTrustResult(trust, &result); checkOSStatus(err, "SecTrustEvaluate", "Couldn't validate certificate"); LogTo(TLSLogDomain, " ...SecTrustEvaluate returned %d", result); if (result != kSecTrustResultUnspecified && result != kSecTrustResultProceed) @@ -796,7 +790,10 @@ virtual int _sign(int/*mbedtls_md_type_t*/ mbedDigestAlgorithm, #endif { for (CFIndex i = 1; i < certCount; ++i) { +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated-declarations" auto certRef = SecTrustGetCertificateAtIndex(trust, i); +#pragma clang diagnostic pop LogTo(TLSLogDomain, " ... root %s", describe(certRef).c_str()); CFDataRef dataRef = SecCertificateCopyData(certRef); CFAutorelease(dataRef); diff --git a/LiteCore/Support/Instrumentation.cc b/LiteCore/Support/Instrumentation.cc index 675ea567d..c0a94fc3a 100644 --- a/LiteCore/Support/Instrumentation.cc +++ b/LiteCore/Support/Instrumentation.cc @@ -21,10 +21,8 @@ namespace litecore { #if defined(__APPLE__) && LITECORE_SIGNPOSTS -# if TARGET_OS_MACCATALYST os_log_t LiteCore = os_log_create("com.couchbase.litecore", "signposts"); ; -# endif enum Color { blue, @@ -35,30 +33,15 @@ namespace litecore { }; void Signpost::mark(Type t, uintptr_t param, uintptr_t param2) { -# if TARGET_OS_MACCATALYST - if ( __builtin_available(iOS 12.0, *) ) - os_signpost_event_emit(LiteCore, t, "LiteCore", "%lu %lu %d %d", param, param2, 0, (t % 5)); -# else - kdebug_signpost(t, param, param2, 0, (t % 5)); -# endif + os_signpost_event_emit(LiteCore, t, "LiteCore", "%lu %lu %d %d", param, param2, 0, (t % 5)); } void Signpost::begin(Type t, uintptr_t param, uintptr_t param2) { -# if TARGET_OS_MACCATALYST - if ( __builtin_available(iOS 12.0, *) ) - os_signpost_interval_begin(LiteCore, t, "LiteCore", "%lu %lu %d %d", param, param2, 0, (t % 5)); -# else - kdebug_signpost_start(t, param, param2, 0, (t % 5)); -# endif + os_signpost_interval_begin(LiteCore, t, "LiteCore", "%lu %lu %d %d", param, param2, 0, (t % 5)); } void Signpost::end(Type t, uintptr_t param, uintptr_t param2) { -# if TARGET_OS_MACCATALYST - if ( __builtin_available(iOS 12.0, *) ) - os_signpost_interval_end(LiteCore, t, "LiteCore", "%lu %lu %d %d", param, param2, 0, (t % 5)); -# else - kdebug_signpost_end(t, param, param2, 0, (t % 5)); -# endif + os_signpost_interval_end(LiteCore, t, "LiteCore", "%lu %lu %d %d", param, param2, 0, (t % 5)); } #endif diff --git a/Xcode/xcconfigs/Project.xcconfig b/Xcode/xcconfigs/Project.xcconfig index 851ac5b6c..d4b91d563 100644 --- a/Xcode/xcconfigs/Project.xcconfig +++ b/Xcode/xcconfigs/Project.xcconfig @@ -25,8 +25,8 @@ LITECORE_VERSION_STRING = 3.2.0 LITECORE_BUILD_NUMBER = 0 IPHONEOS_DEPLOYMENT_TARGET = 12.0 -MACOSX_DEPLOYMENT_TARGET = 10.14 -TVOS_DEPLOYMENT_TARGET = 10.0 +MACOSX_DEPLOYMENT_TARGET = 12.0 +TVOS_DEPLOYMENT_TARGET = 12.0 ONLY_ACTIVE_ARCH = YES SKIP_INSTALL = YES SUPPORTED_PLATFORMS = macosx iphoneos iphonesimulator appletvos appletvsimulator