-
Notifications
You must be signed in to change notification settings - Fork 0
/
compile-and-install.sh
executable file
·56 lines (43 loc) · 1.63 KB
/
compile-and-install.sh
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
#!/usr/bin/env bash
# Warning: the --nogpgcheck is used because it is possible to run the
# installation in my docker but it is not possible to run it inside
# the travis docker.
# Take the base directory
BASE_DIR=`realpath "$1"`
echo "Entering the base directory: ${BASE_DIR}"
cd ${BASE_DIR}
echo "#####################################################"
echo "Removing everything related to the P4"
echo "#####################################################"
PACKAGES=`yum list installed | grep p4lang- | awk '{print $1}'`
if [ -n "$PACKAGES" ]; then
yum remove -y $PACKAGES
fi
echo "System is clear ..."
echo "#####################################################"
echo "Compiling & installing the P4 ENV package"
echo "#####################################################"
rm -rf ~/rpmbuild/
rpmbuild -bb p4scl.spec --define 'scl p4lang-p4'
if [ $? -ne 0 ];then
echo "Error during the RPM build"
exit 1
fi
echo "Installing P4 ENV ..."
yum localinstall --nogpgcheck -y ~/rpmbuild/RPMS/x86_64/*
echo "#####################################################"
echo "Compiling & intalling the P4 TOOLS package"
echo "#####################################################"
rm -rf ~/rpmbuild/
rpmbuild -bb p4scl-tool.spec --define 'scl p4lang-p4devel'
if [ $? -ne 0 ];then
echo "Error during the RPM build"
exit 1
fi
echo "Installing P4 TOOLS ..."
yum localinstall --nogpgcheck -y ~/rpmbuild/RPMS/x86_64/*
echo "We are done ...."
echo "You can run following commands:"
echo " - scl enable p4lang-p4 bash --> to start the environment without tools"
echo " - scl enable p4lang-p4devel bash --> to start the environment with p4c, bmv2"
exit 0