KeePassXC, -devel: update to 2.7.12, 20260309.git36a2630

2.7.10:
* patch value of MAC_OS_VERSION_12_3 to fix build on older systems
* add ScreenCaptureKit to existing patches
* create separate old_macos patch for devel version
* make devel builds not marked as Release build type
2.7.11:
* minimum qt5 now 5.12.0

Closes: https://trac.macports.org/ticket/72178
This commit is contained in:
contextnerror
2025-09-10 22:24:51 -07:00
committed by Herby Gillot
parent 03758f8315
commit 854c67f1f4
4 changed files with 359 additions and 56 deletions
+25 -41
View File
@@ -27,13 +27,9 @@ long_description KeePassXC is a community fork of KeePassX with the \
license {GPL-2 GPL-3}
license_noconflict openssl openssl10 openssl11 openssl3
if {${os.platform} eq "darwin" && [vercmp ${macosx_deployment_target} >= 15.0]} {
macosx_deployment_target 14.0
}
if {${subport} eq ${name}} {
# stable
github.setup keepassxreboot keepassxc 2.7.9
github.setup keepassxreboot keepassxc 2.7.12
revision 0
github.tarball_from releases
distname keepassxc-${version}-src
@@ -45,34 +41,39 @@ if {${subport} eq ${name}} {
# See keepassxc-${version}-src.tar.xz.DIGEST on upstream GitHub releases page for SHA256 sums
checksums ${distname}${extract.suffix} \
rmd160 0ac59defa184907036007f57d55e97ab8b422ce6 \
sha256 3c44e45f22c00ddac63d8bc11054b4b0ada0222ffac08d3ed70f196cb9ed46fd \
size 9789312 \
rmd160 6a4fbddc41aabeee8f825a1e75e120125b1ab4cf \
sha256 be34eeb297881adea4f894c7c6e4a1835bd7927f8043ddea495040df4792a7de \
size 10618652 \
${distname}${extract.suffix}.sig \
rmd160 1ca16506c6bd2abbf3e30e3cb91b5d9a06139ec0 \
sha256 f3a51f4cbb7f4b3574cf3201d84427ebec59461eb5db516065bf282ba9b16a8b \
rmd160 e85f9d5c6144198d5141835921793c623d8afcf1 \
sha256 12dd20bfc11af3e6bcd7c16e9ede8ea7883b354ba75d83d6f77a59f942f2a4b5 \
size 488
gpg_verify.use_gpg_verification \
yes
patchfiles-append add_support_for_old_macos.diff
configure.args-append -DKEEPASSXC_BUILD_TYPE=Release \
}
subport ${name}-devel {
github.setup keepassxreboot keepassxc 37dabd2561c33d7c0e66bba6ab0883bb55e90cf1
# Change github.tarball_from to 'releases' or 'archive' next update
github.tarball_from tarball
github.setup keepassxreboot keepassxc 36a26308d0cf8fc548a57e093b1fb3fc6ebe8a44
github.tarball_from archive
set githash [string range ${github.version} 0 6]
version 20230514.git${githash}
revision 2
version 20260309.git${githash}
revision 0
conflicts KeePassXC
checksums rmd160 16d79aa775a0dc6d8cf32015a3dc7131a2e13163 \
sha256 05fb0c84e426f33bacd41f6809d52c5bc758dace52b41c58001385a26bed89c3 \
size 10967053
checksums rmd160 b005c3dd4fc66cf06174ae79a3f2f5ae5bbe26aa \
sha256 96b3773107461cd68cd9b08b624ab2432952407288092f08369eec93a357423e \
size 13906189
gpg_verify.use_gpg_verification \
no
patchfiles-append add_support_for_old_macos_devel.diff
}
if {[option gpg_verify.use_gpg_verification]} {
@@ -89,12 +90,9 @@ if {[option gpg_verify.use_gpg_verification]} {
}
}
# CMakeLists.txt only checks for Qt 5.2.0 and later but, per the developers,
# "That version check is only for Linux OS. Every other platform we assume
# latest available Qt." Empirically, KeePassXC builds with Qt 5.8 and later
# but not with 5.7 and earlier.
# https://github.com/keepassxreboot/keepassxc/issues/6352
qt5.min_version 5.8.0
# 2.7.11 requires Qt 5.12.0
# https://github.com/keepassxreboot/keepassxc/commit/df1035a31d8f934f31faf3dcd0b51cc947bfe0a8
qt5.min_version 5.12.0
qt5.depends_component qtmacextras qtsvg
qt5.depends_build_component \
qttools
@@ -112,7 +110,6 @@ depends_lib-append port:argon2 \
patchfiles-append patch-no-deployqt.diff \
patch-no-findpackage-path.diff \
add_support_for_old_macos.diff \
add_support_for_old_macos-2.diff
# error: no matching constructor for initialization of 'std::shared_ptr<unsigned char []>'
@@ -124,28 +121,15 @@ configure.args-append \
-DCMAKE_INSTALL_PREFIX=${applications_dir} \
-DCMAKE_INSTALL_MANDIR=${prefix}/share/man \
-DCMAKE_PREFIX_PATH=${qt_cmake_module_dir} \
-DKEEPASSXC_BUILD_TYPE=Release \
-DWITH_XC_BROWSER=ON \
-DWITH_XC_KEESHARE=ON \
-DWITH_XC_NETWORKING=ON \
-DWITH_XC_SSHAGENT=ON \
-DWITH_XC_YUBIKEY=ON \
-DWITH_XC_UPDATECHECK=OFF \
-DWITH_XC_DOCS=OFF
# QTest::addRow was introduced in Qt 5.9
if {[vercmp ${qt5.version} < 5.9]} {
configure.args-append -DWITH_TESTS=OFF
} else {
configure.args-append -DWITH_TESTS=ON
}
# Qt version 5.12.0 or higher is required for Passkeys support
if {[vercmp ${qt5.version} < 5.12]} {
configure.args-append -DWITH_XC_BROWSER_PASSKEYS=OFF
} else {
configure.args-append -DWITH_XC_BROWSER_PASSKEYS=ON
}
-DWITH_XC_DOCS=OFF \
-DWITH_TESTS=ON \
-DWITH_XC_BROWSER_PASSKEYS=ON
post-destroot {
set kp_doc_path ${destroot}${prefix}/share/doc/${name}
@@ -1,6 +1,15 @@
--- src/gui/osutils/macutils/AppKitImpl.mm
+++ src/gui/osutils/macutils/AppKitImpl.mm
@@ -66,7 +66,7 @@
--- src/gui/osutils/macutils/AppKitImpl.mm.orig 2025-05-27 17:48:31.000000000 -0700
+++ src/gui/osutils/macutils/AppKitImpl.mm 2025-05-27 19:14:00.000000000 -0700
@@ -19,7 +19,7 @@
#import "AppKitImpl.h"
#import <QWindow>
#import <Cocoa/Cocoa.h>
-#if __clang_major__ >= 13 && MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_VERSION_12_3
+#if __clang_major__ >= 13 && MAC_OS_X_VERSION_MIN_REQUIRED >= 120300
#import <ScreenCaptureKit/ScreenCaptureKit.h>
#endif
@@ -61,7 +61,7 @@
- (void) observeValueForKeyPath:(NSString *)keyPath
ofObject:(id)object
@@ -9,7 +18,7 @@
context:(void *)context
{
Q_UNUSED(object)
@@ -80,8 +80,10 @@
@@ -75,8 +75,10 @@
};
if(@available(macOS 11.0, *)) {
@@ -20,7 +29,7 @@
}
else {
emitBlock();
@@ -139,7 +141,11 @@
@@ -134,7 +136,11 @@
//
- (bool) isDarkMode
{
@@ -32,3 +41,12 @@
}
@@ -186,7 +192,7 @@
//
- (bool) enableScreenRecording
{
-#if __clang_major__ >= 13 && MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_VERSION_12_3
+#if __clang_major__ >= 13 && MAC_OS_X_VERSION_MIN_REQUIRED >= 120300
if (@available(macOS 12.3, *)) {
__block BOOL hasPermission = NO;
dispatch_semaphore_t sema = dispatch_semaphore_create(0);
@@ -11,9 +11,9 @@ Upstream doesn't want to merge patches to build on versions prior to macos
10.13, so this patch is not forwarded upstream.
See: https://github.com/keepassxreboot/keepassxc/pull/8650#issuecomment-1291750066
--- CMakeLists.txt
+++ CMakeLists.txt
@@ -81,6 +81,42 @@ if(APPLE)
--- CMakeLists.txt.orig 2025-09-17 16:07:50.000000000 -0700
+++ CMakeLists.txt 2025-09-17 16:14:00.000000000 -0700
@@ -82,6 +82,46 @@
${CMAKE_CURRENT_BINARY_DIR}/tiometry_test/
${CMAKE_CURRENT_SOURCE_DIR}/cmake/compiler-checks/macos/control_watch_support.mm)
message(STATUS "Apple watch compiler support: ${XC_APPLE_COMPILER_SUPPORT_WATCH}")
@@ -53,6 +53,10 @@ See: https://github.com/keepassxreboot/keepassxc/pull/8650#issuecomment-12917500
+ ${CMAKE_CURRENT_SOURCE_DIR}/cmake/compiler-checks/macos/control_SecAccessControlRef_support.mm)
+ message(STATUS "SecAccessControlRef compiler support: ${XC_APPLE_COMPILER_SUPPORT_SecAccessControlRef}")
+
+ try_compile(XC_APPLE_COMPILER_SUPPORT_ScreenCaptureKit
+ ${CMAKE_CURRENT_BINARY_DIR}/ScreenCaptureKit_test/
+ ${CMAKE_CURRENT_SOURCE_DIR}/cmake/compiler-checks/macos/control_ScreenCaptureKit_support.mm)
+ message(STATUS "ScreenCaptureKit compiler support: ${XC_APPLE_COMPILER_SUPPORT_ScreenCaptureKit}")
endif()
if(WITH_CCACHE)
@@ -115,9 +119,14 @@ See: https://github.com/keepassxreboot/keepassxc/pull/8650#issuecomment-12917500
+ kSecUseOperationPrompt;
+ return 0;
+}
--- src/config-keepassx.h.cmake
+++ src/config-keepassx.h.cmake
@@ -41,10 +41,24 @@
--- /dev/null
+++ cmake/compiler-checks/macos/control_ScreenCaptureKit_support.mm
@@ -0,0 +1,2 @@
+#include <ScreenCaptureKit/ScreenCaptureKit.h>
+int main() { return 0; }
--- src/config-keepassx.h.cmake.orig 2025-09-17 16:23:31.000000000 -0700
+++ src/config-keepassx.h.cmake 2025-09-17 16:26:08.000000000 -0700
@@ -43,10 +43,26 @@
#cmakedefine01 XC_APPLE_COMPILER_SUPPORT_BIOMETRY()
#cmakedefine01 XC_APPLE_COMPILER_SUPPORT_TOUCH_ID()
#cmakedefine01 XC_APPLE_COMPILER_SUPPORT_WATCH()
@@ -128,6 +137,7 @@ See: https://github.com/keepassxreboot/keepassxc/pull/8650#issuecomment-12917500
+#cmakedefine01 XC_APPLE_COMPILER_SUPPORT_kSecAttrAccessControl()
+#cmakedefine01 XC_APPLE_COMPILER_SUPPORT_kSecUseOperationPrompt()
+#cmakedefine01 XC_APPLE_COMPILER_SUPPORT_SecAccessControlRef()
+#cmakedefine01 XC_APPLE_COMPILER_SUPPORT_ScreenCaptureKit()
#define XC_COMPILER_SUPPORT(X) XC_COMPILER_SUPPORT_PRIVATE_DEFINITION_##X()
#define XC_COMPILER_SUPPORT_PRIVATE_DEFINITION_APPLE_BIOMETRY() XC_APPLE_COMPILER_SUPPORT_BIOMETRY()
@@ -140,6 +150,7 @@ See: https://github.com/keepassxreboot/keepassxc/pull/8650#issuecomment-12917500
+#define XC_COMPILER_SUPPORT_PRIVATE_DEFINITION_kSecAttrAccessControl() XC_APPLE_COMPILER_SUPPORT_kSecAttrAccessControl()
+#define XC_COMPILER_SUPPORT_PRIVATE_DEFINITION_kSecUseOperationPrompt() XC_APPLE_COMPILER_SUPPORT_kSecUseOperationPrompt()
+#define XC_COMPILER_SUPPORT_PRIVATE_DEFINITION_SecAccessControlRef() XC_APPLE_COMPILER_SUPPORT_SecAccessControlRef()
+#define XC_COMPILER_SUPPORT_PRIVATE_DEFINITION_ScreenCaptureKit() XC_APPLE_COMPILER_SUPPORT_ScreenCaptureKit()
#endif // KEEPASSX_CONFIG_KEEPASSX_H
--- src/touchid/TouchID.mm
@@ -229,17 +240,34 @@ See: https://github.com/keepassxreboot/keepassxc/pull/8650#issuecomment-12917500
LogStatusError("TouchID::getKey - key query error", status);
return false;
}
--- src/CMakeLists.txt
+++ src/CMakeLists.txt
@@ -354,7 +354,10 @@ if(WITH_XC_KEESHARE)
--- src/CMakeLists.txt.orig 2025-09-17 17:04:25.000000000 -0700
+++ src/CMakeLists.txt 2025-09-17 17:06:55.000000000 -0700
@@ -372,7 +372,13 @@
endif()
if(APPLE)
- target_link_libraries(keepassx_core "-framework Foundation -framework AppKit -framework Carbon -framework Security -framework LocalAuthentication")
- target_link_libraries(keepassx_core "-framework Foundation -framework AppKit -framework Carbon -framework Security -framework LocalAuthentication -framework ScreenCaptureKit")
+ target_link_libraries(keepassx_core "-framework Foundation -framework AppKit -framework Carbon -framework Security")
+ if(XC_APPLE_COMPILER_SUPPORT_LocalAuthentication)
+ target_link_libraries(keepassx_core "-framework LocalAuthentication")
+ endif()
+ if(XC_APPLE_COMPILER_SUPPORT_ScreenCaptureKit)
+ target_link_libraries(keepassx_core "-framework ScreenCaptureKit")
+ endif()
if(Qt5MacExtras_FOUND)
target_link_libraries(keepassx_core Qt5::MacExtras)
endif()
--- src/autotype/mac/CMakeLists.txt.orig 2025-09-17 18:29:38.000000000 -0700
+++ src/autotype/mac/CMakeLists.txt 2025-09-17 18:40:25.000000000 -0700
@@ -1,7 +1,10 @@
set(autotype_mac_SOURCES AutoTypeMac.cpp)
add_library(keepassxc-autotype-cocoa MODULE ${autotype_mac_SOURCES})
-set_target_properties(keepassxc-autotype-cocoa PROPERTIES LINK_FLAGS "-framework Foundation -framework AppKit -framework Carbon -framework ScreenCaptureKit")
+set_target_properties(keepassxc-autotype-cocoa PROPERTIES LINK_FLAGS "-framework Foundation -framework AppKit -framework Carbon")
+ if(XC_APPLE_COMPILER_SUPPORT_ScreenCaptureKit)
+ set_target_properties(keepassxc-autotype-cocoa PROPERTIES LINK_FLAGS "-framework ScreenCaptureKit")
+ endif()
target_link_libraries(keepassxc-autotype-cocoa ${PROGNAME} Qt5::Core Qt5::Widgets)
install(TARGETS keepassxc-autotype-cocoa
@@ -0,0 +1,273 @@
From: tenzap <fabstz-it@yahoo.fr>
Date: Wed, 13 Nov 2022 09:38:48 +0100
Subject: [PATCH] Fix build failure on macos versions < 10.11
This patch will permit to fix build issues on macos versions < 10.11
Strategy is to check at configure time which functions are available.
Those that are not available, are hidden by preprocessor checks
Upstream doesn't want to merge patches to build on versions prior to macos
10.13, so this patch is not forwarded upstream.
See: https://github.com/keepassxreboot/keepassxc/pull/8650#issuecomment-1291750066
--- CMakeLists.txt.orig 2025-09-17 16:07:50.000000000 -0700
+++ CMakeLists.txt 2025-09-17 16:14:00.000000000 -0700
@@ -82,6 +82,46 @@
${CMAKE_CURRENT_BINARY_DIR}/tiometry_test/
${CMAKE_CURRENT_SOURCE_DIR}/cmake/compiler-checks/macos/control_watch_support.mm)
message(STATUS "Apple watch compiler support: ${XC_APPLE_COMPILER_SUPPORT_WATCH}")
+
+ try_compile(XC_APPLE_COMPILER_SUPPORT_errSecUserCanceled
+ ${CMAKE_CURRENT_BINARY_DIR}/errSecUserCanceled_test/
+ ${CMAKE_CURRENT_SOURCE_DIR}/cmake/compiler-checks/macos/control_errSecUserCanceled_support.mm)
+ message(STATUS "errSecUserCanceled compiler support: ${XC_APPLE_COMPILER_SUPPORT_errSecUserCanceled}")
+
+ try_compile(XC_APPLE_COMPILER_SUPPORT_LocalAuthentication
+ ${CMAKE_CURRENT_BINARY_DIR}/LocalAuthentication_test/
+ ${CMAKE_CURRENT_SOURCE_DIR}/cmake/compiler-checks/macos/control_LocalAuthentication_support.mm)
+ message(STATUS "LocalAuthentication compiler support: ${XC_APPLE_COMPILER_SUPPORT_LocalAuthentication}")
+
+ try_compile(XC_APPLE_COMPILER_SUPPORT_kSecAttrSynchronizable
+ ${CMAKE_CURRENT_BINARY_DIR}/kSecAttrSynchronizable_test/
+ ${CMAKE_CURRENT_SOURCE_DIR}/cmake/compiler-checks/macos/control_kSecAttrSynchronizable_support.mm)
+ message(STATUS "kSecAttrSynchronizable compiler support: ${XC_APPLE_COMPILER_SUPPORT_kSecAttrSynchronizable}")
+
+ try_compile(XC_APPLE_COMPILER_SUPPORT_kSecUseAuthenticationUI
+ ${CMAKE_CURRENT_BINARY_DIR}/kSecUseAuthenticationUI_test/
+ ${CMAKE_CURRENT_SOURCE_DIR}/cmake/compiler-checks/macos/control_kSecUseAuthenticationUI_support.mm)
+ message(STATUS "kSecUseAuthenticationUI compiler support: ${XC_APPLE_COMPILER_SUPPORT_kSecUseAuthenticationUI}")
+
+ try_compile(XC_APPLE_COMPILER_SUPPORT_kSecAttrAccessControl
+ ${CMAKE_CURRENT_BINARY_DIR}/kSecAttrAccessControl_test/
+ ${CMAKE_CURRENT_SOURCE_DIR}/cmake/compiler-checks/macos/control_kSecAttrAccessControl_support.mm)
+ message(STATUS "kSecAttrAccessControl compiler support: ${XC_APPLE_COMPILER_SUPPORT_kSecAttrAccessControl}")
+
+ try_compile(XC_APPLE_COMPILER_SUPPORT_kSecUseOperationPrompt
+ ${CMAKE_CURRENT_BINARY_DIR}/kSecUseOperationPrompt_test/
+ ${CMAKE_CURRENT_SOURCE_DIR}/cmake/compiler-checks/macos/control_kSecUseOperationPrompt_support.mm)
+ message(STATUS "kSecUseOperationPrompt compiler support: ${XC_APPLE_COMPILER_SUPPORT_kSecUseOperationPrompt}")
+
+ try_compile(XC_APPLE_COMPILER_SUPPORT_SecAccessControlRef
+ ${CMAKE_CURRENT_BINARY_DIR}/SecAccessControlRef_test/
+ ${CMAKE_CURRENT_SOURCE_DIR}/cmake/compiler-checks/macos/control_SecAccessControlRef_support.mm)
+ message(STATUS "SecAccessControlRef compiler support: ${XC_APPLE_COMPILER_SUPPORT_SecAccessControlRef}")
+
+ try_compile(XC_APPLE_COMPILER_SUPPORT_ScreenCaptureKit
+ ${CMAKE_CURRENT_BINARY_DIR}/ScreenCaptureKit_test/
+ ${CMAKE_CURRENT_SOURCE_DIR}/cmake/compiler-checks/macos/control_ScreenCaptureKit_support.mm)
+ message(STATUS "ScreenCaptureKit compiler support: ${XC_APPLE_COMPILER_SUPPORT_ScreenCaptureKit}")
endif()
if(WITH_CCACHE)
--- /dev/null
+++ cmake/compiler-checks/macos/control_LocalAuthentication_support.mm
@@ -0,0 +1,2 @@
+#include <LocalAuthentication/LocalAuthentication.h>
+int main() { return 0; }
--- /dev/null
+++ cmake/compiler-checks/macos/control_SecAccessControlRef_support.mm
@@ -0,0 +1,6 @@
+#include <Security/Security.h>
+
+int main() {
+ SecAccessControlRef;
+ return 0;
+}
--- /dev/null
+++ cmake/compiler-checks/macos/control_errSecUserCanceled_support.mm
@@ -0,0 +1,6 @@
+#include <Security/Security.h>
+
+int main() {
+ errSecUserCanceled;
+ return 0;
+}
--- /dev/null
+++ cmake/compiler-checks/macos/control_kSecAttrAccessControl_support.mm
@@ -0,0 +1,6 @@
+#include <Security/Security.h>
+
+int main() {
+ kSecAttrAccessControl;
+ return 0;
+}
--- /dev/null
+++ cmake/compiler-checks/macos/control_kSecAttrSynchronizable_support.mm
@@ -0,0 +1,6 @@
+#include <Security/Security.h>
+
+int main() {
+ kSecAttrSynchronizable;
+ return 0;
+}
--- /dev/null
+++ cmake/compiler-checks/macos/control_kSecUseAuthenticationUI_support.mm
@@ -0,0 +1,6 @@
+#include <Security/Security.h>
+
+int main() {
+ kSecUseAuthenticationUI;
+ return 0;
+}
--- /dev/null
+++ cmake/compiler-checks/macos/control_kSecUseOperationPrompt_support.mm
@@ -0,0 +1,6 @@
+#include <Security/Security.h>
+
+int main() {
+ kSecUseOperationPrompt;
+ return 0;
+}
--- /dev/null
+++ cmake/compiler-checks/macos/control_ScreenCaptureKit_support.mm
@@ -0,0 +1,2 @@
+#include <ScreenCaptureKit/ScreenCaptureKit.h>
+int main() { return 0; }
--- src/config-keepassx.h.cmake.orig 2025-09-17 16:23:31.000000000 -0700
+++ src/config-keepassx.h.cmake 2025-09-17 16:26:08.000000000 -0700
@@ -43,10 +43,26 @@
#cmakedefine01 XC_APPLE_COMPILER_SUPPORT_BIOMETRY()
#cmakedefine01 XC_APPLE_COMPILER_SUPPORT_TOUCH_ID()
#cmakedefine01 XC_APPLE_COMPILER_SUPPORT_WATCH()
+#cmakedefine01 XC_APPLE_COMPILER_SUPPORT_errSecUserCanceled()
+#cmakedefine01 XC_APPLE_COMPILER_SUPPORT_LocalAuthentication()
+#cmakedefine01 XC_APPLE_COMPILER_SUPPORT_kSecAttrSynchronizable()
+#cmakedefine01 XC_APPLE_COMPILER_SUPPORT_kSecUseAuthenticationUI()
+#cmakedefine01 XC_APPLE_COMPILER_SUPPORT_kSecAttrAccessControl()
+#cmakedefine01 XC_APPLE_COMPILER_SUPPORT_kSecUseOperationPrompt()
+#cmakedefine01 XC_APPLE_COMPILER_SUPPORT_SecAccessControlRef()
+#cmakedefine01 XC_APPLE_COMPILER_SUPPORT_ScreenCaptureKit()
#define XC_COMPILER_SUPPORT(X) XC_COMPILER_SUPPORT_PRIVATE_DEFINITION_##X()
#define XC_COMPILER_SUPPORT_PRIVATE_DEFINITION_APPLE_BIOMETRY() XC_APPLE_COMPILER_SUPPORT_BIOMETRY()
#define XC_COMPILER_SUPPORT_PRIVATE_DEFINITION_TOUCH_ID() XC_APPLE_COMPILER_SUPPORT_TOUCH_ID()
#define XC_COMPILER_SUPPORT_PRIVATE_DEFINITION_WATCH_UNLOCK() XC_APPLE_COMPILER_SUPPORT_WATCH()
+#define XC_COMPILER_SUPPORT_PRIVATE_DEFINITION_errSecUserCanceled() XC_APPLE_COMPILER_SUPPORT_errSecUserCanceled()
+#define XC_COMPILER_SUPPORT_PRIVATE_DEFINITION_LocalAuthentication() XC_APPLE_COMPILER_SUPPORT_LocalAuthentication()
+#define XC_COMPILER_SUPPORT_PRIVATE_DEFINITION_kSecAttrSynchronizable() XC_APPLE_COMPILER_SUPPORT_kSecAttrSynchronizable()
+#define XC_COMPILER_SUPPORT_PRIVATE_DEFINITION_kSecUseAuthenticationUI() XC_APPLE_COMPILER_SUPPORT_kSecUseAuthenticationUI()
+#define XC_COMPILER_SUPPORT_PRIVATE_DEFINITION_kSecAttrAccessControl() XC_APPLE_COMPILER_SUPPORT_kSecAttrAccessControl()
+#define XC_COMPILER_SUPPORT_PRIVATE_DEFINITION_kSecUseOperationPrompt() XC_APPLE_COMPILER_SUPPORT_kSecUseOperationPrompt()
+#define XC_COMPILER_SUPPORT_PRIVATE_DEFINITION_SecAccessControlRef() XC_APPLE_COMPILER_SUPPORT_SecAccessControlRef()
+#define XC_COMPILER_SUPPORT_PRIVATE_DEFINITION_ScreenCaptureKit() XC_APPLE_COMPILER_SUPPORT_ScreenCaptureKit()
#endif // KEEPASSX_CONFIG_KEEPASSX_H
--- src/quickunlock/TouchID.mm.orig 2025-09-18 12:16:09.000000000 -0700
+++ src/quickunlock/TouchID.mm 2025-09-18 12:22:53.000000000 -0700
@@ -9,7 +9,9 @@
#include <Foundation/Foundation.h>
#include <CoreFoundation/CoreFoundation.h>
+#if XC_COMPILER_SUPPORT(LocalAuthentication)
#include <LocalAuthentication/LocalAuthentication.h>
+#endif
#include <Security/Security.h>
#include <QCoreApplication>
@@ -130,7 +132,9 @@
// We need both runtime and compile time checks here to solve the following problems:
// - Not all flags are available in all OS versions, so we have to check it at compile time
// - Requesting Biometry/TouchID/DevicePassword when to fingerprint sensor is available will result in runtime error
+#if XC_COMPILER_SUPPORT(SecAccessControlRef)
SecAccessControlCreateFlags accessControlFlags = 0;
+#endif
#if XC_COMPILER_SUPPORT(APPLE_BIOMETRY)
// Needs a special check to work with SecItemAdd, when TouchID is not enrolled and the flag
// is set, the method call fails with an error. But we want to still set this flag if TouchID is
@@ -164,6 +168,7 @@
}
#endif
+#if XC_COMPILER_SUPPORT(SecAccessControlRef)
SecAccessControlRef sacObject = SecAccessControlCreateWithFlags(
kCFAllocatorDefault, kSecAttrAccessibleWhenUnlockedThisDeviceOnly, accessControlFlags, &error);
@@ -172,6 +177,7 @@
debug("TouchID::setKey - Error creating security flags: %s", e.localizedDescription.UTF8String);
return false;
}
+#endif
NSString *accountName = keyName.toNSString(); // The NSString is released by Qt
@@ -185,15 +191,23 @@
CFDictionarySetValue(attributes, kSecClass, kSecClassGenericPassword);
CFDictionarySetValue(attributes, kSecAttrAccount, (__bridge CFStringRef) accountName);
CFDictionarySetValue(attributes, kSecValueData, (__bridge CFDataRef) keychainValueData);
+#if XC_COMPILER_SUPPORT(kSecAttrSynchronizable)
CFDictionarySetValue(attributes, kSecAttrSynchronizable, kCFBooleanFalse);
+#endif
+#if XC_COMPILER_SUPPORT(kSecUseAuthenticationUI)
CFDictionarySetValue(attributes, kSecUseAuthenticationUI, kSecUseAuthenticationUIAllow);
+#endif
+#if XC_COMPILER_SUPPORT(kSecAttrAccessControl) && XC_COMPILER_SUPPORT(SecAccessControlRef)
CFDictionarySetValue(attributes, kSecAttrAccessControl, sacObject);
+#endif
// add to KeyChain
OSStatus status = SecItemAdd(attributes, NULL);
LogStatusError("TouchID::setKey - Status adding new entry", status);
+#if XC_COMPILER_SUPPORT(SecAccessControlRef)
CFRelease(sacObject);
+#endif
CFRelease(attributes);
// Cleanse the key information from the memory
@@ -250,18 +264,23 @@
CFDictionarySetValue(query, kSecClass, kSecClassGenericPassword);
CFDictionarySetValue(query, kSecAttrAccount, (__bridge CFStringRef) accountName);
CFDictionarySetValue(query, kSecReturnData, kCFBooleanTrue);
+#if XC_COMPILER_SUPPORT(kSecUseOperationPrompt)
CFDictionarySetValue(query, kSecUseOperationPrompt, (__bridge CFStringRef) touchPromptMessage);
+#endif
// get data from the KeyChain
CFTypeRef dataTypeRef = NULL;
OSStatus status = SecItemCopyMatching(query, &dataTypeRef);
CFRelease(query);
+#if XC_COMPILER_SUPPORT(errSecUserCanceled)
if (status == errSecUserCanceled) {
// user canceled the authentication, return true with empty key
debug("TouchID::getKey - User canceled authentication");
return true;
- } else if (status != errSecSuccess || dataTypeRef == NULL) {
+ } else
+#endif
+ if (status != errSecSuccess || dataTypeRef == NULL) {
LogStatusError("TouchID::getKey - key query error", status);
return false;
}
--- src/CMakeLists.txt.orig 2025-09-18 12:25:57.000000000 -0700
+++ src/CMakeLists.txt 2025-09-18 12:29:54.000000000 -0700
@@ -397,7 +397,13 @@
${sshagent_LIB})
if(APPLE)
- target_link_libraries(keepassxc_gui "-framework Foundation -framework AppKit -framework Carbon -framework Security -framework LocalAuthentication -framework ScreenCaptureKit")
+ target_link_libraries(keepassxc_gui "-framework Foundation -framework AppKit -framework Carbon -framework Security")
+ if(XC_APPLE_COMPILER_SUPPORT_LocalAuthentication)
+ target_link_libraries(keepassxc_gui "-framework LocalAuthentication")
+ endif()
+ if(XC_APPLE_COMPILER_SUPPORT_ScreenCaptureKit)
+ target_link_libraries(keepassxc_gui "-framework ScreenCaptureKit")
+ endif()
if(Qt5MacExtras_FOUND)
target_link_libraries(keepassxc_gui Qt5::MacExtras)
endif()
--- src/autotype/mac/CMakeLists.txt.orig 2025-09-17 18:29:38.000000000 -0700
+++ src/autotype/mac/CMakeLists.txt 2025-09-17 18:40:25.000000000 -0700
@@ -1,7 +1,10 @@
set(autotype_mac_SOURCES AutoTypeMac.cpp)
add_library(keepassxc-autotype-cocoa MODULE ${autotype_mac_SOURCES})
-set_target_properties(keepassxc-autotype-cocoa PROPERTIES LINK_FLAGS "-framework Foundation -framework AppKit -framework Carbon -framework ScreenCaptureKit")
+set_target_properties(keepassxc-autotype-cocoa PROPERTIES LINK_FLAGS "-framework Foundation -framework AppKit -framework Carbon")
+ if(XC_APPLE_COMPILER_SUPPORT_ScreenCaptureKit)
+ set_target_properties(keepassxc-autotype-cocoa PROPERTIES LINK_FLAGS "-framework ScreenCaptureKit")
+ endif()
target_link_libraries(keepassxc-autotype-cocoa ${PROGNAME} Qt5::Core Qt5::Widgets)
install(TARGETS keepassxc-autotype-cocoa