Fix correct commit hash for release 0.7.0 of openXC7
[dev-env-setup.git] / symbiflow-install
index eab9fd0fcffa758d628d2525051751ded4dbb0c1..2527cbcc7ca686683808e8bf06b4f37943e42019 100755 (executable)
@@ -1,26 +1,25 @@
 #!/bin/bash
+# Relies on install-hdl-apt-reqs being run first
+# which has already added buster-backports (and pinned libcurl3-gnutls, sigh)
+
 if [ "$EUID" -ne 0 ]
   then echo "Please run as root using 'sudo bash'"
   exit
 fi
 
-#!!! buster backports is needed for cmake
-
-apt-get update -y
-apt-get upgrade -y
-
 # change into $SUDO_USER home directory
 cd /home/$SUDO_USER
 mkdir -p src/symbiflow
 cd src/symbiflow
 
-apt-get install -y git wget
+apt-get install -y libcurl3-gnutls/buster git/buster git-man/buster wget
 
 git clone https://github.com/steveicarus/iverilog.git
 git clone https://github.com/YosysHQ/yosys.git
 git clone https://github.com/YosysHQ/abc.git
+git clone https://github.com/oneapi-src/oneTBB.git
 git clone https://github.com/verilog-to-routing/vtr-verilog-to-routing.git
-git clone https://github.com/cliffordwolf/icestorm.git
+git clone https://github.com/YosysHQ/icestorm.git
 git clone https://github.com/SymbiFlow/prjxray.git
 git clone https://github.com/SymbiFlow/prjxray-db.git
 git clone https://github.com/SymbiFlow/yosys-symbiflow-plugins.git
@@ -32,6 +31,7 @@ git clone https://github.com/SymbiFlow/python-fpga-interchange.git
 git clone https://github.com/capnproto/capnproto.git
 git clone https://github.com/capnproto/pycapnp.git
 
+# debian/10 libxml2 has an integer overflow error. blech.
 wget http://xmlsoft.org/sources/libxml2-2.9.12.tar.gz
 wget http://xmlsoft.org/sources/libxslt-1.1.34.tar.gz
 
@@ -54,13 +54,11 @@ make install
 export PATH=/usr/local/symbiflow/iverilog/bin:$PATH
 cd ..
 
-#Please adjust the install paths for iverilog.
-
 ## Steps to compile Yosys
 
 ### Necessary software to install
 
-apt-get install -y -t buster_backports cmake
+apt-get -t buster-backports install -y cmake # symbiflow-arch-defs needs newer cmake
 apt-get install -y python3 clang libreadline-dev gawk tcl-dev \
  libffi-dev pkg-config libboost-system-dev libboost-python-dev \
  libboost-filesystem-dev zlib1g-dev
@@ -74,12 +72,49 @@ git checkout f44110c62561b21fa673f44d8e115c3ee70d2900
 ln -s ../abc .
 make -j $(nproc) PREFIX=/usr/local/symbiflow/yosys
 make PREFIX=/usr/local/symbiflow/yosys install
-install -d -m 0755 /usr/local/symbiflow/share
+install -v -d -m 0755 /usr/local/symbiflow/share
 ln -s ../yosys/share/yosys /usr/local/symbiflow/share
 export PATH=/usr/local/symbiflow/yosys/bin:$PATH
 cd ..
 
