-
Notifications
You must be signed in to change notification settings - Fork 5
/
build
executable file
·262 lines (219 loc) · 5.15 KB
/
build
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
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
#!/bin/sh
if [ x$ACT_HOME = x ]
then
echo "Please set the environment variable ACT_HOME to the install directory"
exit 1
fi
if [ ! -d $ACT_HOME ]
then
echo "ACT_HOME directory [$ACT_HOME] not found?"
exit 1
fi
if [ ! -w $ACT_HOME ]
then
echo
echo "WARNING: ACT_HOME directory [$ACT_HOME] is not writeable; I hope that is okay!"
echo
fi
if [ -f CXX_COMPILER ]
then
rm CXX_COMPILER
fi
if [ -f CXX_LIBFS ]
then
rm CXX_LIBFS
fi
./check_omp.sh || exit 1
./check_filesystem.sh || exit 1
cxx_compiler=`cat CXX_COMPILER`
needlib=""
needmake=""
if [ -f CXX_LIBFS ]
then
needlib="-DNEED_LIBCXXFS=1"
needmake="NEED_LIBCXXFS=1"
fi
#
# Shell re-direct idiom used
#
# ((((command; echo $? >&3) | pipeline >&4) 3>&1) | (read res; exit $res)) 4>&1
#
# 1. Run command and capture its exit status on file descriptor (fd) 3
# 2. Redirect stdout to fd 4
# 3. Redirect fd 3 (the exit code) to stdout
# 4. Read the exit code from stdin (pipeline), and re-exit
# 5. Redirect fd 4 to stdout to restore it
#
cmake_build() {
dir=$1
shift
echo
echo "#### Building and installing package: $dir ####"
date
echo
((((cd $dir; if [ -x ./configure ]; then ./configure; fi; if [ ! -d build ]; then mkdir build; fi; cd build; cmake -DCMAKE_INSTALL_PREFIX=$ACT_HOME -DCMAKE_CXX_COMPILER=$cxx_compiler $needlib $@ .. && make && make install; echo $? >&3) 2>logs/${dir}.err | ./gen_output.sh logs/${dir}.log 10 >&4) 3>&1) | (read res; exit $res)) 4>&1
if [ $? -ne 0 ]
then
echo "FAILED"
exit 1
fi
}
cmake_build_bipart() {
dir=BiPart
echo
echo "#### Building and installing package: Bipart ####"
date
echo
(cd BiPart; if [ ! -d build ]; then mkdir build; fi; cd build; LEF_ROOT=$ACT_HOME GALOIS_INCLUDE=$ACT_HOME/include GALOIS_LIB=$ACT_HOME/lib DEF_ROOT=$ACT_HOME cmake -DCMAKE_INSTALL_PREFIX=$ACT_HOME -DCMAKE_CXX_COMPILER=$cxx_compiler $needlib .. && make && make install) || exit 1
}
act_tool_build() {
if [ $# -eq 1 ]
then
thresh=10
else
thresh=$2
fi
dir=$1
echo
echo "#### Building and installing package: $1 ####"
date
echo
((((cd $dir; if [ -x ./configure ]; then ./configure; fi; if [ -x ./build.sh ]; then ./build.sh CXX=$cxx_compiler $needmake; else make CXX=$cxx_compiler $needmake depend && make CXX=$cxx_compiler $needmake && make install; fi; echo $? >&3) 2>logs/${dir}.err | ./gen_output.sh logs/${dir}.log $thresh >&4) 3>&1) | (read res; exit $res)) 4>&1
if [ $? -ne 0 ]
then
echo "FAILED"
exit 1
fi
}
#
# Apply patches
#
echo "Applying patch to Galois library..."
if [ ! -f patched ]
then
(cd Galois;
patch -p0 < ../extra/Galois;
patch -p0 < ../extra/Galois2;
patch -p0 < ../extra/Galois3;
patch -p0 < ../extra/Galois4
)
touch patched
fi
#
# Create directory to hold build logs
#
if [ ! -d logs ]
then
mkdir logs
fi
echo "Log files and errors can be found in the logs/ directory."
echo "Each number displayed corresponds to 10 lines in the output log file."
echo
echo "Starting: `date`"
#
# Build and install the ACT library
#
echo
echo "#### Building and installing the core ACT library ####"
echo
export VLSI_TOOLS_SRC=`pwd`/act
((((cd act; ./configure $ACT_HOME CXX=$cxx_compiler; ./build; make install; echo $? >&3) 2> logs/act.err | ./gen_output.sh logs/act.log >&4) 3>&1) | (read res; exit $res)) 4>&1
if [ $? -ne 0 ]
then
echo "FAILED"; exit $?
fi
#
# Build and install the Galois library
#
cmake_build Galois 2>logs/Galois.err
if [ -f $ACT_HOME/lib64/libgalois_shmem.a -a ! -f $ACT_HOME/lib/libgalois_shmem.a ]
then
ln -s $ACT_HOME/lib64/libgalois_shmem.a $ACT_HOME/lib/libgalois_shmem.a
fi
#
# Build and install the LEF/DEF library
#
echo
echo "#### Building and installing the LEF/DEF parser ####"
echo
(cd lefdef; make && make install) 2>logs/lefdef.err | ./gen_output.sh logs/lefdef.log || exit 1
# Build and install the SDF/SPEF library
act_tool_build annotate
#
# Build and install...
#
# galois timer library
if [ -f timing/actpin.h ]
then
(cd timing; ./build_galois.sh) 2>logs/timing0.err | ./gen_output.sh logs/timing0.log || exit 1
fi
# phyDB
cmake_build phyDB
#
# Build and install the timing library, if it exists
#
if [ -f timing/actpin.h ]
then
act_tool_build timing
fi
# layout
act_tool_build layout
# BiPart
((((cmake_build_bipart; echo $? >&3) 2>logs/bipart.err | ./gen_output.sh logs/bipart.log >&4) 3>&1) | (read res; exit $res)) 4>&1
if [ $? -ne 0 ]
then
echo "FAILED"
exit 1
fi
# Dali
cmake_build Dali
# PWRoute
cmake_build PWRoute
# SPRoute
cmake_build SPRoute
# TritonRoute-WXL
cmake_build TritonRoute-WXL
# interact
act_tool_build interact
# stdlib
act_tool_build stdlib
# expropt
act_tool_build expropt 50
# expropt_commercial
if [ -f expropt_commercial/Makefile ]
then
act_tool_build expropt_commercial
fi
#
# chp2prs
act_tool_build chp2prs
#
# dflowmap
cmake_build dflowmap
#
# dflowmap_netlist, if it exists
#
if [ -f dflowmap_netlist/build.sh ]
then
cmake_build dflowmap_netlist
cmake_build dflowmap
fi
#
# prs2fpga
act_tool_build prs2fpga
#
# xcell
act_tool_build xcell
#
# dflow2dot
act_tool_build dflow2dot
#
# sky130l
act_tool_build sky130l
#
# utils
act_tool_build utils
# actsim
act_tool_build actsim
echo
echo "Finished: `date`"