Add ghdl install script.
[dev-env-setup.git] / ghdl-install
diff --git a/ghdl-install b/ghdl-install
new file mode 100755 (executable)
index 0000000..3de01a1
--- /dev/null
@@ -0,0 +1,51 @@
+#!/bin/bash
+if [ "$EUID" -ne 0 ]
+  then echo "Please run as root using 'sudo bash'"
+  exit
+fi
+
+apt-get update -y
+apt-get install -y git gnat gcc g++ make file texinfo zlib1g-dev
+
+# change into $SUDO_USER home directory
+cd /home/$SUDO_USER
+mkdir -p src/ghdl
+cd src/ghdl
+
+git clone https://github.com/ghdl/ghdl.git
+wget https://ftp.gnu.org/gnu/gmp/gmp-6.2.1.tar.xz
+wget https://ftp.gnu.org/gnu/mpc/mpc-1.2.1.tar.gz
+wget https://www.mpfr.org/mpfr-4.1.0/mpfr-4.1.0.tar.xz
+wget https://gcc.gnu.org/pub/gcc/infrastructure/isl-0.18.tar.bz2
+wget https://ftp.gnu.org/gnu/gcc/gcc-10.3.0/gcc-10.3.0.tar.xz
+
+tar -xf gcc-10.3.0.tar.xz
+cd gcc-10.3.0
+tar -xf ../gmp-6.2.1.tar.xz
+mv gmp-6.2.1 gmp
+tar -xf ../mpc-1.2.1.tar.gz
+mv mpc-1.2.1 mpc
+tar -xf ../mpfr-4.1.0.tar.xz
+mv mpfr-4.1.0 mpfr
+tar -xf ../isl-0.18.tar.bz2
+mv isl-0.18 isl
+cd ..
+
+cd ghdl
+git checkout v1.0.0
+mkdir build
+cd build
+../configure --with-gcc=../../gcc-10.3.0 --prefix=/usr/local/ghdl
+make copy-sources
+mkdir gcc-objs; cd gcc-objs
+../../../gcc-10.3.0/configure --prefix=/usr/local/ghdl --enable-languages=c,vhdl --disable-bootstrap --disable-lto --disable-multilib --disable-libssp --disable-libgomp --disable-libquadmath
+make -j$(nproc)
+make install
+cd ..
+make ghdllib
+make install
+
+cd /home/$SUDO_USER/src/ghdl
+chown -R $SUDO_USER .
+chgrp -R $SUDO_USER .
+