From f62e74657d802555db61345eaa46362b09b12e88 Mon Sep 17 00:00:00 2001 From: Mauro Sardara Date: Thu, 15 Jul 2021 11:47:19 +0200 Subject: [HICN-714] Update build scripts Signed-off-by: Mauro Sardara Change-Id: Ica3b4f66087446551230a3742fd7bd4db87a4a7e Signed-off-by: Mauro Sardara --- cmake/Modules/BuildMacros.cmake | 8 +++++ extras/libmemif/CMakeLists2.patch | 4 ++- scripts/build-extras.sh | 13 +------- scripts/functions.sh | 66 ++++++++++++++------------------------- 4 files changed, 36 insertions(+), 55 deletions(-) diff --git a/cmake/Modules/BuildMacros.cmake b/cmake/Modules/BuildMacros.cmake index 2c301db5c..15e2ff1a8 100644 --- a/cmake/Modules/BuildMacros.cmake +++ b/cmake/Modules/BuildMacros.cmake @@ -17,6 +17,14 @@ include(GNUInstallDirs) +macro(remove_flag_from_target target flag) + get_target_property(target_cxx_flags ${target} COMPILE_OPTIONS) + if(target_cxx_flags) + list(REMOVE_ITEM target_cxx_flags ${flag}) + set_target_properties(${target} PROPERTIES COMPILE_OPTIONS "${target_cxx_flags}") + endif() +endmacro() + macro(build_executable exec) cmake_parse_arguments(ARG "NO_INSTALL" diff --git a/extras/libmemif/CMakeLists2.patch b/extras/libmemif/CMakeLists2.patch index 38d520bd9..1a02cd725 100644 --- a/extras/libmemif/CMakeLists2.patch +++ b/extras/libmemif/CMakeLists2.patch @@ -39,4 +39,6 @@ build_library(${LIBMEMIF} LINK_LIBRARIES ${CMAKE_THREAD_LIBS_INIT} HEADER_ROOT_DIR memif COMPONENT ${COMPONENT} -) \ No newline at end of file +) + +remove_flag_from_target(${LIBMEMIF_SHARED} -Werror) \ No newline at end of file diff --git a/scripts/build-extras.sh b/scripts/build-extras.sh index 78a6ac98e..becfc7517 100644 --- a/scripts/build-extras.sh +++ b/scripts/build-extras.sh @@ -17,23 +17,12 @@ set -euxo pipefail SCRIPT_PATH=$( cd "$(dirname "${BASH_SOURCE}")" ; pwd -P ) source ${SCRIPT_PATH}/functions.sh -# Libparc and libmemif are still not available in Ubuntu 20, so -# we remove it from the list for now. -# TODO Remove it as soon as they are available. -DEPS_UBUNTU=(${DEPS_UBUNTU[@]/"libmemif-dev"}) -DEPS_UBUNTU=(${DEPS_UBUNTU[@]/"libmemif"}) -DEPS_UBUNTU=(${DEPS_UBUNTU[@]/"libparc-dev"}) - -DEPS_CENTOS=(${DEPS_CENTOS[@]/"libmemif-devel"}) -DEPS_CENTOS=(${DEPS_CENTOS[@]/"libmemif"}) -DEPS_CENTOS=(${DEPS_CENTOS[@]/"libparc-devel"}) - # Parameters: # $1 = Package name # function build_package() { - setup + setup_extras echo "**************************************************************************" echo "********************* STARTING PACKAGE EXTRAS BUILD **********************" diff --git a/scripts/functions.sh b/scripts/functions.sh index 9cb62b5cc..abb34fb7b 100644 --- a/scripts/functions.sh +++ b/scripts/functions.sh @@ -44,9 +44,7 @@ VPP_VERSION_RPM="${VPP_VERSION_DEB}.x86_64" DEPS_UBUNTU=("build-essential" "doxygen" "curl" - "libparc-dev" - "libmemif-dev" - "libmemif" + "cmake" "libasio-dev" "libconfig-dev" "libconfig++-dev" @@ -54,27 +52,17 @@ DEPS_UBUNTU=("build-essential" "libevent-dev" "libssl-dev" "ninja-build" - "vpp=${VPP_VERSION_DEB}" - "vpp-dev=${VPP_VERSION_DEB}" - "libvppinfra=${VPP_VERSION_DEB}" - "libvppinfra-dev=${VPP_VERSION_DEB}" - "vpp-plugin-core=${VPP_VERSION_DEB}" "python3-ply") -# BUILD_TOOLS_GROUP_CENTOS="'Development Tools'" -DEPS_CENTOS=("vpp-devel-${VPP_VERSION_RPM}" - "vpp-lib-${VPP_VERSION_RPM}" - "libparc-devel" - "curl" - "libmemif-devel" - "ninja-build" - "libmemif" - "libcurl-devel" - "asio-devel" - "libconfig-devel" - "dnf-plugins-core" - "bzip2" - "rpm-build") +DEPS_UBUNTU_PKGCLOUD=("libparc-dev" + "libmemif-dev" + "libmemif" + "vpp=${VPP_VERSION_DEB}" + "vpp-dev=${VPP_VERSION_DEB}" + "libvppinfra=${VPP_VERSION_DEB}" + "libvppinfra-dev=${VPP_VERSION_DEB}" + "vpp-plugin-core=${VPP_VERSION_DEB}" + "libparc-dev") COLLECTD_SOURCE="https://github.com/collectd/collectd/releases/download/collectd-5.12.0/collectd-5.12.0.tar.bz2" @@ -89,16 +77,6 @@ function install_collectd_headers() { export COLLECTD_HOME=${PWD}/collectd-5.12.0/src } -function install_cmake() { - [[ $(uname --hardware-platform) = "x86_64" ]] || return 0 - CMAKE_INSTALL_SCRIPT_URL="https://github.com/Kitware/CMake/releases/download/v3.18.4/cmake-3.18.4-Linux-x86_64.sh" - CMAKE_INSTALL_SCRIPT="/tmp/install_cmake.sh" - curl -L ${CMAKE_INSTALL_SCRIPT_URL} > ${CMAKE_INSTALL_SCRIPT} - - sudo mkdir -p ${CMAKE_INSTALL_DIR} - sudo bash ${CMAKE_INSTALL_SCRIPT} --skip-license --prefix=${CMAKE_INSTALL_DIR} -} - function setup_fdio_repo() { DISTRIB_ID=${ID} @@ -117,16 +95,12 @@ function setup_fdio_repo() { # Install dependencies function install_deps() { DISTRIB_ID=${ID} + echo ${DEPS_UBUNTU[@]} | xargs sudo ${apt_get} install -y --allow-unauthenticated --no-install-recommends +} - if [ ${DISTRIB_ID} == "ubuntu" ]; then - echo ${DEPS_UBUNTU[@]} | xargs sudo ${apt_get} install -y --allow-unauthenticated --no-install-recommends - elif [ ${DISTRIB_ID} == "centos" ]; then - yum config-manager --set-enabled powertools - # Temporary workaround until centos fixes the asio-devel package (https://forums.centos.org/viewtopic.php?t=73034) - curl -L http://mirror.centos.org/centos/8/PowerTools/x86_64/os/Packages/asio-devel-1.10.8-7.module_el8.1.0+217+4d875839.x86_64.rpm > /tmp/asio-devel-1.10.8-7.module_el8.1.0+217+4d875839.x86_64.rpm - yum localinstall -y --nogpgcheck /tmp/asio-devel-1.10.8-7.module_el8.1.0+217+4d875839.x86_64.rpm - echo ${DEPS_CENTOS[@]} | xargs sudo yum install -y --nogpgcheck - fi +function install_pkgcloud_deps() { + DISTRIB_ID=${ID} + echo ${DEPS_UBUNTU_PKGCLOUD[@]} | xargs sudo ${apt_get} install -y --allow-unauthenticated --no-install-recommends } # Call a function once @@ -147,6 +121,14 @@ function setup() { call_once setup_fdio_repo call_once install_deps - call_once install_cmake + call_once install_pkgcloud_deps + call_once install_collectd_headers +} + +function setup_extras() { + echo DISTRIBUTION: ${PRETTY_NAME} + # export variables depending on the platform we are running + + call_once install_deps call_once install_collectd_headers } -- cgit 1.2.3-korg