forked from eclufsc/ophidian
-
Notifications
You must be signed in to change notification settings - Fork 1
/
build_dependencies.sh
139 lines (123 loc) · 3.5 KB
/
build_dependencies.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
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
################################################################################
# This shell script is used to compile and install dependencies of the
# Ophidian library
################################################################################
# Make shell stop at any command that not return 0
set -e
# Fetch git submodules
git submodule update --init --recursive
# Get script directory
CURRENT_DIR=$(pwd)
SCRIPT=$(readlink -f "$0")
SOURCE_ROOT=$(dirname "$SCRIPT")
# Set default Dependencies Root
DEPENDENCIES_ROOT=$SOURCE_ROOT/dependencies
# Check if user wants to install elsewhere
AUX=$2
if [ "$1" = "--install_to" ] && [ "${AUX:0:1}" != "/" ]
then
DEPENDENCIES_ROOT=$CURRENT_DIR/$2
elif [ "$1" = "--install_to" ] && [ "${AUX:0:1}" = "/" ]
then
DEPENDENCIES_ROOT=$2
fi
# Useful variables
DEPENDENCIES_BIN_PATH=$DEPENDENCIES_ROOT/bin
DEPENDENCIES_LIB_PATH=$DEPENDENCIES_ROOT/lib
DEPENDENCIES_INCLUDE_PATH=$DEPENDENCIES_ROOT/include
DEPENDENCIES_SHARE_PATH=$DEPENDENCIES_ROOT/share
# isntall dependencies directory
echo "Install dependencies to: ${DEPENDENCIES_ROOT}"
while true; do
read -p "Do you wish to continue? (y/n): " yn
case $yn in
[Yy]* ) break;;
[Nn]* ) exit;;
* ) echo "Please answer y (yes) or n (no).";;
esac
done
install_DEF()
{
echo "installing DEF"
cd $SOURCE_ROOT/3rdparty/DEF
make CXXFLAGS="-fPIC -O3 -w" all
install -D -m 644 bin/* $DEPENDENCIES_BIN_PATH
install -D -m 644 lib/* $DEPENDENCIES_LIB_PATH
install -D -m 644 include/* $DEPENDENCIES_INCLUDE_PATH
make clean
}
install_LEF()
{
echo "installing LEF"
cd $SOURCE_ROOT/3rdparty/LEF
make CXXFLAGS="-fPIC -O3 -w" all
install -D -m 644 bin/* $DEPENDENCIES_BIN_PATH
install -D -m 644 lib/* $DEPENDENCIES_LIB_PATH
install -D -m 644 include/* $DEPENDENCIES_INCLUDE_PATH
make clean
}
install_FLUTE()
{
echo "installing Flute"
cd $SOURCE_ROOT/3rdparty/Flute
mkdir build
cd build
cmake -DCMAKE_CXX_FLAGS="-w" -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX="" ..
make DESTDIR=$DEPENDENCIES_ROOT install
cd ..
rm -rf build
}
install_VERILOG_PARSER()
{
echo "installing verilog-parser"
cd $SOURCE_ROOT/3rdparty/verilog-parser
mkdir build
cd build
cmake -DCMAKE_C_FLAGS="-w" -DCMAKE_CXX_FLAGS="-w" -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX="" ..
make DESTDIR=$DEPENDENCIES_ROOT install
cd ..
rm -rf build
}
install_LEMON()
{
echo "installing lemon"
cd $SOURCE_ROOT/3rdparty/Lemon
mkdir build_static
cd build_static
cmake -DCMAKE_CXX_FLAGS="-w" -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX="" ..
make DESTDIR=$DEPENDENCIES_ROOT install
cd ..
rm -rf build_static
mkdir build_shared
cd build_shared
cmake -DCMAKE_CXX_FLAGS="-w" -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX="" -DBUILD_SHARED_LIBS=TRUE ..
make DESTDIR=$DEPENDENCIES_ROOT install
cd ..
rm -rf build_shared
}
install_UNITS()
{
echo "installing units"
cd $SOURCE_ROOT/3rdparty/units
mkdir build
cd build
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX="" ..
make DESTDIR=$DEPENDENCIES_ROOT install
cd ..
rm -rf build
}
run_install()
{
install -d $DEPENDENCIES_ROOT
install -d $DEPENDENCIES_BIN_PATH
install -d $DEPENDENCIES_LIB_PATH
install -d $DEPENDENCIES_INCLUDE_PATH
echo "Starting installation"
install_DEF
install_LEF
install_FLUTE
install_VERILOG_PARSER
install_LEMON
install_UNITS
}
run_install