Support for PKGBUILD packages and some CMake/CPACK config changes/tidying
This commit is contained in:
@@ -203,12 +203,4 @@ add_custom_command(
|
||||
|
||||
include(./Installing.cmake)
|
||||
|
||||
configure_file(
|
||||
"${PROJECT_SOURCE_DIR}/Packaging.cmake"
|
||||
"${PROJECT_BINARY_DIR}/Packaging.cmake"
|
||||
)
|
||||
|
||||
set(CPACK_GENERATOR "DEB;RPM")
|
||||
set(CPACK_PROJECT_CONFIG_FILE "${PROJECT_BINARY_DIR}/Packaging.cmake")
|
||||
|
||||
include(CPack)
|
||||
include(./Packaging.cmake)
|
||||
|
||||
46
PackageGeneratorConfig.cmake
Normal file
46
PackageGeneratorConfig.cmake
Normal file
@@ -0,0 +1,46 @@
|
||||
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()
|
||||
@@ -1,22 +1,38 @@
|
||||
# This file contains the CPack configuration for packaging Bloom. Bloom is currently packaged in Debian and RPM
|
||||
# packages. To package Bloom, simply run CPack from the CMake build directory:
|
||||
# This file contains the CPack configuration for packaging Bloom. Bloom is currently packaged in Debian, RPM and
|
||||
# PKGBUILD packages. Because CPack doesn't support PKGBUILD packages, we have to build those separately. But we still
|
||||
# use CMake & CPack configuration to generate our PKGBUILD file. See below for more.
|
||||
#
|
||||
# To package Bloom, simply run CPack & makepkg from the CMake build directory:
|
||||
#
|
||||
# $ cd build/cmake-build-release/
|
||||
# $ cpack
|
||||
# $ makepkg
|
||||
#
|
||||
# CPack's -G option can be used to specify a particular generator:
|
||||
# $ cpack -G DEB
|
||||
#
|
||||
# If no generator has been specified, CPack will generate packages for all configured generators (see CPACK_GENERATOR
|
||||
# in Bloom's root CMakeLists.txt).
|
||||
# below).
|
||||
#
|
||||
# The makepkg command builds the PKGBUILD package. It uses the generated PKGBUILD file, which is generated from
|
||||
# resources/packaging/PKGBUILD.template.in. See the configure_file() invocations below.
|
||||
#
|
||||
# NOTE: The above commands assume Bloom has been built in 'release' mode, and the install target has been run.
|
||||
|
||||
configure_file(
|
||||
"${PROJECT_SOURCE_DIR}/PackageGeneratorConfig.cmake"
|
||||
"${PROJECT_BINARY_DIR}/PackageGeneratorConfig.cmake"
|
||||
)
|
||||
|
||||
set(CPACK_GENERATOR "DEB;RPM")
|
||||
set(CPACK_PROJECT_CONFIG_FILE "${PROJECT_BINARY_DIR}/PackageGeneratorConfig.cmake")
|
||||
|
||||
set(CPACK_PACKAGE_NAME "Bloom")
|
||||
string(TOLOWER ${CPACK_PACKAGE_NAME} CPACK_PACKAGE_NAME_LOWER)
|
||||
|
||||
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."
|
||||
"Debugger for AVR-based embedded systems"
|
||||
)
|
||||
|
||||
set(CPACK_PACKAGE_CONTACT "Nav Mohammed <support@bloom.oscillate.io>")
|
||||
@@ -24,50 +40,17 @@ 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)"
|
||||
# Generate the PKGBUILD and bloom.install file in the CMake build directory.
|
||||
configure_file(
|
||||
"${PROJECT_SOURCE_DIR}/resources/packaging/PKGBUILD.template.in"
|
||||
"${PROJECT_BINARY_DIR}/PKGBUILD"
|
||||
@ONLY
|
||||
)
|
||||
|
||||
set(
|
||||
CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/resources/packaging/postinst;
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/resources/packaging/postrm
|
||||
configure_file(
|
||||
"${PROJECT_SOURCE_DIR}/resources/packaging/bloom.install.template.in"
|
||||
"${PROJECT_BINARY_DIR}/bloom.install"
|
||||
@ONLY
|
||||
)
|
||||
|
||||
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()
|
||||
include(CPack)
|
||||
|
||||
17
resources/packaging/PKGBUILD.template.in
Normal file
17
resources/packaging/PKGBUILD.template.in
Normal file
@@ -0,0 +1,17 @@
|
||||
pkgname=@CPACK_PACKAGE_NAME_LOWER@
|
||||
pkgver=@CMAKE_PROJECT_VERSION@
|
||||
pkgrel=1
|
||||
pkgdesc="@CPACK_PACKAGE_DESCRIPTION_SUMMARY@"
|
||||
arch=('i686' 'x86_64')
|
||||
url="@CMAKE_PROJECT_HOMEPAGE_URL@"
|
||||
license=('LGPLv3')
|
||||
install=bloom.install
|
||||
|
||||
package(){
|
||||
depends=('fontconfig>=2.11.94' 'freetype2>=2.6' 'gcc-libs>=5' 'glibc>=2.18' 'libgl' 'libglvnd' 'libpng12' 'libx11' 'libxcb' 'libxext' 'libxkbcommon>=0.5.0' 'libxkbcommon-x11>=0.5.0' 'libxrender' 'xcb-util-image>=0.2.1' 'xcb-util-keysyms>=0.4.0' 'xcb-util-renderutil' 'xcb-util-wm>=0.4.1' 'zlib>=1.1.4')
|
||||
|
||||
mkdir -p "${pkgdir}/@CPACK_PACKAGING_INSTALL_PREFIX@"
|
||||
|
||||
# Extract package data
|
||||
cp -R @CMAKE_INSTALL_PREFIX@* "${pkgdir}/@CPACK_PACKAGING_INSTALL_PREFIX@"
|
||||
}
|
||||
37
resources/packaging/bloom.install.template.in
Normal file
37
resources/packaging/bloom.install.template.in
Normal file
@@ -0,0 +1,37 @@
|
||||
post_install() {
|
||||
xdg-icon-resource forceupdate --theme hicolor &> /dev/null
|
||||
|
||||
BLOOM_UDEV_FILE_PATH=/etc/udev/rules.d/
|
||||
|
||||
if [ ! -f "${BLOOM_UDEV_FILE_PATH}/99-bloom.rules" ] || [ ! -L "${BLOOM_UDEV_FILE_PATH}/99-bloom.rules" ] || [ ! -e "${BLOOM_UDEV_FILE_PATH}/99-bloom.rules" ]; then
|
||||
sudo ln -s /opt/bloom/resources/UDevRules/99-bloom.rules "$BLOOM_UDEV_FILE_PATH";
|
||||
fi
|
||||
|
||||
|
||||
if [ -f "/usr/bin/bloom" ] || [ -L "/usr/bin/bloom" ] || [ -e "/usr/bin/bloom" ]; then
|
||||
sudo rm /usr/bin/bloom;
|
||||
fi
|
||||
|
||||
sudo chmod u=rwx,g=rwx,o=rx -R /opt/bloom
|
||||
ln -s /opt/bloom/bin/bloom /usr/bin/bloom;
|
||||
update-desktop-database -q
|
||||
}
|
||||
|
||||
post_upgrade() {
|
||||
post_install
|
||||
}
|
||||
|
||||
post_remove() {
|
||||
xdg-icon-resource forceupdate --theme hicolor &> /dev/null
|
||||
|
||||
BLOOM_UDEV_FILE_PATH=/etc/udev/rules.d/
|
||||
|
||||
if [ -f "${BLOOM_UDEV_FILE_PATH}/99-bloom.rules" ] || [ -L "${BLOOM_UDEV_FILE_PATH}/99-bloom.rules" ] || [ -e "${BLOOM_UDEV_FILE_PATH}/99-bloom.rules" ]; then
|
||||
sudo rm "$BLOOM_UDEV_FILE_PATH/99-bloom.rules";
|
||||
fi
|
||||
|
||||
if [ -f "/usr/bin/bloom" ] || [ -L "/usr/bin/bloom" ] || [ -e "/usr/bin/bloom" ]; then
|
||||
sudo rm /usr/bin/bloom;
|
||||
fi
|
||||
update-desktop-database -q
|
||||
}
|
||||
Reference in New Issue
Block a user