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 | |
parent | Update Translations & README. (diff) | |
download | GpgFrontend-c77a3c560ebcb06a5ca4214cbfdd688e5f9e32cb.tar.gz GpgFrontend-c77a3c560ebcb06a5ca4214cbfdd688e5f9e32cb.zip |
Add Deb Build Support & Install Support For Linux.
Diffstat (limited to '')
-rw-r--r-- | .github/workflows/release-ci.yml | 215 | ||||
-rw-r--r-- | .github/workflows/release.yml | 27 | ||||
-rw-r--r-- | .gitignore | 1 | ||||
-rw-r--r-- | CMakeLists.txt | 12 | ||||
-rw-r--r-- | resource/desktop/gpgfrontend-gpgfrontend.desktop | 8 | ||||
-rw-r--r-- | resource/hicolor/128x128/apps/pub.gpgfrontend.gpgfrontend.png | bin | 0 -> 3819 bytes | |||
-rw-r--r-- | resource/hicolor/256x256/apps/pub.gpgfrontend.gpgfrontend.png | bin | 0 -> 9155 bytes | |||
-rw-r--r-- | resource/hicolor/32x32/apps/pub.gpgfrontend.gpgfrontend.png | bin | 0 -> 3533 bytes | |||
-rw-r--r-- | resource/meta/pub.gpgfrontend.gpgfrontend.appdata.xml | 37 | ||||
-rw-r--r-- | resource/pixmaps/pub.gpgfrontend.gpgfrontend.png | bin | 0 -> 9155 bytes | |||
-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 |
14 files changed, 182 insertions, 224 deletions
diff --git a/.github/workflows/release-ci.yml b/.github/workflows/release-ci.yml deleted file mode 100644 index 13e4b733..00000000 --- a/.github/workflows/release-ci.yml +++ /dev/null @@ -1,215 +0,0 @@ -name: Build & Package CI Test - -on: - push: - branches: [ develop-ci ] - paths-ignore: - - "**/README.md" - - "**/README_CN.md" - - "resource/ts/**" - - "docs/**" - - "**.md" - pull_request: - branches: [ develop-ci ] - paths-ignore: - - "**/README.md" - - "**/README_CN.md" - - "resource/ts/**" - - "docs/**" - - "**.md" - -env: - # Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.) - BUILD_TYPE: Release - EXECUTABLE_OUTPUT_PATH: ./ - -jobs: - build: - strategy: - matrix: - os: [ "ubuntu-18.04", "macos-10.15", "windows-latest" ] - runs-on: ${{ matrix.os }} - steps: - - uses: actions/checkout@v2 - with: - submodules: recursive - - - name: Install Dependence (Linux) - run: | - sudo apt-get update - sudo apt-get -y install build-essential binutils git autoconf automake gettext texinfo - sudo apt-get -y install gcc-8 g++-8 libconfig++-dev libboost-all-dev - sudo apt-get -y install gpgsm libxcb-xinerama0 libxcb-icccm4-dev libcups2-dev libdrm-dev libegl1-mesa-dev - sudo apt-get -y install libgcrypt11-dev libnss3-dev libpci-dev libpulse-dev libudev-dev libxtst-dev gyp ninja-build - sudo apt-get -y install libglu1-mesa-dev libfontconfig1-dev libx11-xcb-dev libicu-dev libxcb-image0 - sudo apt-get -y install libglu1-mesa-dev libfontconfig1-dev libx11-xcb-dev libicu-dev libxcb-* - sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-8 8 - sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-8 8 - sudo update-alternatives --set gcc "/usr/bin/gcc-8" - sudo update-alternatives --set g++ "/usr/bin/g++-8" - if: matrix.os == 'ubuntu-18.04' - - - name: Codesign Configuration (macOS) - run: | - echo ${{secrets.MACOS_CERTIFICATE}} | base64 --decode > certificate.p12 - security create-keychain -p gpgfrontend build.keychain - security default-keychain -s build.keychain - security unlock-keychain -p gpgfrontend build.keychain - security import certificate.p12 -k build.keychain -P ${{secrets.MAOS_CERTIFICATE_PWD}} -T /usr/bin/codesign - security set-key-partition-list -S apple-tool:,apple:,codesign: -s -k gpgfrontend build.keychain - security set-keychain-settings -lut 3600 - if: matrix.os == 'macos-10.15' - - - name: Install Dependence (macOS) - run: | - brew install cmake git autoconf automake qt@5 gcc texinfo gettext libgpg-error libassuan gpgme openssl - brew install boost libconfig gettext - brew unlink gettext && brew link --force gettext - brew link qt@5 - brew link gcc - brew link openssl --force - if: matrix.os == 'macos-10.15' - - - name: Cache Qt - id: cache-qt - uses: actions/cache@v1 - with: - path: ../Qt - key: ${{ runner.os }}-QtCache - if: matrix.os == 'ubuntu-18.04' - - - name: Install Qt - uses: jurplel/install-qt-action@v2 - with: - cached: ${{ steps.cache-qt.outputs.cache-hit }} - if: matrix.os == 'ubuntu-18.04' - - - name: Set up MinGW (Windows) - uses: msys2/setup-msys2@v2 - with: - install: git msys2-devel base-devel binutils mingw-w64-x86_64-toolchain - release: false - if: matrix.os == 'windows-latest' - - - name: Set up Dependence (Windows) - shell: msys2 {0} - run: | - pacman --noconfirm -S --needed mingw-w64-x86_64-gcc mingw-w64-x86_64-make mingw-w64-x86_64-cmake autoconf automake mingw-w64-x86_64-gpgme - pacman --noconfirm -S --needed make texinfo mingw-w64-x86_64-libconfig mingw-w64-x86_64-boost mingw-w64-x86_64-gnupg gettext-devel libintl msys2-runtime-devel - pacman --noconfirm -S --needed mingw-w64-x86_64-qt5 - if: matrix.os == 'windows-latest' - - - name: Build gpg-error (Linux) - run: | - cd ${{github.workspace}}/third_party/libgpg-error - ./autogen.sh - ./configure --enable-maintainer-mode --enable-static=yes && make -j2 - sudo make install - cd ${{github.workspace}} - if: matrix.os == 'ubuntu-18.04' - - - name: Build assuan (Linux) - run: | - cd ${{github.workspace}}/third_party/libassuan - ./autogen.sh - ./configure --enable-maintainer-mode --enable-static=yes && make -j2 - sudo make install - cd ${{github.workspace}} - if: matrix.os == 'ubuntu-18.04' - - - name: Build GpgME (Linux & macOS) - run: | - cd ${{github.workspace}}/third_party/gpgme - ./autogen.sh - ./configure --enable-maintainer-mode --enable-static=yes --enable-languages=cpp && make -j2 - sudo make install - cd ${{github.workspace}} - if: matrix.os == 'ubuntu-18.04' || matrix.os == 'macos-10.15' - - - name: Build GpgME (Windows) - shell: msys2 {0} - run: | - git clone https://github.com/saturneric/gpgme - cd gpgme - ./autogen.sh - ./configure --enable-maintainer-mode --enable-static=yes --disable-gpg-test --enable-languages=cpp LDFLAGS="-static" && make -j2 - make install - if: matrix.os == 'windows-latest' - - - name: Configure CMake - # Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make. - # See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type - run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DEXECUTABLE_OUTPUT_PATH=${{env.EXECUTABLE_OUTPUT_PATH}} - if: matrix.os == 'ubuntu-18.04' || matrix.os == 'macos-10.15' - - - name: Build GpgFrontend - # Build your program with the given configuration - run: cmake --build ${{github.workspace}}/build --config $env.BUILD_TYPE}} -- -j 2 - if: matrix.os == 'ubuntu-18.04' || matrix.os == 'macos-10.15' - - - name: Build & Sign App Bundle (macOS) - run: | - security -v unlock-keychain -p gpgfrontend - macdeployqt ${{github.workspace}}/build/release/GpgFrontend.app - codesign --deep --force --options=runtime -s "Developer ID Application: Yu Hu (4279AWUL3X)" ${{github.workspace}}/build/release/GpgFrontend.app -v - mkdir ${{github.workspace}}/build/tmp/ - if: matrix.os == 'macos-10.15' - - - name: Package & Sign App Bundle (macOS) - run: | - security -v unlock-keychain -p gpgfrontend - hdiutil create ${{github.workspace}}/build/tmp/tmp.dmg -ov -volname "GpgFrontend" -fs HFS+ -srcfolder ${{github.workspace}}/build/release/ - mkdir ${{github.workspace}}/build/artifactOut - hdiutil convert ${{github.workspace}}/build/tmp/tmp.dmg -format UDZO -o ${{github.workspace}}/build/artifactOut/GpgFrontend.dmg - codesign -s "Developer ID Application: Yu Hu (4279AWUL3X)" ${{github.workspace}}/build/artifactOut/GpgFrontend.dmg - mv ${{github.workspace}}/build/artifactOut/GpgFrontend.dmg ${{github.workspace}}/build/artifactOut/GpgFrontend-${{steps.vars.outputs.sha_short}}-x86_64.dmg - if: matrix.os == 'macos-10.15' - - - name: Notarize Release Build (macOS) - run: | - xcrun altool --notarize-app -f ${{github.workspace}}/build/artifactOut/GpgFrontend-${{steps.vars.outputs.sha_short}}-x86_64.dmg --primary-bundle-id pub.gpgfrontend.gpgfrontend -u ${{secrets.APPLE_DEVELOPER_ID}} -p ${{secrets.APPLE_DEVELOPER_ID_SECRET}} - if: matrix.os == 'macos-10.15' - - - name: Package App Image (Linux) - run: | - mkdir ${{github.workspace}}/build/artifactOut - cd ${{github.workspace}}/build/artifactOut - wget -c -nv https://github.com/probonopd/linuxdeployqt/releases/download/continuous/linuxdeployqt-continuous-x86_64.AppImage - chmod u+x linuxdeployqt-continuous-x86_64.AppImage - ./linuxdeployqt-continuous-x86_64.AppImage ${{github.workspace}}/build/release/gpgfrontend/usr/share/applications/*.desktop -appimage - if: matrix.os == 'ubuntu-18.04' - - - name: Configure CMake & Build Binary(Windows) - shell: msys2 {0} - run: | - cd $(echo "/${{github.workspace}}" | sed 's/\\/\//g' | sed 's/://') - mkdir build && cd build - cmake -G "MinGW Makefiles" -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DEXECUTABLE_OUTPUT_PATH=${{env.EXECUTABLE_OUTPUT_PATH}} .. - # Build your program with the given configuration - cmake --build . --config ${{env.BUILD_TYPE}} -- -j 2 - if: matrix.os == 'windows-latest' - - - name: Get Short SHA of Commit - id: vars - run: echo "::set-output name=sha_short::$(git rev-parse --short HEAD)" - - - name: Upload Artifact(Linux) - uses: actions/upload-artifact@master - with: - name: gpgfrontend-${{matrix.os}}-${{env.BUILD_TYPE}}-${{steps.vars.outputs.sha_short}} - path: ${{github.workspace}}/build/artifactOut/GpgFrontend*.AppImage* - if: matrix.os == 'ubuntu-18.04' - - - name: Upload Artifact(macOS) - uses: actions/upload-artifact@master - with: - name: gpgfrontend-${{matrix.os}}-${{env.BUILD_TYPE}}-${{steps.vars.outputs.sha_short}} - path: ${{github.workspace}}/build/artifactOut/* - if: matrix.os == 'macos-10.15' - - - name: Upload Artifact(Windows) - uses: actions/upload-artifact@master - with: - name: gpgfrontend-${{matrix.os}}-${{env.BUILD_TYPE}}-${{steps.vars.outputs.sha_short}} - path: ${{github.workspace}}/build/release/* - if: matrix.os == 'windows-latest' diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 187b2399..64fd081c 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -33,6 +33,10 @@ jobs: with: submodules: recursive + - name: Get Short SHA of Commit + id: vars + run: echo "::set-output name=sha_short::$(git rev-parse --short HEAD)" + - name: Install Dependence (Linux) run: | sudo apt-get update @@ -143,9 +147,19 @@ jobs: - name: Build GpgFrontend # Build your program with the given configuration - run: cmake --build ${{github.workspace}}/build --config $env.BUILD_TYPE}} -- -j 2 + run: cmake --build ${{github.workspace}}/build --config {{$env.BUILD_TYPE}} -- -j 2 if: matrix.os == 'ubuntu-18.04' || matrix.os == 'macos-10.15' + - name: Build & Package GpgFrontend (Linux DEB Package) + # Build your program with the given configuration + run: | + cmake -B ${{github.workspace}}/build-deb -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DEXECUTABLE_OUTPUT_PATH=${{env.EXECUTABLE_OUTPUT_PATH}} -DAPP_PACKAGE_DEB=ON -DLINUX_INSTALL_SOFTWARE=ON + cmake --build ${{github.workspace}}/build-deb --config {{$env.BUILD_TYPE}} -- -j 2 + cd ${{github.workspace}}/build-deb + make package + cd ${{github.workspace}} + if: matrix.os == 'ubuntu-18.04' + - name: Build & Sign App Bundle (macOS) run: | security -v unlock-keychain -p gpgfrontend @@ -188,10 +202,6 @@ jobs: cmake --build . --config ${{env.BUILD_TYPE}} -- -j 2 if: matrix.os == 'windows-latest' - - name: Get Short SHA of Commit - id: vars - run: echo "::set-output name=sha_short::$(git rev-parse --short HEAD)" - - name: Upload Artifact(Linux) uses: actions/upload-artifact@master with: @@ -199,6 +209,13 @@ jobs: path: ${{github.workspace}}/build/artifactOut/GpgFrontend*.AppImage* if: matrix.os == 'ubuntu-18.04' + - name: Upload Artifact(Linux DEB) + uses: actions/upload-artifact@master + with: + name: gpgfrontend-${{matrix.os}}-${{env.BUILD_TYPE}}-${{steps.vars.outputs.sha_short}}-deb + path: ${{github.workspace}}/build-deb/gpgfrontend*.deb* + if: matrix.os == 'ubuntu-18.04' + - name: Upload Artifact(macOS) uses: actions/upload-artifact@master with: @@ -1,6 +1,7 @@ # Project src/GpgFrontend.h src/GpgFrontendBuildInfo.h +src/GpgFrontendBuildInstallInfo.h # gettext *.mo diff --git a/CMakeLists.txt b/CMakeLists.txt index 377f627c..d5c6a8d8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -222,6 +222,18 @@ set(BASIC_ENV_CONFIG 1) set(QT_MOC_CONFIG 1) set(ESAY_LOGGING_PP 1) +if (LINUX_INSTALL_SOFTWARE) + include(GNUInstallDirs) + set(INSTALL_GPGFRONTEND_APP 1) + set(APP_INSTALL_FLAG LINUX_INSTALL) + add_compile_definitions(LINUX_INSTALL_BUILD) + set(Boost_USE_STATIC_LIBS ON) +else () + set(APP_INSTALL_FLAG BUNDLE) + add_compile_definitions(BUNDLE_BUILD) +endif () + + if (FULL_APPLICATION_BUILD) message(STATUS "Build Full Application") set(QT5_ENV_SUPPORT 1) diff --git a/resource/desktop/gpgfrontend-gpgfrontend.desktop b/resource/desktop/gpgfrontend-gpgfrontend.desktop new file mode 100644 index 00000000..927c8ae0 --- /dev/null +++ b/resource/desktop/gpgfrontend-gpgfrontend.desktop @@ -0,0 +1,8 @@ +[Desktop Entry] +Type=Application +Name=GpgFrontend +Exec=/usr/bin/GpgFrontend +Icon=pub.gpgfrontend.gpgfrontend +Comment=An OpenPGP Crypto Tool +Terminal=false +Categories=Utility;
\ No newline at end of file diff --git a/resource/hicolor/128x128/apps/pub.gpgfrontend.gpgfrontend.png b/resource/hicolor/128x128/apps/pub.gpgfrontend.gpgfrontend.png Binary files differnew file mode 100644 index 00000000..5c24791f --- /dev/null +++ b/resource/hicolor/128x128/apps/pub.gpgfrontend.gpgfrontend.png diff --git a/resource/hicolor/256x256/apps/pub.gpgfrontend.gpgfrontend.png b/resource/hicolor/256x256/apps/pub.gpgfrontend.gpgfrontend.png Binary files differnew file mode 100644 index 00000000..b3268b01 --- /dev/null +++ b/resource/hicolor/256x256/apps/pub.gpgfrontend.gpgfrontend.png diff --git a/resource/hicolor/32x32/apps/pub.gpgfrontend.gpgfrontend.png b/resource/hicolor/32x32/apps/pub.gpgfrontend.gpgfrontend.png Binary files differnew file mode 100644 index 00000000..c90e1d1d --- /dev/null +++ b/resource/hicolor/32x32/apps/pub.gpgfrontend.gpgfrontend.png diff --git a/resource/meta/pub.gpgfrontend.gpgfrontend.appdata.xml b/resource/meta/pub.gpgfrontend.gpgfrontend.appdata.xml new file mode 100644 index 00000000..281215ae --- /dev/null +++ b/resource/meta/pub.gpgfrontend.gpgfrontend.appdata.xml @@ -0,0 +1,37 @@ +<?xml version="1.0" encoding="UTF-8"?> +<component> + <id>pub.gpgfrontend.gpgfrontend</id> + <metadata_license>MIT</metadata_license> + <name>gpgfrontend</name> + <summary>An OpenPGP Crypto Tool</summary> + <icon type="stock">gpgfrontend</icon> + <categories> + <category>Utility</category> + </categories> + <url type="homepage">https://gpgfrontend.pub</url> + <launchable type="desktop-id">gpgfrontend.gpgfrontend.desktop</launchable> + <description> + <p> + GpgFrontend is a Free, Open Source, Powerful, Easy-to-Use, Compact, Cross-Platform OpenPGP Crypto Tool. + By using GpgFrontend, you can quickly encrypt and decrypt text or files. Or at the same time as the above + operations, you can add your own signature to let others know that this document or this paragraph of text + was issued by you. + </p> + </description> + <screenshots> + <screenshot type="default"> + <image>https://github.com/saturneric/Blob/blob/master/screenshots/main-ubuntu.png</image> + <caption>Main Dialog</caption> + </screenshot> + </screenshots> + <keywords> + <keyword>gpg</keyword> + <keyword>encrypt</keyword> + <keyword>crypto</keyword> + <keyword>pgp</keyword> + <keyword>gnupg</keyword> + <keyword>openpgp</keyword> + </keywords> + <project_license>GPL-3.0+</project_license> + <developer_name>Saturneric</developer_name> +</component>
\ No newline at end of file diff --git a/resource/pixmaps/pub.gpgfrontend.gpgfrontend.png b/resource/pixmaps/pub.gpgfrontend.gpgfrontend.png Binary files differnew file mode 100644 index 00000000..b3268b01 --- /dev/null +++ b/resource/pixmaps/pub.gpgfrontend.gpgfrontend.png 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 = |