Skip to content

Commit

Permalink
Initial deb package support via cmake.
Browse files Browse the repository at this point in the history
  • Loading branch information
TimEvens committed Sep 7, 2014
1 parent cc3b952 commit 56d0c67
Show file tree
Hide file tree
Showing 2 changed files with 76 additions and 1 deletion.
11 changes: 10 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
# cmake file for openbmpd

# Define the version
set (OPENBMPD_VERSION "0.8.0-pre")
set (OPENBMP_VER_MAJOR "0")
set (OPENBMP_VER_MINOR "8")
set (OPENBMP_VER_PATCH "0-pre")
set (OPENBMPD_VERSION "${OPENBMP_VER_MAJOR}.${OPENBMP_VER_MINOR}.${OPENBMP_VER_PATCH}")

cmake_minimum_required (VERSION 2.8)
project (OPENBMP)
Expand All @@ -19,3 +22,9 @@ include_directories( ${CMAKE_BINARY_DIR}/generated/ )
# Add the Server directory
add_subdirectory (Server)

FIND_PROGRAM(DPKG_CMD dpkg)
IF(DPKG_CMD)
add_subdirectory (deb_package)
ENDIF(DPKG_CMD)


66 changes: 66 additions & 0 deletions deb_package/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
INCLUDE(InstallRequiredSystemLibraries)

SET(CPACK_GENERATOR "DEB")

IF(NOT UNIX)
MESSAGE(FATAL_ERROR "Can only be run under Unix.")
ENDIF(NOT UNIX)

#
# Define standard control properties
#
SET (CPACK_PACKAGE_NAME "openbmp")
SET (CPACK_PACKAGE_VERSION_MAJOR ${OPENBMP_VER_MAJOR})
SET (CPACK_PACKAGE_VERSION_MINOR ${OPENBMP_VER_MINOR})
SET (CPACK_PACKAGE_VERSION_PATCH ${OPENBMP_VER_PATCH})
SET (CPACK_DEBIAN_PACKAGE_VERSION ${OPENBMPD_VERSION})
SET (CPACK_DEBIAN_PACKAGE_MAINTAINER "www.openbmp.org")
SET (CPACK_DEBIAN_PACKAGE_DESCRIPTION "Open BGP monitoring protocol (OpenBMP) collector server. Receives BMP messages and stores them for real-time and historical analytics.")
SET (CPACK_DEBIAN_PACKAGE_SECTION "main")

#
# Set the architecture
#
FIND_PROGRAM(DPKG_CMD dpkg)
IF(NOT DPKG_CMD)
MESSAGE(STATUS "Can not find dpkg in your path, default to i386.")
SET(CPACK_DEBIAN_PACKAGE_ARCHITECTURE i386)
ENDIF(NOT DPKG_CMD)
EXECUTE_PROCESS(COMMAND "${DPKG_CMD}" --print-architecture
OUTPUT_VARIABLE CPACK_DEBIAN_PACKAGE_ARCHITECTURE
OUTPUT_STRIP_TRAILING_WHITESPACE
)

#
# Define the depends
#
#set (CPACK_DEBIAN_PACKAGE_DEPENDS "libstdc++6 (>= 4.6), libmysqlcppconn7 (>= 1.1.3), libc6 (>= 2.14)")
set (CPACK_DEBIAN_PACKAGE_SHLIBDEPS ON)


#
# Define the extras (post/pre install, etc.)
#
#SET (CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA "${CMAKE_CURRENT_SOURCE_DIR}/deb_package/postinst;${CMAKE_CURRENT_SOURCE_DIR}/deb_package/prerm;" )

#
# Set the package config filename
#
SET (CPACK_OUTPUT_CONFIG_FILE "${CMAKE_CURRENT_SOURCE_DIR}/debPackageConfig.cmake")
SET (CPACK_SOURCE_OUTPUT_CONFIG_FILE "${CMAKE_CURRENT_SOURCE_DIR}/debPackageSourceConfig.cmake")

# Define the package filename

SET(CPACK_SOURCE_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}-${OPENBMP_VERSION}-src")
SET(CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}-${OPENBMPD_VERSION}")

add_custom_target(deb_package
COMMAND "${CMAKE_CPACK_COMMAND}"
"--config" "${CMAKE_CURRENT_SOURCE_DIR}/debPackageConfig.cmake")


#
# include cpack module last (loads the config)
#
INCLUDE(CPack)

0 comments on commit 56d0c67

Please sign in to comment.