Added missing /bin/bash at the start, bug 696 still occurring for me
[dev-env-setup.git] / coriolis_install
1 #!/bin/bash
2 # name of user running script
3 if [ -z $SUDO_USER ]
4 echo "Checking whoami for current user"
5 then SUDO_USER=$(whoami)
6 fi
7 echo "Current SUDO_USER=$SUDO_USER"
8
9 # Install apt dependencies
10 echo Installing necessary apt dependencies in the chroot
11 sudo apt-get update -y
12 sudo apt-get upgrade -y
13 sudo apt-get install -y automake binutils-dev bison build-essential \
14 sysvinit-utils sysvinit-core \
15 ccache clang cmake doxygen dvipng flex gcc git graphviz \
16 imagemagick libboost-all-dev libboost-python-dev libbz2-dev \
17 libmpfr-dev libgmp-dev libmotif-dev libreadline-dev \
18 libqwt-dev libtool libx11-dev libxaw7-dev libxml2-dev \
19 python2.7 python2.7-dev \
20 libxpm-dev libxt-dev python3.7 python3-jinja2 python3-pip \
21 python3-setuptools python-dev python-qt4 python-sphinx \
22 qt4-dev-tools rapidjson-dev tcl tcl-dev tcl-tclreadline \
23 texlive texlive-fonts-extra texlive-lang-french \
24 texlive-latex-extra texlive-pictures xfig zlib1g-dev
25
26 # Add convenience variable to chroot user .bash_profile
27 echo -e 'export PATH=/usr/lib/ccache:"\044PATH"\nexport DISPLAY=:0.0\nexport ALLIANCE_TOP=/home/$SUDO_USER/alliance/install\nexport YOSYS_TOP=/home/$SUDO_USER/yosys\nexport LD_LIBRARY_PATH=\044{ALLIANCE_TOP}/lib:\044{LD_LIBRARY_PATH}\nexport LD_LIBRARY_PATH=\044{ALLIANCE_TOP}/lib64:\044{LD_LIBRARY_PATH}' > /home/$SUDO_USER/.bash_profile
28
29 chown $SUDO_USER /home/$SUDO_USER/.bash_profile
30 chgrp $SUDO_USER /home/$SUDO_USER/.bash_profile
31
32 echo -e "Added 'export PATH=/usr/lib/ccache:\"\044PATH\"\nexport DISPLAY=:0.0' to /home/$SUDO_USER/.bash_profile to speed up rebuilds"
33
34 # Build and install yosys from source
35 # note that a specific version of yosys is needed for ls180 at the moment
36 echo "deb-src http://ftp.debian.org/debian buster main" > /etc/apt/sources.list.d/bustersrc.list
37 sudo apt-get update -y
38 sudo apt-get build-dep yosys -y
39
40 cd /home/$SUDO_USER
41 git clone https://github.com/cliffordwolf/yosys.git
42 cd yosys
43 git checkout 049e3abf9baf795e69b9ecb9c4f19de6131f8418
44 make config-clang
45 make -j$(nproc)
46
47 cd /home/$SUDO_USER/yosys
48 sudo make install
49
50 # Install coriolis2 from source
51 cd /home/$SUDO_USER
52 source .bash_profile
53 mkdir -p /home/$SUDO_USER/coriolis-2.x/src
54 cd /home/$SUDO_USER/coriolis-2.x/src
55 git clone https://gitlab.lip6.fr/vlsi-eda/coriolis.git
56 cd coriolis
57 git checkout devel
58 ./bootstrap/ccb.py --project=coriolis --make="-j$(nproc) install"
59
60 # Setup and test coriolisenv
61 /home/$SUDO_USER/coriolis-2.x/src/coriolis/bootstrap/coriolisEnv.py > /home/$SUDO_USER/coriolisenv
62 source /home/$SUDO_USER/.bash_profile
63 source /home/$SUDO_USER/coriolisenv
64
65 # Install alliance from source
66 cd /home/$SUDO_USER
67 source coriolisenv
68 git clone https://gitlab.lip6.fr/vlsi-eda/alliance.git
69 mkdir -p /home/$SUDO_USER/alliance/build /home/$SUDO_USER/alliance/install
70 mv alliance/alliance/src alliance
71 rm -rf alliance/alliance
72 cd alliance/src
73 ./autostuff
74 cd /home/$SUDO_USER/alliance/build
75 ../src/configure --prefix=/home/$SUDO_USER/alliance/install --enable-alc-shared
76
77 cd /home/$SUDO_USER/alliance/build
78 source /home/$SUDO_USER/coriolisenv
79 sudo make -j1 install
80
81 # Install and configure alliance-check-toolkit
82 cd /home/$SUDO_USER
83 git clone https://gitlab.lip6.fr/vlsi-eda/alliance-check-toolkit.git
84 source coriolisenv
85 touch alliance-check-toolkit/etc/mk/users.d/user-$SUDO_USER.mk
86 cat <<EOG >>alliance-check-toolkit/etc/mk/users.d/user-$SUDO_USER.mk
87 export CORIOLIS_TOP=/home/$SUDO_USER/coriolis-2.x/Linux.x86_64/Release.Shared/install
88 export ALLIANCE_TOP=/home/$SUDO_USER/alliance/install
89 export CHECK_TOOLKIT=/home/$SUDO_USER/alliance-check-toolkit
90 export YOSYS_TOP=/home/$SUDO_USER/yosys
91 EOG
92 source /home/$SUDO_USER/.bash_profile
93 cd alliance-check-toolkit/benchs/ARM/cmos
94 make lvx
95 echo -e "
96 \e[1;91mSelect File -> Open Cell or press CTRL + o then enter as the cell name 'arm_chip_cts_r' without the single quotation marks.\e[0m
97 "
98 make cgt
99
100 cd /home/$SUDO_USER/src/nextpnr
101 chown -R $SUDO_USER .
102 chgrp -R $SUDO_USER .