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