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