Migrate devstack images to Ansible provisioners
[releng/builder.git] / jjb / opflex / scripts / opflex-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 echo "---> scripts/opflex-build.sh"
12
13 # Build script for opflex
14
15 set -e
16 set -x
17
18 ROOT=/tmp/opflex-prefix
19
20 function cleanup {
21     if [ -d "$ROOT" ]; then rm -rf "$ROOT"; fi
22 }
23
24 # create dependency root prefix
25 cleanup
26 mkdir -p "$ROOT"
27 trap cleanup EXIT
28
29 # Download the artifacts from nexus thirdparty
30 wget -nv ${NEXUS_URL}/service/local/repositories/thirdparty/content/openvswitch/openvswitch/${OPENVSWITCH_VERSION}/openvswitch-${OPENVSWITCH_VERSION}.tar.gz
31 wget -nv ${NEXUS_URL}/service/local/repositories/thirdparty/content/rapidjson/rapidjson/${RAPIDJSON_VERSION}/rapidjson-${RAPIDJSON_VERSION}.tar.gz
32 wget -nv ${NEXUS_URL}/service/local/repositories/thirdparty/content/libuv/libuv/${LIBUV_VERSION}/libuv-${LIBUV_VERSION}.tar.gz
33
34 tar -xz -C "$ROOT" --strip-components=2 -f libuv-${LIBUV_VERSION}.tar.gz
35 tar -xz -C "$ROOT" --strip-components=2 -f rapidjson-${RAPIDJSON_VERSION}.tar.gz
36 tar -xz -C "$ROOT" --strip-components=2 -f openvswitch-${OPENVSWITCH_VERSION}.tar.gz
37
38 export PATH="$ROOT/bin:$PATH"
39 export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$ROOT/lib"
40 export PKG_CONFIG_PATH="$ROOT/lib/pkgconfig"
41
42 # Move OpFlex artifacts to upload files directory
43 UPLOAD_FILES_PATH="$WORKSPACE/upload_files"
44 mkdir -p "$UPLOAD_FILES_PATH"
45
46 # build libopflex
47 pushd libopflex
48 ./autogen.sh
49 ./configure --prefix="$ROOT" \
50     --with-buildversion=$BUILD_NUMBER \
51     CPPFLAGS="-isystem $ROOT/include" \
52     CXXFLAGS="-Wall"
53 make -j4
54 if ! make check; then find . -name test-suite.log -exec cat {} \; && false; fi
55 make install
56 make dist
57 mv *.tar.gz "$UPLOAD_FILES_PATH"
58 popd
59
60 # build libmodelgbp
61 pushd genie
62 CLASSPATH=target/classes java org.opendaylight.opflex.genie.Genie
63 pushd target/libmodelgbp
64 bash autogen.sh
65 ./configure --prefix="$ROOT"
66 make -j2
67 make install
68 make dist
69 mv *.tar.gz "$UPLOAD_FILES_PATH"
70 popd
71 popd
72
73 # build agent-ovs
74 pushd agent-ovs
75 ./autogen.sh
76 ./configure --prefix="$ROOT" \
77     --with-buildversion=$BUILD_NUMBER \
78     CPPFLAGS="-isystem $ROOT/include" \
79     CXXFLAGS="-Wall"
80 make -j4
81 if ! make check; then find . -name test-suite.log -exec cat {} \; && false; fi
82 make dist
83 mv *.tar.gz "$UPLOAD_FILES_PATH"
84 popd