From 2a46e7620b6f5c50ba5e7bad1e272b5bbce99e46 Mon Sep 17 00:00:00 2001 From: Inoki Date: Mon, 9 Dec 2024 23:37:33 +0100 Subject: [PATCH] Add CPack packaging (#33) * Add cpack packaging * Enable packaging in linux * Try to pack on Windows * As well as FreeBSD * Disable packaging for FreeBSD * Add error output in Windows packaging * Disable icons for NSIS * Use the right output for NSIS build --- .../workflows/cmake-linux-amd64-appimage.yml | 16 +++++- .github/workflows/cmake-windows-x86-x64.yml | 19 ++++++- CMakeLists.txt | 54 +++++++++++++++++++ 3 files changed, 86 insertions(+), 3 deletions(-) diff --git a/.github/workflows/cmake-linux-amd64-appimage.yml b/.github/workflows/cmake-linux-amd64-appimage.yml index 060afe9..e2ca171 100644 --- a/.github/workflows/cmake-linux-amd64-appimage.yml +++ b/.github/workflows/cmake-linux-amd64-appimage.yml @@ -1,4 +1,4 @@ -name: Build Linux x64 AppImage +name: Build Linux x64 AppImage and deb on: push: @@ -43,7 +43,7 @@ jobs: - 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}} -DCMAKE_INSTALL_PREFIX=/usr + run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DCMAKE_INSTALL_PREFIX=/usr -DENABLE_PACKAGING=ON - name: Build # Build your program with the given configuration @@ -69,3 +69,15 @@ jobs: name: QEFI Entry Manager x86_64 AppImage Qt${{matrix.qt-ver}} # A file, directory or wildcard pattern that describes what to upload path: ${{github.workspace}}/build/EFI_Entry_Manager-x86_64-Qt${{matrix.qt-ver}}.AppImage + + - name: Packaging Debian + working-directory: ${{github.workspace}}/build + run: cpack -G DEB + + - name: Upload a Build Artifact + uses: actions/upload-artifact@v4 + with: + # Artifact name + name: QEFI Entry Manager x86_64 deb Qt${{matrix.qt-ver}} + # A file, directory or wildcard pattern that describes what to upload + path: ${{github.workspace}}/build/*.deb diff --git a/.github/workflows/cmake-windows-x86-x64.yml b/.github/workflows/cmake-windows-x86-x64.yml index 49bfc8b..1934e38 100644 --- a/.github/workflows/cmake-windows-x86-x64.yml +++ b/.github/workflows/cmake-windows-x86-x64.yml @@ -45,7 +45,7 @@ jobs: - 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}} + run: cmake -B ${{github.workspace}}\build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DENABLE_PACKAGING=ON env: QT_VERSION: ${{ matrix.qtvers }} @@ -71,3 +71,20 @@ jobs: ${{github.workspace}}\build\${{env.BUILD_TYPE}}\platforms ${{github.workspace}}\build\${{env.BUILD_TYPE}}\imageformats ${{github.workspace}}\build\${{env.BUILD_TYPE}}\iconengines + + - name: Installing NSIS + uses: repolevedavaj/install-nsis@v1.0.1 + with: + nsis-version: '3.10' + + - name: Packaging using NSIS + run: | + cd ${{github.workspace}}\build + cpack -G NSIS || type ${{github.workspace}}\build\_CPack_Packages\win64\NSIS\NSISOutput.log + + - name: Upload a NSIS Build Artifact + uses: actions/upload-artifact@v4 + with: + # Artifact name + name: QEFI Entry Manager NSIS installer for Windows Qt${{ matrix.qtvers }} + path: ${{github.workspace}}\build\*.exe diff --git a/CMakeLists.txt b/CMakeLists.txt index 398cbae..4b5f702 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -120,3 +120,57 @@ install(PROGRAMS qefientrymanager.desktop install(FILES cc.inoki.qefientrymanager.png DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/icons/hicolor/96x96/apps ) + +# Use CPack to generate the package(s) +if(ENABLE_PACKAGING) +set(CPACK_PACKAGE_NAME "qefientrymanager") +set(CPACK_PACKAGE_VERSION "${QEFI_ENTRY_MANAGER_VERSION}") +set(CPACK_PACKAGE_DISPLAY_NAME "EFI Entry Manager") +set(CPACK_PACKAGE_CONTACT "Inoki ") +set(CPACK_PACKAGE_HOMEPAGE_URL "https://github.com/Inokinoki/QEFIEntryManager") +set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "A userspace cross-platform EFI boot entry management GUI App based on Qt.") +set(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_SOURCE_DIR}/README.md") +set(CPACK_PACKAGE_VENDOR "Inoki") +set(CPACK_PACKAGE_LICENSE "GPL-3.0") +set(CPACK_PACKAGING_INSTALL_PREFIX "/usr") +set(CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}-${CMAKE_SYSTEM_NAME}") +# For DEB + set(CPACK_DEBIAN_PACKAGE_SECTION "utils") + set(CPACK_DEBIAN_PACKAGE_PRIORITY "optional") + if(${QT_VERSION_MAJOR} GREATER_EQUAL 6) + set(CPACK_DEBIAN_PACKAGE_DEPENDS "qt6-base") + else() + set(CPACK_DEBIAN_PACKAGE_DEPENDS "qt5-default") + endif() +# End DEB +# For RPM + set(CPACK_RPM_PACKAGE_LICENSE "GPL-3.0") + set(CPACK_RPM_PACKAGE_GROUP "Applications/System") + set(CPACK_RPM_PACKAGE_REQUIRES "qt5-qtbase") + if(${QT_VERSION_MAJOR} GREATER_EQUAL 6) + set(CPACK_RPM_PACKAGE_DEPENDS "qt6-qtbase") + else() + set(CPACK_RPM_PACKAGE_DEPENDS "qt5-qtbase") + endif() +# End RPM +# For NSIS + set(CPACK_NSIS_PACKAGE_NAME ${CPACK_PACKAGE_NAME}) + set(CPACK_NSIS_DISPLAY_NAME "${CPACK_PACKAGE_DISPLAY_NAME} ${CPACK_PACKAGE_VERSION}") + set(CPACK_NSIS_PACKAGE_NAME "${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}") + set(CPACK_NSIS_CONTACT ${CPACK_PACKAGE_CONTACT}) + set(CPACK_NSIS_URL ${CPACK_PACKAGE_HOMEPAGE_URL}) + # NSIS is not happy with the my "icon" + # set(CPACK_NSIS_MUI_ICON "${CMAKE_SOURCE_DIR}/cc.inoki.qefientrymanager.png") + # set(CPACK_NSIS_MUI_UNIICON "${CMAKE_SOURCE_DIR}/cc.inoki.qefientrymanager.png") +# End NSIS +# For FreeBSD + set(CPACK_FREEBSD_PACKAGE_CATEGORIES "sysutils") + set(CPACK_FREEBSD_PACKAGE_ORIGIN "sysutils/qefientrymanager") + if(${QT_VERSION_MAJOR} GREATER_EQUAL 6) + set(CPACK_FREEBSD_PACKAGE_DEPS "qt6") + else() + set(CPACK_FREEBSD_PACKAGE_DEPS "qt5") + endif() +# End FreeBSD +include(CPack) +endif() \ No newline at end of file