Skip to content

Commit

Permalink
Add CPack packaging (#33)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
Inokinoki authored Dec 9, 2024
1 parent 258802d commit 2a46e76
Show file tree
Hide file tree
Showing 3 changed files with 86 additions and 3 deletions.
16 changes: 14 additions & 2 deletions .github/workflows/cmake-linux-amd64-appimage.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Build Linux x64 AppImage
name: Build Linux x64 AppImage and deb

on:
push:
Expand Down Expand Up @@ -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
Expand All @@ -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
19 changes: 18 additions & 1 deletion .github/workflows/cmake-windows-x86-x64.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}

Expand All @@ -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/[email protected]
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
54 changes: 54 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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 <[email protected]>")
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()

0 comments on commit 2a46e76

Please sign in to comment.