Improved CPack configuration and added support for RPM package generation

This commit is contained in:
Nav
2022-04-02 17:12:40 +01:00
parent f0adcc3fca
commit 0e1aef7098
4 changed files with 70 additions and 16 deletions

3
.gitignore vendored
View File

@@ -7,4 +7,5 @@ build/resources
build/bin/bloom build/bin/bloom
build/bin/bloom.json build/bin/bloom.json
*.deb *.deb
src/Generated *.rpm
src/Generated

View File

@@ -1,6 +1,8 @@
cmake_minimum_required(VERSION 3.12) cmake_minimum_required(VERSION 3.12)
project(Bloom LANGUAGES CXX VERSION 0.8.2) project(Bloom LANGUAGES CXX VERSION 0.8.2)
set(CMAKE_PROJECT_HOMEPAGE_URL "https://bloom.oscillate.io")
set(CMAKE_VERBOSE_MAKEFILE off) set(CMAKE_VERBOSE_MAKEFILE off)
# Create directory for generated sources # Create directory for generated sources
@@ -374,21 +376,12 @@ install(
DIRECTORY_PERMISSIONS OWNER_EXECUTE OWNER_WRITE OWNER_READ FILE_PERMISSIONS OWNER_EXECUTE OWNER_WRITE OWNER_READ DIRECTORY_PERMISSIONS OWNER_EXECUTE OWNER_WRITE OWNER_READ FILE_PERMISSIONS OWNER_EXECUTE OWNER_WRITE OWNER_READ
) )
# Debian package configuration configure_file(
set(CPACK_GENERATOR "DEB") "${PROJECT_SOURCE_DIR}/CPack.cmake"
set(CPACK_DEBIAN_PACKAGE_NAME "Bloom") "${PROJECT_BINARY_DIR}/CPack.cmake"
set(CPACK_DEBIAN_PACKAGE_DESCRIPTION "")
file(READ ${CMAKE_CURRENT_SOURCE_DIR}/resources/packaging/description.txt CPACK_DEBIAN_PACKAGE_DESCRIPTION)
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "A debug interface for embedded systems development on Linux")
set(CPACK_DEBIAN_PACKAGE_MAINTAINER "Bloom Support <support@bloom.oscillate.io>")
set(CPACK_DEBIAN_PACKAGE_HOMEPAGE "https://bloom.oscillate.io")
set(CPACK_PACKAGE_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
set(CPACK_DEBIAN_PACKAGE_SHLIBDEPS ON)
set(CPACK_PACKAGING_INSTALL_PREFIX "/opt/bloom")
set(
CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA
${CMAKE_CURRENT_SOURCE_DIR}/resources/packaging/postinst;
${CMAKE_CURRENT_SOURCE_DIR}/resources/packaging/postrm
) )
set(CPACK_GENERATOR "DEB;RPM")
set(CPACK_PROJECT_CONFIG_FILE "${PROJECT_BINARY_DIR}/CPack.cmake")
include(CPack) include(CPack)

59
CPack.cmake Normal file
View File

@@ -0,0 +1,59 @@
set(CPACK_PACKAGE_NAME "Bloom")
set(
CPACK_PACKAGE_DESCRIPTION_SUMMARY
"A debug interface for embedded systems development on Linux. Bloom supports most Microchip AVR8 targets, along with numerous EDBG-based debug tools."
)
set(CPACK_PACKAGE_CONTACT "Nav Mohammed <support@bloom.oscillate.io>")
set(CPACK_PACKAGE_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
set(CPACK_PACKAGING_INSTALL_PREFIX "/opt/bloom")
if (CPACK_GENERATOR MATCHES "DEB")
# For Debian packages, we have to specify our own dependency list. We can't use the automatic dependency generator
# because CPack doesn't allow us to exclude dependencies that are shipped with Bloom. CPack uses dpkg-shlibdeps to
# generate the dependencies, and there appears to be a -x option to exclude certain packages, but CPack doesn't
# yet support this.
# This list could probably be reduced. It was generated by CPack (via dpkg-shlibdeps)
string(
CONCAT
CPACK_DEBIAN_PACKAGE_DEPENDS
"libc6 (>= 2.18), "
"libfontconfig1 (>= 2.11.94), "
"libfreetype6 (>= 2.6), "
"libgcc1 (>= 1:4.2), "
"libgl1-mesa-glx | libgl1, "
"libstdc++6 (>= 5), "
"libudev1 (>= 183), "
"libx11-6, "
"libx11-xcb1, "
"libxcb-icccm4 (>= 0.4.1), "
"libxcb-image0 (>= 0.2.1), "
"libxcb-keysyms1 (>= 0.4.0), "
"libxcb-render-util0, "
"libxext6, "
"libxkbcommon-x11-0 (>= 0.5.0), "
"libxkbcommon0 (>= 0.5.0), "
"libxrender1, "
"zlib1g (>= 1:1.1.4)"
)
set(
CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA
${CMAKE_CURRENT_SOURCE_DIR}/resources/packaging/postinst;
${CMAKE_CURRENT_SOURCE_DIR}/resources/packaging/postrm
)
elseif (CPACK_GENERATOR MATCHES "RPM")
set(CPACK_RPM_PACKAGE_LICENSE "LGPLv3+")
set(CPACK_RPM_PACKAGE_GROUP "Development/Debuggers")
set(CPACK_RPM_PACKAGE_AUTOREQ ON)
set(CPACK_RPM_REQUIRES_EXCLUDE_FROM "bin/lib/")
set(CPACK_RPM_POST_INSTALL_SCRIPT_FILE ${CMAKE_CURRENT_SOURCE_DIR}/resources/packaging/postinst)
set(CPACK_RPM_POST_UNINSTALL_SCRIPT_FILE ${CMAKE_CURRENT_SOURCE_DIR}/resources/packaging/postrm)
endif()

View File

@@ -6,6 +6,7 @@ rm -fr build/cmake-build-debug/*; rm -fr build/cmake-build-release/*;
rm -fr release; rm -fr release;
rm -fr Bloom-*.deb; rm -fr Bloom-*.deb;
rm -fr Bloom-*.rpm;
rm -fr "_CPack_Packages"; rm -fr "_CPack_Packages";
export CMAKE_PREFIX_PATH=/opt/Qt/6.1.2/gcc_64/ export CMAKE_PREFIX_PATH=/opt/Qt/6.1.2/gcc_64/