Merge "Migrate devstack images to Ansible provisioners"
[releng/builder.git] / jjb / opflex / scripts / openvswitch-build.sh
1 #!/bin/bash
2 # SPDX-License-Identifier: EPL-1.0
3 ##############################################################################
4 # Copyright (c) 2017 The Linux Foundation and others.
5 #
6 # All rights reserved. This program and the accompanying materials
7 # are made available under the terms of the Eclipse Public License v1.0
8 # which accompanies this distribution, and is available at
9 # http://www.eclipse.org/legal/epl-v10.html
10 ##############################################################################
11 # Build script for openvswitch
12
13 set -e
14 set -x
15
16 echo "---> scripts/openvswitch-build.sh"
17
18 ROOT=/tmp/opflex-prefix
19 DESTDIR=install-root
20
21 mkdir -p "$DESTDIR"
22
23 ./boot.sh
24 ./configure --prefix="$ROOT" --enable-shared
25 make -j4
26 DESTDIR=$(pwd)/$DESTDIR make install
27
28 if [[ $OPENVSWITCH_VERSION =~ 2.6.0 ]]; then
29     mkdir -p $DESTDIR/$ROOT/include/openvswitch/openvswitch
30     mv $DESTDIR/$ROOT/include/openvswitch/*.h $DESTDIR/$ROOT/include/openvswitch/openvswitch
31     mv $DESTDIR/$ROOT/include/openflow $DESTDIR/$ROOT/include/openvswitch
32     cp -t "$DESTDIR/$ROOT/include/openvswitch/" include/*.h
33     find lib -name "*.h" -exec cp --parents -t "$DESTDIR/$ROOT/include/openvswitch/" {} \;
34 elif [[ $OPENVSWITCH_VERSION =~ noiro ]]; then
35     find lib ofproto -name "*.h" -exec cp --parents -t "$DESTDIR/$ROOT/include/openvswitch/" {} \;
36 fi
37
38 pushd $DESTDIR
39 tar -cvzf -- "openvswitch-$OPENVSWITCH_VERSION.tar.gz" *
40 # Move tarball to dir of files that will be uploaded to Nexus
41 UPLOAD_FILES_PATH="$WORKSPACE/upload_files"
42 mkdir -p "$UPLOAD_FILES_PATH"
43 mv -- *.tar.gz "$_"
44 popd