#!/bin/bash # really this is covered by hdl-tools-yosys already, it's best to # use that (and install yosys at the same time, you'll need it anyway) 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 .. # see hdl-tools-yosys, a *very* specific version is needed to work # with yosys and the yosys-ghdl-plugin cd ghdl #git checkout v1.0.0 git checkout 263c843ed49f59cb4cc3038bafcac2b9238ebad4 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 --enable-default-pie make -j$(nproc) make install cd .. make ghdllib make install cd /home/$SUDO_USER/src/ghdl chown -R $SUDO_USER . chgrp -R $SUDO_USER .