--- /usr/portage/sci-geosciences/mapserver/mapserver-4.10.0.ebuild	2007-02-07 12:06:32.000000000 +0400
+++ /home/dirk/overlay/sci-geosciences/mapserver/mapserver-4.10.0.ebuild	2007-03-01 21:44:39.000000000 +0400
@@ -5,7 +5,16 @@
 PHP_EXT_NAME="php_mapscript php_proj"
 RUBY_OPTIONAL="yes"
 
-inherit eutils autotools distutils depend.php depend.apache webapp ruby java-pkg
+#I must check for mygis use flag availability 
+#"mono"
+IUSE="apache xml pdf proj geos tiff gdal xpm postgis flash php python perl ruby tcl java"
+
+inherit eutils autotools distutils depend.php depend.apache ruby java-pkg
+
+if use apache
+then
+	inherit webapp 
+fi
 
 DESCRIPTION="OpenSource development environment for constructing spatially enabled Internet-web applications."
 
@@ -17,17 +26,12 @@
 
 KEYWORDS="~x86"
 
-#I must check for mygis use flag availability 
-#"mono"
-IUSE="xml pdf proj geos tiff gdal xpm postgis flash php python perl ruby tcl java"
-
-
 DEPEND="media-libs/libpng
 	media-libs/jpeg
 	>=media-libs/gd-2.0.12
 	media-libs/freetype
 	sys-libs/zlib
-	net-www/apache
+	apache? ( net-www/apache )
 	geos? ( sci-libs/geos )
 	proj? ( sci-libs/proj net-misc/curl )
 	xml? ( dev-libs/libxml2 )
@@ -44,9 +48,11 @@
 	java? ( =virtual/jdk-1.4* dev-java/java-config dev-lang/swig )
 	tcl? ( dev-lang/tcl dev-lang/swig )"
 
-WEBAPP_MANUAL_SLOT=yes
-
-want_apache
+if use apache
+then
+	WEBAPP_MANUAL_SLOT=yes
+	want_apache
+fi
 
 cd_script() {
 	einfo "$2 the mapserver $1-mapscript"
@@ -54,7 +60,9 @@
 }
 
 pkg_setup(){
-	webapp_pkg_setup
+	if use apache; then
+		webapp_pkg_setup
+	fi
 	if use php; then
 		# check how many versions of php was installed
 		has_php
@@ -100,7 +108,11 @@
 	AT_GNUCONF_UPDATE="no" eautoreconf
 
 	local myconf
-	myconf="--with-httpd=${APACHECTL/'ctl'/} --with-freetype"
+	myconf="--with-freetype"
+
+	if use apache; then
+		myconf="${myconf} --with-httpd=${APACHECTL/'ctl'/}"
+	fi
 
 	if use geos; then
 		myconf="${myconf} --with-geos=$(which geos-config)"
@@ -150,6 +162,7 @@
 		$(use_with pdf)\
 		$(use_with flash ming)\
 		$(use_with java)\
+		$(use_with apache httpd)\
 		${myconf}\
 		|| die "econf failed"
 
@@ -293,8 +306,11 @@
 		doins "${S}"/$i/* || die "Unable to add extra_dir to document tree"
 	done
 
-	webapp_src_preinst
-	chmod +x "${S}"/mapserv || die "Unable to find mapserv"
-	cp "${S}"/mapserv "${D}"/${MY_CGIBINDIR} || die "Unable to install mapserv"
-	webapp_src_install
+	if use apache
+	then
+		webapp_src_preinst
+		chmod +x "${S}"/mapserv || die "Unable to find mapserv"
+		cp "${S}"/mapserv "${D}"/${MY_CGIBINDIR} || die "Unable to install mapserv"
+		webapp_src_install
+	fi
 }