1
1
function find_binary() {
2
2
binary=" $1 "
3
3
shift
4
- $binary -h 2>&1 > /dev/null
4
+ /usr/bin/env $binary -h 2>&1 > /dev/null
5
5
if [ " $? " != 0 ]; then
6
6
echo " [Error] Binary not found: $binary "
7
7
echo $@
@@ -10,24 +10,54 @@ function find_binary() {
10
10
return 0
11
11
}
12
12
13
+ DIR=" $( cd " $( dirname " ${BASH_SOURCE[0]} " ) " /.. > /dev/null && pwd ) "
14
+ CWD=$PWD
15
+ cd $DIR /envscr
16
+
17
+ echo " [INFO] Checking the presence of Python Interpreter"
18
+ find_binary python " Check out Python from https://www.python.org/"
19
+ retval=$?
20
+ if [ " $retval " != 0 ]; then return $retval 2> /dev/null; exit $retval ; fi
21
+
22
+ echo " [INFO] Checking the presence of PIP"
23
+ python -m pip 2>&1 > /dev/null
24
+ retval=$?
25
+ if [ " $? " != 0 ]; then
26
+ echo " [Error] Python module not found: pip"
27
+ echo " Checkout PIP from: https://pypi.org/project/pip/"
28
+ return $retval 2> /dev/null
29
+ exit $retval
30
+ fi
31
+
32
+ echo " [INFO] Checking if prga.py is installed"
33
+ python -c " from __future__ import absolute_import; import prga" 2>&1 > /dev/null
34
+ retval=$?
35
+ if [ " $retval " != 0 ]; then
36
+ echo " [INFO] Installing prga.py"
37
+ python -m pip install -e $DIR /prga.py --user
38
+ fi
39
+
40
+ echo " [INFO] Checking the presence of VPR"
13
41
find_binary vpr " Check out VPR from " \
14
42
" https://github.com/verilog-to-routing/vtr-verilog-to-routing, " \
15
43
" compile it and find 'vpr' under \$ VTR_ROOT/vpr/"
16
- if [ " $? " != 0 ]; then exit 1; fi
44
+ retval=$?
45
+ if [ " $retval " != 0 ]; then return $retval 2> /dev/null; exit $retval ; fi
17
46
47
+ echo " [INFO] Checking the presence of VPR utility: genfasm"
18
48
find_binary genfasm " Check out VPR from " \
19
49
" https://github.com/verilog-to-routing/vtr-verilog-to-routing, " \
20
50
" compile it and find 'genfasm' under \$ VTR_ROOT/build/utils/fasm/"
21
- if [ " $? " != 0 ]; then exit 1; fi
51
+ retval=$?
52
+ if [ " $retval " != 0 ]; then return $retval 2> /dev/null; exit $retval ; fi
22
53
23
- find_binary " yosys" " Check out Yosys from " \
54
+ echo " [INFO] Checking the presence of yosys"
55
+ find_binary yosys " Check out Yosys from " \
24
56
" http://www.clifford.at/yosys/, compile and install it"
25
- if [ " $? " != 0 ]; then exit 1; fi
57
+ retval=$?
58
+ if [ " $retval " != 0 ]; then return $retval 2> /dev/null; exit $retval ; fi
26
59
27
60
rm vpr_stdout.log
61
+ cd $CWD
28
62
29
- DIR=" $( cd " $( dirname " ${BASH_SOURCE[0]} " ) " /.. > /dev/null && pwd ) "
30
- export PRGA_ROOT=$DIR
31
- if [[ " :$PYTHONPATH :" != * " :$DIR /prga.py:" * ]]; then
32
- export PYTHONPATH=" $DIR /prga.py${PYTHONPATH: +" :$PYTHONPATH " } "
33
- fi
63
+ echo " [INFO] Environmental setup succeeded!"
0 commit comments