You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Tom Vaughan <tv...@aventail.com> on 1998/10/23 22:39:46 UTC

[PATCH] compile and run in same dir?

On Thu, 22 Oct 1998, Ralf S. Engelschall wrote:

[SNIP]
> And the crazy ones can even try my personally preferred way:
> 
> # ./configure --prefix=`pwd` --compat 
>               --sbindir=`pwd`/src --bindir=`pwd`/src
> # make install
> # src/httpd 
[SNIP]

This allows me to "run" Apache from within the source tree but not
"debug", since doing a "make install" strips httpd. And it copies
the support programs and include files around and such. Though I'm
sure it all boils down to what one prefers to do...

I've patched Makefile.tmpl to add a new target "inplace." On a
"make inplace", any shared objects are copied to ./libexec, the
config files are created in ./conf, and the proxy cache dir, ./proxy,
is created. The only prerequisite is that one must specify the
--compat option to configure.

This may look like a lot, but all I did was take some pieces from
the "install-programs" and "install-config" targets and move them
to "handle-modules" and "handle-config" respectively. This way
they can be used by either "[install|inplace]-programs" or
"[install|inplace]-config." The, perhaps only, significant change
is that handle-modules and handle-config rely on a new set of
environment variables which are set by [install|inplace]-programs
and [install|inplace]-config.

I've tested this on a RH 5.1 box only.

Since an empty ./logs dir is included in the distribution, should an
empty ./proxy dir be included too?

If this patch is accepted, I'll update
http://www.apache.org/docs/install.html too.

Thanks,
Tom

--
Tom Vaughan <tv...@aventail.com>

--- Makefile.tmpl.orig	Thu Oct 22 17:24:57 1998
+++ Makefile.tmpl	Fri Oct 23 12:11:16 1998
@@ -175,6 +175,88 @@
 	echo "<=== $(SRC)/support"
 
 ## ------------------------------------------------------------------
