#!/usr/bin/env bash # Copyright (c) 2016 Open Platform for NFV Project, Inc. and its contributors # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. set -o xtrace if [ -e <%= @ovs_dir %>/BUILD_COMPLETE ]; then echo "Build already done." cd <%= @ovs_dir %> sudo make install else cd <%= @ovs_dpdk_dir %> make config T=<%= @rte_target %> if [ -e <%= @ovs_dpdk_dir %>/<%= @rte_target %> ]; then rm <%= @rte_target %> fi # block of code with more strict error handling set -o errexit ln -s -f build <%= @rte_target %> sed "s/CONFIG_RTE_BUILD_COMBINE_LIBS=n/CONFIG_RTE_BUILD_COMBINE_LIBS=y/" -i <%= @ovs_dpdk_dir %>/build/.config sed "s/CONFIG_RTE_MAX_MEMSEG=.*$/CONFIG_RTE_MAX_MEMSEG=<%= @ovs_dpdk_mem_segments %>/" -i <%= @ovs_dpdk_dir %>/build/.config sed "s/CONFIG_RTE_LIBRTE_VHOST=.*$/CONFIG_RTE_LIBRTE_VHOST=<%= @ovs_dpdk_rte_librte_vhost %>/" -i <%= @ovs_dpdk_dir %>/build/.config sed "s/CONFIG_RTE_LIBRTE_VHOST_DEBUG=.*$/CONFIG_RTE_LIBRTE_VHOST_DEBUG=<%= @ovs_dpdk_vhost_user_debug %>/" -i <%= @ovs_dpdk_dir %>/build/.config make -j `nproc` sudo cp <%= @ovs_dpdk_dir %>/build/lib/*dpdk.* /lib cd <%= @ovs_dir %> ./boot.sh ./configure --with-dpdk=<%= @ovs_dpdk_dir %>/<%= @rte_target %> --prefix=/usr --with-dbdir=<%= @ovs_db_conf_dir %> --with-rundir=<%= @ovs_db_socket_dir %> make -j `nproc` CFLAGS='-O3 -march=native' touch <%= @ovs_dir %>/BUILD_COMPLETE sudo make install set +o errexit fi set +o xtrace