blob: fcfd52aa707383c527a5f3b758e96dfe5cc58f53 [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
20# Figure out what system we are running on
21if [ -f /etc/lsb-release ];then
22 . /etc/lsb-release
23elif [ -f /etc/redhat-release ];then
24 sudo yum install -y redhat-lsb
25 DISTRIB_ID=`lsb_release -si`
26 DISTRIB_RELEASE=`lsb_release -sr`
27 DISTRIB_CODENAME=`lsb_release -sc`
28 DISTRIB_DESCRIPTION=`lsb_release -sd`
khers28262a02017-05-24 15:43:54 +043029elif [ -f /etc/os-release ];then
30 . /etc/os-release
31 DISTRIB_ID=$ID
32 DISTRIB_RELEASE=$VERSION_ID
33 DISTRIB_CODENAME=$VERSION
34 DISTRIB_DESCRIPTION=$PRETTY_NAME
Ed Warnicked6a0fc52016-04-12 17:34:48 -050035fi
Dave Wallace431cd2f2016-06-03 17:09:11 -040036KERNEL_OS=`uname -o`
37KERNEL_MACHINE=`uname -m`
38KERNEL_RELEASE=`uname -r`
39KERNEL_VERSION=`uname -v`
40
41echo KERNEL_OS: $KERNEL_OS
42echo KERNEL_MACHINE: $KERNEL_MACHINE
43echo KERNEL_RELEASE: $KERNEL_RELEASE
44echo KERNEL_VERSION: $KERNEL_VERSION
Ed Warnicked6a0fc52016-04-12 17:34:48 -050045echo DISTRIB_ID: $DISTRIB_ID
46echo DISTRIB_RELEASE: $DISTRIB_RELEASE
47echo DISTRIB_CODENAME: $DISTRIB_CODENAME
48echo DISTRIB_DESCRIPTION: $DISTRIB_DESCRIPTION
49
50# Install dependencies
51cd $VPP_DIR
Damjan Marionc5e86812016-05-02 19:40:27 +020052make UNATTENDED=yes install-dep
Ed Warnicked6a0fc52016-04-12 17:34:48 -050053
54# Really really clean things up so we can be sure
55# that the build works even when switching distros
Ed Warnicke3ba4d362016-09-01 11:54:27 -070056$SUDOCMD make wipe
57(cd build-root/;$SUDOCMD make distclean)
Ed Warnicked6a0fc52016-04-12 17:34:48 -050058rm -f build-root/.bootstrap.ok
59
Ed Warnicked6a779c2016-05-03 16:47:50 -050060if [ $DISTRIB_ID == "CentOS" ]; then
61 echo rpm -V apr-devel
62 rpm -V apr-devel
63 if [ $? != 0 ]; then sudo yum reinstall -y apr-devel;fi
64 echo rpm -V ganglia-devel
65 rpm -V ganglia-devel
66 if [ $? != 0 ]; then sudo yum reinstall -y ganglia-devel;fi
67 echo rpm -V libconfuse-devel
68 rpm -V libconfuse-devel
69 if [ $? != 0 ]; then sudo yum reinstall -y libconfuse-devel;fi
70fi
71
Ed Warnicked6a0fc52016-04-12 17:34:48 -050072# Build and install packaging
73$SUDOCMD make bootstrap
khers28262a02017-05-24 15:43:54 +043074
Marco Varlesedc33d4c2017-09-22 17:53:53 +020075if [ "$DISTRIB_ID" == "Ubuntu" ]; then
Ed Warnicked6a0fc52016-04-12 17:34:48 -050076 $SUDOCMD make pkg-deb
Marco Varlesedc33d4c2017-09-22 17:53:53 +020077elif [ "$DISTRIB_ID" == "debian" ]; then
khers28262a02017-05-24 15:43:54 +043078 $SUDOCMD make pkg-deb
Marco Varlesedc33d4c2017-09-22 17:53:53 +020079elif [ "$DISTRIB_ID" == "CentOS" ]; then
Billy McFall8cb034b2016-10-20 08:50:11 -040080 (cd $VPP_DIR/vnet ;$SUDOCMD aclocal;$SUDOCMD automake -a)
Ed Warnicked6a0fc52016-04-12 17:34:48 -050081 $SUDOCMD make pkg-rpm
Marco Varlesedc33d4c2017-09-22 17:53:53 +020082elif [ "$DISTRIB_ID" == "opensuse" ]; then
83 $SUDOCMD make build-release
Ed Warnicked6a0fc52016-04-12 17:34:48 -050084fi
85