+##                       Installation & Inplace Targets
+## ------------------------------------------------------------------
+
+handle-modules:
+	-@if [ ".`grep 'SUBTARGET=target_shared' $(TOP)/$(SRC)/Makefile`" != . ]; then \
+		SHLIB_SUFFIX_NAME="`grep '^SHLIB_SUFFIX_NAME=' $(TOP)/$(SRC)/Makefile | sed -e 's:^.*=::'`"; \
+		SHLIB_SUFFIX_LIST="`grep '^SHLIB_SUFFIX_LIST=' $(TOP)/$(SRC)/Makefile | sed -e 's:^.*=::'`"; \
+		echo "$(INSTALL_DSO) $(TOP)/$(SRC)/libhttpd.ep $(AP_LIBEXECDIR)/libhttpd.ep"; \
+		$(INSTALL_DSO) $(TOP)/$(SRC)/libhttpd.ep $(AP_LIBEXECDIR)/libhttpd.ep; \
+		echo "$(INSTALL_DSO) $(TOP)/$(SRC)/libhttpd.$${SHLIB_SUFFIX_NAME} $(AP_LIBEXECDIR)/libhttpd.$${SHLIB_SUFFIX_NAME}"; \
+		$(INSTALL_DSO) $(TOP)/$(SRC)/libhttpd.$${SHLIB_SUFFIX_NAME} $(AP_LIBEXECDIR)/libhttpd.$${SHLIB_SUFFIX_NAME}; \
+		if [ ".$${SHLIB_SUFFIX_LIST}" != . ]; then \
+			echo "$(RM) $(AP_LIBEXECDIR)/libhttpd.$${SHLIB_SUFFIX_NAME}.*"; \
+			$(RM) $(AP_LIBEXECDIR)/libhttpd.$${SHLIB_SUFFIX_NAME}.*; \
+			for suffix in $${SHLIB_SUFFIX_LIST} ""; do \
+				[ ".$${suffix}" = . ] && continue; \
+				echo "$(LN) $(AP_LIBEXECDIR)/libhttpd.$${SHLIB_SUFFIX_NAME} $(AP_LIBEXECDIR)/libhttpd.$${SHLIB_SUFFIX_NAME}.$${suffix}"; \
+				$(LN) $(AP_LIBEXECDIR)/libhttpd.$${SHLIB_SUFFIX_NAME} $(AP_LIBEXECDIR)/libhttpd.$${SHLIB_SUFFIX_NAME}.$${suffix}; \
+			done; \
+		fi; \
+	fi
+	-@$(RM) $(SRC)/.apaci.install.conf; touch $(SRC)/.apaci.install.conf
+	-@if [ ".`grep '^[ 	]*SharedModule' $(TOP)/$(SRC)/Configuration.apaci`" != . ]; then \
+		for mod in `egrep '^[ 	]*SharedModule' $(TOP)/$(SRC)/Configuration.apaci |\
+	                sed -e 's/^[ 	]*SharedModule[ 	]*//'`; do \
+			file=`echo $${mod} | sed -e 's;^.*/\([^/]*\);\1;'`; \
+			echo "$(INSTALL_DSO) $(TOP)/$(SRC)/$${mod} $(AP_LIBEXECDIR)/$${file}"; \
+			$(INSTALL_DSO) $(TOP)/$(SRC)/$${mod} $(AP_LIBEXECDIR)/$${file}; \
+			name=`$(TOP)/$(AUX)/fmn.sh $(TOP)/$(SRC)/$${mod}`; \
+			echo dummy | awk '{ printf("LoadModule %-18s %s\n", modname, modpath); }' \
+			modname="$${name}" modpath="$(AP_LIBEXECREL)/$${file}" >>$(SRC)/.apaci.install.conf; \
+		done; \
+		echo "" >>$(SRC)/.apaci.install.conf; \
+		echo "#  Reconstruction of the complete module list from all available modules" >>$(SRC)/.apaci.install.conf; \
+		echo "#  (static and shared ones) to achieve correct module execution order." >>$(SRC)/.apaci.install.conf; \
+		echo "#  [WHENEVER YOU CHANGE THE LOADMODULE SECTION ABOVE UPDATE THIS, TOO]" >>$(SRC)/.apaci.install.conf; \
+		echo "ClearModuleList" >>$(SRC)/.apaci.install.conf; \
+		egrep "^[ 	]*(Add|Shared)Module" $(SRC)/Configuration.apaci |\
+		sed	-e 's:SharedModule:AddModule:' \
+			-e 's:modules/[^/]*/::' \
+			-e 's:[ 	]lib: mod_:' \
+			-e 's:\.[soa]*$$:.c:' >>$(SRC)/.apaci.install.conf; \
+	fi
+
+handle-config:
+	-@for conf in httpd.conf access.conf srm.conf; do \
+		(echo "##"; \
+		 echo "## $${conf} -- Apache HTTP server configuration file"; \
+		 echo "##"; \
+		 echo ""; \
+		 cat $(TOP)/conf/$${conf}-dist ) |\
+		 sed -e '/# LoadModule/r $(TOP)/$(SRC)/.apaci.install.conf' \
+			-e 's;@@ServerRoot@@/htdocs;$(AP_DATADIR)/htdocs;' \
+			-e 's;@@ServerRoot@@/icons;$(AP_DATADIR)/icons;' \
+			-e 's;@@ServerRoot@@/cgi-bin;$(AP_DATADIR)/cgi-bin;' \
+			-e 's;@@ServerRoot@@/proxy;$(AP_PROXYCACHEDIR);' \
+			-e 's;@@ServerRoot@@;$(AP_PREFIX);' \
+			-e 's;logs/accept.lock;$(AP_RUNTIMEDIR)/httpd.lock;' \
+			-e 's;logs/apache_runtime_status;$(AP_RUNTIMEDIR)/httpd.scoreboard;' \
+			-e 's;logs/httpd.pid;$(AP_RUNTIMEDIR)/httpd.pid;' \
+			-e 's;logs/access_log;$(AP_LOGFILEDIR)/access_log;' \
+			-e 's;logs/error_log;$(AP_LOGFILEDIR)/error_log;' \
+			-e 's;logs/referer_log;$(AP_LOGFILEDIR)/referer_log;' \
+			-e 's;logs/agent_log;$(AP_LOGFILEDIR)/agent_log;' \
+			-e 's;conf/magic;$(AP_SYSCONFDIR)/magic;' \
+			-e 's;conf/mime.types;$(AP_SYSCONFDIR)/mime.types;' \
+			-e 's;Group #-1;Group $(conf_group);' \
+			-e 's;Port 80;Port $(conf_port);' \
+			-e 's;ServerAdmin you@your.address;ServerAdmin $(conf_serveradmin);' \
+			-e 's;ServerName new.host.name;ServerName $(conf_servername);' \
+        	> $(TOP)/$(SRC)/.apaci.install.tmp && \
+		echo "$(INSTALL_DATA) $(TOP)/conf/$${conf}-dist[*] $(AP_ROOT)$(AP_SYSCONFDIR)/$${conf}.default"; \
+		$(INSTALL_DATA) $(TOP)/$(SRC)/.apaci.install.tmp $(AP_ROOT)$(AP_SYSCONFDIR)/$${conf}.default; \
+		if [ ! -f "$(AP_ROOT)$(AP_SYSCONFDIR)/$${conf}" ]; then \
+			echo "$(INSTALL_DATA) $(TOP)/conf/$${conf}-dist[*] $(AP_ROOT)$(AP_SYSCONFDIR)/$${conf}"; \
+			$(INSTALL_DATA) $(TOP)/$(SRC)/.apaci.install.tmp $(AP_ROOT)$(AP_SYSCONFDIR)/$${conf}; \
+		else \
+			echo "[PRESERVING EXISTING CONFIG FILE: $(AP_ROOT)$(AP_SYSCONFDIR)/$${conf}]"; \
+		fi; \
+	done
+
+## ------------------------------------------------------------------
 ##                       Installation Targets
 ## ------------------------------------------------------------------
 
