Upstream uses DESTDIR, but then tries to hard-install the apache config
modules, as well as not allowing other arguments to Build.PL easily.

Split apache modules to be built during compile phase, and allow control of
apxs2 install mode (for Gentoo, pass APXS2_INSTALL=-i).

For the Build.PL problem, just disable it entirely here, and use the Gentoo
build functions to call Build.PL instead 
(presently does --installdirs=vendor --libdoc= --destdir="${D}" --create_packlist=0).

Signed-off-by: Robin H. Johnson <robbat2@gentoo.org>

diff -Nuar opensrf-2.1.1.orig/src/gateway/Makefile.am opensrf-2.1.1/src/gateway/Makefile.am
--- opensrf-2.1.1.orig/src/gateway/Makefile.am	2012-11-06 17:39:46.000000000 +0000
+++ opensrf-2.1.1/src/gateway/Makefile.am	2012-11-12 21:56:52.108564157 +0000
@@ -17,20 +17,23 @@
 AM_CFLAGS = -D_LARGEFILE64_SOURCE -Wall -I@abs_top_srcdir@/include/ -I$(LIBXML2_HEADERS) -I$(APACHE2_HEADERS) -I$(APR_HEADERS)
 AM_LDFLAGS = -L$(LIBDIR) -L@top_builddir@/src/libopensrf
 AP_LIBEXECDIR = `$(APXS2) -q LIBEXECDIR`
+APXS2_INSTALL = -i -a
 
 DISTCLEANFILES = Makefile.in Makefile
 
-install-exec-local: 
-	d=`$(APXS2) -q SYSCONFDIR` && \
-		if ! grep mod_placeholder $${d}/httpd.conf 2>&1 >/dev/null ; \
-		then echo -e "#\n#LoadModule mod_placeholder /usr/lib/apache2/modules/mod_placeholder.so" \
-		>> $${d}/httpd.conf; \
-	fi
+all:
 	$(APXS2) -c $(DEF_LDLIBS) $(AM_CFLAGS) $(AM_LDFLAGS) @srcdir@/osrf_json_gateway.c apachetools.c apachetools.h libopensrf.so
 	$(APXS2) -c $(DEF_LDLIBS) $(AM_CFLAGS) $(AM_LDFLAGS) @srcdir@/osrf_http_translator.c apachetools.c apachetools.h libopensrf.so
+
+install-exec-local:
+#	d=`$(APXS2) -q SYSCONFDIR` && \
+#		if ! grep mod_placeholder $${d}/httpd.conf 2>&1 >/dev/null ; \
+#		then echo -e "#\n#LoadModule mod_placeholder /usr/lib/apache2/modules/mod_placeholder.so" \
+#		>> $${d}/httpd.conf; \
+#	fi
 	$(MKDIR_P) $(DESTDIR)$(AP_LIBEXECDIR)
-	$(APXS2) -i -S LIBEXECDIR=$(DESTDIR)$(AP_LIBEXECDIR) -a @srcdir@/osrf_json_gateway.la
-	$(APXS2) -i -S LIBEXECDIR=$(DESTDIR)$(AP_LIBEXECDIR) -a @srcdir@/osrf_http_translator.la
+	$(APXS2) $(APXS2_INSTALL) -S LIBEXECDIR=$(DESTDIR)$(AP_LIBEXECDIR) @srcdir@/osrf_json_gateway.la
+	$(APXS2) $(APXS2_INSTALL) -S LIBEXECDIR=$(DESTDIR)$(AP_LIBEXECDIR) @srcdir@/osrf_http_translator.la
 
 clean-local:
 	rm -f @srcdir@/osrf_http_translator.la @srcdir@/osrf_http_translator.lo @srcdir@/osrf_http_translator.slo @srcdir@/osrf_json_gateway.la @srcdir@/osrf_json_gateway.lo @srcdir@/osrf_json_gateway.slo
diff -Nuar opensrf-2.1.1.orig/configure.ac opensrf-2.1.1/configure.ac
--- opensrf-2.1.1.orig/configure.ac	2012-11-06 17:39:46.000000000 +0000
+++ opensrf-2.1.1/configure.ac	2012-11-12 22:04:38.673403306 +0000
@@ -352,7 +352,6 @@
 			 src/gateway/Makefile
 			 src/jserver/Makefile
 			 src/libopensrf/Makefile
-			 src/perl/Makefile
 			 src/ports/strn_compat/Makefile
 			 src/python/opensrf.py
 			 src/router/Makefile
diff -Nuar opensrf-2.1.1.orig/src/Makefile.am opensrf-2.1.1/src/Makefile.am
--- opensrf-2.1.1.orig/src/Makefile.am	2012-11-06 17:39:46.000000000 +0000
+++ opensrf-2.1.1/src/Makefile.am	2012-11-12 22:04:35.580149012 +0000
@@ -40,7 +40,7 @@
 endif
 
 if BUILDCORE
-MAYBE_CORE = libopensrf c-apps router srfsh gateway perl
+MAYBE_CORE = libopensrf c-apps router srfsh gateway
 if BUILDPYTHON
 dist_bin_SCRIPTS = @top_srcdir@/bin/opensrf-perl.pl @top_srcdir@/src/python/opensrf.py @top_srcdir@/src/python/srfsh.py
 else
