diff options
author | Mauro Sardara <msardara+fdio@cisco.com> | 2017-04-29 20:39:24 +0200 |
---|---|---|
committer | Mauro Sardara <msardara+fdio@cisco.com> | 2017-04-29 18:43:08 +0000 |
commit | cdd6b2a782f50d635e5da73dd94ce39508ddcf19 (patch) | |
tree | e8a98080492333b0595f9395ad69eeb7a0054139 | |
parent | cf992f97d8e421417a8e8c26e6bc706473edcde0 (diff) |
Adding support for dev and doc packages.
Change-Id: Ie084c1db30436d754a6e3e0045c9659ef24603c9
Signed-off-by: Mauro Sardara <msardara+fdio@cisco.com>
-rw-r--r-- | libccnx-portal/.gitignore | 3 | ||||
-rw-r--r-- | libccnx-portal/CMakeLists.txt | 98 | ||||
-rw-r--r-- | libccnx-portal/ccnx/api/ccnx_Portal/CMakeLists.txt | 42 | ||||
-rw-r--r-- | libccnx-portal/ccnx/api/ccnx_Portal/command-line/CMakeLists.txt | 12 | ||||
-rw-r--r-- | libccnx-portal/ccnx/api/ccnx_Portal/test/CMakeLists.txt | 11 | ||||
-rw-r--r-- | libccnx-portal/scripts/build-package.sh | 56 |
6 files changed, 112 insertions, 110 deletions
diff --git a/libccnx-portal/.gitignore b/libccnx-portal/.gitignore index a70a103d..140cd67b 100644 --- a/libccnx-portal/.gitignore +++ b/libccnx-portal/.gitignore @@ -18,7 +18,6 @@ conf.mk *.a *.la .libs -conf.mk .deps config.log config.h @@ -28,13 +27,11 @@ config.status .dirstamp Makefile stamp-h1 -.DS_Store 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-portal/CMakeLists.txt b/libccnx-portal/CMakeLists.txt index 25e237e1..deca30ac 100644 --- a/libccnx-portal/CMakeLists.txt +++ b/libccnx-portal/CMakeLists.txt @@ -93,46 +93,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) -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)") + 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), libevent-2.0-5, libssl1.0.0, libparc (>= 1.0), libccnx-common (>= 1.0), libccnx-transport-rta (>= 1.0)") + set(CPACK_${TYPE}_HEADERS_PACKAGE_DEPENDS "libccnx-portal (>= 1.0), libccnx-transport-rta-dev (>= 1.0), libccnx-common-dev (>= 1.0), libparc-dev (>= 1.0), longbow-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, libccnx-common >= 1.0, libccnx-transport-rta >= 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, libevent-2.0-5, libssl1.0.0, libparc >= 1.0, libccnx-common >= 1.0, libccnx-transport-rta >= 1.0") + set(CPACK_${TYPE}_HEADERS_PACKAGE_REQUIRES "libccnx-portal >= 1.0, libccnx-transport-rta-devel >= 1.0, libccnx-common-devel >= 1.0, libparc-devel >= 1.0, longbow-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 Portal API is a simple API to communicate via Interests and Content Objects. It connects to a transport stack like Transport RTA (libccnx-transport-rta).") -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 Portal API is a simple API to communicate via Interests and Content Objects. It connects to a transport stack like Transport RTA (libccnx-transport-rta).") +set(CPACK_${TYPE}_PACKAGE_HOMEPAGE "https://wiki.fd.io/view/Ccnxlib") + +include(CPack) diff --git a/libccnx-portal/ccnx/api/ccnx_Portal/CMakeLists.txt b/libccnx-portal/ccnx/api/ccnx_Portal/CMakeLists.txt index b4d2a136..a7d9e8dd 100644 --- a/libccnx-portal/ccnx/api/ccnx_Portal/CMakeLists.txt +++ b/libccnx-portal/ccnx/api/ccnx_Portal/CMakeLists.txt @@ -3,36 +3,36 @@ configure_file(config.h.in config.h @ONLY) set(CCNX_API_PORTAL_HEADERS - ccnx_Portal.h - ccnx_PortalFactory.h - ccnx_PortalAttributes.h - ccnx_PortalStack.h - ccnx_PortalRTA.h - ccnx_PortalAPI.h - ccnx_PortalAnchor.h + ccnx_Portal.h + ccnx_PortalFactory.h + ccnx_PortalAttributes.h + ccnx_PortalStack.h + ccnx_PortalRTA.h + ccnx_PortalAPI.h + ccnx_PortalAnchor.h ccnxPortal_About.h ) set(CCNX_API_PORTAL_SOURCE_FILES ${CCNX_API_PORTAL_HEADERS} - ccnx_Portal.c - ccnx_PortalFactory.c - ccnx_PortalAttributes.c - ccnx_PortalStack.c - ccnx_PortalRTA.c - ccnx_PortalAPI.c - ccnx_PortalAnchor.c - ccnxPortal_About.c - ) + ccnx_Portal.c + ccnx_PortalFactory.c + ccnx_PortalAttributes.c + ccnx_PortalStack.c + ccnx_PortalRTA.c + ccnx_PortalAPI.c + ccnx_PortalAnchor.c + ccnxPortal_About.c + ) source_group(Sources FILES ${CCNX_API_PORTAL_SOURCE_FILES}) source_group(Sources FILES ${CCNX_API_PORTAL_HEADERS}) add_library(ccnx_api_portal STATIC ${CCNX_API_PORTAL_SOURCE_FILES} ${CCNX_API_PORTAL_HEADER_FILES}) add_library(ccnx_api_portal.shared SHARED ${CCNX_API_PORTAL_SOURCE_FILES}) -set_target_properties(ccnx_api_portal.shared PROPERTIES +set_target_properties(ccnx_api_portal.shared PROPERTIES C_STANDARD 99 - SOVERSION 1 + SOVERSION 1 VERSION 1.0 OUTPUT_NAME ccnx_api_portal ) @@ -42,11 +42,11 @@ set(libccnx_api_portal_libraries ) foreach(lib ${libccnx_api_portal_libraries}) - 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 ${CCNX_API_PORTAL_HEADERS} DESTINATION include/ccnx/api/ccnx_Portal ) - +install(FILES ${CCNX_API_PORTAL_HEADERS} DESTINATION include/ccnx/api/ccnx_Portal COMPONENT headers) + add_subdirectory(test) add_subdirectory(command-line) diff --git a/libccnx-portal/ccnx/api/ccnx_Portal/command-line/CMakeLists.txt b/libccnx-portal/ccnx/api/ccnx_Portal/command-line/CMakeLists.txt index 6d0a3f09..9c91aadd 100644 --- a/libccnx-portal/ccnx/api/ccnx_Portal/command-line/CMakeLists.txt +++ b/libccnx-portal/ccnx/api/ccnx_Portal/command-line/CMakeLists.txt @@ -1,11 +1,11 @@ set(CCNX_CLIENT_SRC - ccnx-client.c - ccnxPortalClient_About.c + ccnx-client.c + ccnxPortalClient_About.c ) -set(CCNX_SERVER_SRC - ccnx-server.c - ccnxPortalServer_About.c +set(CCNX_SERVER_SRC + ccnx-server.c + ccnxPortalServer_About.c ) @@ -16,4 +16,4 @@ target_link_libraries(ccnx-client ${CCNX_LINK_LIBRARIES}) add_executable(ccnx-server ${CCNX_SERVER_SRC}) target_link_libraries(ccnx-server ${CCNX_LINK_LIBRARIES}) -install(TARGETS ccnx-client ccnx-server RUNTIME DESTINATION bin ) +install(TARGETS ccnx-client ccnx-server COMPONENT library RUNTIME DESTINATION bin ) diff --git a/libccnx-portal/ccnx/api/ccnx_Portal/test/CMakeLists.txt b/libccnx-portal/ccnx/api/ccnx_Portal/test/CMakeLists.txt index 88ce6f1a..9c2a94ff 100644 --- a/libccnx-portal/ccnx/api/ccnx_Portal/test/CMakeLists.txt +++ b/libccnx-portal/ccnx/api/ccnx_Portal/test/CMakeLists.txt @@ -3,15 +3,14 @@ add_definitions(--coverage) set(CMAKE_EXE_LINKER_FLAGS ${CMAKE_EXE_LINKER_FLAGS} " --coverage") set(TestsExpectedToPass - test_ccnx_Portal - test_ccnx_PortalFactory - test_ccnx_PortalStack - test_ccnx_PortalAPI - test_ccnx_PortalRTA + test_ccnx_Portal + test_ccnx_PortalFactory + test_ccnx_PortalStack + test_ccnx_PortalAPI + test_ccnx_PortalRTA test_ccnx_PortalAnchor ) - foreach(test ${TestsExpectedToPass}) AddTest(${test}) endforeach() diff --git a/libccnx-portal/scripts/build-package.sh b/libccnx-portal/scripts/build-package.sh index bfa95693..300d0f4e 100644 --- a/libccnx-portal/scripts/build-package.sh +++ b/libccnx-portal/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 libccnx-common libccnx-transport-rta" +DEPS_UBUNTU="$LIBSSL_LIBEVENT_UBUNTU longbow-dev libparc-dev libccnx-common-dev libccnx-transport-rta-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" +DEPS_CENTOS="$LIBSSL_LIBEVENT_CENTOS longbow-devel libparc-devel libccnx-common-devel libccnx-transport-rta-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 |