blob: 3a10e707fb9f81269c5cd64518e85053ce717ee6 [file] [log] [blame]
Ed Warnicked6a0fc52016-04-12 17:34:48 -05001#!/bin/bash
2
3# Get Command Line arguements if present
4VPP_DIR=$1
5if [ "x$1" != "x" ]; then
6 VPP_DIR=$1
7else
8 VPP_DIR=`dirname $0`/../../
9fi
10
11if [ "x$2" != "x" ]; then
12 SUDOCMD="sudo -H -u $2"
13fi
14echo 0:$0
15echo 1:$1
16echo 2:$2
17echo VPP_DIR: $VPP_DIR
18echo SUDOCMD: $SUDOCMD
19
Marco Varlesec2e63fe2017-10-06 15:07:08 +020020if [ "$(uname)" <> "Darwin" ]; then
21 OS_ID=$(grep '^ID=' /etc/os-release | cut -f2- -d= | sed -e 's/\"//g')
22 OS_VERSION_ID=$(grep '^VERSION_ID=' /etc/os-release | cut -f2- -d= | sed -e 's/\"//g')
Ed Warnicked6a0fc52016-04-12 17:34:48 -050023fi
Marco Varlesec2e63fe2017-10-06 15:07:08 +020024
Dave Wallace431cd2f2016-06-03 17:09:11 -040025KERNEL_OS=`uname -o`
26KERNEL_MACHINE=`uname -m`
27KERNEL_RELEASE=`uname -r`
28KERNEL_VERSION=`uname -v`
29
30echo KERNEL_OS: $KERNEL_OS
31echo KERNEL_MACHINE: $KERNEL_MACHINE
32echo KERNEL_RELEASE: $KERNEL_RELEASE
33echo KERNEL_VERSION: $KERNEL_VERSION
Marco Varlesec2e63fe2017-10-06 15:07:08 +020034echo OS_ID: $OS_ID
35echo OS_VERSION_ID: $OS_ID
Ed Warnicked6a0fc52016-04-12 17:34:48 -050036
37# Install dependencies
38cd $VPP_DIR
Damjan Marionc5e86812016-05-02 19:40:27 +020039make UNATTENDED=yes install-dep
Ed Warnicked6a0fc52016-04-12 17:34:48 -050040
41# Really really clean things up so we can be sure
42# that the build works even when switching distros
Ed Warnicke3ba4d362016-09-01 11:54:27 -070043$SUDOCMD make wipe
44(cd build-root/;$SUDOCMD make distclean)
Ed Warnicked6a0fc52016-04-12 17:34:48 -050045rm -f build-root/.bootstrap.ok
46
Marco Varlesec2e63fe2017-10-06 15:07:08 +020047if [ $OS_ID == "centos" ]; then
Ed Warnicked6a779c2016-05-03 16:47:50 -050048 echo rpm -V apr-devel
49 rpm -V apr-devel
Kyle Mesteryacc1fbc2018-08-10 16:32:13 -050050 if [ $? != 0 ]; then sudo -E yum reinstall -y apr-devel;fi
Ed Warnicked6a779c2016-05-03 16:47:50 -050051 echo rpm -V ganglia-devel
52 rpm -V ganglia-devel
Kyle Mesteryacc1fbc2018-08-10 16:32:13 -050053 if [ $? != 0 ]; then sudo -E yum reinstall -y ganglia-devel;fi
Ed Warnicked6a779c2016-05-03 16:47:50 -050054 echo rpm -V libconfuse-devel
55 rpm -V libconfuse-devel
Kyle Mesteryacc1fbc2018-08-10 16:32:13 -050056 if [ $? != 0 ]; then sudo -E yum reinstall -y libconfuse-devel;fi
Ed Warnicked6a779c2016-05-03 16:47:50 -050057fi
58
Ed Warnicked6a0fc52016-04-12 17:34:48 -050059# Build and install packaging
60$SUDOCMD make bootstrap
khers28262a02017-05-24 15:43:54 +043061
Marco Varlesec2e63fe2017-10-06 15:07:08 +020062if [ "$OS_ID" == "ubuntu" ]; then
Ed Warnicked6a0fc52016-04-12 17:34:48 -050063 $SUDOCMD make pkg-deb
Marco Varlesec2e63fe2017-10-06 15:07:08 +020064elif [ "$OS_ID" == "debian" ]; then
khers28262a02017-05-24 15:43:54 +043065 $SUDOCMD make pkg-deb
Marco Varlesec2e63fe2017-10-06 15:07:08 +020066elif [ "$OS_ID" == "centos" ]; then
Billy McFall8cb034b2016-10-20 08:50:11 -040067 (cd $VPP_DIR/vnet ;$SUDOCMD aclocal;$SUDOCMD automake -a)
Ed Warnicked6a0fc52016-04-12 17:34:48 -050068 $SUDOCMD make pkg-rpm
Marco Varlesec2e63fe2017-10-06 15:07:08 +020069elif [ "$OS_ID" == "opensuse" ]; then
Marco Varleseaba730f2017-11-29 16:13:04 +010070 $SUDOCMD make pkg-rpm
Ed Warnicked6a0fc52016-04-12 17:34:48 -050071fi
72