Issue 1 (trivial): in the ebuild if djvu use flag is set in src_compile one of the sed lines reports as unterminated cause there's a line break in it (it's the second line) Issue 2 (not trivial): one of the dependencies is jpeg2k? ( media-libs/jasper ) however ghostscript does NOT use it: its configure.ac prefers building local (static) version from the tree. Unfortunately, ghostscript authors have modified their copy of jasper sources in a way that makes it incompatible with upstream jasper, so at this time it not possible to use upstream jasper for ghostscript.
I wonder if it's the same with zlib, ghostscript prefers local copy too, haven't checked if it's compatible.
Thanks for reporting, this is fixed in app-text/ghostscript-gpl-8.61-r2, for the remaining zlib see bug #206893.