-#Please adjust the install paths for Yosys.
+# NOTE: Option to choose TBB and build vtr-verilog-to-routing with or
+# without or both. Set env var TBB_VTR.
+# TBB_VTR=0   --- Do not build TBB and so build vtr without TBB
+# TBB_VTR=1   --- Build TBB and build vtr with TBB only
+# TBB_VTR=2   --- Build TBB and build one vtr without TBB and another with TBB
+#                 Choose vtr without TBB as default
+# TBB_VTR=3   --- Build TBB and build one vtr without TBB and another with TBB
+#                 Choose vtr with TBB as default
+
+export TBB_VTR=0
+
+## Steps to compile oneTBB
+
+#Note: TBB is needed for multi-threading VTR-Verilog-to-routing
+#If not need multi-threading do not build TBB and VTR with TBB
+
+### Necessary software to install
+
+[ $TBB_VTR != 0 ] && apt-get install -y libhwloc-dev
+
+### Build TBB
+
+if [ $TBB_VTR != 0 ]; then
+
+cd oneTBB
+git checkout v2020.3
+make -j$(nproc) tbb tbbmalloc tbbproxy tbbbind
+install -v -d -m 0755 /usr/local/symbiflow/oneTBB/lib
+cp -dpr include /usr/local/symbiflow/oneTBB
+install -v -Dm755 build/linux_*/*.so* -t /usr/local/symbiflow/oneTBB/lib
+cmake -DINSTALL_DIR=/usr/local/symbiflow/oneTBB/lib/cmake/TBB \
+  -DTBB_VERSION_FILE=/usr/local/symbiflow/oneTBB/include/tbb/tbb_stddef.h \
+  -DSYSTEM_NAME=Linux -P cmake/tbb_config_installer.cmake
+echo "/usr/local/symbiflow/oneTBB/lib" > /etc/ld.so.conf.d/symbiflow.conf
+ldconfig
+cd ..
+
+fi
 
 ## Steps to compile vtr-verilog-to-routing
 
@@ -91,20 +126,46 @@ apt-get install -y libeigen3-dev
 #apt-get install libcairo2-dev libfontconfig1-dev libx11-dev libxft-dev \
 #libgtk-3-dev
 
-### Build vtr-verilog-to-routing
+### Build vtr
+
+if [ $TBB_VTR != 1 ]; then
 
 cd vtr-verilog-to-routing
-git checkout 77a3df829fdf509a76b9d7b941376f3835c2576a
+git checkout d15ed677472e5cc30e6b79717196ac61150652aa
 mkdir build; cd build
-cmake -DBUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr/local/symbiflow/vtr ..
+cmake -DCMAKE_INSTALL_PREFIX=/usr/local/symbiflow/vtr ..
 make -j $(nproc)
 make install
-install -d -m 0755 /usr/local/symbiflow/share/vtr
-cp ../libs/libvtrcapnproto/gen/rr_graph_uxsdcxx.capnp /usr/local/symbiflow/share/vtr
-export PATH=/usr/local/symbiflow/vtr/bin:$PATH
+install -v -d -m 0755 /usr/local/symbiflow/share/vtr
+install -v -m 0644 ../libs/libvtrcapnproto/gen/rr_graph_uxsdcxx.capnp \
+  /usr/local/symbiflow/share/vtr
+[ $TBB_VTR == 0 ] || [ $TBB_VTR == 2 ] && \
+  export PATH=/usr/local/symbiflow/vtr/bin:$PATH
 cd ../..
 
-#Please adjust the install paths for vtr-verilog-to-routing.
+fi
+
+### Build vtr-tbb
+
+if [ $TBB_VTR != 0 ]; then
+
+cd vtr-verilog-to-routing
+git checkout d15ed677472e5cc30e6b79717196ac61150652aa
+mkdir build-tbb; cd build-tbb
+cmake -DCMAKE_INSTALL_PREFIX=/usr/local/symbiflow/vtr-tbb \
+  -DTBB_INCLUDE_DIR=/usr/local/symbiflow/oneTBB/include \
+  -DTBB_LIBRARY=/usr/local/symbiflow/oneTBB/lib ..
+LIBRARY_PATH=/usr/local/symbiflow/oneTBB/lib make -j $(nproc)
+LIBRARY_PATH=/usr/local/symbiflow/oneTBB/lib make install
+install -v -d -m 0755 /usr/local/symbiflow/share/vtr
+install -v -m 0644 ../libs/libvtrcapnproto/gen/rr_graph_uxsdcxx.capnp \
+  /usr/local/symbiflow/share/vtr
+# Choose either one of path for vtr-binaries
+[ $TBB_VTR == 1 ] || [ $TBB_VTR == 3 ] && \
+  export PATH=/usr/local/symbiflow/vtr-tbb/bin:$PATH
+cd ../..
+
+fi
 
 ## Steps to compile libxml2
 
@@ -119,16 +180,15 @@ apt-get install -y python3-dev
 
 tar -xf libxml2-2.9.12.tar.gz
 cd libxml2-2.9.12
-./configure --prefix=/usr/local/symbiflow/libxml2 --with-history --with-python=/usr/bin/python3
+./configure --prefix=/usr/local/symbiflow/libxml2 --with-history \
+  --with-python=/usr/bin/python3
 make -j $(nproc)
 make install
-echo "/usr/local/symbiflow/libxml2/lib" > /etc/ld.so.conf.d/symbiflow.conf
+echo "/usr/local/symbiflow/libxml2/lib" >> /etc/ld.so.conf.d/symbiflow.conf
 ldconfig
 export PATH=/usr/local/symbiflow/libxml2/bin:$PATH
 cd ..
 
-#Please adjust the install paths for libxml2
-
 ## Steps to compile libxslt
 
 # Needed by python3 lxml.
@@ -139,7 +199,8 @@ tar -xf libxslt-1.1.34.tar.gz
 cd libxslt-1.1.34
 sed -i s/3000/5000/ libxslt/transform.c doc/xsltproc.{1,xml}
 sed -i -r '/max(Parser)?Depth/d' ./tests/fuzz/fuzz.c
-./configure --prefix=/usr/local/symbiflow/libxslt --disable-static --without-python PKG_CONFIG_PATH=/usr/local/symbiflow/libxml2/lib/pkgconfig
+./configure --prefix=/usr/local/symbiflow/libxslt --disable-static \
+  --without-python PKG_CONFIG_PATH=/usr/local/symbiflow/libxml2/lib/pkgconfig
 make -j $(nproc)
 make install
 echo "/usr/local/symbiflow/libxslt/lib" >> /etc/ld.so.conf.d/symbiflow.conf
@@ -147,8 +208,6 @@ ldconfig
 export PATH=/usr/local/symbiflow/libxslt/bin:$PATH
 cd ..
 
-#Please adjust the install paths for libxslt
-
 ## Steps to compile prjxray
 
 ### Necessary software to install
@@ -160,7 +219,7 @@ git checkout f7f06896ad26bb7c94680dc323d4b871eded1f4e
 git submodule update --init --recursive
 mkdir build; cd build
 cmake -DCMAKE_INSTALL_PREFIX=/usr/local/symbiflow ..
-make
+make -j$(nproc)
 make install
 export PATH=/usr/local/symbiflow/bin:$PATH
 cd ../..
@@ -172,7 +231,7 @@ cd ../..
 cd yosys-symbiflow-plugins
 git checkout b170f1d3575568d87901422f846b700169e299be
 sed -i -e 's@-include third_party/make-env/conda.mk@#-include third_party/make-env/conda.mk@' Makefile
-make
+make -j$(nproc)
 make install
 cd ..
 
@@ -181,7 +240,8 @@ cd ..
 ### Install prjxray-db
 
 cd prjxray-db
-git archive --format=tar --prefix=prjxray-db/ cd41f08a8a4d2a60053750a0fe10623b1e2e35da | tar -C /usr/local/symbiflow -xf -
+git archive --format=tar --prefix=prjxray-db/ \
+  cd41f08a8a4d2a60053750a0fe10623b1e2e35da | tar -C /usr/local/symbiflow -xf -
 
 cat > /usr/local/symbiflow/bin/prjxray-config << EOF
 #!/bin/bash
@@ -202,7 +262,7 @@ apt-get install -y libftdi-dev
 cd icestorm
 git checkout 83b8ef947f77723f602b706eac16281e37de278c
 make -j $(nproc) PREFIX=/usr/local/symbiflow/icestorm
-make install
+make PREFIX=/usr/local/symbiflow/icestorm install
 export PATH=/usr/local/symbiflow/icestorm/bin:$PATH
 cd ..
 
@@ -235,26 +295,43 @@ git checkout v1.0.0b1
 pip3 install .
 cd ..
 
+## Git checkout python-fpga-interchange
+
+cd python-fpga-interchange
+git checkout 1959b40e998db987c604c0a75664ccb209df13f7
+cd ..
+
+##  Git checkout quicklogic-fasm-utils
+
+cd quicklogic-fasm-utils
+git checkout 3d6a375ddb6b55aaa5a59d99e44a207d4c18709f
+cd ..
+
+##  Git checkout quicklogic-fasm
+
+cd quicklogic-fasm
+git checkout ee546ff09b2ee25894db3f419366afaf3c4bfe32
+cd ..
+
 ## Steps to compile symbiflow-arch-defs
 
 ## Necessary software to install
 
-apt-get install -y nodejs npm python-pytest openocd flake8 \
-  default-jre-headless libantlr4-runtime-dev python3-numpy \
+apt-get install -y nodejs npm python-pytest openocd flake8 python3-numpy \
   python3-intervaltree python3-simplejson python3-intelhex \
   python3-importlib-metadata python3-jsonschema python3-packaging \
   python3-pyparsing python3-pyrsistent python3-tqdm python3-zipp \
   python3-typing-extensions python3-ply
 
 pip3 install textx fasm pyjson5 pyyaml tinyfpgab tinyprog pyjson lxml \
-  progressbar2 hilbertcurve==1.0.5 python-constraint parameterized \
-  yapf==0.26.0 python-sat
-
-pip3 install python-fpga-interchange
+  python-utils==3.4.5 progressbar2 hilbertcurve==1.0.5 python-constraint \
+  parameterized yapf==0.26.0 python-sat
 
 cd symbiflow-arch-defs
+git checkout c2c0f00960baf538eb31e4c42bf5d09dca87bad7
 git submodule init
 git submodule update --init --recursive
+pip3 install ../python-fpga-interchange
 pip3 install -e third_party/prjxray
 pip3 install -e third_party/xc-fasm
 pip3 install ../quicklogic-fasm-utils
@@ -269,20 +346,25 @@ pip3 install -e third_party/symbiflow-xc-fasm2bels
 mkdir -p env/conda/envs
 ln -s /usr/local/symbiflow env/conda/envs/symbiflow_arch_def_base
 
-git checkout c2c0f00960baf538eb31e4c42bf5d09dca87bad7
+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
 
-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
+### Build symbiflow-arch-defs-xc7-artix7-100t
 
-### Build symbiflow-arch-defs-xc7-artix7_100t
+export VPR_NUM_WORKERS=$(nproc)
 
 mkdir build; cd build
-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 ..
+cmake -DUSE_CONDA=FALSE -DPRJXRAY_DB_DIR=/usr/local/symbiflow/prjxray-db \
+  -DINSTALL_FAMILIES=xc7 -DINSTALL_ARCHS=artix7_100t \
+  -DINSTALL_DEVICES=xc7a100t -DCMAKE_INSTALL_PREFIX=/usr/local/symbiflow ..
 cd xc/xc7/archs/artix7_100t
 make install
 cd ../..;
 make PINMAP_INSTALL_arty100t-full_xc7a100t_test_arty100t-full_pinmap.csv
-install -d -m 0755 /usr/local/symbiflow/share/symbiflow/arch/xc7a100t_test/xc7a100tcsg324-1
-cp arty100t-full_pinmap.csv /usr/local/symbiflow/share/symbiflow/arch/xc7a100t_test/xc7a100tcsg324-1/pinmap.csv
+install -v -d -m 0755 /usr/local/symbiflow/share/symbiflow/arch/xc7a100t_test/xc7a100tcsg324-1
+install -v -m 0644 arty100t-full_pinmap.csv /usr/local/symbiflow/share/symbiflow/arch/xc7a100t_test/xc7a100tcsg324-1/pinmap.csv
+cd ../../../..
 
 cd /home/$SUDO_USER/src/symbiflow
 chown -R $SUDO_USER .