summaryrefslogtreecommitdiffstats
path: root/scripts/build-extras.sh
diff options
context:
space:
mode:
authorMauro Sardara <msardara@cisco.com>2020-11-06 12:42:46 +0100
committerMauro Sardara <msardara@cisco.com>2020-11-06 17:15:30 +0100
commit7f2bbf5f6934be58c016f0159e497fa519d14372 (patch)
tree0d6469b1a4089756dba08b8a76d109dd120095fe /scripts/build-extras.sh
parentda2c11cfd77383f37dd01e67efb5c44dece9c3a9 (diff)
[HICN-653] Cleanup build scripts.
Main changes: - Next VPP version is now counted 4 months (instead of 3) from the current one - CMake will now use Ninja as generator - Build functions are gathered under build/functions.sh and they are shared instead of being duplicated in build-extras and build-packages - Various bug fixes for dependencies and versioning. Signed-off-by: Mauro Sardara <msardara@cisco.com> Change-Id: I3f482d2c87847a465019dd0992ee9375c88bb412 Signed-off-by: Mauro Sardara <msardara@cisco.com>
Diffstat (limited to 'scripts/build-extras.sh')
-rw-r--r--scripts/build-extras.sh151
1 files changed, 22 insertions, 129 deletions
diff --git a/scripts/build-extras.sh b/scripts/build-extras.sh
index 2c5d95794..948e2d15b 100644
--- a/scripts/build-extras.sh
+++ b/scripts/build-extras.sh
@@ -15,143 +15,36 @@
set -euxo pipefail
SCRIPT_PATH=$( cd "$(dirname "${BASH_SOURCE}")" ; pwd -P )
-APT_PATH=`which apt-get` || true
-apt_get=${APT_PATH:-"/usr/local/bin/apt-get"}
-
-PACKAGECLOUD_RELEASE_REPO_DEB="https://packagecloud.io/install/repositories/fdio/release/script.deb.sh"
-PACKAGECLOUD_RELEASE_REPO_RPM="https://packagecloud.io/install/repositories/fdio/release/script.rpm.sh"
-
-VPP_GIT_REPO="https://git.fd.io/vpp"
-VPP_BRANCH="stable/2005"
-
-VPP_VERSION_DEB="20.05-release"
-VPP_VERSION_RPM="20.05-release.x86_64"
-
-BUILD_TOOLS_UBUNTU="build-essential doxygen"
-LIBSSL_LIBEVENT_UBUNTU="libevent-dev libssl-dev"
-DEPS_UBUNTU="libvppinfra=${VPP_VERSION_DEB} \
- libvppinfra-dev=${VPP_VERSION_DEB} \
- vpp=${VPP_VERSION_DEB} \
- vpp-dev=${VPP_VERSION_DEB} \
- vpp-plugin-core=${VPP_VERSION_DEB}"
-
-# BUILD_TOOLS_GROUP_CENTOS="'Development Tools'"
-DEPS_CENTOS="vpp-devel-${VPP_VERSION_RPM} \
- vpp-lib-${VPP_VERSION_RPM} \
- centos-release-scl \
- devtoolset-7"
-
-LATEST_EPEL_REPO="http://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm"
-
-install_cmake() {
- if ! grep -q "8.8.8.8" /etc/resolv.conf; then
- echo "nameserver 8.8.8.8" | sudo tee -a /etc/resolv.conf
- fi
-
- cat /etc/resolv.conf
-
- 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:
-# $1 = Distribution id
-# $2 = Distribution codename
-#
-setup_fdio_repo() {
- DISTRIB_ID=${1}
-
- if [ "${DISTRIB_ID}" == "ubuntu" ]; then
- curl -s ${PACKAGECLOUD_RELEASE_REPO_DEB} | sudo bash
- elif [ "${DISTRIB_ID}" == "centos" ]; then
- curl -s ${PACKAGECLOUD_RELEASE_REPO_RPM} | sudo bash
- curl ${LATEST_EPEL_REPO} > epel-release-latest-7.noarch.rpm
- rpm -ivh epel-release-latest-7.noarch.rpm || true
- rm epel-release-latest-7.noarch.rpm
- else
- echo "Distribution ${DISTRIB_ID} is not supported"
- exit -1
- fi
-}
-
-setup() {
- # Figure out what system we are running on
- if [ -f /etc/os-release ]; then
- . /etc/os-release
- else
- echo "ERROR: System configuration not recognized. Build failed"
- exit -1
- fi
-
- DISTRIB_ID=${ID}
-
- echo DISTRIBUTION: ${PRETTY_NAME}
- echo ARCHITECTURE: $(uname -m)
-
- ARCH=`uname -m`
- if [ "$ARCH" == "x86_64" ] || [ "$ARCH" == "x86" ]; then
- install_cmake
- fi
- setup_fdio_repo ${DISTRIB_ID}
-
- if [ "${DISTRIB_ID}" == "ubuntu" ]; then
- sudo ${apt_get} update || true
- fi
-
- # Install dependencies
- if [ ${DISTRIB_ID} == "ubuntu" ]; then
- echo ${BUILD_TOOLS_UBUNTU} ${DEPS_UBUNTU} | xargs sudo ${apt_get} install -y --allow-unauthenticated --no-install-recommends
- sudo ${apt_get} clean && sudo ${apt_get} update
- sudo ${apt_get} install -y --allow-unauthenticated --no-install-recommends libpcre3-dev
- elif [ ${DISTRIB_ID} == "centos" ]; then
- # echo ${BUILD_TOOLS_GROUP_CENTOS} | xargs sudo yum groupinstall -y --nogpgcheck
- echo ${DEPS_CENTOS} | xargs sudo yum install -y --nogpgcheck
- sudo yum install devtoolset-7 pcre-devel
-
- CXX_COMPILER="/opt/rh/devtoolset-7/root/usr/bin/c++"
- CC_COMPILER="/opt/rh/devtoolset-7/root/usr/bin/cc"
-
- ${CXX_COMPILER} --version
- ${CC_COMPILER} --version
-
- export CC=${CC_COMPILER} CXX=${CXX_COMPILER}
- fi
-}
+source ${SCRIPT_PATH}/functions.sh
# Parameters:
# $1 = Package name
#
-build_package() {
+function build_package() {
setup
- echo "*******************************************************************"
- echo "********************* STARTING PACKAGE BUILD **********************"
- echo "*******************************************************************"
+ echo "**************************************************************************"
+ echo "********************* STARTING PACKAGE EXTRAS BUILD **********************"
+ echo "**************************************************************************"
mkdir -p build && pushd build
-
- rm -rf *
- cmake -DCMAKE_INSTALL_PREFIX=/usr \
- -DBUILD_LIBHICN=OFF \
- -DBUILD_UTILS=OFF \
- -DBUILD_HICNPLUGIN=OFF \
- -DBUILD_HICNLIGHT=OFF \
- -DBUILD_LIBTRANSPORT=OFF \
- -DBUILD_APPS=OFF \
- -DBUILD_CTRL=OFF \
- -DBUILD_SYSREPOPLUGIN=OFF \
- -DBUILD_EXTRAS=ON \
- ${SCRIPT_PATH}/..
- make package
-
- find . -type d -iname '_CPack_Packages' -print0 | xargs -0 rm -rf -- || true
- find . -iname '*Unspecified*' -print0 | xargs -0 rm -rf -- || true
-
+ rm -rf *
+ cmake -G Ninja -DCMAKE_INSTALL_PREFIX=/usr \
+ -DBUILD_LIBHICN=OFF \
+ -DBUILD_UTILS=OFF \
+ -DBUILD_HICNPLUGIN=OFF \
+ -DBUILD_HICNLIGHT=OFF \
+ -DBUILD_LIBTRANSPORT=OFF \
+ -DBUILD_APPS=OFF \
+ -DBUILD_CTRL=OFF \
+ -DBUILD_SYSREPOPLUGIN=OFF \
+ -DBUILD_EXTRAS=ON \
+ ${SCRIPT_PATH}/..
+ ninja
+
+ find . -type f '(' -name '*.deb' -o -name '*.rpm' ')' -exec mv {} . \;
+ find . -not -name '*.deb' -not -name '*.rpm' -print0 | xargs -0 rm -rf -- || true
+ rm *Unspecified* || true
popd
echo "*******************************************************************"