[HICN-714] Update build scripts 45/33145/7 v21.06-rc0
authorMauro Sardara <msardara@cisco.com>
Thu, 15 Jul 2021 09:47:19 +0000 (11:47 +0200)
committerMauro Sardara <msardara@cisco.com>
Fri, 16 Jul 2021 08:10:37 +0000 (10:10 +0200)
Signed-off-by: Mauro Sardara <msardara@cisco.com>
Change-Id: Ica3b4f66087446551230a3742fd7bd4db87a4a7e
Signed-off-by: Mauro Sardara <msardara@cisco.com>
cmake/Modules/BuildMacros.cmake
extras/libmemif/CMakeLists2.patch
scripts/build-extras.sh
scripts/functions.sh

index 2c301db..15e2ff1 100644 (file)
 
 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"
index 38d520b..1a02cd7 100644 (file)
@@ -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
index 78a6ac9..becfc75 100644 (file)
@@ -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 **********************"
index 9cb62b5..abb34fb 100644 (file)
@@ -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
 }