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