Need help compiling older GCC versions

I’ve been trying to build some older GCC versions to run older versions of CUDA and have had the same errors every time.

I keep getting:
/usr/share/makepkg/util/message.sh: line 51: QUIET: unbound variable
/usr/bin/makepkg: line 129: logpipe: unbound variable
error making: gcc5-exit status

Does anyone know if there are any patches or anything I need to compile gcc5 from the AUR? I’ve tried a few others but CUDA 8 looks like my best bet to do what I need and it requires gcc5 and gcc5-libs. Any help would be appreciated.

I did not see an easy way to build gcc5; so many old libs would also be needed. This site has precompiled versions of gcc, including gcc5:

Not sure if this helps.