mirror of
https://github.com/gnss-sdr/gnss-sdr
synced 2025-01-26 00:46:59 +00:00
Working towards a fully compliant Debian package
This commit is contained in:
parent
a89a6821ec
commit
d04eec0033
@ -17,17 +17,17 @@
|
||||
#
|
||||
|
||||
|
||||
if(DEFINED __INCLUDED_GNSS_SDR_PACKAGE_CMAKE)
|
||||
return()
|
||||
endif()
|
||||
set( __INCLUDED_GNSS_SDR_PACKAGE_CMAKE TRUE)
|
||||
#if(DEFINED __INCLUDED_GNSS_SDR_PACKAGE_CMAKE)
|
||||
# return()
|
||||
#endif()
|
||||
#set( __INCLUDED_GNSS_SDR_PACKAGE_CMAKE TRUE)
|
||||
|
||||
|
||||
#set the cpack generator based on the platform type
|
||||
if(CPACK_GENERATOR)
|
||||
#already set by user
|
||||
elseif(APPLE)
|
||||
set(PACKAGE_GENERATOR "TGZ")
|
||||
set(PACKAGE_GENERATOR "DragNDrop")
|
||||
set(PACKAGE_SOURCE_GENERATOR "TGZ;ZIP")
|
||||
elseif(UNIX)
|
||||
if(${LINUX_DISTRIBUTION} MATCHES "Debian" OR ${LINUX_DISTRIBUTION} MATCHES "Ubuntu")
|
||||
@ -48,6 +48,18 @@ set (CPACK_GENERATOR "${PACKAGE_GENERATOR}" CACHE STRING "List of binary package
|
||||
set (CPACK_SOURCE_GENERATOR "${PACKAGE_SOURCE_GENERATOR}" CACHE STRING "List of source package generators (CPack).")
|
||||
|
||||
|
||||
|
||||
|
||||
CONFIGURE_FILE("${CMAKE_SOURCE_DIR}/cmake/Packaging/postinst.in" "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}/scripts/postinst" @ONLY IMMEDIATE)
|
||||
FILE(COPY ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}/scripts/postinst DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}
|
||||
FILE_PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)
|
||||
CONFIGURE_FILE("${CMAKE_SOURCE_DIR}/cmake/Packaging/prerm.in" "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}/scripts/prerm" @ONLY IMMEDIATE)
|
||||
FILE(COPY ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}/scripts/prerm DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}
|
||||
FILE_PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)
|
||||
|
||||
|
||||
|
||||
|
||||
########################################################################
|
||||
# Setup CPack
|
||||
########################################################################
|
||||
@ -64,12 +76,16 @@ set(CPACK_PACKAGE_VERSION_PATCH "${VERSION_INFO_MINOR_VERSION}")
|
||||
set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_SOURCE_DIR}/COPYING")
|
||||
set(CPACK_RESOURCE_FILE_README "${CMAKE_SOURCE_DIR}/README.md")
|
||||
set(CPACK_RESOURCE_FILE_WELCOME "${CMAKE_SOURCE_DIR}/README.md")
|
||||
set(CPACK_SET_DESTDIR "ON")
|
||||
set(CPACK_SET_DESTDIR "OFF")
|
||||
set(CPACK_STRIP_FILES "${CMAKE_INSTALL_PREFIX}/bin/gnss-sdr;${CMAKE_INSTALL_PREFIX}/bin/volk_gnsssdr_profile")
|
||||
|
||||
# Debian-specific settings
|
||||
set(CPACK_DEBIAN_PACKAGE_SECTION "science")
|
||||
set(CPACK_DEBIAN_PACKAGE_PRIORITY "optional")
|
||||
set(CPACK_DEBIAN_PACKAGE_DEPENDS "libboost-dev (>= 1.45), libstdc++6 (>= 4.7), libc6 (>= 2.18), gnuradio (>= 3.7), libarmadillo-dev (>= 1:4.400.2), liblapack-dev (>= 3.5), libopenblas-dev (>= 0.2), gfortran (>= 1:4.7), libssl-dev (>= 1.0), libgflags-dev (>= 2.0)")
|
||||
set(CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}/postinst;${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}/prerm")
|
||||
|
||||
|
||||
|
||||
|
||||
# system/architecture
|
||||
@ -223,8 +239,6 @@ list(LENGTH CMAKE_TARGET_ARCHITECTURES cmake_target_arch_len)
|
||||
endif()
|
||||
endif(APPLE)
|
||||
|
||||
set(CPACK_STRIP_FILES "${CMAKE_INSTALL_PREFIX}/bin/gnss-sdr;${CMAKE_INSTALL_PREFIX}/bin/volk_gnsssdr_profile")
|
||||
|
||||
# source package settings
|
||||
#set (CPACK_SOURCE_TOPLEVEL_TAG "source")
|
||||
set (CPACK_SOURCE_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}")
|
||||
@ -237,5 +251,15 @@ if (CPACK_PACKAGE_ARCHITECTURE)
|
||||
set (CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_FILE_NAME}_${CPACK_PACKAGE_ARCHITECTURE}")
|
||||
endif ()
|
||||
|
||||
if(CPACK_GENERATOR STREQUAL "DEB")
|
||||
CONFIGURE_FILE("${CMAKE_SOURCE_DIR}/cmake/Packaging/fixup_deb_permissions.sh.in" "${CMAKE_CURRENT_BINARY_DIR}/fixup_deb_permissions.sh" @ONLY IMMEDIATE)
|
||||
endif(CPACK_GENERATOR STREQUAL "DEB")
|
||||
|
||||
if(CPACK_GENERATOR STREQUAL "DEB")
|
||||
CONFIGURE_FILE("${CMAKE_SOURCE_DIR}/cmake/Packaging/fixup_deb_permissions.sh.in" "${CMAKE_CURRENT_BINARY_DIR}/scripts/fixup_deb_permissions.sh" @ONLY IMMEDIATE)
|
||||
FILE(COPY ${CMAKE_CURRENT_BINARY_DIR}/scripts/fixup_deb_permissions.sh DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}/
|
||||
FILE_PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)
|
||||
endif(CPACK_GENERATOR STREQUAL "DEB")
|
||||
|
||||
|
||||
include(CPack)
|
||||
|
10
cmake/Packaging/fixup_deb_permissions.sh.in
Normal file
10
cmake/Packaging/fixup_deb_permissions.sh.in
Normal file
@ -0,0 +1,10 @@
|
||||
#!/bin/sh
|
||||
set -e
|
||||
mkdir fix_up_deb
|
||||
dpkg-deb -x @CPACK_PACKAGE_FILE_NAME@.deb fix_up_deb_permissions
|
||||
dpkg-deb --control @CPACK_PACKAGE_FILE_NAME@.deb fix_up_deb_permissions/DEBIAN
|
||||
rm @CPACK_PACKAGE_FILE_NAME@.deb
|
||||
chmod 0644 fix_up_deb_permissions/DEBIAN/md5sums
|
||||
find -type d -print0 |xargs -0 chmod 755
|
||||
fakeroot dpkg -b fix_up_deb_permissions @CPACK_PACKAGE_FILE_NAME@.deb
|
||||
rm -rf fix_up_deb_permissions
|
4
cmake/Packaging/postinst.in
Normal file
4
cmake/Packaging/postinst.in
Normal file
@ -0,0 +1,4 @@
|
||||
#!/bin/sh
|
||||
set -e
|
||||
chmod +x @TARGET_INSTALL_DESTINATION@/bin/@PROJECT_NAME@
|
||||
chmod +x @TARGET_INSTALL_DESTINATION@/bin/volk_gnsssdr_profile
|
10
cmake/Packaging/prerm.in
Normal file
10
cmake/Packaging/prerm.in
Normal file
@ -0,0 +1,10 @@
|
||||
#!/bin/sh
|
||||
set -e
|
||||
if test -e @CMAKE_INSTALL_PREFIX@/@PROJECT_NAME@ ; then
|
||||
rm @CMAKE_INSTALL_PREFIX@/@PROJECT_NAME@
|
||||
rm @CMAKE_INSTALL_PREFIX@/volk_gnsssdr_profile
|
||||
fi
|
||||
if test -e @CMAKE_INSTALL_PREFIX@/etc/@PROJECT_NAME@ ; then
|
||||
rm @CMAKE_INSTALL_PREFIX@/etc/@PROJECT_NAME@
|
||||
fi
|
||||
|
Loading…
Reference in New Issue
Block a user