Please don't close this bug until it's properly fixed.
Created attachment 199593 [details] Build log
Created attachment 201696 [details] ebuild for version 5.4.2 New ebuild for mapserver 5.4.2. There still is a problem in compiling gdal with mysql support, so leave it out.
Sounds this problem was solved some time ago allready. The mapserver 5.4.2 ebuild is allready in the official portage tree.
alread yfixed