Build OVS 2.6 with DPDK 16.11
[ovsnfv.git] / build / build_dpdk_rpm.sh
1 #!/bin/bash
2
3 # Copyright (c) 2016 Open Platform for NFV Project, Inc. and its contributors
4 #
5 #    Licensed under the Apache License, Version 2.0 (the "License");
6 #    you may not use this file except in compliance with the License.
7 #    You may obtain a copy of the License at
8 #
9 #        http://www.apache.org/licenses/LICENSE-2.0
10 #
11 #    Unless required by applicable law or agreed to in writing, software
12 #    distributed under the License is distributed on an "AS IS" BASIS,
13 #    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 #    See the License for the specific language governing permissions and
15 #    limitations under the License.
16
17 set -e
18
19 echo "==============================="
20 echo executing $0 $@
21 echo executing on machine `uname -a`
22
23 usage() {
24     echo run BuildAndTestOVS -h for complete help on options on ovsnfv scripts.
25 }
26
27 while getopts "g:hp:u:v" opt; do
28     case "$opt" in
29         g)
30             DPDK_VERSION=${OPTARG}
31             ;;
32         h|\?)
33             usage
34             exit 1
35             ;;
36         p)
37             DPDK_PATCH=${OPTARG}
38             ;;
39         u)
40             DPDK_REPO_URL=${OPTARG}
41             ;;
42         v)
43             verbose="yes"
44             ;;
45     esac
46 done
47
48 if [ -z $DPDK_REPO_URL ]; then
49     DPDK_REPO_URL=http://dpdk.org/git/dpdk
50 fi
51 if [ -z $DPDK_VERSION ]; then
52     DPDK_VERSION=16.11
53 fi
54 export REPO_PATH="/etc/yum.repos.d/fdio-release.repo"
55 if [ ! -f $REPO_PATH ]; then
56     echo "-------------------------------------------"
57     echo install upstream repo  - Use fd.io nexus repo for now
58     echo until dpdk rpm is in epel or Centos NFV SIG
59     FDIORELEASE=$(mktemp)
60     cat - > $FDIORELEASE <<"_EOF"
61 [fdio-release]
62 name=fd.io release branch latest merge
63 baseurl=https://nexus.fd.io/content/repositories/fd.io.master.centos7/
64 enabled=1
65 gpgcheck=0
66 _EOF
67     sudo cp $FDIORELEASE $REPO_PATH
68     sudo chmod 644 $REPO_PATH
69 fi
70
71 HOME=`pwd`
72 TOPDIR=$HOME
73 TEMPDIR=$TOPDIR/rpms
74
75 function install_pre_reqs() {
76     echo "----------------------------------------"
77     echo Install dependencies for dpdk.
78     echo
79     sudo yum -y install gcc make python-devel openssl-devel kernel-devel graphviz \
80                 kernel-debug-devel autoconf automake rpm-build redhat-rpm-config \
81                 libtool python-twisted-core desktop-file-utils groff PyQt4 \
82                 yum-utils
83 }
84
85 if [ ! -d $TEMPDIR ]; then
86     mkdir -p $TEMPDIR
87 fi
88
89
90 install_pre_reqs
91
92 cd $TEMPDIR
93 echo "---------------------------------"
94 echo Download DPDK RPMs
95 yumdownloader dpdk-$DPDK_VERSION
96 yumdownloader dpdk-devel-$DPDK_VERSION
97 yumdownloader dpdk-debuginfo-$DPDK_VERSION
98 yumdownloader dpdk-doc-$DPDK_VERSION
99 yumdownloader dpdk-examples-$DPDK_VERSION
100 yumdownloader dpdk-tools-$DPDK_VERSION
101
102
103 echo "-------------------------------"
104 echo Copy dpdk RPM
105 echo
106 cp $TEMPDIR/*.rpm $HOME
107
108 exit 0