From a2fd5af13e69e4bc153ffb8ae953d35349ae744d Mon Sep 17 00:00:00 2001 From: Maxim Logaev Date: Mon, 15 Apr 2024 20:07:49 +0300 Subject: [PATCH] Added DEB-package generation using CPack Signed-off-by: Maxim Logaev --- .github/workflows/build.yml | 23 ++++++++++++++++++++--- CMakeLists.txt | 3 +++ cmake/Packing.cmake | 34 ++++++++++++++++++++++++++++++++++ 3 files changed, 57 insertions(+), 3 deletions(-) create mode 100644 cmake/Packing.cmake diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index aaa66b8d..a0e5635d 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -10,9 +10,26 @@ jobs: - run: sudo apt-get update - run: sudo apt-get remove libunwind-14-dev - run: sudo apt-get install -y build-essential gettext cmake valac libgee-0.8-dev libsqlite3-dev libgtk-4-dev libnotify-dev libgpgme-dev libsoup2.4-dev libgcrypt20-dev libqrencode-dev libnice-dev libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev libsrtp2-dev libwebrtc-audio-processing-dev libadwaita-1-dev libsignal-protocol-c-dev libcanberra-dev - - run: ./configure --with-tests --with-libsignal-in-tree - - run: make - - run: make test + - run: ./configure --release --no-debug --with-tests --enable-plugin=notification-sound --prefix=/usr + - run: cmake --build build + - run: cmake --build build --target=test + - name: Build DEB-package + run: cd build && cpack -G DEB + - name: Upload Dino+ DEB-package + uses: actions/upload-artifact@v4 + with: + name: dino-plus-deb + path: _packages/dino-plus.deb + - name: Release Dino+ DEB-package + if: ${{ github.ref_type == 'tag' }} + uses: svenstaro/upload-release-action@2.9.0 + with: + repo_token: ${{ secrets.GITHUB_TOKEN }} + file: _packages/dino-plus.deb + asset_name: dino-plus.deb + tag: ${{ github.ref }} + release_name: Dino ${{ github.ref_name }} + build-meson: runs-on: ubuntu-22.04 steps: diff --git a/CMakeLists.txt b/CMakeLists.txt index 0078f203..85097edf 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -223,6 +223,9 @@ add_subdirectory(main) add_subdirectory(crypto-vala) add_subdirectory(plugins) +# To generate a DEB package +include(Packing) + # uninstall target configure_file("${CMAKE_SOURCE_DIR}/cmake/cmake_uninstall.cmake.in" "${CMAKE_BINARY_DIR}/cmake_uninstall.cmake" IMMEDIATE @ONLY) add_custom_target(uninstall COMMAND ${CMAKE_COMMAND} -P ${CMAKE_BINARY_DIR}/cmake_uninstall.cmake COMMENT "Uninstall the project...") diff --git a/cmake/Packing.cmake b/cmake/Packing.cmake new file mode 100644 index 00000000..17444f58 --- /dev/null +++ b/cmake/Packing.cmake @@ -0,0 +1,34 @@ +# This is a package creation module using CPack. +# Currently only DEB package generation is supported. + +set(CPACK_PACKAGE_NAME dino-plus) +set(CPACK_PACKAGE_DESCRIPTION_SUMMARY + "modern XMPP/Jabber client software, based on Dino. +Dino+ is a fork of Dino, a modern XMPP/Jabber client +written in Vala using GTK+, which includes a few +relatively minor but important quality-of-life features.") + +set(CPACK_VERBATIM_VARIABLES YES) +set(CPACK_PACKAGE_FILE_NAME ${CPACK_PACKAGE_NAME}) +set(CPACK_PACKAGE_INSTALL_DIRECTORY ${CPACK_PACKAGE_NAME}) +set(CPACK_OUTPUT_FILE_PREFIX "${CMAKE_SOURCE_DIR}/_packages") +set(CPACK_PACKAGE_VERSION ${VERSION_FULL}) +set(CPACK_PACKAGE_HOMEPAGE_URL "https://github.com/mxlgv/dino") +set(CPACK_PACKAGE_CONTACT "maxlogaev@proton.me") +set(CPACK_COMPONENTS_GROUPING ALL_COMPONENTS_IN_ONE) +set(CPACK_STRIP_FILES TRUE) + +# For DEB only +set(CPACK_DEBIAN_PACKAGE_MAINTAINER "Maxim Logaev <${CPACK_PACKAGE_CONTACT}>") +set(CPACK_DEB_COMPONENT_INSTALL YES) +set(CPACK_DEBIAN_PACKAGE_SECTION "net") +set(CPACK_DEBIAN_PACKAGE_CONFLICTS "dino-im, dino-im-common") +set(CPACK_DEBIAN_PACKAGE_RECOMMENDS "ca-certificates, dbus, fonts-noto-color-emoji, network-manager") +set(CPACK_DEBIAN_PACKAGE_SHLIBDEPS ON) +set(CPACK_DEBIAN_PACKAGE_GENERATE_SHLIBS ON) +set(CPACK_DEBIAN_PACKAGE_GENERATE_SHLIBS_POLICY ">=") + +install(FILES ${CMAKE_SOURCE_DIR}/LICENSE_SHORT DESTINATION ${SHARE_INSTALL_PREFIX}/doc/${CPACK_PACKAGE_NAME} RENAME copyright) +install(FILES ${CMAKE_SOURCE_DIR}/README.md DESTINATION ${SHARE_INSTALL_PREFIX}/doc/${CPACK_PACKAGE_NAME}) + +include(CPack)