@@ -238,46 +320,9 @@
 install-programs:
 	@echo "===> [programs: Installing Apache httpd program and shared objects]"
 	$(INSTALL_PROGRAM) $(TOP)/$(SRC)/httpd $(root)$(sbindir)/httpd
-	-@if [ ".`grep 'SUBTARGET=target_shared' $(TOP)/$(SRC)/Makefile`" != . ]; then \
-		SHLIB_SUFFIX_NAME="`grep '^SHLIB_SUFFIX_NAME=' $(TOP)/$(SRC)/Makefile | sed -e 's:^.*=::'`"; \
-		SHLIB_SUFFIX_LIST="`grep '^SHLIB_SUFFIX_LIST=' $(TOP)/$(SRC)/Makefile | sed -e 's:^.*=::'`"; \
-		echo "$(INSTALL_DSO) $(TOP)/$(SRC)/libhttpd.ep $(root)$(libexecdir)/libhttpd.ep"; \
-		$(INSTALL_DSO) $(TOP)/$(SRC)/libhttpd.ep $(root)$(libexecdir)/libhttpd.ep; \
-		echo "$(INSTALL_DSO) $(TOP)/$(SRC)/libhttpd.$${SHLIB_SUFFIX_NAME} $(root)$(libexecdir)/libhttpd.$${SHLIB_SUFFIX_NAME}"; \
-		$(INSTALL_DSO) $(TOP)/$(SRC)/libhttpd.$${SHLIB_SUFFIX_NAME} $(root)$(libexecdir)/libhttpd.$${SHLIB_SUFFIX_NAME}; \
-		if [ ".$${SHLIB_SUFFIX_LIST}" != . ]; then \
-			echo "$(RM) $(libexecdir)/libhttpd.$${SHLIB_SUFFIX_NAME}.*"; \
-			$(RM) $(libexecdir)/libhttpd.$${SHLIB_SUFFIX_NAME}.*; \
-			for suffix in $${SHLIB_SUFFIX_LIST} ""; do \
-				[ ".$${suffix}" = . ] && continue; \
-				echo "$(LN) $(root)$(libexecdir)/libhttpd.$${SHLIB_SUFFIX_NAME} $(root)$(libexecdir)/libhttpd.$${SHLIB_SUFFIX_NAME}.$${suffix}"; \
-				$(LN) $(root)$(libexecdir)/libhttpd.$${SHLIB_SUFFIX_NAME} $(root)$(libexecdir)/libhttpd.$${SHLIB_SUFFIX_NAME}.$${suffix}; \
-			done; \
-		fi; \
-	fi
 	$(INSTALL_DATA) $(TOP)/$(SRC)/support/httpd.8 $(root)$(mandir)/man8/httpd.8
