Yea was same for me. It's really not that bad.
mkdir gcc
cd gcc
git clone git://gcc.gnu.org/git/gcc.git src
mkdir build
mkdir install
PREFIX=$(pwd)/install
cd build
../src/configure \
--enable-host-shared \
--enable-languages=jit,c++ \
--disable-bootstrap \
--enable-checking=release \
--prefix=$PREFIX \
--disable-multilib
nice make -j4 # altering the "4" to however many cores you have
[0]
May need to install some prerequisites listed here https://gcc.gnu.org/install/prerequisites.html (the error message from the configure might not be obvious so better go through the list first, think I needed MPC and MPFR, whatever I found with apt-cache search libmpc and libmpfr worked).
And then configure and make emacs with PATH, LIBRARY_PATH, LD_LIBRARY_PATH including your gcc build (install/bin and install/lib).
[0] taken and modified from https://gcc.gnu.org/onlinedocs/gcc-6.4.0/jit/internals/index...