From 8dab1436b701372eacf32bd6e22b452c486af01e Mon Sep 17 00:00:00 2001 From: Mauro Sardara Date: Sat, 29 Apr 2017 04:30:05 +0200 Subject: Adding support for building dev and doc packages. Change-Id: I0631bbf72e23e8f03645f300f2b89980e91da6ec Signed-off-by: Mauro Sardara --- longbow/CMakeLists.txt | 94 +++++++++++++++++-------- longbow/documentation/CMakeLists.txt | 8 +-- longbow/scripts/build-package.sh | 54 ++++---------- longbow/src/LongBow/CMakeLists.txt | 6 +- longbow/src/python/CMakeLists.txt | 4 +- longbow/src/python/site-packages/CMakeLists.txt | 24 +++---- 6 files changed, 99 insertions(+), 91 deletions(-) (limited to 'longbow') diff --git a/longbow/CMakeLists.txt b/longbow/CMakeLists.txt index 0a706dd9..07c743c7 100644 --- a/longbow/CMakeLists.txt +++ b/longbow/CMakeLists.txt @@ -72,46 +72,78 @@ else() 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") - 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) + + 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_${TYPE}_PACKAGE_DEPENDS "python (>= 2.7.0)") - SET(CPACK_PACKAGE_FILE_NAME "${PACKAGE_NAME}_${PACKAGE_VERSION}_${ARCHITECTURE}") + 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 "python (>= 2.7.0)") + set(CPACK_${TYPE}_HEADERS_PACKAGE_DEPENDS "longbow (>= 1.0)") + set(CPACK_${TYPE}_DOCUMENTATION_PACKAGE_DEPENDS "") elseif(RPM_PACKAGE) - SET(TYPE "RPM") - SET(GENERATOR "RPM") - SET(CPACK_${TYPE}_PACKAGE_REQUIRES "python >= 2.7.0") - 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(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 "python >= 2.7.0") + set(CPACK_${TYPE}_HEADERS_PACKAGE_REQUIRES "longbow >= 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 "Runtime and testing framework for C applications.") - SET(CPACK_${TYPE}_PACKAGE_HOMEPAGE "https://wiki.fd.io/view/Cframework") - - 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 "Runtime and testing framework for C applications.") + set(CPACK_${TYPE}_PACKAGE_HOMEPAGE "https://wiki.fd.io/view/Cframework") + + include(CPack) endif() \ No newline at end of file diff --git a/longbow/documentation/CMakeLists.txt b/longbow/documentation/CMakeLists.txt index 33f92995..61e9f8b6 100644 --- a/longbow/documentation/CMakeLists.txt +++ b/longbow/documentation/CMakeLists.txt @@ -5,10 +5,10 @@ if(DOXYGEN_FOUND) set(GITHUB_REMOTE http://github.com/PARC/LongBow) configure_file(longbow.doxygen.in config.doxygen @ONLY) - install(DIRECTORY images/ DESTINATION ${CMAKE_INSTALL_PREFIX}/share/doc/longbow/images) - install(DIRECTORY doxygen-extras/ DESTINATION ${CMAKE_INSTALL_PREFIX}/share/doc/longbow/doxygen-extras) - install(DIRECTORY examples/ DESTINATION ${CMAKE_INSTALL_PREFIX}/share/doc/longbow/examples) - install(FILES DoxygenLayout.xml DESTINATION ${CMAKE_INSTALL_PREFIX}/share/doc/longbow) + install(DIRECTORY images/ DESTINATION ${CMAKE_INSTALL_PREFIX}/share/doc/longbow/images COMPONENT documentation) + install(DIRECTORY doxygen-extras/ DESTINATION ${CMAKE_INSTALL_PREFIX}/share/doc/longbow/doxygen-extras COMPONENT documentation) + install(DIRECTORY examples/ DESTINATION ${CMAKE_INSTALL_PREFIX}/share/doc/longbow/examples COMPONENT documentation) + install(FILES DoxygenLayout.xml DESTINATION ${CMAKE_INSTALL_PREFIX}/share/doc/longbow COMPONENT documentation) set(HTML_PATH ${CMAKE_CURRENT_BINARY_DIR}/generated-documentation/html) diff --git a/longbow/scripts/build-package.sh b/longbow/scripts/build-package.sh index a7078e0a..9bab45e5 100644 --- a/longbow/scripts/build-package.sh +++ b/longbow/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="" BUILD_TOOLS_GROUP_CENTOS="'Development Tools'" -BUILD_TOOLS_SINGLE_CENTOS="cmake" LIBSSL_LIBEVENT_CENTOS="libevent-devel openssl-devel" DEPS_CENTOS="" -# 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 @@ -217,4 +193,4 @@ build_package() { PACKAGE_NAME="LONGBOW" pushd $SCRIPT_PATH/.. build_package $PACKAGE_NAME -popd \ No newline at end of file +popd diff --git a/longbow/src/LongBow/CMakeLists.txt b/longbow/src/LongBow/CMakeLists.txt index 476cc8ab..27efc12c 100644 --- a/longbow/src/LongBow/CMakeLists.txt +++ b/longbow/src/LongBow/CMakeLists.txt @@ -157,11 +157,11 @@ set(longbowLibraries ) foreach(lib ${longbowLibraries}) - install(TARGETS ${lib} LIBRARY DESTINATION lib ARCHIVE DESTINATION lib) + install(TARGETS ${lib} COMPONENT library LIBRARY DESTINATION lib ARCHIVE DESTINATION lib) endforeach() -install(FILES ${LIBLONGBOW_HEADER_FILES} DESTINATION include/LongBow ) -install(FILES ${LONGBOW_REPORT_HEADER_FILES} DESTINATION include/LongBow/Reporting ) +install(FILES ${LIBLONGBOW_HEADER_FILES} DESTINATION include/LongBow COMPONENT headers) +install(FILES ${LONGBOW_REPORT_HEADER_FILES} DESTINATION include/LongBow/Reporting COMPONENT headers) if(ANDROID_API) message("############ Detected cross compile for ${CMAKE_SYSTEM_NAME}") diff --git a/longbow/src/python/CMakeLists.txt b/longbow/src/python/CMakeLists.txt index 157cda21..33e2d70e 100644 --- a/longbow/src/python/CMakeLists.txt +++ b/longbow/src/python/CMakeLists.txt @@ -1,10 +1,10 @@ -add_subdirectory(site-packages) +add_subdirectory(site-packages) install( FILES parc_uncrustify.cfg DESTINATION ${CMAKE_INSTALL_PREFIX}/etc ) macro(AddLongBowPythonScript scriptFile) configure_file(${ARGV0}.py ${ARGV0} @ONLY) - install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/${ARGV0} DESTINATION ${CMAKE_INSTALL_PREFIX}/bin) + install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/${ARGV0} COMPONENT library DESTINATION ${CMAKE_INSTALL_PREFIX}/bin) endmacro(AddLongBowPythonScript) set(ScriptList diff --git a/longbow/src/python/site-packages/CMakeLists.txt b/longbow/src/python/site-packages/CMakeLists.txt index fab750f7..f0be88f6 100644 --- a/longbow/src/python/site-packages/CMakeLists.txt +++ b/longbow/src/python/site-packages/CMakeLists.txt @@ -1,12 +1,12 @@ -install(FILES longbow.pth DESTINATION ${INSTALL_BASE_PYTHON_DIR}) -install(FILES longbow/LongBow.py DESTINATION ${INSTALL_PYTHON_DIR}) -install(FILES longbow/FileUtil.py DESTINATION ${INSTALL_PYTHON_DIR}) -install(FILES longbow/GCov.py DESTINATION ${INSTALL_PYTHON_DIR}) -install(FILES longbow/GCovSummary.py DESTINATION ${INSTALL_PYTHON_DIR}) -install(FILES longbow/ANSITerm.py DESTINATION ${INSTALL_PYTHON_DIR}) -install(FILES longbow/SymbolTable.py DESTINATION ${INSTALL_PYTHON_DIR}) -install(FILES longbow/Language_C.py DESTINATION ${INSTALL_PYTHON_DIR}) -install(FILES longbow/StyleReport.py DESTINATION ${INSTALL_PYTHON_DIR}) -install(FILES longbow/CoverageReport.py DESTINATION ${INSTALL_PYTHON_DIR}) -install(FILES longbow/VocabularyReport.py DESTINATION ${INSTALL_PYTHON_DIR}) -install(FILES longbow/NameReport.py DESTINATION ${INSTALL_PYTHON_DIR}) +install(FILES longbow.pth DESTINATION ${INSTALL_BASE_PYTHON_DIR} COMPONENT library) +install(FILES longbow/LongBow.py DESTINATION ${INSTALL_PYTHON_DIR} COMPONENT library) +install(FILES longbow/FileUtil.py DESTINATION ${INSTALL_PYTHON_DIR} COMPONENT library) +install(FILES longbow/GCov.py DESTINATION ${INSTALL_PYTHON_DIR} COMPONENT library) +install(FILES longbow/GCovSummary.py DESTINATION ${INSTALL_PYTHON_DIR} COMPONENT library) +install(FILES longbow/ANSITerm.py DESTINATION ${INSTALL_PYTHON_DIR} COMPONENT library) +install(FILES longbow/SymbolTable.py DESTINATION ${INSTALL_PYTHON_DIR} COMPONENT library) +install(FILES longbow/Language_C.py DESTINATION ${INSTALL_PYTHON_DIR} COMPONENT library) +install(FILES longbow/StyleReport.py DESTINATION ${INSTALL_PYTHON_DIR} COMPONENT library) +install(FILES longbow/CoverageReport.py DESTINATION ${INSTALL_PYTHON_DIR} COMPONENT library) +install(FILES longbow/VocabularyReport.py DESTINATION ${INSTALL_PYTHON_DIR} COMPONENT library) +install(FILES longbow/NameReport.py DESTINATION ${INSTALL_PYTHON_DIR} COMPONENT library) -- cgit 1.2.3-korg