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