-	-@$(RM) $(SRC)/.apaci.install.conf; touch $(SRC)/.apaci.install.conf
-	-@if [ ".`grep '^[ 	]*SharedModule' $(TOP)/$(SRC)/Configuration.apaci`" != . ]; then \
-		for mod in `egrep '^[ 	]*SharedModule' $(TOP)/$(SRC)/Configuration.apaci |\
-	                sed -e 's/^[ 	]*SharedModule[ 	]*//'`; do \
-			file=`echo $${mod} | sed -e 's;^.*/\([^/]*\);\1;'`; \
-			echo "$(INSTALL_DSO) $(TOP)/$(SRC)/$${mod} $(root)$(libexecdir)/$${file}"; \
-			$(INSTALL_DSO) $(TOP)/$(SRC)/$${mod} $(root)$(libexecdir)/$${file}; \
-			name=`$(TOP)/$(AUX)/fmn.sh $(TOP)/$(SRC)/$${mod}`; \
-			echo dummy | awk '{ printf("LoadModule %-18s %s\n", modname, modpath); }' \
-			modname="$${name}" modpath="$(libexecdir_relative)$${file}" >>$(SRC)/.apaci.install.conf; \
-		done; \
-		echo "" >>$(SRC)/.apaci.install.conf; \
-		echo "#  Reconstruction of the complete module list from all available modules" >>$(SRC)/.apaci.install.conf; \
-		echo "#  (static and shared ones) to achieve correct module execution order." >>$(SRC)/.apaci.install.conf; \
-		echo "#  [WHENEVER YOU CHANGE THE LOADMODULE SECTION ABOVE UPDATE THIS, TOO]" >>$(SRC)/.apaci.install.conf; \
-		echo "ClearModuleList" >>$(SRC)/.apaci.install.conf; \
-		egrep "^[ 	]*(Add|Shared)Module" $(SRC)/Configuration.apaci |\
-		sed	-e 's:SharedModule:AddModule:' \
-			-e 's:modules/[^/]*/::' \
-			-e 's:[ 	]lib: mod_:' \
-			-e 's:\.[soa]*$$:.c:' >>$(SRC)/.apaci.install.conf; \
-	fi
+	@AP_LIBEXECDIR="$(root)$(libexecdir)" AP_LIBEXECREL="$(libexecdir_relative)" \
+		$(MAKE) -f $(MKF) $(MFLAGS) $(MFWD) handle-modules
 	@echo "<=== [programs]"
 
 #   install the support programs and scripts
@@ -371,41 +416,8 @@
 #   and initial config files while preserving existing ones.
 install-config:
 	@echo "===> [config: Installing Apache configuration files]"
