diff options
author | Saturneric <[email protected]> | 2021-12-14 03:56:12 +0000 |
---|---|---|
committer | Saturneric <[email protected]> | 2021-12-14 04:55:56 +0000 |
commit | c77a3c560ebcb06a5ca4214cbfdd688e5f9e32cb (patch) | |
tree | fc0ddd6f2f50bd87a00919de30584925d5be0417 /src | |
parent | Update Translations & README. (diff) | |
download | GpgFrontend-c77a3c560ebcb06a5ca4214cbfdd688e5f9e32cb.tar.gz GpgFrontend-c77a3c560ebcb06a5ca4214cbfdd688e5f9e32cb.zip |
Add Deb Build Support & Install Support For Linux.
Diffstat (limited to 'src')
-rw-r--r-- | src/CMakeLists.txt | 53 | ||||
-rw-r--r-- | src/GpgFrontendBuildInfo.h.in | 4 | ||||
-rw-r--r-- | src/GpgFrontendBuildInstallInfo.h.in | 37 | ||||
-rw-r--r-- | src/ui/settings/GlobalSettingStation.h | 12 |
4 files changed, 102 insertions, 4 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 0c75be69..9a0f7eb8 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -42,7 +42,7 @@ if (APPLICATION_BUILD) if (${CMAKE_BUILD_TYPE} STREQUAL "Release") if (APPLE) set(RESOURCE_OUTPUT_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/Resources) - elseif (LINUX) + elseif (LINUX AND NOT LINUX_INSTALL_SOFTWARE) file(COPY ${CMAKE_SOURCE_DIR}/resource/gpgfrontend DESTINATION ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/ FOLLOW_SYMLINK_CHAIN) set(RESOURCE_OUTPUT_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/gpgfrontend/usr/share) else () @@ -64,6 +64,10 @@ if (MULTI_LANG_SUPPORT) find_package(Gettext REQUIRED) FIND_PROGRAM(GETTEXT_MSGFMT_EXECUTABLE msgfmt) FIND_PROGRAM(GETTEXT_XGETTEXT_EXECUTABLE xgettext) + + set(LOCALE_OUTPUT_PATH ${RESOURCE_OUTPUT_DIRECTORY}/locales) + message(STATUS "LOCALE_OUTPUT_PATH ${LOCALE_OUTPUT_PATH}") + if (NOT GETTEXT_MSGFMT_EXECUTABLE OR NOT GETTEXT_XGETTEXT_EXECUTABLE) message(ERROR "msgfmt or xgettext not found. Translations will *not* be installed") else (NOT GETTEXT_MSGFMT_EXECUTABLE) @@ -91,7 +95,7 @@ if (MULTI_LANG_SUPPORT) ) add_custom_command( TARGET translations - COMMAND msgfmt --check --verbose --output-file ${RESOURCE_OUTPUT_DIRECTORY}/locales/${_langName}/LC_MESSAGES/GpgFrontend.mo ${_poFile} + COMMAND msgfmt --check --verbose --output-file ${LOCALE_OUTPUT_PATH}/${_langName}/LC_MESSAGES/GpgFrontend.mo ${_poFile} ) endforeach () @@ -102,6 +106,7 @@ if (BASIC_ENV_CONFIG) # Set Build Information configure_file(${CMAKE_SOURCE_DIR}/src/GpgFrontend.h.in ${CMAKE_SOURCE_DIR}/src/GpgFrontend.h @ONLY) configure_file(${CMAKE_SOURCE_DIR}/src/GpgFrontendBuildInfo.h.in ${CMAKE_SOURCE_DIR}/src/GpgFrontendBuildInfo.h @ONLY) + configure_file(${CMAKE_SOURCE_DIR}/src/GpgFrontendBuildInstallInfo.h.in ${CMAKE_SOURCE_DIR}/src/GpgFrontendBuildInstallInfo.h @ONLY) endif () if (APPLICATION_BUILD) @@ -117,7 +122,7 @@ if (APPLICATION_BUILD) file(COPY ${CMAKE_SOURCE_DIR}/gpgfrontend.icns DESTINATION ${RESOURCE_OUTPUT_DIRECTORY}/ FOLLOW_SYMLINK_CHAIN) # Refresh App Bundle file(REMOVE ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${AppName}.app) - elseif (LINUX) + elseif (LINUX AND NOT LINUX_INSTALL_SOFTWARE) file(REMOVE ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/gpgfrontend/usr/bin/${AppName}) endif () endif () @@ -168,7 +173,7 @@ if (APPLICATION_BUILD) COMMAND /bin/mv -n ./Resources ./${AppName}.app/Contents/ WORKING_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} COMMENT "Copying Resources into App Bundle Resource") - elseif (LINUX) + elseif (LINUX AND NOT LINUX_INSTALL_SOFTWARE) add_executable(${AppName} ${BASE_SOURCE} ${RESOURCE_FILES} ${QT5_MOCS}) add_custom_command(TARGET ${AppName} POST_BUILD COMMAND /bin/mkdir -p ./gpgfrontend/usr/bin && /bin/mv -f ./${AppName} ./gpgfrontend/usr/bin/ @@ -238,3 +243,43 @@ if (APPLICATION_BUILD) endif () endif () +if (LINUX_INSTALL_SOFTWARE) + if (LINUX) + if (INSTALL_GPGFRONTEND_APP) + install(TARGETS ${AppName} + EXPORT GpgFrontendTargets + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + ) + install(FILES ${CMAKE_SOURCE_DIR}/resource/meta/pub.gpgfrontend.gpgfrontend.appdata.xml + DESTINATION /usr/share/metainfo/) + install(DIRECTORY ${CMAKE_SOURCE_DIR}/resource/desktop/ + DESTINATION /usr/share/applications/) + install(DIRECTORY ${CMAKE_SOURCE_DIR}/resource/pixmaps/ + DESTINATION /usr/share/pixmaps/) + install(DIRECTORY ${CMAKE_SOURCE_DIR}/resource/hicolor/ + DESTINATION /usr/share/icons/hicolor/) + endif () + if (MULTI_LANG_SUPPORT) + message(STATUS "Local Output Path ${LOCALE_OUTPUT_PATH}") + install(DIRECTORY ${LOCALE_OUTPUT_PATH}/ + DESTINATION ${CMAKE_INSTALL_FULL_LOCALEDIR}) + endif () + if (APP_PACKAGE_DEB) + SET(CPACK_GENERATOR "DEB") + set(CPACK_INSTALL_PREFIX "/usr/local/") + set(CPACK_PACKAGE_NAME "gpgfrontend") + set(CPACK_DEBIAN_PACKAGE_NAME "gpgfrontend") + set(CPACK_DEBIAN_PACKAGE_ARCHITECTURE "amd64") + set(CPACK_PACKAGE_CONTACT "[email protected]") + SET(CPACK_DEBIAN_PACKAGE_MAINTAINER "Saturneric") + set(CPACK_DEBIAN_PACKAGE_DEPENDS "gpg (>= 2.2), libqt5core5a (>= 5.9), libqt5gui5 (>= 5.9), libqt5widgets5 (>= 5.9), libqt5network5 (>= 5.9), libqt5printsupport5 (>= 5.9)") + set(CPACK_PACKAGE_VERSION_MAJOR "${PROJECT_VERSION_MAJOR}") + set(CPACK_PACKAGE_VERSION_MINOR "${PROJECT_VERSION_MINOR}") + set(CPACK_PACKAGE_VERSION_PATCH "${PROJECT_VERSION_PATCH}") + include(CPack) + endif () + endif () +endif () + diff --git a/src/GpgFrontendBuildInfo.h.in b/src/GpgFrontendBuildInfo.h.in index eaf0475b..12bef1b8 100644 --- a/src/GpgFrontendBuildInfo.h.in +++ b/src/GpgFrontendBuildInfo.h.in @@ -50,5 +50,9 @@ */ #define BUILD_FLAG @BUILD_FLAG@ #define BUILD_TIMESTAMP "@BUILD_TIMESTAMP@" +#define APP_INSTALL_FLAG "@APP_INSTALL_FLAG@" + + + #endif // GPGFRONTEND_BUILD_INFO_H_IN diff --git a/src/GpgFrontendBuildInstallInfo.h.in b/src/GpgFrontendBuildInstallInfo.h.in new file mode 100644 index 00000000..057f30fe --- /dev/null +++ b/src/GpgFrontendBuildInstallInfo.h.in @@ -0,0 +1,37 @@ +/** + * This file is part of GpgFrontend. + * + * GpgFrontend is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Foobar is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Foobar. If not, see <https://www.gnu.org/licenses/>. + * + * The initial version of the source code is inherited from gpg4usb-team. + * Their source code version also complies with GNU General Public License. + * + * The source code version of this software was modified and released + * by Saturneric<[email protected]> starting on May 12, 2021. + * + */ + +#ifndef GPGFRONTEND_BUILD_INSTALL_INFO_H_IN +#define GPGFRONTEND_BUILD_INSTALL_INFO_H_IN + +/** + * Build & Install Path Information + */ +#define APP_LOCALE_PATH "@CMAKE_INSTALL_FULL_LOCALEDIR@" +#define APP_BIN_PATH "@CMAKE_INSTALL_FULL_BINDIR@" +#define APP_LOCALSTATE_PATH "@CMAKE_INSTALL_FULL_LOCALSTATEDIR@" +#define APP_SYSCONF_PATH "@CMAKE_INSTALL_FULL_SYSCONFDIR@" +#define APP_INFO_PATH "@CMAKE_INSTALL_FULL_INFODIR@" + +#endif // GPGFRONTEND_BUILD_INSTALL_INFO_H_IN
\ No newline at end of file diff --git a/src/ui/settings/GlobalSettingStation.h b/src/ui/settings/GlobalSettingStation.h index 07b904a8..a7cbe569 100644 --- a/src/ui/settings/GlobalSettingStation.h +++ b/src/ui/settings/GlobalSettingStation.h @@ -28,6 +28,7 @@ #include <boost/filesystem/operations.hpp> #include <boost/filesystem/path.hpp> +#include "GpgFrontendBuildInstallInfo.h" #include "ui/GpgFrontendUI.h" namespace GpgFrontend::UI { @@ -69,11 +70,22 @@ class GlobalSettingStation : public QObject { // Program Data Location boost::filesystem::path app_log_path = app_data_path / "logs"; +#ifdef LINUX_INSTALL_BUILD + // Program Data Location + boost::filesystem::path app_resource_path = + boost::filesystem::path(APP_LOCALSTATE_PATH) / "gpgfrontend"; +#else // Program Data Location boost::filesystem::path app_resource_path = RESOURCE_DIR_BOOST_PATH(app_path); +#endif +#ifdef LINUX_INSTALL_BUILD + // Program Data Location + boost::filesystem::path app_locale_path = std::string(APP_LOCALE_PATH); +#else // Program Data Location boost::filesystem::path app_locale_path = app_resource_path / "locales"; +#endif // Program Configure Location boost::filesystem::path app_configure_path = |