Although MapServer traditionally comes as CGI for a webserver, it also comes as extension for various programming languages. Through these extensions low level functionality of MapServer is available, which makes it suitable for usage as a mini GIS SDK without a webserver.
The attached patch makes the CGI part dependent of the 'apache' USE flag and allows to use MapServer without a webserver.
Created attachment 111738 [details, diff]
Patch to the MapServer 4.10.0 ebuild to make it dependent on apache only when 'apache' USE var set
The build process has been tested with and without apache. I had to rearrange the IUSE that blowed the patch visually a bit. Sorry for that. ;)
+if use apache
+ inherit webapp
This is not allowed, it kills metadata caching. Do not do such things in ebuilds.