eab9fd0fcffa758d628d2525051751ded4dbb0c1
[dev-env-setup.git] / symbiflow-install
1 #!/bin/bash
2 if [ "$EUID" -ne 0 ]
3 then echo "Please run as root using 'sudo bash'"
4 exit
5 fi
6
7 #!!! buster backports is needed for cmake
8
9 apt-get update -y
10 apt-get upgrade -y
11
12 # change into $SUDO_USER home directory
13 cd /home/$SUDO_USER
14 mkdir -p src/symbiflow
15 cd src/symbiflow
16
17 apt-get install -y git wget
18
19 git clone https://github.com/steveicarus/iverilog.git
20 git clone https://github.com/YosysHQ/yosys.git
21 git clone https://github.com/YosysHQ/abc.git
22 git clone https://github.com/verilog-to-routing/vtr-verilog-to-routing.git
23 git clone https://github.com/cliffordwolf/icestorm.git
24 git clone https://github.com/SymbiFlow/prjxray.git
25 git clone https://github.com/SymbiFlow/prjxray-db.git
26 git clone https://github.com/SymbiFlow/yosys-symbiflow-plugins.git
27 #git clone https://github.com/SymbiFlow/symbiflow-examples.git
28 git clone https://github.com/SymbiFlow/symbiflow-arch-defs.git
29 git clone https://github.com/QuickLogic-Corp/quicklogic-fasm.git
30 git clone https://github.com/QuickLogic-Corp/quicklogic-fasm-utils.git
31 git clone https://github.com/SymbiFlow/python-fpga-interchange.git
32 git clone https://github.com/capnproto/capnproto.git
33 git clone https://github.com/capnproto/pycapnp.git
34
35 wget http://xmlsoft.org/sources/libxml2-2.9.12.tar.gz
36 wget http://xmlsoft.org/sources/libxslt-1.1.34.tar.gz
37
38 ## Steps to compile Icarus Verilog
39
40 ### Necessary software to install
41
42 apt-get install -y build-essential autoconf make g++ bison flex gperf \
43 libreadline6-dev
44
45 ### Build Icarus Verilog
46
47 cd iverilog
48 git checkout v11_0
49 sh autoconf.sh
50 ./configure --prefix=/usr/local/symbiflow/iverilog
51 make -j$(nproc)
52 make check
53 make install
54 export PATH=/usr/local/symbiflow/iverilog/bin:$PATH
55 cd ..
56
57 #Please adjust the install paths for iverilog.
58
59 ## Steps to compile Yosys
60
61 ### Necessary software to install
62
63 apt-get install -y -t buster_backports cmake
64 apt-get install -y python3 clang libreadline-dev gawk tcl-dev \
65 libffi-dev pkg-config libboost-system-dev libboost-python-dev \
66 libboost-filesystem-dev zlib1g-dev
67
68 ### Build Yosys
69
70 cd abc
71 git checkout 4f5f73d18b137930fb3048c0b385c82fa078db38
72 cd ../yosys
73 git checkout f44110c62561b21fa673f44d8e115c3ee70d2900
74 ln -s ../abc .
75 make -j $(nproc) PREFIX=/usr/local/symbiflow/yosys
76 make PREFIX=/usr/local/symbiflow/yosys install
77 install -d -m 0755 /usr/local/symbiflow/share
78 ln -s ../yosys/share/yosys /usr/local/symbiflow/share
79 export PATH=/usr/local/symbiflow/yosys/bin:$PATH
80 cd ..
81
82 #Please adjust the install paths for Yosys.
83
84 ## Steps to compile vtr-verilog-to-routing
85
86 ### Necessary software to install
87
88 apt-get install -y libeigen3-dev
89
90 # Only if want GUI place and route
91 #apt-get install libcairo2-dev libfontconfig1-dev libx11-dev libxft-dev \
92 #libgtk-3-dev
93
94 ### Build vtr-verilog-to-routing
95
96 cd vtr-verilog-to-routing
97 git checkout 77a3df829fdf509a76b9d7b941376f3835c2576a
98 mkdir build; cd build
99 cmake -DBUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr/local/symbiflow/vtr ..
100 make -j $(nproc)
101 make install
102 install -d -m 0755 /usr/local/symbiflow/share/vtr
103 cp ../libs/libvtrcapnproto/gen/rr_graph_uxsdcxx.capnp /usr/local/symbiflow/share/vtr
104 export PATH=/usr/local/symbiflow/vtr/bin:$PATH
105 cd ../..
106
107 #Please adjust the install paths for vtr-verilog-to-routing.
108
109 ## Steps to compile libxml2
110
111 # Newer version is needed which fixes a integer overflow error and is not
112 # provided by Buster.
113
114 ### Necessary software to install
115
116 apt-get install -y python3-dev
117
118 ### Build libxml2
119
120 tar -xf libxml2-2.9.12.tar.gz
121 cd libxml2-2.9.12
122 ./configure --prefix=/usr/local/symbiflow/libxml2 --with-history --with-python=/usr/bin/python3
123 make -j $(nproc)
124 make install
125 echo "/usr/local/symbiflow/libxml2/lib" > /etc/ld.so.conf.d/symbiflow.conf
126 ldconfig
127 export PATH=/usr/local/symbiflow/libxml2/bin:$PATH
128 cd ..
129
130 #Please adjust the install paths for libxml2
131
132 ## Steps to compile libxslt
133
134 # Needed by python3 lxml.
135
136 ### Build libxslt
137
138 tar -xf libxslt-1.1.34.tar.gz
139 cd libxslt-1.1.34
140 sed -i s/3000/5000/ libxslt/transform.c doc/xsltproc.{1,xml}
141 sed -i -r '/max(Parser)?Depth/d' ./tests/fuzz/fuzz.c
142 ./configure --prefix=/usr/local/symbiflow/libxslt --disable-static --without-python PKG_CONFIG_PATH=/usr/local/symbiflow/libxml2/lib/pkgconfig
143 make -j $(nproc)
144 make install
145 echo "/usr/local/symbiflow/libxslt/lib" >> /etc/ld.so.conf.d/symbiflow.conf
146 ldconfig
147 export PATH=/usr/local/symbiflow/libxslt/bin:$PATH
148 cd ..
149
150 #Please adjust the install paths for libxslt
151
152 ## Steps to compile prjxray
153
154 ### Necessary software to install
155
156 ### Build prjxray
157
158 cd prjxray
159 git checkout f7f06896ad26bb7c94680dc323d4b871eded1f4e
160 git submodule update --init --recursive
161 mkdir build; cd build
162 cmake -DCMAKE_INSTALL_PREFIX=/usr/local/symbiflow ..
163 make
164 make install
165 export PATH=/usr/local/symbiflow/bin:$PATH
166 cd ../..
167
168 ## Steps to compile yosys-symbiflow-plugins
169
170 ### Build yosys-symbiflow-plugins
171
172 cd yosys-symbiflow-plugins
173 git checkout b170f1d3575568d87901422f846b700169e299be
174 sed -i -e 's@-include third_party/make-env/conda.mk@#-include third_party/make-env/conda.mk@' Makefile
175 make
176 make install
177 cd ..
178
179 ## Steps to compile prjxray-db
180
181 ### Install prjxray-db
182
183 cd prjxray-db
184 git archive --format=tar --prefix=prjxray-db/ cd41f08a8a4d2a60053750a0fe10623b1e2e35da | tar -C /usr/local/symbiflow -xf -
185
186 cat > /usr/local/symbiflow/bin/prjxray-config << EOF
187 #!/bin/bash
188 echo /usr/local/symbiflow/prjxray-db
189 EOF
190
191 chmod +x /usr/local/symbiflow/bin/prjxray-config
192 cd ..
193
194 ## Steps to compile Icestorm
195
196 ### Necessary software to install
197
198 apt-get install -y libftdi-dev
199
200 ### Build Icestorm
201
202 cd icestorm
203 git checkout 83b8ef947f77723f602b706eac16281e37de278c
204 make -j $(nproc) PREFIX=/usr/local/symbiflow/icestorm
205 make install
206 export PATH=/usr/local/symbiflow/icestorm/bin:$PATH
207 cd ..
208
209 ## Steps to compile capnproto
210
211 ### Necessary software to install
212
213 apt-get install -y automake autoconf libtool
214
215 cd capnproto
216 git checkout v0.8.0
217 cd c++
218 autoreconf -i
219 ./configure --prefix=/usr/local/symbiflow/capnproto
220 make -j $(nproc)
221 make install
222 echo "/usr/local/symbiflow/capnproto/lib" >> /etc/ld.so.conf.d/symbiflow.conf
223 ldconfig
224 export PATH=/usr/local/symbiflow/capnproto/bin:$PATH
225 cd ../..
226
227 ## Steps to compile pycapnp
228
229 ### Necessary software to install
230
231 apt-get install -y python3-pip cython3
232
233 cd pycapnp
234 git checkout v1.0.0b1
235 pip3 install .
236 cd ..
237
238 ## Steps to compile symbiflow-arch-defs
239
240 ## Necessary software to install
241
242 apt-get install -y nodejs npm python-pytest openocd flake8 \
243 default-jre-headless libantlr4-runtime-dev python3-numpy \
244 python3-intervaltree python3-simplejson python3-intelhex \
245 python3-importlib-metadata python3-jsonschema python3-packaging \
246 python3-pyparsing python3-pyrsistent python3-tqdm python3-zipp \
247 python3-typing-extensions python3-ply
248
249 pip3 install textx fasm pyjson5 pyyaml tinyfpgab tinyprog pyjson lxml \
250 progressbar2 hilbertcurve==1.0.5 python-constraint parameterized \
251 yapf==0.26.0 python-sat
252
253 pip3 install python-fpga-interchange
254
255 cd symbiflow-arch-defs
256 git submodule init
257 git submodule update --init --recursive
258 pip3 install -e third_party/prjxray
259 pip3 install -e third_party/xc-fasm
260 pip3 install ../quicklogic-fasm-utils
261 pip3 install ../quicklogic-fasm
262 pip3 install -e third_party/qlf-fasm
263 pip3 install -e quicklogic/common/utils/quicklogic-timings-importer
264 pip3 install -e third_party/vtr-xml-utils
265 pip3 install -e third_party/python-symbiflow-v2x
266 pip3 install -e third_party/python-sdf-timing
267 pip3 install -e third_party/symbiflow-xc-fasm2bels
268
269 mkdir -p env/conda/envs
270 ln -s /usr/local/symbiflow env/conda/envs/symbiflow_arch_def_base
271
272 git checkout c2c0f00960baf538eb31e4c42bf5d09dca87bad7
273
274 sed -i -e 's@add_subdirectory(litex)@#add_subdirectory(litex)@g' -e 's@add_subdirectory(ibex)@#add_subdirectory(ibex)@g' xc/xc7/tests/soc/CMakeLists.txt
275
276 ### Build symbiflow-arch-defs-xc7-artix7_100t
277
278 mkdir build; cd build
279 cmake -DUSE_CONDA=FALSE -DPRJXRAY_DB_DIR=/usr/local/symbiflow/prjxray-db -DINSTALL_FAMILIES=xc7 -DINSTALL_ARCHS=artix7_100t -DCMAKE_INSTALL_PREFIX=/usr/local/symbiflow ..
280 cd xc/xc7/archs/artix7_100t
281 make install
282 cd ../..;
283 make PINMAP_INSTALL_arty100t-full_xc7a100t_test_arty100t-full_pinmap.csv
284 install -d -m 0755 /usr/local/symbiflow/share/symbiflow/arch/xc7a100t_test/xc7a100tcsg324-1
285 cp arty100t-full_pinmap.csv /usr/local/symbiflow/share/symbiflow/arch/xc7a100t_test/xc7a100tcsg324-1/pinmap.csv
286
287 cd /home/$SUDO_USER/src/symbiflow
288 chown -R $SUDO_USER .
289 chgrp -R $SUDO_USER .
290