diff options
author | Mauro Sardara <msardara+fdio@cisco.com> | 2017-04-29 17:56:10 +0200 |
---|---|---|
committer | Mauro Sardara <msardara+fdio@cisco.com> | 2017-04-29 16:36:25 +0000 |
commit | 45cbd1b86e6365c50e75da122040b5d57127ebe5 (patch) | |
tree | a3d91469491d51da29fd181f85db7a933cefd3ee /libccnx-common | |
parent | fe3052d3a135ec679fb38e915adbd0554f565674 (diff) |
Adding support for dev and doc packages
Change-Id: I4c7af976dabd7974d997d9e0bacd5444a9b09694
Signed-off-by: Mauro Sardara <msardara+fdio@cisco.com>
Diffstat (limited to 'libccnx-common')
-rw-r--r-- | libccnx-common/.gitignore | 2 | ||||
-rw-r--r-- | libccnx-common/CMakeLists.txt | 96 | ||||
-rw-r--r-- | libccnx-common/ccnx/common/CMakeLists.txt | 16 | ||||
-rw-r--r-- | libccnx-common/documentation/CMakeLists.txt | 8 | ||||
-rw-r--r-- | libccnx-common/scripts/build-package.sh | 56 |
5 files changed, 91 insertions, 87 deletions
diff --git a/libccnx-common/.gitignore b/libccnx-common/.gitignore index c97454e4..9d34f6aa 100644 --- a/libccnx-common/.gitignore +++ b/libccnx-common/.gitignore @@ -20,7 +20,6 @@ conf.mk *.a *.la .libs -conf.mk .deps config.log config.h @@ -35,7 +34,6 @@ transport/common/test/test_keyvalue transport/transport_rta/test/test_multi_connections transport/transport_rta/test/rtatest transport/transport_rta/test/test_bent_pipe -transport/transport_rta/test/test_multi_connections transport/transport_rta/test/x transport/transport_rta/test/y transport/transport_rta/tlv/test/x diff --git a/libccnx-common/CMakeLists.txt b/libccnx-common/CMakeLists.txt index 4557abba..ea15ce2a 100644 --- a/libccnx-common/CMakeLists.txt +++ b/libccnx-common/CMakeLists.txt @@ -77,46 +77,76 @@ add_subdirectory(documentation) 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) +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)") + 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) + + set(CPACK_${TYPE}_LIBRARY_PACKAGE_DEPENDS "longbow (>= 1.0), libparc (>= 1.0)") + set(CPACK_${TYPE}_HEADERS_PACKAGE_DEPENDS "libccnx-common (>= 1.0), longbow-dev (>= 1.0), libparc-dev (>= 1.0)") + 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") + 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") + set(CPACK_${TYPE}_HEADERS_PACKAGE_REQUIRES "libccnx-common >= 1.0, longbow-devel >= 1.0, libparc-devel >= 1.0") + 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 "The CCNx Common library is a set of functions and data structures for CCNx.") -SET(CPACK_${TYPE}_PACKAGE_HOMEPAGE "https://wiki.fd.io/view/Ccnxlib") - -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 "The CCNx Common library is a set of functions and data structures for CCNx.") +set(CPACK_${TYPE}_PACKAGE_HOMEPAGE "https://wiki.fd.io/view/Ccnxlib") + +include(CPack) diff --git a/libccnx-common/ccnx/common/CMakeLists.txt b/libccnx-common/ccnx/common/CMakeLists.txt index 3f21b095..66d82a44 100644 --- a/libccnx-common/ccnx/common/CMakeLists.txt +++ b/libccnx-common/ccnx/common/CMakeLists.txt @@ -253,17 +253,17 @@ set(libccnx_commonLibraries ) foreach(lib ${libccnx_commonLibraries}) - install(TARGETS ${lib} LIBRARY DESTINATION lib ARCHIVE DESTINATION lib) + install(TARGETS ${lib} COMPONENT library LIBRARY DESTINATION lib ARCHIVE DESTINATION lib) set_property(TARGET ${lib} PROPERTY C_STANDARD 99) endforeach() -install(FILES ${CORE_HDRS} DESTINATION ${CMAKE_INSTALL_PREFIX}/include/ccnx/common ) -install(FILES ${INTERNAL_HDRS} DESTINATION ${CMAKE_INSTALL_PREFIX}/include/ccnx/common/internal ) -install(FILES ${VALIDATION_HDRS} DESTINATION ${CMAKE_INSTALL_PREFIX}/include/ccnx/common/validation ) -install(FILES ${CODEC_HDRS} DESTINATION ${CMAKE_INSTALL_PREFIX}/include/ccnx/common/codec ) -install(FILES ${TESTDATA_HDRS} DESTINATION ${CMAKE_INSTALL_PREFIX}/include/ccnx/common/codec/testdata ) -install(FILES ${SCHEMAV1_HDRS} DESTINATION ${CMAKE_INSTALL_PREFIX}/include/ccnx/common/codec/schema_v1 ) -install(FILES ${SCHEMAV1_TESTDATA_HDRS} DESTINATION ${CMAKE_INSTALL_PREFIX}/include/ccnx/common/codec/schema_v1/testdata ) +install(FILES ${CORE_HDRS} DESTINATION ${CMAKE_INSTALL_PREFIX}/include/ccnx/common COMPONENT headers) +install(FILES ${INTERNAL_HDRS} DESTINATION ${CMAKE_INSTALL_PREFIX}/include/ccnx/common/internal COMPONENT headers) +install(FILES ${VALIDATION_HDRS} DESTINATION ${CMAKE_INSTALL_PREFIX}/include/ccnx/common/validation COMPONENT headers) +install(FILES ${CODEC_HDRS} DESTINATION ${CMAKE_INSTALL_PREFIX}/include/ccnx/common/codec COMPONENT headers) +install(FILES ${TESTDATA_HDRS} DESTINATION ${CMAKE_INSTALL_PREFIX}/include/ccnx/common/codec/testdata COMPONENT headers) +install(FILES ${SCHEMAV1_HDRS} DESTINATION ${CMAKE_INSTALL_PREFIX}/include/ccnx/common/codec/schema_v1 COMPONENT headers) +install(FILES ${SCHEMAV1_TESTDATA_HDRS} DESTINATION ${CMAKE_INSTALL_PREFIX}/include/ccnx/common/codec/schema_v1/testdata COMPONENT headers) #add_subdirectory(test) #add_subdirectory(validation/test) diff --git a/libccnx-common/documentation/CMakeLists.txt b/libccnx-common/documentation/CMakeLists.txt index e18939fa..1f3d722d 100644 --- a/libccnx-common/documentation/CMakeLists.txt +++ b/libccnx-common/documentation/CMakeLists.txt @@ -6,10 +6,10 @@ if(DOXYGEN_FOUND) configure_file(libccnx-stage1.doxygen.in config.doxygen @ONLY) configure_file(libccnx-stage2.doxygen.in config2.doxygen @ONLY) - install(DIRECTORY images/ DESTINATION ${CMAKE_INSTALL_PREFIX}/share/libccnx-common/images) - install(DIRECTORY doxygen-extras/ DESTINATION ${CMAKE_INSTALL_PREFIX}/share/libccnx-common/doxygen-extras) - install(DIRECTORY examples/ DESTINATION ${CMAKE_INSTALL_PREFIX}/share/libccnx-common/examples) - install(FILES DoxygenLayout.xml DESTINATION ${CMAKE_INSTALL_PREFIX}/share/libccnx-common) + install(DIRECTORY images/ DESTINATION ${CMAKE_INSTALL_PREFIX}/share/libccnx-common/images COMPONENT documentation) + install(DIRECTORY doxygen-extras/ DESTINATION ${CMAKE_INSTALL_PREFIX}/share/libccnx-common/doxygen-extras COMPONENT documentation) + install(DIRECTORY examples/ DESTINATION ${CMAKE_INSTALL_PREFIX}/share/libccnx-common/examples COMPONENT documentation) + install(FILES DoxygenLayout.xml DESTINATION ${CMAKE_INSTALL_PREFIX}/share/libccnx-common COMPONENT documentation) set(HTML_PATH ${CMAKE_CURRENT_BINARY_DIR}/generated-documentation/html) diff --git a/libccnx-common/scripts/build-package.sh b/libccnx-common/scripts/build-package.sh index 7a057087..0b7792fa 100644 --- a/libccnx-common/scripts/build-package.sh +++ b/libccnx-common/scripts/build-package.sh @@ -7,43 +7,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" +DEPS_UBUNTU="$LIBSSL_LIBEVENT_UBUNTU longbow-dev libparc-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" +DEPS_CENTOS="$LIBSSL_LIBEVENT_CENTOS longbow-devel libparc-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: @@ -126,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 } @@ -189,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 |