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