You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by wr...@apache.org on 2007/12/15 04:25:55 UTC
svn commit: r604382 - in /httpd/mod_ftp/trunk: Makefile.apxs README-FTP
build/ build/addloadexample.awk configure.apxs modules/ftp/.deps
modules/ftp/Makefile.apxs modules/ftp/modules.mk modules/ftp/modules.mk.apxs
Author: wrowe
Date: Fri Dec 14 19:25:52 2007
New Revision: 604382
URL: http://svn.apache.org/viewvc?rev=604382&view=rev
Log:
Add configure.apxs, one script to solve out-of-tree builds.
Added:
httpd/mod_ftp/trunk/Makefile.apxs (with props)
httpd/mod_ftp/trunk/build/
httpd/mod_ftp/trunk/build/addloadexample.awk (with props)
httpd/mod_ftp/trunk/configure.apxs (with props)
httpd/mod_ftp/trunk/modules/ftp/modules.mk.apxs
- copied, changed from r604093, httpd/mod_ftp/trunk/modules/ftp/modules.mk
Removed:
httpd/mod_ftp/trunk/modules/ftp/.deps
httpd/mod_ftp/trunk/modules/ftp/modules.mk
Modified:
httpd/mod_ftp/trunk/README-FTP
httpd/mod_ftp/trunk/modules/ftp/Makefile.apxs
Added: httpd/mod_ftp/trunk/Makefile.apxs
URL: http://svn.apache.org/viewvc/httpd/mod_ftp/trunk/Makefile.apxs?rev=604382&view=auto
==============================================================================
--- httpd/mod_ftp/trunk/Makefile.apxs (added)
+++ httpd/mod_ftp/trunk/Makefile.apxs Fri Dec 14 19:25:52 2007
@@ -0,0 +1,114 @@
+##
+## Makefile.apxs -- Build procedure for mod_ftp Apache module
+##
+## Do not use this target; build from the mod_ftp dir root
+##
+
+# top_builddir and top_srcdir are misnomers, because build/*.mk scripts
+# expect each of them to be the parent of the build directory, and fail
+# to trust the installbuilddir.
+exp_installbuilddir=$(shell $(APXS) -q exp_installbuilddir)
+top_srcdir=$(installbuilddir)/..
+top_builddir=$(installbuilddir)/..
+
+ftp_builddir=.
+ftp_srcdir=.
+builddir=.
+srcdir=.
+
+SUBDIRS = modules/ftp
+CLEAN_SUBDIRS =
+
+TARGETS =
+INSTALL_TARGETS = install-conf install-ftpdocs install-manual install-include
+DISTCLEAN_TARGETS = modules/ftp/ftp_config.h
+EXTRACLEAN_TARGETS =
+
+include $(exp_installbuilddir)/rules.mk
+
+# Dang nabbit, these are stripped! Reconsitute them;
+rel_libexecdir=`echo $(exp_libexecdir) | sed -e "s#^$(prefix)/##;"`
+rel_sysconfdir=`echo $(exp_sysconfdir) | sed -e "s#^$(prefix)/##;"`
+
+httpd_conffile=$(exp_sysconfdir)/$(progname).conf
+
+exp_ftpdocsdir=$(shell cd $(exp_htdocsdir)/../ftpdocs; pwd)
+
+FTPPORT=21
+
+install-conf:
+ @echo Installing configuration files
+ @$(MKINSTALLDIRS) $(exp_sysconfdir) $(exp_sysconfdir)/extra \
+ $(exp_sysconfdir)/original $(exp_sysconfdir)/original/extra
+ @cd $(ftp_srcdir)/docs/conf; \
+ for j in $(ftp_srcdir)/docs/conf $(ftp_builddir)/docs/conf ; do \
+ cd $$j ; \
+ for i in extra/ftpd*.conf; do \
+ if [ -f $$i ] ; then \
+ sed -e 's#@exp_ftpdocsdir@#$(exp_ftpdocsdir)#g' \
+ -e 's#@@FTPPort@@#$(FTPPORT)#g' \
+ < $$i; \
+ > $(exp_sysconfdir)/original/$$i; \
+ chmod 0644 $(exp_sysconfdir)/original/$$i; \
+ if test ! -f $(exp_sysconfdir)/$$i; then \
+ $(INSTALL_DATA) $(exp_sysconfdir)/original/$$i \
+ $(exp_sysconfdir)/$$i; \
+ fi; \
+ fi; \
+ done ; \
+ done ; \
+ awk -F $(ftp_srcdir)/build/addloadexample.awk \
+ MODULE=ftp LIBPATH=$(rel_libexecdir) \
+ EXAMPLECONF=$(rel_sysconfdir)/extra/ftpd.conf \
+ < $(httpd_conffile) > $(httpd_conffile).new && \
+ mv $(httpd_conffile) $(httpd_conffile).bak && \
+ mv $(httpd_conffile).new $(httpd_conffile)
+
+docs:
+ @if test -d $(ftp_srcdir)/docs/manual/build; then \
+ cd $(ftp_srcdir)/docs/manual/build && ./build.sh all; \
+ else \
+ echo 'For details on generating the docs, please read:'; \
+ echo ' http://httpd.apache.org/docs-project/docsformat.html'; \
+ fi
+
+dox:
+ doxygen $(ftp_srcdir)/docs/doxygen.conf
+
+ftpdocs-srcdir = $(ftp_srcdir)/docs/ftproot
+
+install-ftpdocs:
+ @if test -d $(exp_ftpdocsdir); then
+ echo Preserving existing FTP documents ; \
+ else \
+ echo Installing FTP documents ; \
+ $(MKINSTALLDIRS) $(exp_ftpdocsdir) ; \
+ if test -d $(ftpdocs-srcdir) && test "x$(RSYNC)" != "x" \
+ && test -x $(RSYNC) ; then \
+ $(RSYNC) --exclude .svn -rlpt --numeric-ids $(ftpdocs-srcdir)/ \
+ $(exp_ftpdocsdir)/; \
+ else \
+ test -d $(ftpdocs-srcdir) && (cd $(ftpdocs-srcdir) \
+ && cp -rp * $(exp_ftpdocsdir)) ; \
+ cd $(exp_ftpdocsdir) && find . -name ".svn" -type d -print \
+ | xargs rm -rf 2>/dev/null || true; \
+ fi; \
+ fi
+
+install-manual:
+ @echo Installing online manual
+ @test -d $(DESTDIR)$(manualdir) || $(MKINSTALLDIRS) $(DESTDIR)$(manualdir)
+ @if test "x$(RSYNC)" != "x" && test -x $(RSYNC) ; then \
+ $(RSYNC) --exclude .svn -rlpt --numeric-ids \
+ $(top_srcdir)/docs/manual/ $(DESTDIR)$(manualdir)/; \
+ else \
+ cd $(top_srcdir)/docs/manual && cp -rp * $(DESTDIR)$(manualdir); \
+ cd $(DESTDIR)$(manualdir) && find . -name ".svn" -type d -print
+ | xargs rm -rf 2>/dev/null || true; \
+ fi
+
+install-include:
+ @echo Installing header files
+ @$(MKINSTALLDIRS) $(exp_includedir)
+ @$(INSTALL_DATA) include/mod_ftp.h $(exp_includedir)
+
Propchange: httpd/mod_ftp/trunk/Makefile.apxs
------------------------------------------------------------------------------
svn:eol-style = native
Modified: httpd/mod_ftp/trunk/README-FTP
URL: http://svn.apache.org/viewvc/httpd/mod_ftp/trunk/README-FTP?rev=604382&r1=604381&r2=604382&view=diff
==============================================================================
--- httpd/mod_ftp/trunk/README-FTP (original)
+++ httpd/mod_ftp/trunk/README-FTP Fri Dec 14 19:25:52 2007
@@ -1,30 +1,28 @@
-To build and install, one can simply...
+To build and install as a DSO outside of the httpd source
+build, from the ftp source root directory, simply;
- cd modules/ftp
- apxs -c -I ../../include mod_ftp.c ftp_*.c
- apxs -i mod_ftp.la
+ ./configure.apxs
+ make
+ make install
- -or-
+If apxs is not in your path, or you are building to a different
+httpd installation, use
- cd modules/ftp
- make -f Makefile.apxs
- make -f Makefile.apxs install
+ APXS=/path/to/bin/apxs ./configure.apxs
- -or-
+instead, so the right configuration is picked up.
+
+To build static, or as a DSO but within the same build as httpd,
+copy the entire ftp directory over an existing httpd source tree,
+and from the httpd source root directory
+
+ ./buildconf (to pick up ftp)
+ ./configure --enable-ftp {your usual options}
+
+and proceed as usual.
- copy modules/ftp/ and include/ over an httpd tree
- ./buildconf to pick up ftp
- ./configure --enable-ftp
-
-but we need to add some autoconf-like detection for the first
-two methods; for now - ftp_config.h sets fchmod and the header
-file arpa/ftp.h as 'found'.
-
-On windows, it's necessary to erase the stock ftp_config.h to
-clear these missing features. The project will make an empty
-stub defining none of these. On windows, for example
+On windows, simply
- del include/ftp_config.h
set APACHE2_HOME=c:\apache22
-and then...-
@@ -33,7 +31,7 @@
-or-
- devenv /useenv mod_ftp.dsw
+ devenv /useenv mod_ftp.dsw
The later command will convert mod_ftp.dsw to mod_ftp.sln, so
after converting once, invoke 'devenv /useenv mod_ftp.sln' instead.
Added: httpd/mod_ftp/trunk/build/addloadexample.awk
URL: http://svn.apache.org/viewvc/httpd/mod_ftp/trunk/build/addloadexample.awk?rev=604382&view=auto
==============================================================================
--- httpd/mod_ftp/trunk/build/addloadexample.awk (added)
+++ httpd/mod_ftp/trunk/build/addloadexample.awk Fri Dec 14 19:25:52 2007
@@ -0,0 +1,29 @@
+# Invoke as awk addloadexample.awk
+
+BEGIN {
+ lm = "LoadModule " MODULE "_module " LIBPATH "/mod_" MODULE ".so";
+ lms = 0
+}
+
+/^ *LoadModule/{
+ if ( ! lms ) lms = 1;
+}
+
+!/LoadModule/{
+ if ( lms == 1 ) {
+ print lm;
+ lms = 2;
+ }
+}
+
+{
+ print $0;
+}
+
+END {
+ if ( lms < 2 ) { print; print lm; }
+ print;
+ print "# Example mod_" MODULE " configuration";
+ print "#Include " EXAMPLECONF "\n";
+}
+
Propchange: httpd/mod_ftp/trunk/build/addloadexample.awk
------------------------------------------------------------------------------
svn:eol-style = native
Added: httpd/mod_ftp/trunk/configure.apxs
URL: http://svn.apache.org/viewvc/httpd/mod_ftp/trunk/configure.apxs?rev=604382&view=auto
==============================================================================
--- httpd/mod_ftp/trunk/configure.apxs (added)
+++ httpd/mod_ftp/trunk/configure.apxs Fri Dec 14 19:25:52 2007
@@ -0,0 +1,67 @@
+#!/bin/sh
+#
+# configure.apxs --- build configuration script for creating mod_ftp
+# out of tree using the apxs utility and httpd build toolset
+#
+if test "$APXS" == ""; then
+ APXS=`which apxs 2>/dev/null`
+fi;
+
+if test "$APXS" == ""; then
+ echo $0 must be able to find apxs in your path,
+ echo or the environment variable APXS must provide the full path of APXS,
+ echo or you may specify it with:
+ echo
+ echo APXS=/path/to/apxs $0
+ echo
+ echo configuration failed
+ exit 1
+fi
+
+echo Configuring mod_ftp for APXS in $APXS
+
+# top_builddir and top_srcdir are a misnomers, because build/*.mk
+# scripts expect them to be the parent of the build directory
+# they fail to use the $installbuilddir path.
+exp_installbuilddir=`$APXS -q exp_installbuilddir`
+top_installbuilddir=`cd $exp_installbuilddir/..; pwd`
+
+builddir=`pwd`
+srcdir=$builddir
+ftp_builddir=$builddir
+ftp_srcdir=$builddir
+
+for i in Makefile modules/ftp/Makefile modules/ftp/modules.mk; do
+ l_r=`echo $i|sed -e "s#/*[^/]*\\\$##;"`
+ sed -e "s#^\(exp_installbuilddir\)=.*#\1=$exp_installbuilddir#;" \
+ -e "s#^\(top_builddir\)=.*#\1=$top_installbuilddir#;" \
+ -e "s#^\(top_srcdir\)=.*#\1=$top_installbuilddir#;" \
+ -e "s#^\(ftp_srcdir\)=.*#\1=$srcdir#;" \
+ -e "s#^\(ftp_builddir\)=.*#\1=$builddir#;" \
+ -e "s#^\(srcdir\)=.*#\1=$srcdir/$l_r#;" \
+ -e "s#^\(builddir\)=.*#\1=$builddir/$l_r#;" \
+ < $i.apxs > $i
+done
+
+touch .deps
+touch modules/ftp/.deps
+
+sed -e "s/^#undef \(HAVE_FCHMOD\)/#define \1/;" \
+ < modules/ftp/ftp_config.h.in > modules/ftp/ftp_config.h
+
+echo ""
+echo "Finished, use 'make' to compile mod_ftp"
+echo "Use 'make FTPPORT=8021 install' to install mod_ftp"
+echo "(the default FTPPORT is 21 if not specified)"
+echo ""
+echo "The manual pages ftp/index.html and mod/mod_ftp.html"
+echo "will be installed to help get you started."
+echo
+echo "The conf/extra/ftpd.conf will be installed as an example"
+echo "for you to work from. In your configuration file,"
+echo " `$APXS -q exp_sysconfdir`/`$APXS -q progname`.conf"
+echo "Uncomment the line '#Include conf/extra/ftpd.conf'"
+echo "to activate this example mod_ftp configuration."
+
+# -e "s#^\(include\) \$(exp_installbuilddir)#\1 $exp_installbuilddir#;" \
+#
Propchange: httpd/mod_ftp/trunk/configure.apxs
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: httpd/mod_ftp/trunk/configure.apxs
------------------------------------------------------------------------------
svn:executable = *
Modified: httpd/mod_ftp/trunk/modules/ftp/Makefile.apxs
URL: http://svn.apache.org/viewvc/httpd/mod_ftp/trunk/modules/ftp/Makefile.apxs?rev=604382&r1=604381&r2=604382&view=diff
==============================================================================
--- httpd/mod_ftp/trunk/modules/ftp/Makefile.apxs (original)
+++ httpd/mod_ftp/trunk/modules/ftp/Makefile.apxs Fri Dec 14 19:25:52 2007
@@ -1,52 +1,35 @@
##
-## Makefile -- Build procedure for sample ftp Apache module
-## Autogenerated via ``apxs -n ftp -g''.
+## Makefile.apx -- Build procedure for mod_ftp Apache module
##
+## Do not use this target; build from the mod_ftp dir root
+##
+
+# top_builddir and top_srcdir are misnomers, because build/*.mk
+# scripts expect it them be the parent of the build directory,
+# and fail to trust the installbuilddir.
+exp_installbuilddir=$(shell $(APXS) -q exp_installbuilddir)
+top_srcdir=$(installbuilddir)/..
+top_builddir=$(installbuilddir)/..
-# the used tools
-APXS=apxs
-APACHECTL=apachectl
+ftp_builddir=../..
+ftp_srcdir=../..
+builddir=.
+srcdir=.
-PREFIX=$(shell $(APXS) -q PREFIX)
+TARGETS =
+CLEAN_TARGETS =
-builddir=.
-top_srcdir=$(PREFIX)
-top_builddir=$(PREFIX)
-include $(shell $(APXS) -q exp_installbuilddir)/special.mk
+include $(exp_installbuilddir)/special.mk
+
+all: local-shared-build
# additional defines, includes and libraries
-#DEFS=-Dmy_define=my_value
-INCLUDES=-I$(builddir)/. -I$(builddir)/../../include
+DEFS=-DFTP_APXS_BUILD
+INCLUDES=-I$(builddir) -I$(srcdir) -I$(ftp_srcdir)/include
#LIBS=-Lmy/lib/dir -lmylib
-# the default target
-all: local-shared-build
-
-$(builddir)/ftp_protocol.h: $(builddir)/../../include/mod_ftp.h \
- $(builddir)/ftp_commands.c
- ./remake_ftp_protocol > $(builddir)/ftp_protocol.h
-
-# cleanup
-clean:
- -rm -f mod_ftp*.o ftp_*.o mod_ftp*.lo ftp_*.lo mod_ftp*.slo ftp_*.slo
- -rm -rf mod_ftp*.la .libs
-
-distclean: clean
-
-# simple test
-test: reload
- lynx -mime_header http://localhost/ftp
-
-# install and activate shared object by reloading Apache to
-# force a reload of the shared object file
-reload: install restart
-
-# the general Apache start/restart/stop
-# procedures
-start:
- $(APACHECTL) start
-restart:
- $(APACHECTL) restart
-stop:
- $(APACHECTL) stop
+$(ftp_srcdir)/include/ftp_protocol.h: $(ftp_srcdir)/include/mod_ftp.h \
+ $(srcdir)/ftp_commands.c
+ cd $(srcdir); \
+ ./remake_ftp_protocol > $(ftp_srcdir)/include/ftp_protocol.h
Copied: httpd/mod_ftp/trunk/modules/ftp/modules.mk.apxs (from r604093, httpd/mod_ftp/trunk/modules/ftp/modules.mk)
URL: http://svn.apache.org/viewvc/httpd/mod_ftp/trunk/modules/ftp/modules.mk.apxs?p2=httpd/mod_ftp/trunk/modules/ftp/modules.mk.apxs&p1=httpd/mod_ftp/trunk/modules/ftp/modules.mk&r1=604093&r2=604382&rev=604382&view=diff
==============================================================================
--- httpd/mod_ftp/trunk/modules/ftp/modules.mk (original)
+++ httpd/mod_ftp/trunk/modules/ftp/modules.mk.apxs Fri Dec 14 19:25:52 2007
@@ -2,4 +2,7 @@
$(SH_LINK) -rpath $(libexecdir) -module -avoid-version mod_ftp.lo ftp_commands.lo ftp_connection.lo ftp_data_connection.lo ftp_data_filters.lo ftp_filters.lo ftp_inet_pton.lo ftp_limitlogin.lo ftp_log.lo ftp_message.lo ftp_protocol.lo ftp_request.lo ftp_util.lo
mod_ftp_cmd_pwd.la: mod_ftp.la mod_ftp_cmd_pwd.slo
$(SH_LINK) -rpath $(libexecdir) -module -avoid-version mod_ftp_cmd_pwd.lo
-shared = mod_ftp.la mod_ftp_cmd_pwd.la
+DISTCLEAN_TARGETS = modules.mk
+static =
+shared = mod_ftp.la
+# not by default; mod_ftp_cmd_pwd.la