blob: 677a1ed81ed2c6c51c0986ae88449254c50580f8 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
|
#!/bin/bash
# basic build script example
set -euo pipefail
IFS=$'\n\t'
apt_get=`which apt-get`
# Parameters:
# $1 = Distribution [trusty / CentOS]
#
update_cmake_repo() {
DISTRIBUTION=$1
if [ "$DISTRIBUTION" == "trusty" ]; then
sudo ${apt_get} install -y --allow-unauthenticated software-properties-common
sudo add-apt-repository --yes ppa:george-edison55/cmake-3.x
elif [ "$DISTRIBUTION" == "CentOS" ]; then
sudo cat << EOF > cmake.repo
[cmake-repo]
name=Repo for cmake3
baseurl=http://mirror.ghettoforge.org/distributions/gf/el/7/plus/x86_64/
enabled=1
gpgcheck=0
EOF
sudo cat << EOF > jsoncpp.repo
[jsoncp-repo]
name=Repo for jsoncpp
baseurl=http://dl.fedoraproject.org/pub/epel/7/x86_64/
enabled=1
gpgcheck=0
EOF
sudo mv cmake.repo /etc/yum.repos.d/cmake.repo
sudo mv jsoncpp.repo /etc/yum.repos.d/jsoncpp.repo
fi
}
# Parameters:
# $1 = Distribution codename
#
update_qt_repo() {
DISTRIBUTION_CODENAME=$1
if [ "$DISTRIBUTION_CODENAME" != "trusty" ] && [ "$DISTRIBUTION_CODENAME" != "xenial" ]; then
echo "No valid distribution specified when calling 'update_qt_repo'. Exiting.."
exit -1
fi
sudo ${apt_get} install -y --allow-unauthenticated software-properties-common
sudo add-apt-repository --yes ppa:beineri/opt-qt571-$DISTRIBUTION_CODENAME
wget -q -O - http://archive.getdeb.net/getdeb-archive.key | sudo apt-key add -
sudo sh -c "echo 'deb http://archive.getdeb.net/ubuntu $DISTRIBUTION_CODENAME-getdeb apps' >> /etc/apt/sources.list.d/getdeb.list"
sudo ${apt_get} update
}
setup() {
DISTRIB_ID=$1
DISTRIB_CODENAME=$2
if ! [ -z ${REPO_NAME} ]; then
REPO_URL="${NEXUSPROXY}/content/repositories/fd.io.${REPO_NAME}"
echo "REPO_URL: ${REPO_URL}"
else
exit -1
fi
if [ $DISTRIB_ID == "Ubuntu" ]; then
if [ "$DISTRIB_CODENAME" == "trusty" ]; then
update_cmake_repo $DISTRIB_CODENAME
fi
echo "deb ${REPO_URL} ./" | sudo tee /etc/apt/sources.list.d/99fd.io.list
sudo ${apt_get} update
elif [ "$DISTRIB_ID" == "CentOS" ]; then
update_cmake_repo $DISTRIB_ID
sudo cat << EOF > fdio-master.repo
[fdio-master]
name=fd.io master branch latest merge
baseurl=${REPO_URL}
enabled=1
gpgcheck=0
EOF
sudo mv fdio-master.repo /etc/yum.repos.d/fdio-master.repo
fi
}
build_package() {
ARCHITECTURE=`uname -m`
# Figure out what system we are running on
if [ -f /etc/lsb-release ];then
BUILD_TOOLS="build-essential cmake"
LIBSSL_LIBEVENT="libevent-dev libssl-dev"
LONGBOW_DEPS=""
LIBPARC_DEPS="longbow $LIBSSL_LIBEVENT"
LIBCCNX_COMMON_DEPS="$LIBPARC_DEPS libparc"
LIBCCNX_TRANSPORT_RTA_DEPS="$LIBCCNX_COMMON_DEPS libccnx-common"
LIBCCNX_PORTAL_DEPS="$LIBCCNX_TRANSPORT_RTA_DEPS libccnx-transport-rta"
LIBICNET_DEPS="$LIBCCNX_PORTAL_DEPS libboost-system-dev"
METIS_DEPS="$LIBCCNX_TRANSPORT_RTA_DEPS libccnx-transport-rta"
HTTP_SERVER_DEPS="$LIBICNET_DEPS libicnet libboost-regex-dev libboost-filesystem-dev"
VPP_PLUGIN_DEPS="vpp-dev vpp-dpkg-dev"
. /etc/lsb-release
DEB=ON
RPM=OFF
if [ "$ARCHITECTURE" == "x86_64" ]; then
ARCHITECTURE="amd64"
fi
elif [ -f /etc/redhat-release ];then
BUILD_TOOLS_GROUP="'Development Tools'"
BUILD_TOOLS_SINGLE="cmake"
LIBSSL_LIBEVENT="libevent-devel openssl-devel"
LONGBOW_DEPS=""
LIBPARC_DEPS="longbow $LIBSSL_LIBEVENT"
LIBCCNX_COMMON_DEPS="$LIBPARC_DEPS libparc"
LIBCCNX_TRANSPORT_RTA_DEPS="$LIBCCNX_COMMON_DEPS libccnx-common"
LIBCCNX_PORTAL_DEPS="$LIBCCNX_TRANSPORT_RTA_DEPS libccnx-transport-rta"
LIBICNET_DEPS="$LIBCCNX_PORTAL_DEPS boost-devel"
METIS_DEPS="$LIBCCNX_TRANSPORT_RTA_DEPS libccnx-transport-rta"
HTTP_SERVER_DEPS="$LIBICNET_DEPS libicnet boost-devel"
sudo yum install -y redhat-lsb
DISTRIB_ID=`lsb_release -si`
DISTRIB_RELEASE=`lsb_release -sr`
DISTRIB_CODENAME=`lsb_release -sc`
DISTRIB_DESCRIPTION=`lsb_release -sd`
DEB=OFF
RPM=ON
else
echo "ERROR: System configuration not recognized. Build failed"
exit -1
fi
echo ARCHITECTURE: $ARCHITECTURE
echo DISTRIB_ID: $DISTRIB_ID
echo DISTRIB_RELEASE: $DISTRIB_RELEASE
echo DISTRIB_CODENAME: $DISTRIB_CODENAME
echo DISTRIB_DESCRIPTION: $DISTRIB_DESCRIPTION
setup $DISTRIB_ID $DISTRIB_CODENAME
if [ $DISTRIB_ID == "Ubuntu" ]; then
echo $BUILD_TOOLS ${!PACKAGE_DEPS} | xargs sudo ${apt_get} install -y --allow-unauthenticated
elif [ $DISTRIB_ID == "CentOS" ]; then
echo $BUILD_TOOLS_GROUP | xargs sudo yum groupinstall -y --nogpgcheck || true
echo $BUILD_TOOLS_SINGLE | xargs sudo yum install -y --nogpgcheck || true
echo ${!PACKAGE_DEPS} | xargs sudo yum install -y --nogpgcheck || true
fi
# do nothing but print the current slave hostname
hostname
# Install package dependencies
export CCACHE_DIR=/tmp/ccache
if [ -d $CCACHE_DIR ];then
echo $CCACHE_DIR exists
du -sk $CCACHE_DIR
else
echo $CCACHE_DIR does not exist. This must be a new slave.
fi
echo "cat /etc/bootstrap.sha"
if [ -f /etc/bootstrap.sha ];then
cat /etc/bootstrap.sha
else
echo "Cannot find cat /etc/bootstrap.sha"
fi
echo "cat /etc/bootstrap-functions.sha"
if [ -f /etc/bootstrap-functions.sha ];then
cat /etc/bootstrap-functions.sha
else
echo "Cannot find cat /etc/bootstrap-functions.sha"
fi
echo "sha1sum of this script: ${0}"
sha1sum $0
# Make the package
mkdir -p build && pushd build
rm -rf *
cmake -DCMAKE_INSTALL_PREFIX=/usr -DRPM_PACKAGE=$RPM -DDEB_PACKAGE=$DEB -DDISTRIBUTION=$DISTRIB_CODENAME -DARCHITECTURE=$ARCHITECTURE ..
make package
echo "*******************************************************************"
echo "* $PACKAGE_NAME BUILD SUCCESSFULLY COMPLETED"
echo "*******************************************************************"
exit 0
}
|