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 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 vars_for_bash_profile="export PATH=/usr/lib/ccache:\044PATH
29 export DISPLAY=:0.0
30 export ALLIANCE_TOP=/home/$USER/alliance/install
31 export YOSYS_TOP=/home/$USER/yosys
32 export LD_LIBRARY_PATH=\044{ALLIANCE_TOP}/lib:\044{LD_LIBRARY_PATH}
33 export LD_LIBRARY_PATH=\044{ALLIANCE_TOP}/lib64:\044{LD_LIBRARY_PATH}"
34
35 echo -e "$vars_for_bash_profile" > /home/$USER/.bash_profile
36
37 echo "Setting /home/$USER/.bash_profile file to (for faster rebuilds):
38 $vars_for_bash_profile"
39
40 sudo chown $USER /home/$USER/.bash_profile
41 sudo chgrp $USER /home/$USER/.bash_profile
42
43 # Build and install yosys from source
44 # note that a specific version of yosys is needed for ls180 at the moment
45 echo "deb-src http://ftp.debian.org/debian buster main" > /etc/apt/sources.list.d/bustersrc.list
46 sudo apt-get update -y
47 sudo apt-get build-dep yosys -y
48
49 cd /home/$USER
50 git clone https://github.com/YosysHQ/yosys.git
51 cd yosys
52 git checkout 049e3abf9baf795e69b9ecb9c4f19de6131f8418
53 make config-clang
54 # WAY too heavy a load (18+) - make -j$(nproc)
55 make
56
57 cd /home/$USER/yosys
58 sudo make install
59
60 # Install coriolis2 from source
61 cd /home/$USER
62 source .bash_profile
63 mkdir -p /home/$USER/coriolis-2.x/src
64 cd /home/$USER/coriolis-2.x/src
65 git clone https://gitlab.lip6.fr/vlsi-eda/coriolis.git
66 cd coriolis
67 # check out Libre-SOC 180nm ASIC version - uses stable python2 version
68 #git checkout devel
69 git checkout LS180_RC7_FINAL
70 # guaranteed to fail ./bootstrap/ccb.py --projecrt=coriolis --make="-j$(nproc) install"
71 ./bootstrap/ccb.py --project=coriolis --make="-j1 install"
72
73 # Setup and test coriolisenv
74 # Have to use workaround as coriolisEnv.py can't detect the shell when ran inside a script.
75 /bin/bash << EOF
76 /home/$USER/coriolis-2.x/src/coriolis/bootstrap/coriolisEnv.py > /home/$USER/coriolisenv
77 EOF
78
79 # Set the environment variables needed for Coriolis2 and Alliance
80 # coriolisenv overwrites env vars, so should occur first
81 source /home/$USER/coriolisenv
82 source /home/$USER/.bash_profile
83
84 # Install alliance from source
85 cd /home/$USER
86 git clone https://gitlab.lip6.fr/vlsi-eda/alliance.git
87 mkdir -p /home/$USER/alliance/build /home/$USER/alliance/install
88 mv alliance/alliance/src alliance
89 rm -rf alliance/alliance
90 # Compile Alliance
91 cd alliance/src
92 ./autostuff
93 cd /home/$USER/alliance/build
94 ../src/configure --prefix=/home/$USER/alliance/install --enable-alc-shared
95 # Make/Install as local user
96 make -j1 install
97
98 # Install and configure alliance-check-toolkit
99 cd /home/$USER
100 git clone https://gitlab.lip6.fr/vlsi-eda/alliance-check-toolkit.git
101 touch alliance-check-toolkit/etc/mk/users.d/user-$USER.mk
102
103 # Environment variables for alliance-check-toolkit in a single script variable
104 vars_for_alliance_check="export CORIOLIS_TOP=/home/$USER/coriolis-2.x/Linux.x86_64/Release.Shared/install
105 export ALLIANCE_TOP=/home/$USER/alliance/install
106 export CHECK_TOOLKIT=/home/$USER/alliance-check-toolkit
107 export YOSYS_TOP=/home/$USER/yosys"
108
109 echo -e "$vars_for_alliance_check" > /home/$USER/alliance-check-toolkit/etc/mk/users.d/user-$USER.mk
110
111 echo "Setting /home/$USER/alliance-check-toolkit/etc/mk/users.d/user-$USER.mk file to:
112 $vars_for_alliance_check"
113
114 example_cell="chip_r"
115 cd alliance-check-toolkit/benchs/adder/cmos
116 make lvx
117 echo -e "
118 \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
119 "
120 make cgt
121
122 cd /home/$USER/
123 sudo chown -R $USER *
124 sudo chgrp -R $USER *