Fix correct commit hash for release 0.7.0 of openXC7
[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 cat << EOF > /etc/apt/sources.list.d/buster_backports.list
9 deb http://deb.debian.org/debian buster-backports main
10 EOF
11
12 # oooo annoying, pin preferences for buster-backports
13 cat << EOF > /etc/apt/preferences.d/99buster-backports
14 Package: *
15 Pin: release a=buster-backports
16 Pin-Priority: 900
17 EOF
18
19 # upgrade to buster-backports
20 apt-get update -y
21 apt-get upgrade -y
22
23 # change into $SUDO_USER home directory
24 cd /home/$SUDO_USER
25 mkdir -p src/symbiflow
26 cd src/symbiflow
27
28 apt-get install -y libcurl3-gnutls/buster git/buster git-man/buster wget
29
30 git clone https://github.com/steveicarus/iverilog.git
31 git clone https://github.com/YosysHQ/yosys.git
32 git clone https://github.com/YosysHQ/abc.git
33 git clone https://github.com/oneapi-src/oneTBB.git
34 git clone https://github.com/verilog-to-routing/vtr-verilog-to-routing.git
35 git clone https://github.com/YosysHQ/icestorm.git
36 git clone https://github.com/SymbiFlow/prjxray.git
37 git clone https://github.com/SymbiFlow/prjxray-db.git
38 git clone https://github.com/SymbiFlow/yosys-symbiflow-plugins.git
39 #git clone https://github.com/SymbiFlow/symbiflow-examples.git
40 git clone https://github.com/SymbiFlow/symbiflow-arch-defs.git
41 git clone https://github.com/QuickLogic-Corp/quicklogic-fasm.git
42 git clone https://github.com/QuickLogic-Corp/quicklogic-fasm-utils.git
43 git clone https://github.com/SymbiFlow/python-fpga-interchange.git
44 git clone https://github.com/capnproto/capnproto.git
45 git clone https://github.com/capnproto/pycapnp.git
46
47 # debian/10 libxml2 has an integer overflow error. blech.
48 wget http://xmlsoft.org/sources/libxml2-2.9.12.tar.gz
49 wget http://xmlsoft.org/sources/libxslt-1.1.34.tar.gz
50
51 ## Steps to compile Icarus Verilog
52
53 ### Necessary software to install
54
55 apt-get install -y build-essential autoconf make g++ bison flex gperf \
56 libreadline6-dev
57
58 ### Build Icarus Verilog
59
60 cd iverilog
61 git checkout v11_0
62 sh autoconf.sh
63 ./configure --prefix=/usr/local/symbiflow/iverilog
64 make -j$(nproc)
65 make check
66 make install
67 export PATH=/usr/local/symbiflow/iverilog/bin:$PATH
68 cd ..
69
70 ## Steps to compile Yosys
71
72 ### Necessary software to install
73
74 apt-get install -y cmake
75 apt-get install -y python3 clang libreadline-dev gawk tcl-dev \
76 libffi-dev pkg-config libboost-system-dev libboost-python-dev \
77 libboost-filesystem-dev zlib1g-dev
78
79 ### Build Yosys
80
81 cd abc
82 git checkout 4f5f73d18b137930fb3048c0b385c82fa078db38
83 cd ../yosys
84 git checkout f44110c62561b21fa673f44d8e115c3ee70d2900
85 ln -s ../abc .
86 make -j $(nproc) PREFIX=/usr/local/symbiflow/yosys
87 make PREFIX=/usr/local/symbiflow/yosys install
88 install -v -d -m 0755 /usr/local/symbiflow/share
89 ln -s ../yosys/share/yosys /usr/local/symbiflow/share
90 export PATH=/usr/local/symbiflow/yosys/bin:$PATH
91 cd ..
92
93 # NOTE: Option to choose TBB and build vtr-verilog-to-routing with or
94 # without or both. Set env var TBB_VTR.
95 # TBB_VTR=0 --- Do not build TBB and so build vtr without TBB
96 # TBB_VTR=1 --- Build TBB and build vtr with TBB only
97 # TBB_VTR=2 --- Build TBB and build one vtr without TBB and another with TBB
98 # Choose vtr without TBB as default
99 # TBB_VTR=3 --- Build TBB and build one vtr without TBB and another with TBB
100 # Choose vtr with TBB as default
101
102 export TBB_VTR=0
103
104 ## Steps to compile oneTBB
105
106 #Note: TBB is needed for multi-threading VTR-Verilog-to-routing
107 #If not need multi-threading do not build TBB and VTR with TBB
108
109 ### Necessary software to install
110
111 [ $TBB_VTR != 0 ] && apt-get install -y libhwloc-dev
112
113 ### Build TBB
114
115 if [ $TBB_VTR != 0 ]; then
116
117 cd oneTBB
118 git checkout v2020.3
119 make -j$(nproc) tbb tbbmalloc tbbproxy tbbbind
120 install -v -d -m 0755 /usr/local/symbiflow/oneTBB/lib
121 cp -dpr include /usr/local/symbiflow/oneTBB
122 install -v -Dm755 build/linux_*/*.so* -t /usr/local/symbiflow/oneTBB/lib
123 cmake -DINSTALL_DIR=/usr/local/symbiflow/oneTBB/lib/cmake/TBB \
124 -DTBB_VERSION_FILE=/usr/local/symbiflow/oneTBB/include/tbb/tbb_stddef.h \
125 -DSYSTEM_NAME=Linux -P cmake/tbb_config_installer.cmake
126 echo "/usr/local/symbiflow/oneTBB/lib" > /etc/ld.so.conf.d/symbiflow.conf
127 ldconfig
128 cd ..
129
130 fi
131
132 ## Steps to compile vtr-verilog-to-routing
133
134 ### Necessary software to install
135
136 apt-get install -y libeigen3-dev
137
138 # Only if want GUI place and route
139 #apt-get install libcairo2-dev libfontconfig1-dev libx11-dev libxft-dev \
140 #libgtk-3-dev
141
142 ### Build vtr
143
144 if [ $TBB_VTR != 1 ]; then
145
146 cd vtr-verilog-to-routing
147 git checkout d15ed677472e5cc30e6b79717196ac61150652aa
148 mkdir build; cd build
149 cmake -DCMAKE_INSTALL_PREFIX=/usr/local/symbiflow/vtr ..
150 make -j $(nproc)
151 make install
152 install -v -d -m 0755 /usr/local/symbiflow/share/vtr
153 install -v -m 0644 ../libs/libvtrcapnproto/gen/rr_graph_uxsdcxx.capnp \
154 /usr/local/symbiflow/share/vtr
155 [ $TBB_VTR == 0 ] || [ $TBB_VTR == 2 ] && \
156 export PATH=/usr/local/symbiflow/vtr/bin:$PATH
157 cd ../..
158
159 fi
160
161 ### Build vtr-tbb
162
163 if [ $TBB_VTR != 0 ]; then
164
165 cd vtr-verilog-to-routing
166 git checkout d15ed677472e5cc30e6b79717196ac61150652aa
167 mkdir build-tbb; cd build-tbb
168 cmake -DCMAKE_INSTALL_PREFIX=/usr/local/symbiflow/vtr-tbb \
169 -DTBB_INCLUDE_DIR=/usr/local/symbiflow/oneTBB/include \
170 -DTBB_LIBRARY=/usr/local/symbiflow/oneTBB/lib ..
171 LIBRARY_PATH=/usr/local/symbiflow/oneTBB/lib make -j $(nproc)
172 LIBRARY_PATH=/usr/local/symbiflow/oneTBB/lib make install
173 install -v -d -m 0755 /usr/local/symbiflow/share/vtr
174 install -v -m 0644 ../libs/libvtrcapnproto/gen/rr_graph_uxsdcxx.capnp \
175 /usr/local/symbiflow/share/vtr
176 # Choose either one of path for vtr-binaries
177 [ $TBB_VTR == 1 ] || [ $TBB_VTR == 3 ] && \
178 export PATH=/usr/local/symbiflow/vtr-tbb/bin:$PATH
179 cd ../..
180
181 fi
182
183 ## Steps to compile libxml2
184
185 # Newer version is needed which fixes a integer overflow error and is not
186 # provided by Buster.
187
188 ### Necessary software to install
189
190 apt-get install -y python3-dev
191
192 ### Build libxml2
193
194 tar -xf libxml2-2.9.12.tar.gz
195 cd libxml2-2.9.12
196 ./configure --prefix=/usr/local/symbiflow/libxml2 --with-history \
197 --with-python=/usr/bin/python3
198 make -j $(nproc)
199 make install
200 echo "/usr/local/symbiflow/libxml2/lib" >> /etc/ld.so.conf.d/symbiflow.conf
201 ldconfig
202 export PATH=/usr/local/symbiflow/libxml2/bin:$PATH
203 cd ..
204
205 ## Steps to compile libxslt
206
207 # Needed by python3 lxml.
208
209 ### Build libxslt
210
211 tar -xf libxslt-1.1.34.tar.gz
212 cd libxslt-1.1.34
213 sed -i s/3000/5000/ libxslt/transform.c doc/xsltproc.{1,xml}
214 sed -i -r '/max(Parser)?Depth/d' ./tests/fuzz/fuzz.c
215 ./configure --prefix=/usr/local/symbiflow/libxslt --disable-static \
216 --without-python PKG_CONFIG_PATH=/usr/local/symbiflow/libxml2/lib/pkgconfig
217 make -j $(nproc)
218 make install
219 echo "/usr/local/symbiflow/libxslt/lib" >> /etc/ld.so.conf.d/symbiflow.conf
220 ldconfig
221 export PATH=/usr/local/symbiflow/libxslt/bin:$PATH
222 cd ..
223
224 ## Steps to compile prjxray
225
226 ### Necessary software to install
227
228 ### Build prjxray
229
230 cd prjxray
231 git checkout f7f06896ad26bb7c94680dc323d4b871eded1f4e
232 git submodule update --init --recursive
233 mkdir build; cd build
234 cmake -DCMAKE_INSTALL_PREFIX=/usr/local/symbiflow ..
235 make -j$(nproc)
236 make install
237 export PATH=/usr/local/symbiflow/bin:$PATH
238 cd ../..
239
240 ## Steps to compile yosys-symbiflow-plugins
241
242 ### Build yosys-symbiflow-plugins
243
244 cd yosys-symbiflow-plugins
245 git checkout b170f1d3575568d87901422f846b700169e299be
246 sed -i -e 's@-include third_party/make-env/conda.mk@#-include third_party/make-env/conda.mk@' Makefile
247 make -j$(nproc)
248 make install
249 cd ..
250
251 ## Steps to compile prjxray-db
252
253 ### Install prjxray-db
254
255 cd prjxray-db
256 git archive --format=tar --prefix=prjxray-db/ \
257 cd41f08a8a4d2a60053750a0fe10623b1e2e35da | tar -C /usr/local/symbiflow -xf -
258
259 cat > /usr/local/symbiflow/bin/prjxray-config << EOF
260 #!/bin/bash
261 echo /usr/local/symbiflow/prjxray-db
262 EOF
263
264 chmod +x /usr/local/symbiflow/bin/prjxray-config
265 cd ..
266
267 ## Steps to compile Icestorm
268
269 ### Necessary software to install
270
271 apt-get install -y libftdi-dev
272
273 ### Build Icestorm
274
275 cd icestorm
276 git checkout 83b8ef947f77723f602b706eac16281e37de278c
277 make -j $(nproc) PREFIX=/usr/local/symbiflow/icestorm
278 make PREFIX=/usr/local/symbiflow/icestorm install
279 export PATH=/usr/local/symbiflow/icestorm/bin:$PATH
280 cd ..
281
282 ## Steps to compile capnproto
283
284 ### Necessary software to install
285
286 apt-get install -y automake autoconf libtool
287
288 cd capnproto
289 git checkout v0.8.0
290 cd c++
291 autoreconf -i
292 ./configure --prefix=/usr/local/symbiflow/capnproto
293 make -j $(nproc)
294 make install
295 echo "/usr/local/symbiflow/capnproto/lib" >> /etc/ld.so.conf.d/symbiflow.conf
296 ldconfig
297 export PATH=/usr/local/symbiflow/capnproto/bin:$PATH
298 cd ../..
299
300 ## Steps to compile pycapnp
301
302 ### Necessary software to install
303
304 apt-get install -y python3-pip cython3
305
306 cd pycapnp
307 git checkout v1.0.0b1
308 pip3 install .
309 cd ..
310
311 ## Git checkout python-fpga-interchange
312
313 cd python-fpga-interchange
314 git checkout 1959b40e998db987c604c0a75664ccb209df13f7
315 cd ..
316
317 ## Git checkout quicklogic-fasm-utils
318
319 cd quicklogic-fasm-utils
320 git checkout 3d6a375ddb6b55aaa5a59d99e44a207d4c18709f
321 cd ..
322
323 ## Git checkout quicklogic-fasm
324
325 cd quicklogic-fasm
326 git checkout ee546ff09b2ee25894db3f419366afaf3c4bfe32
327 cd ..
328
329 ## Steps to compile symbiflow-arch-defs
330
331 ## Necessary software to install
332
333 apt-get install -y nodejs npm python-pytest openocd flake8 python3-numpy \
334 python3-intervaltree python3-simplejson python3-intelhex \
335 python3-importlib-metadata python3-jsonschema python3-packaging \
336 python3-pyparsing python3-pyrsistent python3-tqdm python3-zipp \
337 python3-typing-extensions python3-ply
338
339 pip3 install textx fasm pyjson5 pyyaml tinyfpgab tinyprog pyjson lxml \
340 progressbar2 hilbertcurve==1.0.5 python-constraint parameterized \
341 yapf==0.26.0 python-sat
342
343 cd symbiflow-arch-defs
344 git checkout c2c0f00960baf538eb31e4c42bf5d09dca87bad7
345 git submodule init
346 git submodule update --init --recursive
347 pip3 install ../python-fpga-interchange
348 pip3 install -e third_party/prjxray
349 pip3 install -e third_party/xc-fasm
350 pip3 install ../quicklogic-fasm-utils
351 pip3 install ../quicklogic-fasm
352 pip3 install -e third_party/qlf-fasm
353 pip3 install -e quicklogic/common/utils/quicklogic-timings-importer
354 pip3 install -e third_party/vtr-xml-utils
355 pip3 install -e third_party/python-symbiflow-v2x
356 pip3 install -e third_party/python-sdf-timing
357 pip3 install -e third_party/symbiflow-xc-fasm2bels
358
359 mkdir -p env/conda/envs
360 ln -s /usr/local/symbiflow env/conda/envs/symbiflow_arch_def_base
361
362 sed -i -e 's@add_subdirectory(litex)@#add_subdirectory(litex)@g' \
363 -e 's@add_subdirectory(ibex)@#add_subdirectory(ibex)@g' \
364 xc/xc7/tests/soc/CMakeLists.txt
365
366 ### Build symbiflow-arch-defs-xc7-artix7-100t
367
368 export VPR_NUM_WORKERS=$(nproc)
369
370 mkdir build; cd build
371 cmake -DUSE_CONDA=FALSE -DPRJXRAY_DB_DIR=/usr/local/symbiflow/prjxray-db \
372 -DINSTALL_FAMILIES=xc7 -DINSTALL_ARCHS=artix7_100t \
373 -DINSTALL_DEVICES=xc7a100t -DCMAKE_INSTALL_PREFIX=/usr/local/symbiflow ..
374 cd xc/xc7/archs/artix7_100t
375 make install
376 cd ../..;
377 make PINMAP_INSTALL_arty100t-full_xc7a100t_test_arty100t-full_pinmap.csv
378 install -v -d -m 0755 /usr/local/symbiflow/share/symbiflow/arch/xc7a100t_test/xc7a100tcsg324-1
379 install -v -m 0644 arty100t-full_pinmap.csv /usr/local/symbiflow/share/symbiflow/arch/xc7a100t_test/xc7a100tcsg324-1/pinmap.csv
380 cd ../../../..
381
382 cd /home/$SUDO_USER/src/symbiflow
383 chown -R $SUDO_USER .
384 chgrp -R $SUDO_USER .
385