aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/build-packages.sh
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/build-packages.sh')
-rw-r--r--scripts/build-packages.sh228
1 files changed, 24 insertions, 204 deletions
diff --git a/scripts/build-packages.sh b/scripts/build-packages.sh
index cc9074d38..c9f329d9a 100644
--- a/scripts/build-packages.sh
+++ b/scripts/build-packages.sh
@@ -15,190 +15,12 @@
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.09-release"
-VPP_VERSION_RPM="20.09-release.x86_64"
-
-BUILD_TOOLS_UBUNTU="build-essential doxygen"
-LIBSSL_LIBEVENT_UBUNTU="libevent-dev libssl-dev"
-DEPS_UBUNTU="libparc-dev \
- libmemif-dev \
- libmemif \
- libasio-dev \
- libconfig-dev \
- libcurl4-openssl-dev \
- 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"
-
-
-DEPS_UBUNTU_NOVERSION="libparc-dev \
- libmemif-dev \
- libmemif \
- libasio-dev \
- libconfig-dev \
- libcurl4-openssl-dev \
- vpp \
- vpp-dev \
- libvppinfra \
- libvppinfra-dev \
- vpp-plugin-core \
- python3-ply \
- python3-setuptools \
- python3-pip"
-
-DEPS_CMAKE_UBUNTU="curl"
-
-# BUILD_TOOLS_GROUP_CENTOS="'Development Tools'"
-DEPS_CENTOS="vpp-devel-${VPP_VERSION_RPM} \
- vpp-lib-${VPP_VERSION_RPM} \
- libparc-devel \
- libmemif-devel \
- libmemif \
- libcurl-devel \
- asio-devel \
- libconfig-devel \
- centos-release-scl \
- devtoolset-7"
-
-DEPS_CENTOS_NOVERSION="vpp-devel \
- vpp-lib \
- libparc-devel \
- libcurl-devel \
- asio-devel \
- libmemif-devel \
- libmemif \
- centos-release-scl \
- devtoolset-7"
-
-LATEST_EPEL_REPO="http://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm"
-
-install_cmake() {
- if [ "${DISTRIB_ID}" == "ubuntu" ]; then
- sudo apt update
- echo ${DEPS_CMAKE_UBUNTU} | xargs sudo ${apt_get} install -y --allow-unauthenticated --no-install-recommends
- fi
-
- 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
- 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
-
- c++ --version
-
- 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
-
- # do nothing but check compiler version
- c++ --version
-}
-
-
-install_collectd_headers() {
- if [ -f /etc/os-release ]; then
- . /etc/os-release
- else
- echo "ERROR: System configuration not recognized. Build failed"
- exit -1
- fi
-
- if [ "${DISTRIB_ID}" == "ubuntu" ]; then
- sudo apt-get install collectd-dev -y --allow-unauthenticated
-
- if [ "${VERSION_CODENAME}" == "xenial" ]; then
- awk '/config.h/ { print; print "#include \"collectd/liboconfig/oconfig.h\""; next }1' /usr/include/collectd/core/daemon/configfile.h | sudo tee /usr/include/collectd/core/daemon/configfile.h
- fi
- elif [ "${DISTRIB_ID}" == "centos" ]; then
- wget https://storage.googleapis.com/collectd-tarballs/collectd-5.9.2.tar.bz2
- tar -xf collectd-5.9.2.tar.bz2
- cd collectd-5.9.2 && ./configure && make && cd -
- export COLLECTD_HOME=${PWD}/collectd-5.9.2/src
- fi
-}
+source ${SCRIPT_PATH}/functions.sh
# Parameters:
# $1 = Package name
#
-build_package() {
+function build_package() {
setup
echo "*******************************************************************"
@@ -207,29 +29,27 @@ build_package() {
# Make the package
mkdir -p ${SCRIPT_PATH}/../build && pushd ${SCRIPT_PATH}/../build
-
- rm -rf *
- cmake -DCMAKE_INSTALL_PREFIX=/usr -DBUILD_APPS=ON ..
- make VERBOSE=1 -j8 package
-
- rm -rf libtransport ctrl/libhicnctrl
-
- install_collectd_headers
-
- cmake -DCMAKE_INSTALL_PREFIX=/usr \
- -DBUILD_HICNPLUGIN=ON \
- -DBUILD_LIBTRANSPORT=ON \
- -DBUILD_APPS=ON \
- -DBUILD_HICNLIGHT=OFF \
- -DBUILD_SYSREPOPLUGIN=OFF \
- -DBUILD_TELEMETRY=ON \
- ${SCRIPT_PATH}/..
-
- make VERBOSE=1 -j8 package
-
- find . -not -name '*.deb' -not -name '*.rpm' -print0 | xargs -0 rm -rf -- || true
- rm *Unspecified* || true
-
+ rm -rf *
+
+ # First round - Without libmemif
+ cmake -G Ninja -DCMAKE_INSTALL_PREFIX=/usr -DBUILD_APPS=ON ..
+ ninja -j8 package
+
+ # Second round - With Libmemif
+ rm -rf libtransport ctrl/libhicnctrl
+ cmake -G Ninja -DCMAKE_INSTALL_PREFIX=/usr \
+ -DBUILD_HICNPLUGIN=ON \
+ -DBUILD_LIBTRANSPORT=ON \
+ -DBUILD_APPS=ON \
+ -DBUILD_HICNLIGHT=OFF \
+ -DBUILD_SYSREPOPLUGIN=OFF \
+ -DBUILD_TELEMETRY=ON \
+ ${SCRIPT_PATH}/..
+
+ ninja -j8 package
+
+ find . -not -name '*.deb' -not -name '*.rpm' -print0 | xargs -0 rm -rf -- || true
+ rm *Unspecified* || true
popd
echo "*******************************************************************"
@@ -267,7 +87,7 @@ build_doxygen() {
}
function usage() {
- echo "Usage: ${0} [doc|sphinx|doxygen]"
+ echo "Usage: ${0} [sphinx|doxygen|packages]"
exit 1
}