ebuild cleanup and fixes for various compilation issues