aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsaturneric <[email protected]>2025-04-30 16:22:09 +0000
committersaturneric <[email protected]>2025-04-30 16:22:09 +0000
commit442c0e8b4fe3ac54aa31323e8e885062b6544638 (patch)
tree23b1b7424d77bd4b37aa20228177c2f7abf55b30
parentfix: correct tooltips and text of buttons of key lists (diff)
parentMerge pull request #212 from Anthony-Lloyd/main (diff)
downloadGpgFrontend-442c0e8b4fe3ac54aa31323e8e885062b6544638.tar.gz
GpgFrontend-442c0e8b4fe3ac54aa31323e8e885062b6544638.zip
Merge remote-tracking branch 'github/main' into develop
-rw-r--r--CMakeLists.txt113
-rw-r--r--cmake/rpm/post-install.sh26
-rw-r--r--cmake/rpm/post-uninstall.sh21
-rw-r--r--src/core/CMakeLists.txt2
-rw-r--r--src/core/function/gpg/GpgSmartCardManager.cpp9
-rw-r--r--src/ui/GpgFrontendApplication.cpp5
6 files changed, 169 insertions, 7 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 6ce5cdcb..65212fe3 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -163,6 +163,14 @@ if(GPGFRONTEND_BUILD_TYPE_ONLY_APPLICATION)
set(STABLE_BUILD_ONLY_APPLICATION 1)
endif()
+# Fallback for BUILD_APPLICATION if not set by any build type
+if(NOT DEFINED BUILD_APPLICATION)
+ if(GPGFRONTEND_GENERATE_LINUX_INSTALL_SOFTWARE OR GPGFRONTEND_BUILD_TYPE_STABLE OR GPGFRONTEND_BUILD_TYPE_ONLY_APPLICATION)
+ set(BUILD_APPLICATION 1)
+ message(STATUS "Setting BUILD_APPLICATION=1 as fallback based on build configuration")
+ endif()
+endif()
+
if(GPGFRONTEND_BUILD_APP_IMAGE)
set(BUILD_APP_IMAGE 1)
endif()
@@ -413,6 +421,18 @@ set(CMAKE_AUTOUIC ON)
set(CMAKE_AUTORCC_OPTIONS "--compress;9")
set(CMAKE_AUTOUIC_SEARCH_PATHS ${CMAKE_AUTOUIC_SEARCH_PATHS} ${CMAKE_SOURCE_DIR}/ui)
+# Find and configure libassuan using pkg-config
+find_package(PkgConfig REQUIRED)
+pkg_check_modules(LIBASSUAN libassuan)
+
+if(NOT LIBASSUAN_FOUND)
+ message(FATAL_ERROR "libassuan not found. Please install libassuan-dev or libassuan-devel package for your system.")
+endif()
+
+# Add libassuan include and library paths globally since it's a core dependency
+include_directories(${LIBASSUAN_INCLUDE_DIRS})
+link_directories(${LIBASSUAN_LIBRARY_DIRS})
+
if(STABLE_BUILD_APPLICATION)
message("[*] Build Stable Application")
set(BUILD_CORE 1)
@@ -456,6 +476,99 @@ message(STATUS "Build Type: ${CMAKE_BUILD_TYPE}")
message(STATUS "Build C Flags: ${CMAKE_C_FLAGS}")
message(STATUS "Build C++ Flags: ${CMAKE_CXX_FLAGS}")
+# CPack configuration
+set(CPACK_GENERATOR "RPM")
+set(CPACK_PACKAGE_NAME "GpgFrontend")
+set(CPACK_PACKAGE_VERSION "${PROJECT_VERSION}")
+set(CPACK_PACKAGE_RELEASE "1")
+set(CPACK_PACKAGING_INSTALL_PREFIX "/usr")
+set(CPACK_PACKAGE_CONTACT "[email protected]")
+set(CPACK_RPM_PACKAGE_LICENSE "GPLv3")
+set(CPACK_RPM_PACKAGE_GROUP "Applications/System")
+set(CPACK_RPM_PACKAGE_REQUIRES "libassuan >= 2.5.0, gpgme >= 1.12.0, qt6-qtbase >= 6.0.0, gtk-update-icon-cache")
+set(CPACK_RPM_PACKAGE_URL "https://gpgfrontend.bktus.com")
+set(CPACK_RPM_PACKAGE_DESCRIPTION "GpgFrontend is a free, open-source, robust yet user-friendly, compact and cross-platform tool for OpenPGP encryption.")
+
+# Configure RPM scripts
+configure_file(
+ "${CMAKE_SOURCE_DIR}/cmake/rpm/post-install.sh"
+ "${CMAKE_BINARY_DIR}/rpm-post-install.sh"
+ @ONLY
+)
+configure_file(
+ "${CMAKE_SOURCE_DIR}/cmake/rpm/post-uninstall.sh"
+ "${CMAKE_BINARY_DIR}/rpm-post-uninstall.sh"
+ @ONLY
+)
+
+# Set RPM scripts
+set(CPACK_RPM_POST_INSTALL_SCRIPT_FILE "${CMAKE_BINARY_DIR}/rpm-post-install.sh")
+set(CPACK_RPM_POST_UNINSTALL_SCRIPT_FILE "${CMAKE_BINARY_DIR}/rpm-post-uninstall.sh")
+
+# Make the scripts executable
+file(CHMOD ${CMAKE_BINARY_DIR}/rpm-post-install.sh
+ PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)
+file(CHMOD ${CMAKE_BINARY_DIR}/rpm-post-uninstall.sh
+ PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)
+
+# Documentation handling
+set(CPACK_RPM_PACKAGE_LICENSE_FILE "${CMAKE_SOURCE_DIR}/COPYING")
+set(CPACK_RPM_PACKAGE_DOCUMENTATION "${CMAKE_SOURCE_DIR}/README.md")
+
+# Install license and documentation
+install(FILES "${CMAKE_SOURCE_DIR}/COPYING"
+ DESTINATION "share/licenses/${CPACK_PACKAGE_NAME}"
+ COMPONENT runtime)
+install(FILES "${CMAKE_SOURCE_DIR}/README.md"
+ DESTINATION "share/doc/${CPACK_PACKAGE_NAME}"
+ COMPONENT runtime)
+
+# Install icons for all resolutions
+foreach(size IN ITEMS 32 48 64 128 256 512)
+ install(FILES "${CMAKE_SOURCE_DIR}/resource/lfs/hicolor/${size}x${size}/apps/com.bktus.gpgfrontend.png"
+ DESTINATION "share/icons/hicolor/${size}x${size}/apps"
+ RENAME "gpgfrontend.png"
+ COMPONENT runtime)
+ # Also install with the full name for .desktop file compatibility
+ install(FILES "${CMAKE_SOURCE_DIR}/resource/lfs/hicolor/${size}x${size}/apps/com.bktus.gpgfrontend.png"
+ DESTINATION "share/icons/hicolor/${size}x${size}/apps"
+ COMPONENT runtime)
+endforeach()
+
+# Install desktop file
+install(FILES "${CMAKE_SOURCE_DIR}/resource/appstream/com.bktus.gpgfrontend.desktop"
+ DESTINATION "share/applications"
+ COMPONENT runtime)
+
+# Install metainfo/appdata
+install(FILES "${CMAKE_SOURCE_DIR}/resource/appstream/com.bktus.gpgfrontend.metainfo.xml"
+ DESTINATION "share/metainfo"
+ COMPONENT runtime)
+
+# Exclude files from auto-detection of dependencies
+set(CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST_ADDITION
+ "/usr/share/doc"
+ "/usr/share/licenses"
+ "/usr/share/applications"
+ "/usr/share/metainfo"
+ "/usr/share/icons"
+ "/usr/share/icons/hicolor"
+ "/usr/share/icons/hicolor/128x128"
+ "/usr/share/icons/hicolor/256x256"
+ "/usr/share/icons/hicolor/32x32"
+ "/usr/share/icons/hicolor/48x48"
+ "/usr/share/icons/hicolor/512x512"
+ "/usr/share/icons/hicolor/64x64"
+ "/usr/share/icons/hicolor/128x128/apps"
+ "/usr/share/icons/hicolor/256x256/apps"
+ "/usr/share/icons/hicolor/32x32/apps"
+ "/usr/share/icons/hicolor/48x48/apps"
+ "/usr/share/icons/hicolor/512x512/apps"
+ "/usr/share/icons/hicolor/64x64/apps")
+
+# Include CPack to enable packaging support
+include(CPack)
+
# third_party
add_subdirectory(third_party) # source code
add_subdirectory(src)
diff --git a/cmake/rpm/post-install.sh b/cmake/rpm/post-install.sh
new file mode 100644
index 00000000..7e532d2b
--- /dev/null
+++ b/cmake/rpm/post-install.sh
@@ -0,0 +1,26 @@
+#!/bin/sh
+
+# Update icon cache
+if [ -x /usr/bin/gtk-update-icon-cache ]; then
+ /usr/bin/gtk-update-icon-cache -f -t /usr/share/icons/hicolor || :
+fi
+
+# Update desktop database
+if [ -x /usr/bin/update-desktop-database ]; then
+ /usr/bin/update-desktop-database -q /usr/share/applications || :
+fi
+
+# Update mime database
+if [ -x /usr/bin/update-mime-database ]; then
+ /usr/bin/update-mime-database /usr/share/mime || :
+fi
+
+# Try XDG icon cache update if available
+if [ -x /usr/bin/xdg-icon-resource ]; then
+ /usr/bin/xdg-icon-resource forceupdate --theme hicolor || :
+fi
+
+# Clear icon cache for current user if logged in
+if [ ! -z "$SUDO_USER" ]; then
+ su "$SUDO_USER" -c 'gtk-update-icon-cache -f -t ~/.local/share/icons/hicolor 2>/dev/null || :'
+fi \ No newline at end of file
diff --git a/cmake/rpm/post-uninstall.sh b/cmake/rpm/post-uninstall.sh
new file mode 100644
index 00000000..87da628d
--- /dev/null
+++ b/cmake/rpm/post-uninstall.sh
@@ -0,0 +1,21 @@
+#!/bin/sh
+
+# Update icon cache after removal
+if [ -x /usr/bin/gtk-update-icon-cache ]; then
+ /usr/bin/gtk-update-icon-cache -f -t /usr/share/icons/hicolor || :
+fi
+
+# Update desktop database after removal
+if [ -x /usr/bin/update-desktop-database ]; then
+ /usr/bin/update-desktop-database -q /usr/share/applications || :
+fi
+
+# Update mime database after removal
+if [ -x /usr/bin/update-mime-database ]; then
+ /usr/bin/update-mime-database /usr/share/mime || :
+fi
+
+# Try XDG icon cache update if available
+if [ -x /usr/bin/xdg-icon-resource ]; then
+ /usr/bin/xdg-icon-resource forceupdate --theme hicolor || :
+fi \ No newline at end of file
diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt
index c60bdac3..d5dd4a6e 100644
--- a/src/core/CMakeLists.txt
+++ b/src/core/CMakeLists.txt
@@ -55,7 +55,7 @@ target_sources(gpgfrontend_core PRIVATE
${CMAKE_SOURCE_DIR}/third_party/qt-aes/qaesencryption.cpp)
# link gnupg libraries
-target_link_libraries(gpgfrontend_core PUBLIC gpgme assuan gpg-error)
+target_link_libraries(gpgfrontend_core PUBLIC gpgme ${LIBASSUAN_LIBRARIES} gpg-error)
# link openssl
target_link_libraries(gpgfrontend_core PUBLIC OpenSSL::SSL OpenSSL::Crypto)
diff --git a/src/core/function/gpg/GpgSmartCardManager.cpp b/src/core/function/gpg/GpgSmartCardManager.cpp
index 83f3a45d..976b7fd1 100644
--- a/src/core/function/gpg/GpgSmartCardManager.cpp
+++ b/src/core/function/gpg/GpgSmartCardManager.cpp
@@ -252,10 +252,11 @@ auto GpgSmartCardManager::ModifyPin(const QString& pin_ref)
return {err, status.join(' ')};
}
-auto GpgSmartCardManager::GenerateKey(
- const QString& serial_number, const QString& name, const QString& email,
- const QString& comment, const QDateTime& expire,
- bool non_expire) -> std::tuple<GpgError, QString> {
+auto GpgSmartCardManager::GenerateKey(const QString& serial_number,
+ const QString& name, const QString& email,
+ const QString& comment,
+ const QDateTime& expire, bool non_expire)
+ -> std::tuple<GpgError, QString> {
if (name.isEmpty() || email.isEmpty()) {
return {GPG_ERR_INV_ARG, "name or email is empty"};
}
diff --git a/src/ui/GpgFrontendApplication.cpp b/src/ui/GpgFrontendApplication.cpp
index 5f896fd5..eed6a054 100644
--- a/src/ui/GpgFrontendApplication.cpp
+++ b/src/ui/GpgFrontendApplication.cpp
@@ -35,8 +35,9 @@ namespace GpgFrontend::UI {
GpgFrontendApplication::GpgFrontendApplication(int &argc, char *argv[])
: QApplication(argc, argv) {
#if !(defined(__APPLE__) && defined(__MACH__))
- GpgFrontend::UI::GpgFrontendApplication::setWindowIcon(
- QIcon(":/icons/gpgfrontend.png"));
+ // Try system theme icon first, fall back to resource
+ QIcon appIcon = QIcon::fromTheme("gpgfrontend", QIcon(":/icons/gpgfrontend.png"));
+ GpgFrontend::UI::GpgFrontendApplication::setWindowIcon(appIcon);
#endif
QString application_display_name = GetProjectName();