diff options
author | Mauro Sardara <msardara+fdio@cisco.com> | 2017-04-29 21:14:25 +0200 |
---|---|---|
committer | Mauro Sardara <msardara+fdio@cisco.com> | 2017-04-29 22:11:51 +0200 |
commit | 844daaec88924ba1f374c7bd8fd69692904012ed (patch) | |
tree | 0d8bca1560ee58cc227e9386758f23def4147bd6 | |
parent | 307d69f67c01dbf05b1da447589645713d6ca27b (diff) |
Adding dev and doc package support.
Change-Id: I89b4aa6598d88226a1eafd6b7240a30be3d795c3
Signed-off-by: Mauro Sardara <msardara+fdio@cisco.com>
-rw-r--r-- | CMakeLists.txt | 115 | ||||
-rwxr-xr-x | apps/consumers/CMakeLists.txt | 6 | ||||
-rw-r--r-- | apps/iping/CMakeLists.txt | 4 | ||||
-rwxr-xr-x | apps/producers/CMakeLists.txt | 2 | ||||
-rwxr-xr-x | apps/producers/icnet_producer_test.cc | 2 | ||||
-rw-r--r-- | icnet/CMakeLists.txt | 8 | ||||
-rw-r--r-- | scripts/build-package.sh | 59 |
7 files changed, 101 insertions, 95 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index f1f8bf93..8cd83945 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -88,14 +88,14 @@ else () endif (ANDROID_API) set(LIBRARIES - ${CCNX_PORTAL_LIBRARIES} - ${CCNX_TRANSPORT_RTA_LIBRARIES} - ${CCNX_COMMON_LIBRARIES} - ${LIBPARC_LIBRARIES} - ${Boost_LIBRARIES} - ${CMAKE_THREAD_LIBS_INIT} - ${LONGBOW_LIBRARIES} - ${ANDROID_LIBRARIES}) + ${CCNX_PORTAL_LIBRARIES} + ${CCNX_TRANSPORT_RTA_LIBRARIES} + ${CCNX_COMMON_LIBRARIES} + ${LIBPARC_LIBRARIES} + ${Boost_LIBRARIES} + ${CMAKE_THREAD_LIBS_INIT} + ${LONGBOW_LIBRARIES} + ${ANDROID_LIBRARIES}) set(SUBFOLDERS ${SUBFOLDERS} icnet) @@ -106,46 +106,77 @@ subdirs(${SUBFOLDERS}) option(DEB_PACKAGE "Create deb package" OFF) option(RPM_PACKAGE "Create deb package" OFF) -SET(VENDOR "Cisco Systems" CACHE STRING "Vendor") -SET(CONTACT "msardara@cisco.com" CACHE STRING "Contact") -SET(DISTRIBUTION "xenial" CACHE STRING "Distribution") -SET(ARCHITECTURE "amd64" CACHE STRING "Architecture") -SET(PACKAGE_MAINTAINER "Mauro Sardara (msardara@cisco.com)" CACHE STRING "Maintainer") -SET(BUILD_NUMBER "1" CACHE STRING "Build Number") -STRING(TOLOWER ${CMAKE_PROJECT_NAME} PACKAGE_NAME) - -SET(CPACK_PACKAGING_INSTALL_PREFIX "/usr") -SET(CPACK_PACKAGE_VENDOR ${VENDOR}) -SET(CPACK_PACKAGE_CONTACT ${CONTACT}) +set(VENDOR "Cisco Systems" CACHE STRING "Vendor") +set(CONTACT "msardara@cisco.com" CACHE STRING "Contact") +set(DISTRIBUTION "xenial" CACHE STRING "Distribution") +set(ARCHITECTURE "amd64" CACHE STRING "Architecture") +set(PACKAGE_MAINTAINER "Mauro Sardara (msardara@cisco.com)" CACHE STRING "Maintainer") +string(TOLOWER ${CMAKE_PROJECT_NAME} PACKAGE_NAME) +set(CPACK_PACKAGING_INSTALL_PREFIX "/usr") +set(CPACK_PACKAGE_VENDOR ${VENDOR}) +set(CPACK_PACKAGE_CONTACT ${CONTACT}) +set(CPACK_COMPONENTS_ALL library headers documentation) # Get the version execute_process(COMMAND bash ${CMAKE_SOURCE_DIR}/scripts/version - OUTPUT_VARIABLE PACKAGE_VERSION) -string(STRIP ${PACKAGE_VERSION} PACKAGE_VERSION) + OUTPUT_VARIABLE PACKAGE_VERSION) + +if (PACKAGE_VERSION) + string(STRIP ${PACKAGE_VERSION} PACKAGE_VERSION) +else() + set(PACKAGE_VERSION 1.0) +endif() if(DEB_PACKAGE) - SET(TYPE "DEBIAN") - SET(GENERATOR "DEB") - SET(CPACK_PACKAGE_FILE_NAME "${PACKAGE_NAME}_${PACKAGE_VERSION}_${ARCHITECTURE}") - SET(CPACK_${TYPE}_PACKAGE_DEPENDS "longbow (>= 1.0), libevent-2.0-5, libssl1.0.0, libparc (>= 1.0), libccnx-common (>= 1.0), libccnx-transport-rta (>= 1.0), libccnx-portal (>= 1.0), libboost-system-dev (>= 1.53)") + set(TYPE "DEBIAN") + set(GENERATOR "DEB") + + set(CPACK_${TYPE}_LIBRARY_PACKAGE_NAME "${PACKAGE_NAME}") + set(CPACK_${TYPE}_HEADERS_PACKAGE_NAME "${PACKAGE_NAME}-dev") + set(CPACK_${TYPE}_DOCUMENTATION_PACKAGE_NAME "${PACKAGE_NAME}-doc") + + set(CPACK_${TYPE}_LIBRARY_FILE_NAME "${PACKAGE_NAME}_${PACKAGE_VERSION}_${ARCHITECTURE}.deb") + set(CPACK_${TYPE}_HEADERS_FILE_NAME "${PACKAGE_NAME}-dev_${PACKAGE_VERSION}_${ARCHITECTURE}.deb") + set(CPACK_${TYPE}_DOCUMENTATION_FILE_NAME "${PACKAGE_NAME}-doc_${PACKAGE_VERSION}_${ARCHITECTURE}.deb") + + set(CPACK_DEBIAN_LIBRARY_PACKAGE_SHLIBDEPS ON) + + # No boost deps here. Let shlibdeps discover it. + set(CPACK_${TYPE}_LIBRARY_PACKAGE_DEPENDS "longbow (>= 1.0), libparc (>= 1.0), libccnx-common (>= 1.0), libccnx-transport-rta (>= 1.0), libccnx-portal (>= 1.0)") + set(CPACK_${TYPE}_HEADERS_PACKAGE_DEPENDS "libccnx-common-dev (>= 1.0), libicnet (>= 1.0), libccnx-portal-dev (>= 1.0), libccnx-transport-rta-dev (>=1.0), libboost-system-dev (>= 1.53), libparc-dev (>= 1.0), longbow-dev (>= 1.0), libboost-system-dev (>= 1.53)") + set(CPACK_${TYPE}_DOCUMENTATION_PACKAGE_DEPENDS "") elseif(RPM_PACKAGE) - SET(TYPE "RPM") - SET(GENERATOR "RPM") - SET(CPACK_PACKAGE_FILE_NAME "${PACKAGE_NAME}-${PACKAGE_VERSION}.${ARCHITECTURE}") - SET(CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST_ADDITION "/usr/etc" "/usr/lib/python2.7" "/usr/lib/python2.7/site-packages") - SET(CPACK_${TYPE}_PACKAGE_REQUIRES "longbow >= 1.0, libevent >= 2.0, openssl >= 1.0, libparc >= 1.0, libccnx-common >= 1.0, libccnx-transport-rta >= 1.0, libccnx-portal >= 1.0, boost-system >= 1.53") + set(TYPE "RPM") + set(GENERATOR "RPM") + + set(CPACK_${TYPE}_LIBRARY_PACKAGE_NAME "${PACKAGE_NAME}") + set(CPACK_${TYPE}_HEADERS_PACKAGE_NAME "${PACKAGE_NAME}-devel") + set(CPACK_${TYPE}_DOCUMENTATION_PACKAGE_NAME "${PACKAGE_NAME}-doc") + + set(CPACK_${TYPE}_LIBRARY_FILE_NAME "${PACKAGE_NAME}-${PACKAGE_VERSION}.${ARCHITECTURE}.rpm") + set(CPACK_${TYPE}_HEADERS_FILE_NAME "${PACKAGE_NAME}-devel-${PACKAGE_VERSION}.${ARCHITECTURE}.rpm") + set(CPACK_${TYPE}_DOCUMENTATION_FILE_NAME "${PACKAGE_NAME}-doc-${PACKAGE_VERSION}.${ARCHITECTURE}.rpm") + + set(CPACK_${TYPE}_LIBRARY_PACKAGE_AUTOREQ ON) + + set(CPACK_${TYPE}_LIBRARY_PACKAGE_REQUIRES "longbow >= 1.0, libparc >= 1.0, libccnx-common >= 1.0, libccnx-transport-rta >= 1.0, libccnx-portal >= 1.0, boost-system >= 1.53") + set(CPACK_${TYPE}_HEADERS_PACKAGE_REQUIRES "libicnet >= 1.0, libccnx-common-devel >= 1.0, libccnx-portal-devel >= 1.0, libccnx-transport-rta-devel >=1.0, libparc-devel >= 1.0, longbow-devel >= 1.0, boost-devel >= 1.53") + set(CPACK_${TYPE}_DOCUMENTATION_PACKAGE_REQUIRES "") + + set(CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST_ADDITION "/usr/etc" "/usr/lib/python2.7" "/usr/lib/python2.7/site-packages") else() - RETURN() + return() endif() -SET(CPACK_GENERATOR ${GENERATOR}) -SET(CPACK_${TYPE}_PACKAGE_MAINTAINER ${PACKAGE_MAINTAINER}) -SET(CPACK_${TYPE}_PACKAGE_NAME ${PACKAGE_NAME}) -SET(CPACK_${TYPE}_PACKAGE_VERSION ${PACKAGE_VERSION}) -SET(CPACK_${TYPE}_PACKAGE_ARCHITECTURE ${ARCHITECTURE}) -SET(CPACK_${TYPE}_PACKAGE_RELEASE 1) -SET(CPACK_${TYPE}_PACKAGE_VENDOR ${VENDOR}) -SET(CPACK_${TYPE}_PACKAGE_DESCRIPTION "This library is designed to provide a transport layer for applications willing to communicate using an ICN protocol stack.") -SET(CPACK_${TYPE}_PACKAGE_HOMEPAGE "https://wiki.fd.io/view/Libicnet") - -INCLUDE(CPack) +set(CPACK_GENERATOR ${GENERATOR}) +set(CPACK_${GENERATOR}_COMPONENT_INSTALL ON) +set(CPACK_${TYPE}_PACKAGE_MAINTAINER ${PACKAGE_MAINTAINER}) +set(CPACK_${TYPE}_PACKAGE_NAME ${PACKAGE_NAME}) +set(CPACK_${TYPE}_PACKAGE_VERSION ${PACKAGE_VERSION}) +set(CPACK_${TYPE}_PACKAGE_ARCHITECTURE ${ARCHITECTURE}) +set(CPACK_${TYPE}_PACKAGE_RELEASE 1) +set(CPACK_${TYPE}_PACKAGE_VENDOR ${VENDOR}) +set(CPACK_${TYPE}_PACKAGE_DESCRIPTION "This library is designed to provide a transport layer for applications willing to communicate using an ICN protocol stack.") +set(CPACK_${TYPE}_PACKAGE_HOMEPAGE "https://wiki.fd.io/view/Libicnet") + +include(CPack) diff --git a/apps/consumers/CMakeLists.txt b/apps/consumers/CMakeLists.txt index b9314060..68e79834 100755 --- a/apps/consumers/CMakeLists.txt +++ b/apps/consumers/CMakeLists.txt @@ -25,6 +25,6 @@ target_link_libraries(consumer-test icnet ${CMAKE_THREAD_LIBS_INIT} ${Boost_LIBR target_link_libraries(iget icnet ${CMAKE_THREAD_LIBS_INIT} ${Boost_LIBRARIES}) target_link_libraries(consumer-dash icnet ${CMAKE_THREAD_LIBS_INIT} ${Boost_LIBRARIES}) -install(TARGETS consumer-test DESTINATION ${CMAKE_INSTALL_PREFIX}/bin) -install(TARGETS iget DESTINATION ${CMAKE_INSTALL_PREFIX}/bin) -install(TARGETS consumer-dash DESTINATION ${CMAKE_INSTALL_PREFIX}/bin) +install(TARGETS consumer-test DESTINATION ${CMAKE_INSTALL_PREFIX}/bin COMPONENT library) +install(TARGETS iget DESTINATION ${CMAKE_INSTALL_PREFIX}/bin COMPONENT library) +install(TARGETS consumer-dash DESTINATION ${CMAKE_INSTALL_PREFIX}/bin COMPONENT library) diff --git a/apps/iping/CMakeLists.txt b/apps/iping/CMakeLists.txt index 5bd2ec5f..b2fa4874 100644 --- a/apps/iping/CMakeLists.txt +++ b/apps/iping/CMakeLists.txt @@ -43,8 +43,8 @@ link_directories(${CCNX_HOME}/lib) add_executable(iPing_Client ${CCNX_PING_CLIENT_SOURCE_FILES}) target_link_libraries(iPing_Client ${CCNX_LIBRARIES}) -install(TARGETS iPing_Client RUNTIME DESTINATION bin) +install(TARGETS iPing_Client RUNTIME DESTINATION bin COMPONENT library) add_executable(iPing_Server ${CCNX_PING_SERVER_SOURCE_FILES}) target_link_libraries(iPing_Server ${CCNX_LIBRARIES}) -install(TARGETS iPing_Server RUNTIME DESTINATION bin) +install(TARGETS iPing_Server RUNTIME DESTINATION bin COMPONENT library) diff --git a/apps/producers/CMakeLists.txt b/apps/producers/CMakeLists.txt index c478bf53..9259394e 100755 --- a/apps/producers/CMakeLists.txt +++ b/apps/producers/CMakeLists.txt @@ -19,4 +19,4 @@ set(PRODUCER_SOURCE_FILES add_executable(producer-test ${PRODUCER_SOURCE_FILES}) target_link_libraries(producer-test icnet ${CMAKE_THREAD_LIBS_INIT} ${Boost_LIBRARIES}) -install(TARGETS producer-test DESTINATION ${CMAKE_INSTALL_PREFIX}/bin) +install(TARGETS producer-test DESTINATION ${CMAKE_INSTALL_PREFIX}/bin COMPONENT library) diff --git a/apps/producers/icnet_producer_test.cc b/apps/producers/icnet_producer_test.cc index 6add25d3..c122090a 100755 --- a/apps/producers/icnet_producer_test.cc +++ b/apps/producers/icnet_producer_test.cc @@ -25,7 +25,7 @@ class CallbackContainer { : buffer_(1400, 'X'), final_chunk_number_(0) { content_object_.setContent((uint8_t *) buffer_.c_str(), 1400); if (download_size > 0) { - final_chunk_number_ = static_cast<uint64_t>(std::ceil(download_size / 1400)); + final_chunk_number_ = static_cast<uint64_t>(std::ceil(download_size / 1400.0)); } } diff --git a/icnet/CMakeLists.txt b/icnet/CMakeLists.txt index 81252a5c..fae22d61 100644 --- a/icnet/CMakeLists.txt +++ b/icnet/CMakeLists.txt @@ -69,9 +69,9 @@ set(libicnet_libraries icnet.shared) foreach(lib ${libicnet_libraries}) - install(TARGETS ${lib} LIBRARY DESTINATION ${CMAKE_INSTALL_PREFIX}/lib ARCHIVE DESTINATION ${CMAKE_INSTALL_PREFIX}/lib) + install(TARGETS ${lib} COMPONENT library LIBRARY DESTINATION ${CMAKE_INSTALL_PREFIX}/lib ARCHIVE DESTINATION ${CMAKE_INSTALL_PREFIX}/lib) endforeach() -install(FILES ${HEADER_FILES} DESTINATION ${CMAKE_INSTALL_PREFIX}/include/icnet) -install(FILES ${ICNET_HEADER_FILES} DESTINATION ${CMAKE_INSTALL_PREFIX}/include/icnet) -install(FILES ${ICNET_CONFIG} DESTINATION ${CMAKE_INSTALL_PREFIX}/etc/) +install(FILES ${HEADER_FILES} DESTINATION ${CMAKE_INSTALL_PREFIX}/include/icnet COMPONENT headers) +install(FILES ${ICNET_HEADER_FILES} DESTINATION ${CMAKE_INSTALL_PREFIX}/include/icnet COMPONENT headers) +install(FILES ${ICNET_CONFIG} DESTINATION ${CMAKE_INSTALL_PREFIX}/etc/ COMPONENT library) diff --git a/scripts/build-package.sh b/scripts/build-package.sh index 9673438a..f4fb67ea 100644 --- a/scripts/build-package.sh +++ b/scripts/build-package.sh @@ -1,5 +1,4 @@ #!/bin/bash -# basic build script example set -euxo pipefail IFS=$'\n\t' @@ -7,43 +6,27 @@ SCRIPT_PATH=$( cd "$(dirname "${BASH_SOURCE}")" ; pwd -P ) APT_PATH=`which apt-get` || true apt_get=${APT_PATH:-"/usr/local/bin/apt-get"} -BUILD_TOOLS_UBUNTU="build-essential cmake" +BUILD_TOOLS_UBUNTU="build-essential doxygen" LIBSSL_LIBEVENT_UBUNTU="libevent-dev libssl-dev" -DEPS_UBUNTU="$LIBSSL_LIBEVENT_UBUNTU longbow libparc libccnx-common libccnx-transport-rta libccnx-portal libboost-system-dev" +DEPS_UBUNTU="$LIBSSL_LIBEVENT_UBUNTU longbow-dev libparc-dev libccnx-common-dev libccnx-transport-rta-dev libccnx-portal-dev libboost-system-dev" BUILD_TOOLS_GROUP_CENTOS="'Development Tools'" -BUILD_TOOLS_SINGLE_CENTOS="cmake" LIBSSL_LIBEVENT_CENTOS="libevent-devel openssl-devel" -DEPS_CENTOS="$LIBSSL_LIBEVENT_CENTOS longbow libparc libccnx-common libccnx-transport-rta libccnx-portal boost-devel" +DEPS_CENTOS="$LIBSSL_LIBEVENT_CENTOS longbow-devel libparc-devel libccnx-common-devel libccnx-transport-rta-devel libccnx-portal-devel boost-devel" -# Parameters: -# $1 = Distribution [Trusty / CentOS] -# update_cmake_repo() { - DISTRIBUTION=$1 + cat /etc/resolv.conf + echo "nameserver 8.8.8.8" | sudo tee -a /etc/resolv.conf + cat /etc/resolv.conf - if [ "$DISTRIBUTION" == "trusty" ]; then - sudo ${apt_get} install -y --allow-unauthenticated software-properties-common - sudo add-apt-repository --yes ppa:george-edison55/cmake-3.x - elif [ "$DISTRIBUTION" == "CentOS" ]; then - sudo cat << EOF > cmake.repo -[cmake-repo] -name=Repo for cmake3 -baseurl=http://mirror.ghettoforge.org/distributions/gf/el/7/plus/x86_64/ -enabled=1 -gpgcheck=0 -EOF - sudo cat << EOF > jsoncpp.repo -[jsoncp-repo] -name=Repo for jsoncpp -baseurl=http://dl.fedoraproject.org/pub/epel/7/x86_64/ -enabled=1 -gpgcheck=0 -EOF - sudo mv cmake.repo /etc/yum.repos.d/cmake.repo - sudo mv jsoncpp.repo /etc/yum.repos.d/jsoncpp.repo - fi + CMAKE_INSTALL_SCRIPT_URL="https://cmake.org/files/v3.8/cmake-3.8.0-Linux-x86_64.sh" + CMAKE_INSTALL_SCRIPT="/tmp/install_cmake.sh" + curl ${CMAKE_INSTALL_SCRIPT_URL} > ${CMAKE_INSTALL_SCRIPT} + + sudo mkdir -p /opt/cmake + sudo bash ${CMAKE_INSTALL_SCRIPT} --skip-license --prefix=/opt/cmake + export PATH=/opt/cmake/bin:$PATH } # Parameters: @@ -127,18 +110,11 @@ setup() { DISTRIB_ID=$1 DISTRIB_CODENAME=$2 - if [ "$DISTRIB_ID" == "Ubuntu" ]; then - if [ "$DISTRIB_CODENAME" == "trusty" ]; then - update_cmake_repo $DISTRIB_CODENAME - fi - - update_fdio_repo $DISTRIB_ID $DISTRIB_CODENAME + update_cmake_repo + update_fdio_repo $DISTRIB_ID $DISTRIB_CODENAME + if [ "$DISTRIB_ID" == "Ubuntu" ]; then sudo ${apt_get} update || true - - elif [ "$DISTRIB_ID" == "CentOS" ]; then - update_cmake_repo $DISTRIB_ID - update_fdio_repo $DISTRIB_ID $DISTRIB_CODENAME fi } @@ -190,7 +166,6 @@ build_package() { echo $BUILD_TOOLS_UBUNTU $DEPS_UBUNTU | xargs sudo ${apt_get} install -y --allow-unauthenticated elif [ $DISTRIB_ID == "CentOS" ]; then echo $BUILD_TOOLS_GROUP_CENTOS | xargs sudo yum groupinstall -y --nogpgcheck - echo $BUILD_TOOLS_SINGLE_CENTOS | xargs sudo yum install -y --nogpgcheck echo $DEPS_CENTOS | xargs sudo yum install -y --nogpgcheck || true fi @@ -218,4 +193,4 @@ build_package() { PACKAGE_NAME="LIBICNET" pushd $SCRIPT_PATH/.. build_package $PACKAGE_NAME -popd
\ No newline at end of file +popd |