diff --git a/build/packaging/deb/control.in b/build/packaging/deb/control.in new file mode 100644 index 00000000..68f5b34b --- /dev/null +++ b/build/packaging/deb/control.in @@ -0,0 +1,26 @@ +Package: @BLOOM_PACKAGE_NAME_LOWER@ +Version: @CMAKE_PROJECT_VERSION@ +Architecture: amd64 +Description: @BLOOM_PACKAGE_DESCRIPTION@ +Section: devel +Priority: optional +Homepage: @CMAKE_PROJECT_HOMEPAGE_URL@ +Maintainer: @BLOOM_PACKAGE_CONTACT@ +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) diff --git a/build/packaging/deb/package-deb.sh.in b/build/packaging/deb/package-deb.sh.in new file mode 100644 index 00000000..62990f66 --- /dev/null +++ b/build/packaging/deb/package-deb.sh.in @@ -0,0 +1,49 @@ +#!/bin/bash + +RELEASE_DIR=@CMAKE_BINARY_DIR@/packaging/tmp/deb; +BLOOM_INSTALLATION_PREFIX=/opt/bloom/ +BLOOM_INSTALLATION_DIR=${RELEASE_DIR}./${BLOOM_INSTALLATION_PREFIX} +BLOOM_PACKAGE_PATH=@CMAKE_BINARY_DIR@/packaging/@BLOOM_PACKAGE_FILE_NAME@.deb + +if [ ! -f @CMAKE_BINARY_DIR@/bin/bloom ]; then + echo "Build files not found. Did you forget to build?" + exit 1; +fi + +echo "Preparing release directory..."; +mkdir -p ${BLOOM_INSTALLATION_DIR}; +mkdir -p ${BLOOM_INSTALLATION_DIR}/bin; + +mkdir -p ${RELEASE_DIR}/usr/lib/udev/rules.d/; +mkdir -p ${RELEASE_DIR}/usr/bin/; + +echo "Copying Bloom binary..."; +cp @CMAKE_BINARY_DIR@/bin/bloom ${BLOOM_INSTALLATION_DIR}/bin/; + +echo "Copying resources..."; +cp -R @CMAKE_BINARY_DIR@/resources ${BLOOM_INSTALLATION_DIR}/; +cp -R @CMAKE_CURRENT_SOURCE_DIR@/build/distributed/fonts ${BLOOM_INSTALLATION_DIR}/resources/; + +echo "Copying distributed binaries..."; +cp -R @CMAKE_CURRENT_SOURCE_DIR@/build/distributed/bin/lib ${BLOOM_INSTALLATION_DIR}/; +cp -R @CMAKE_CURRENT_SOURCE_DIR@/build/distributed/bin/plugins ${BLOOM_INSTALLATION_DIR}/; +cp -R @CMAKE_CURRENT_SOURCE_DIR@/build/distributed/bin/platforms ${BLOOM_INSTALLATION_DIR}/; + +echo "Copying udev rules..."; +cp -R @CMAKE_CURRENT_SOURCE_DIR@/build/distributed/udevrules/99-bloom.rules ${RELEASE_DIR}/usr/lib/udev/rules.d/; + +echo "Adjusting permissions..."; +chmod u=rwx,g=rx,o=rx -R ${BLOOM_INSTALLATION_DIR}/bin/; +chmod u=rwx,g=rx,o=rx -R ${BLOOM_INSTALLATION_DIR}/lib/; +chmod u=rwx,g=rx,o=rx -R ${BLOOM_INSTALLATION_DIR}/plugins/; +chmod u=rwx,g=rx,o=rx -R ${BLOOM_INSTALLATION_DIR}/platforms/; + +chmod u=rwX,g=rX,o=rX -R ${BLOOM_INSTALLATION_DIR}/resources/; + +chmod u=rw,g=r,o=r ${RELEASE_DIR}/usr/lib/udev/rules.d/99-bloom.rules; + +echo "Creating symbolic link for Bloom binary..." +ln -s -f ${BLOOM_INSTALLATION_PREFIX}./bin/bloom ${RELEASE_DIR}/usr/bin/; + +echo "Building Debian package..."; +dpkg-deb --build ${RELEASE_DIR} ${BLOOM_PACKAGE_PATH}; diff --git a/cmake/Packaging.cmake b/cmake/Packaging.cmake index 80e4328f..d578eede 100644 --- a/cmake/Packaging.cmake +++ b/cmake/Packaging.cmake @@ -1,56 +1,30 @@ -# 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 -# 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. +set(BLOOM_PACKAGE_NAME "Bloom") +set(BLOOM_PACKAGE_FILE_NAME "Bloom-${CMAKE_PROJECT_VERSION}-Linux") +set(BLOOM_PACKAGE_DESCRIPTION "Debugger for AVR-based embedded systems") +set(BLOOM_PACKAGE_CONTACT "Nav Mohammed ") +set(BLOOM_PACKAGE_RELEASE_DIR "${CMAKE_BINARY_DIR}/packaging/tmp/release") + +string(TOLOWER ${BLOOM_PACKAGE_NAME} BLOOM_PACKAGE_NAME_LOWER) + +file(MAKE_DIRECTORY "${BLOOM_PACKAGE_RELEASE_DIR}") configure_file( - "${PROJECT_SOURCE_DIR}/cmake/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 - "Debugger for AVR-based embedded systems" -) - -set(CPACK_PACKAGE_CONTACT "Nav Mohammed ") - -set(CPACK_PACKAGE_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}) -set(CPACK_PACKAGING_INSTALL_PREFIX "/opt/bloom") - -# 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" + "${CMAKE_CURRENT_SOURCE_DIR}/build/packaging/deb/package-deb.sh.in" + "${CMAKE_BINARY_DIR}/packaging/package-deb.sh" + FILE_PERMISSIONS + OWNER_EXECUTE OWNER_READ OWNER_WRITE + GROUP_READ + WORLD_READ @ONLY ) +file(MAKE_DIRECTORY "${CMAKE_BINARY_DIR}/packaging/tmp/deb") +file(MAKE_DIRECTORY "${CMAKE_BINARY_DIR}/packaging/tmp/rpm") +file(MAKE_DIRECTORY "${CMAKE_BINARY_DIR}/packaging/tmp/pkgbuild") + +# Generate the relevant configuration files for our DEB, RPM and PKGBUILD packages configure_file( - "${PROJECT_SOURCE_DIR}/resources/packaging/bloom.install.template.in" - "${PROJECT_BINARY_DIR}/bloom.install" + "${CMAKE_CURRENT_SOURCE_DIR}/build/packaging/deb/control.in" + "${CMAKE_BINARY_DIR}/packaging/tmp/deb/DEBIAN/control" @ONLY ) - -include(CPack)