-	-@for conf in httpd.conf access.conf srm.conf; do \
-		(echo "##"; \
-		 echo "## $${conf} -- Apache HTTP server configuration file"; \
-		 echo "##"; \
-		 echo ""; \
-		 cat $(TOP)/conf/$${conf}-dist ) |\
-		 sed -e '/# LoadModule/r $(TOP)/$(SRC)/.apaci.install.conf' \
-			-e 's;@@ServerRoot@@/htdocs;$(datadir)/htdocs;' \
-			-e 's;@@ServerRoot@@/icons;$(datadir)/icons;' \
-			-e 's;@@ServerRoot@@/cgi-bin;$(datadir)/cgi-bin;' \
-			-e 's;@@ServerRoot@@/proxy;$(proxycachedir);' \
-			-e 's;@@ServerRoot@@;$(prefix);' \
-			-e 's;logs/accept.lock;$(runtimedir)/httpd.lock;' \
-			-e 's;logs/apache_runtime_status;$(runtimedir)/httpd.scoreboard;' \
-			-e 's;logs/httpd.pid;$(runtimedir)/httpd.pid;' \
-			-e 's;logs/access_log;$(logfiledir)/access_log;' \
-			-e 's;logs/error_log;$(logfiledir)/error_log;' \
-			-e 's;logs/referer_log;$(logfiledir)/referer_log;' \
-			-e 's;logs/agent_log;$(logfiledir)/agent_log;' \
-			-e 's;conf/magic;$(sysconfdir)/magic;' \
-			-e 's;conf/mime.types;$(sysconfdir)/mime.types;' \
-			-e 's;Group #-1;Group $(conf_group);' \
-			-e 's;Port 80;Port $(conf_port);' \
-			-e 's;ServerAdmin you@your.address;ServerAdmin $(conf_serveradmin);' \
-			-e 's;ServerName new.host.name;ServerName $(conf_servername);' \
-        	> $(TOP)/$(SRC)/.apaci.install.tmp && \
-		echo "$(INSTALL_DATA) $(TOP)/conf/$${conf}-dist[*] $(root)$(sysconfdir)/$${conf}.default"; \
-		$(INSTALL_DATA) $(TOP)/$(SRC)/.apaci.install.tmp $(root)$(sysconfdir)/$${conf}.default; \
-		if [ ! -f "$(root)$(sysconfdir)/$${conf}" ]; then \
-			echo "$(INSTALL_DATA) $(TOP)/conf/$${conf}-dist[*] $(root)$(sysconfdir)/$${conf}"; \
-			$(INSTALL_DATA) $(TOP)/$(SRC)/.apaci.install.tmp $(root)$(sysconfdir)/$${conf}; \
-		else \
-			echo "[PRESERVING EXISTING CONFIG FILE: $(root)$(sysconfdir)/$${conf}]"; \
-		fi; \
-	done
+	@AP_ROOT="$(root)" AP_PREFIX="$(prefix)" AP_DATADIR="$(datadir)" AP_SYSCONFDIR="$(sysconfdir)" AP_LOGFILEDIR="$(logfiledir)" AP_RUNTIMEDIR="$(runtimedir)" AP_PROXYCACHEDIR="$(proxycachedir)" \
+		$(MAKE) -f $(MKF) $(MFLAGS) $(MFWD) handle-config
 	-@for conf in mime.types magic; do \
 		echo "$(INSTALL_DATA) $(TOP)/conf/$${conf} $(root)$(sysconfdir)/$${conf}.default"; \
 		$(INSTALL_DATA) $(TOP)/conf/$${conf} $(root)$(sysconfdir)/$${conf}.default; \
@@ -418,6 +430,43 @@
 	done
 	@echo "<=== [config]"
 
+
+## ------------------------------------------------------------------
+##                       Inplace Targets
+## ------------------------------------------------------------------
+
+#   this cleans-up a few things to allow httpd to to be run from within
+#   the source tree.
+inplace:
+	@if [ ! -f $(TOP)/$(SRC)/.apaci.build.ok ]; then \
+		$(MAKE) -f $(MKF) $(MFLAGS) $(MFWD) build; \
+	else \
+		:; \
+	fi
+	@$(MAKE) -f $(MKF) $(MFLAGS) $(MFWD) \
+		inplace-mktree inplace-programs inplace-config
+	-@$(RM) $(SRC)/.apaci.install.tmp
+	-@$(RM) $(SRC)/.apaci.install.conf
+
+#   we need a single repository to put all the modules in. should the
+#   proxy directory be added to the repository just like logs?
+inplace-mktree:
+	@echo "===> [inplace mktree: Preparing Apache source tree]"
+	$(MKDIR) $(TOP)/libexec
+	$(MKDIR) $(TOP)/proxy
+	@echo "<=== [inplace mktree]"
+
+inplace-programs:
+	@echo "===> [inplace programs: Installing Apache httpd program and shared objects]"
+	@AP_LIBEXECDIR="`pwd`/libexec" AP_LIBEXECREL=libexec \
+		$(MAKE) -f $(MKF) $(MFLAGS) $(MFWD) handle-modules
+	@echo "<=== [inplace programs]"
+
+inplace-config:
+	@echo "===> [inplace config: Installing Apache configuration files]"
+	@AP_ROOT= AP_PREFIX="`pwd`" AP_DATADIR="`pwd`" AP_SYSCONFDIR=conf AP_LOGFILEDIR=logs AP_RUNTIMEDIR=logs AP_PROXYCACHEDIR=proxy \
+		$(MAKE) -f $(MKF) $(MFLAGS) $(MFWD) handle-config
+	@echo "<=== [inplace config]"
 
 ## ------------------------------------------------------------------
 ##                       Cleanup Targets