Fix correct commit hash for release 0.7.0 of openXC7
[dev-env-setup.git] / coriolis-install
1 #!/bin/bash
2
3 if [ "$EUID" -eq 0 ]; then
4 echo "Please run as a normal user!"
5 echo "This script is NOT intended to run as root."
6 exit
7 fi
8
9 echo "Current USER=$USER"
10
11 # Install apt dependencies
12 echo Installing necessary apt dependencies in the chroot
13 sudo apt-get update -y
14 sudo apt-get upgrade -y
15 sudo apt-get install -y automake binutils-dev bison build-essential \
16 sysvinit-utils sysvinit-core \
17 ccache clang cmake doxygen dvipng flex gcc git graphviz \
18 imagemagick libboost-all-dev libboost-python-dev libbz2-dev \
19 libmpfr-dev libgmp-dev libmotif-dev libreadline-dev \
20 libqwt-dev libtool libx11-dev libxaw7-dev libxml2-dev \
21 python2.7 python2.7-dev \
22 libxpm-dev libxt-dev python3.7 python3-jinja2 python3-pip \
23 python3-setuptools python-dev python-qt4 python-sphinx \
24 qt4-dev-tools rapidjson-dev tcl tcl-dev tcl-tclreadline \
25 texlive texlive-fonts-extra texlive-lang-french \
26 texlive-latex-extra texlive-pictures xfig zlib1g-dev
27
28 # Add convenience variable to chroot user .bash_profile
29 vars_for_bash_profile="export PATH=/usr/lib/ccache:\044PATH
30 export DISPLAY=:0.0
31 export ALLIANCE_TOP=/home/$USER/alliance/install
32 export YOSYS_TOP=/home/$USER/yosys
33 export LD_LIBRARY_PATH=\044{ALLIANCE_TOP}/lib:\044{LD_LIBRARY_PATH}
34 export LD_LIBRARY_PATH=\044{ALLIANCE_TOP}/lib64:\044{LD_LIBRARY_PATH}"
35
36 echo -e "$vars_for_bash_profile" > /home/$USER/.bash_profile
37
38 echo "Setting /home/$USER/.bash_profile file to (for faster rebuilds):
39 $vars_for_bash_profile"
40
41 sudo chown $USER /home/$USER/.bash_profile
42 sudo chgrp $USER /home/$USER/.bash_profile
43
44 # Build and install yosys from source
45 # note that a specific version of yosys is needed for ls180 at the moment
46 echo "deb-src http://ftp.debian.org/debian buster main" > /etc/apt/sources.list.d/bustersrc.list
47 sudo apt-get update -y
48 sudo apt-get build-dep yosys -y
49
50 cd /home/$USER
51 git clone https://github.com/YosysHQ/yosys.git
52 cd yosys
53 git checkout 049e3abf9baf795e69b9ecb9c4f19de6131f8418
54 make config-clang
55 # WAY too heavy a load (18+) - make -j$(nproc)
56 make
57
58 cd /home/$USER/yosys
59 sudo make install
60
61 # Install coriolis2 from source
62 cd /home/$USER
63 source .bash_profile
64 mkdir -p /home/$USER/coriolis-2.x/src
65 cd /home/$USER/coriolis-2.x/src
66 git clone https://gitlab.lip6.fr/vlsi-eda/coriolis.git
67 cd coriolis
68 # check out Libre-SOC 180nm ASIC version - uses stable python2 version
69 #git checkout devel
70 git checkout LS180_RC7_FINAL
71 # guaranteed to fail ./bootstrap/ccb.py --projecrt=coriolis --make="-j$(nproc) install"
72 ./bootstrap/ccb.py --project=coriolis --make="-j1 install"
73
74 # Setup and test coriolisenv
75 # Have to use workaround as coriolisEnv.py can't detect the shell when ran inside a script.
76 /bin/bash << EOF
77 /home/$USER/coriolis-2.x/src/coriolis/bootstrap/coriolisEnv.py > /home/$USER/coriolisenv
78 EOF
79
80 # Set the environment variables needed for Coriolis2 and Alliance
81 # coriolisenv overwrites env vars, so should occur first
82 source /home/$USER/coriolisenv
83 source /home/$USER/.bash_profile
84
85 # Install alliance from source
86 cd /home/$USER
87 git clone https://gitlab.lip6.fr/vlsi-eda/alliance.git
88 mkdir -p /home/$USER/alliance/build /home/$USER/alliance/install
89 mv alliance/alliance/src alliance
90 rm -rf alliance/alliance
91 # Compile Alliance
92 cd alliance/src
93 ./autostuff
94 cd /home/$USER/alliance/build
95 ../src/configure --prefix=/home/$USER/alliance/install --enable-alc-shared
96 # Make/Install as local user
97 make -j1 install
98
99 # Install and configure alliance-check-toolkit
100 cd /home/$USER
101 git clone https://gitlab.lip6.fr/vlsi-eda/alliance-check-toolkit.git
102 touch alliance-check-toolkit/etc/mk/users.d/user-$USER.mk
103
104 # Environment variables for alliance-check-toolkit in a single script variable
105 vars_for_alliance_check="export CORIOLIS_TOP=/home/$USER/coriolis-2.x/Linux.x86_64/Release.Shared/install
106 export ALLIANCE_TOP=/home/$USER/alliance/install
107 export CHECK_TOOLKIT=/home/$USER/alliance-check-toolkit
108 export YOSYS_TOP=/home/$USER/yosys"
109
110 echo -e "$vars_for_alliance_check" > /home/$USER/alliance-check-toolkit/etc/mk/users.d/user-$USER.mk
111
112 echo "Setting /home/$USER/alliance-check-toolkit/etc/mk/users.d/user-$USER.mk file to:
113 $vars_for_alliance_check"
114
115 example_cell="chip_r"
116 cd alliance-check-toolkit/benchs/adder/cmos
117 make lvx
118 echo -e "
119 \e[1;91mSelect File -> Open Cell or press CTRL + o then enter as the cell name '$example_cell' without the single quotation marks.\e[0m
120 "
121 make cgt
122
123 cd /home/$USER/
124 sudo chown -R $USER *
125 sudo chgrp -R $USER *