rse 98/12/05 03:13:45
Modified: src CHANGES src/helpers mkshadow.sh . configure INSTALL Makefile.tmpl Log: Build outside of source tree (take 3) ===================================== This patch provides a --shadow=DIR option variant for APACI in addition to the already existing --shadow option. The difference is just this now: --shadow ........ creates an internal build shadow tree --shadow=DIR .... creates first an external build shadow tree and then there the internal build shadow tree The result is obvious: With --shadow=DIR you now can mount the extracted Apache distribution tree read-only from NFS or CDROM or whatever and still use the complete functionality of APACI, _INCLUDING_ creating the internal build shadow trees to solve the parallel-platform conflict. Just one thing we have to change in general to allow this patch: We have to use the -h (don't follow symlinks) option of `tar' under `make install'. I checked this against FreeBSD, Linux, SunOS and Solaris and -h really seems a very old and well-supported option. Now the use case: $ cd apache_1.3.x $ ./configure --shadow=/tmp/apache [...] $ make -f /tmp/apache/Makefile $ make -f /tmp/apache/Makefile install Or alternatively: $ cd apache_1.3.x $ ./configure --shadow=/tmp/apache [...] $ cd /tmp/apache $ make $ make install As you can see this is _very_ similar to the non-shadow situation ;-): $ cd apache_1.3.x $ ./configure [...] $ make $ make install Revision Changes Path 1.1162 +8 -0 apache-1.3/src/CHANGES Index: CHANGES =================================================================== RCS file: /home/cvs/apache-1.3/src/CHANGES,v retrieving revision 1.1161 retrieving revision 1.1162 diff -u -r1.1161 -r1.1162 --- CHANGES 1998/12/04 18:29:42 1.1161 +++ CHANGES 1998/12/05 11:13:41 1.1162 @@ -1,5 +1,13 @@ Changes with Apache 1.3.4 + *) Add APACI --shadow=DIR variant (in addition to --shadow). This now first + creates an external package shadow tree in DIR before the local build + shadow tree is generated under DIR. This way one can have the extracted + Apache distribution tree read-only on NFS or CDROM and still build Apache + from these sources. An automatically triggered VPATH-like mechanism is + provided through the TOP variable, too. + [Ralf S. Engelschall, Wilfredo Sanchez <[EMAIL PROTECTED]>] + *) Fix negotiation so that a Vary response header is correctly generated when, for a particular dimension, variants only vary in having or not having a value for that dimension. [Paul Sutton] 1.4 +43 -20 apache-1.3/src/helpers/mkshadow.sh Index: mkshadow.sh =================================================================== RCS file: /home/cvs/apache-1.3/src/helpers/mkshadow.sh,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- mkshadow.sh 1998/09/16 20:49:25 1.3 +++ mkshadow.sh 1998/12/05 11:13:42 1.4 @@ -19,18 +19,35 @@ src=`echo $1 | sed -e 's:/$::'` dst=`echo $2 | sed -e 's:/$::'` -# determine if source is an absolute path +# check whether source exists +if [ ! -d $src ]; then + echo "mkshadow.sh:Error: source directory not found" 1>&2 + exit 1 +fi + +# determine if one of the paths is an absolute path, +# because then we have to use an absolute symlink +oneisabs=0 case $src in - /* ) srcisabs=1 ;; - * ) srcisabs=0 ;; + /* ) oneisabs=1 ;; esac - -# determine reverse directory to directory case $dst in - /* ) dstrevdir='' ;; - * ) dstrevdir="`$src/helpers/fp2rp $dst`/" ;; + /* ) oneisabs=1 ;; esac +# determine reverse directory for destination directory +dstrevdir='' +if [ $oneisabs = 0 ]; then + # (inlined fp2rp) + OIFS2="$IFS"; IFS='/' + for pe in $dst; do + dstrevdir="../$dstrevdir" + done + IFS="$OIFS2" +else + src="`cd $src; pwd`"; +fi + # create directory tree at destination if [ ! -d $dst ]; then mkdir $dst @@ -48,7 +65,7 @@ # fill directory tree with symlinks to files FILES="`cd $src - find . -type f -depth -print |\ + find . -depth -print |\ sed -e '/\.o$/d' \ -e '/\.a$/d' \ -e '/\.so$/d' \ @@ -63,23 +80,29 @@ -e 's/^\.\///'`" OIFS="$IFS" IFS="$DIFS" for file in $FILES; do + # don't use `-type f' above for find because of symlinks + if [ -d $file ]; then + continue + fi basename=`echo $file | sed -e 's:^.*/::'` dir=`echo $file | sed -e 's:[^/]*$::' -e 's:/$::' -e 's:$:/:' -e 's:^/$::'` from="$src/$file" to="$dst/$dir$basename" - if [ $srcisabs = 0 -a ".$dir" != . ]; then - subdir=`echo $dir | sed -e 's:/$::'` - # (inlined fp2rp) - revdir='' - OIFS2="$IFS"; IFS='/' - for pe in $subdir; do - revdir="../$revdir" - done - IFS="$OIFS2" - # finalize from - from="$revdir$from" + if [ $oneisabs = 0 ]; then + if [ ".$dir" != . ]; then + subdir=`echo $dir | sed -e 's:/$::'` + # (inlined fp2rp) + revdir='' + OIFS2="$IFS"; IFS='/' + for pe in $subdir; do + revdir="../$revdir" + done + IFS="$OIFS2" + # finalize from + from="$revdir$from" + fi + from="$dstrevdir$from" fi - from="$dstrevdir$from" echo " $to" ln -s $from $to done 1.56 +98 -49 apache-1.3/configure Index: configure =================================================================== RCS file: /home/cvs/apache-1.3/configure,v retrieving revision 1.55 retrieving revision 1.56 diff -u -r1.55 -r1.56 --- configure 1998/12/03 10:16:44 1.55 +++ configure 1998/12/05 11:13:43 1.56 @@ -79,6 +79,7 @@ pldconf=src/.apaci.pldconf configlayout=config.layout configstatus=config.status +shadow='' ## ## pre-determine runtime modes @@ -218,8 +219,6 @@ rules=`echo $rules | sed -e 's/^://'` # determine modules -rm -f $addconf 2>/dev/null -touch $addconf modules="" modulelist="" OIFS="$IFS" IFS=' @@ -263,49 +262,11 @@ done IFS="$OIFS" -# create a config status script for restoring -# the configuration via a simple shell script -if [ ".$help" = .no ]; then - rm -f $configstatus 2>/dev/null - echo "#!/bin/sh" >$configstatus - echo "##" >>$configstatus - echo "## $configstatus -- APACI auto-generated configuration restore script" >>$configstatus - echo "##" >>$configstatus - echo "## Use this shell script to re-run the APACI configure script for" >>$configstatus - echo "## restoring your configuration. Additional parameters can be supplied." >>$configstatus - echo "##" >>$configstatus - echo "" >>$configstatus - for var in CC CPP OPTIM CFLAGS CFLAGS_SHLIB LDFLAGS LD_SHLIB LDFLAGS_SHLIB \ - LDFLAGS_SHLIB_EXPORT LIBS INCLUDES RANLIB DEPS TARGET; do - eval "val=\"\$$var\"" - if [ ".$val" != . ]; then - echo "$var=$val" |\ - sed -e 's:\(["$\\]\):\\\1:g' \ - -e 's:\([A-Z]*=\):\1":' \ - -e 's:$:" \\:' >>$configstatus - fi - done - if [ $# -eq 0 ]; then - echo "./configure" >>$configstatus - else - echo $SEO "./configure \\" >>$configstatus - for arg - do - echo "$arg" |\ - sed -e 's:\(["$\\]\):\\\1:g' \ - -e 's:^:":' \ - -e 's:$:" \\:' >>$configstatus - done - fi - echo '"$@"' >>$configstatus - echo '' >>$configstatus - chmod a+x $configstatus -fi - ## ## parse argument line options ## +addconf_created=0 apc_prev="" OIFS1="$IFS" IFS="$DIFS" for apc_option @@ -330,7 +291,27 @@ --verbose | -v) verbose=yes ;; - --shadow) + --shadow*) + # if we use an external shadow tree, first shadow all of ourself + # to this tree and switch over to to it for internal (=platform) + # shadowing... + case "$apc_option" in + --shadow=*) + shadow="$apc_optarg" + if [ .$quiet = .no ]; then + echo " + creating external package shadow tree ($shadow)" + fi + rm -rf $shadow 2>/dev/null + $aux/mkshadow.sh . $shadow + for file in $mkf $sedsubst $addconf $tplconf $pldconf $configstatus; do + rm -f $shadow/$file 2>/dev/null + done + if [ .$quiet = .no ]; then + echo " + switching to external package shadow tree ($shadow)" + fi + cd $shadow + ;; + esac # determine GNU platform triple gnutriple=`$aux/GuessOS | sed -e 's:/:-:g' | $AWK '{ printf("%s",$1); }'` # create Makefile wrapper (the first time only) @@ -342,10 +323,15 @@ echo "## Apache Makefile (shadow wrapper)" >> Makefile echo "##" >> Makefile echo "" >> Makefile + if [ ".$shadow" != . ]; then + echo "SHADOW=$shadow" >> Makefile + else + echo "SHADOW=." >> Makefile + fi echo "GNUTRIPLE=\`$aux/GuessOS | sed -e 's:/:-:g' | $AWK '{ printf(\"%s\",\$\$1); }'\`" >> Makefile echo "" >> Makefile echo "all build install install-quiet clean distclean:" >> Makefile - echo " @\$(MAKE) -f Makefile.\$(GNUTRIPLE) \$(MFLAGS) \$@" >> Makefile + echo " @cd \$(SHADOW); \$(MAKE) -f Makefile.\$(GNUTRIPLE) \$(MFLAGS) \$@" >> Makefile echo "" >> Makefile fi # set shadow paths @@ -357,7 +343,7 @@ shadowtplconf="src.$gnutriple/.apaci.tplconf" # (re)create shadow tree if [ .$quiet = .no ]; then - echo " + create shadow tree ($shadowsrc)" + echo " + creating internal platform shadow tree ($shadowsrc)" fi rm -rf $shadowsrc $aux/mkshadow.sh $src $shadowsrc @@ -366,10 +352,7 @@ src=$shadowsrc aux=$shadowaux sedsubst=$shadowsedsubst - rm -f $addconf 2>/dev/null addconf=$shadowaddconf - rm -f $addconf 2>/dev/null - touch $addconf tplconf=$shadowtplconf ;; --help | -h | -help ) @@ -378,7 +361,7 @@ echo "General options:" echo " --quiet, --silent do not print messages" echo " --verbose, -v print even more messages" - echo " --shadow switch to a shadow tree for building" + echo " --shadow[=DIR] switch to a shadow tree (under DIR) for building" echo "" echo "Stand-alone options:" echo " --help, -h print this message" @@ -531,6 +514,11 @@ if [ ".$file" != ".$src/modules/extra/$modfilec" ]; then cp $file $src/modules/extra/$modfilec fi + if [ ".$addconf_created" = .0 ]; then + addconf_created=1 + rm -f $addconf 2>/dev/null + touch $addconf 2>/dev/null + fi echo "" >>$addconf echo "## On-the-fly added module" >>$addconf echo "## (configure --add-module=$file)" >>$addconf @@ -557,6 +545,11 @@ ;; esac modfile=`echo $file | sed -e 's;^src/;;'` + if [ ".$addconf_created" = .0 ]; then + addconf_created=1 + rm -f $addconf 2>/dev/null + touch $addconf 2>/dev/null + fi echo "" >>$addconf echo "## On-the-fly activated module" >>$addconf echo "## (configure --activate-module=$file)" >>$addconf @@ -790,7 +783,48 @@ echo "configure:Error: missing argument to --`echo $apc_prev | sed 's/_/-/g'`" 1>&2 exit 1 fi +if [ ".$addconf_created" = .0 ]; then + rm -f $addconf 2>/dev/null + touch $addconf 2>/dev/null +fi +# create a config status script for restoring +# the configuration via a simple shell script +rm -f $configstatus 2>/dev/null +echo "#!/bin/sh" >$configstatus +echo "##" >>$configstatus +echo "## $configstatus -- APACI auto-generated configuration restore script" >>$configstatus +echo "##" >>$configstatus +echo "## Use this shell script to re-run the APACI configure script for" >>$configstatus +echo "## restoring your configuration. Additional parameters can be supplied." >>$configstatus +echo "##" >>$configstatus +echo "" >>$configstatus +for var in CC CPP OPTIM CFLAGS CFLAGS_SHLIB LDFLAGS LD_SHLIB LDFLAGS_SHLIB \ + LDFLAGS_SHLIB_EXPORT LIBS INCLUDES RANLIB DEPS TARGET; do + eval "val=\"\$$var\"" + if [ ".$val" != . ]; then + echo "$var=$val" |\ + sed -e 's:\(["$\\]\):\\\1:g' \ + -e 's:\([A-Z]*=\):\1":' \ + -e 's:$:" \\:' >>$configstatus + fi +done +if [ $# -eq 0 ]; then + echo "./configure" >>$configstatus +else + echo $SEO "./configure \\" >>$configstatus + for arg + do + echo "$arg" |\ + sed -e 's:\(["$\\]\):\\\1:g' \ + -e 's:^:":' \ + -e 's:$:" \\:' >>$configstatus + done +fi +echo '"$@"' >>$configstatus +echo '' >>$configstatus +chmod a+x $configstatus + ## ## a few errors ## @@ -970,7 +1004,6 @@ fi sed <Makefile.tmpl >$mkf \ -e "[EMAIL PROTECTED]@%$PERL%g" \ --e "[EMAIL PROTECTED]@%$top%g" \ -e "[EMAIL PROTECTED]@%$src%g" \ -e "[EMAIL PROTECTED]@%$mkf%g" \ -e "[EMAIL PROTECTED]@%$aux%g" \ @@ -1230,5 +1263,21 @@ sed -e '/^Using config file:.*/d' \ -e "s:Makefile in :Makefile in $src\\/:" \ -e "s:Makefile\$:Makefile in $src:") +fi + +## +## final hints +## +if [ .$quiet = .no ]; then + if [ ".$shadow" != . ]; then + echo "Hint: You now have to build inside $shadow." + echo "This can be done either by running the canonical commands" + echo " \$ cd $shadow" + echo " \$ make" + echo " \$ make install" + echo "or by running this alternative commands" + echo " \$ make -f $shadow/Makefile" + echo " \$ make -f $shadow/Makefile install" + fi fi 1.48 +21 -23 apache-1.3/INSTALL Index: INSTALL =================================================================== RCS file: /home/cvs/apache-1.3/INSTALL,v retrieving revision 1.47 retrieving revision 1.48 diff -u -r1.47 -r1.48 --- INSTALL 1998/12/02 09:09:16 1.47 +++ INSTALL 1998/12/05 11:13:43 1.48 @@ -141,28 +141,25 @@ [INCLUDES=...] [LDFLAGS_SHLIB_EXPORT=...] [LDFLAGS=...] [RANLIB=...] [LIBS=...] [DEPS=...] - ./configure [--quiet] [--prefix=DIR] [--enable-rule=NAME] - [--verbose] [--exec-prefix=PREFIX] [--disable-rule=NAME] - [--shadow] [--bindir=EPREFIX] [--add-module=FILE] - [--help] [--sbindir=DIR] [--activate-module=FILE] - [--libexecdir=DIR] [--enable-module=NAME] - [--mandir=DIR] [--disable-module=NAME] - [--sysconfdir=DIR] [--enable-shared=NAME] - [--datadir=DIR] [--disable-shared=NAME] - [--includedir=DIR] [--permute-module=N1:N2] - [--localstatedir=DIR] - [--runtimedir=DIR] [--enable-suexec] - [--logfiledir=DIR] [--suexec-caller=UID] - [--proxycachedir=DIR] [--suexec-docroot=DIR] - [--with-layout=[F:]ID] [--suexec-logfile=FILE] - [--show-layout] [--suexec-userdir=DIR] - [--suexec-uidmin=UID] - [--suexec-gidmin=GID] - [--suexec-safepath=PATH] - - [--with-perl=FILE] - [--without-support] - [--without-confadjust] + ./configure + [--quiet] [--prefix=DIR] [--enable-rule=NAME] + [--verbose] [--exec-prefix=PREFIX] [--disable-rule=NAME] + [--shadow[=DIR]] [--bindir=EPREFIX] [--add-module=FILE] + [--show-layout] [--sbindir=DIR] [--activate-module=FILE] + [--help] [--libexecdir=DIR] [--enable-module=NAME] + [--mandir=DIR] [--disable-module=NAME] + [--sysconfdir=DIR] [--enable-shared=NAME] + [--datadir=DIR] [--disable-shared=NAME] + [--includedir=DIR] [--permute-module=N1:N2] + [--localstatedir=DIR] + [--runtimedir=DIR] [--enable-suexec] + [--logfiledir=DIR] [--suexec-caller=UID] + [--proxycachedir=DIR] [--suexec-docroot=DIR] + [--with-layout=[FILE:]ID] [--suexec-logfile=FILE] + [--suexec-userdir=DIR] + [--with-perl=FILE] [--suexec-uidmin=UID] + [--without-support] [--suexec-gidmin=GID] + [--without-confadjust] [--suexec-safepath=PATH] Use the CC, OPTIM, CFLAGS, INCLUDES, LDFLAGS, LIBS, CFLAGS_SHLIB, LD_SHLIB, LDFLAGS_SHLIB, LDFLAGS_SHLIB_EXPORT, RANLIB, DEPS and TARGET @@ -400,7 +397,8 @@ Use the --shadow option to let APACI create a shadow source tree of the sources for building. This is useful when you want to build for different platforms in parallel (usually through a NFS, AFS or DFS mounted - filesystem). + filesystem). You may specify a directory to the --shadow option into + which the shadow tree will be created. Use the --quiet option to disable all configuration verbose messages. 1.52 +14 -14 apache-1.3/Makefile.tmpl Index: Makefile.tmpl =================================================================== RCS file: /home/cvs/apache-1.3/Makefile.tmpl,v retrieving revision 1.51 retrieving revision 1.52 diff -u -r1.51 -r1.52 --- Makefile.tmpl 1998/12/01 23:59:51 1.51 +++ Makefile.tmpl 1998/12/05 11:13:44 1.52 @@ -70,7 +70,7 @@ SHELL = /bin/sh # paths to the source tree parts -TOP = @TOP@ +TOP = . SRC = @SRC@ MKF = @MKF@ AUX = @AUX@ @@ -152,7 +152,7 @@ # build the package build: @echo "===> $(SRC)" - @$(MAKE) -f $(MKF) $(MFLAGS) $(MFWD) build-std $(build-support) + @$(MAKE) -f $(TOP)/$(MKF) $(MFLAGS) $(MFWD) build-std $(build-support) @touch $(TOP)/$(SRC)/.apaci.build.ok @echo "<=== $(SRC)" @@ -188,11 +188,11 @@ # separate parts of the installation process. install: @if [ ! -f $(TOP)/$(SRC)/.apaci.build.ok ]; then \ - $(MAKE) -f $(MKF) $(MFLAGS) $(MFWD) build; \ + $(MAKE) -f $(TOP)/$(MKF) $(MFLAGS) $(MFWD) build; \ else \ :; \ fi - @$(MAKE) -f $(MKF) $(MFLAGS) $(MFWD) \ + @$(MAKE) -f $(TOP)/$(MKF) $(MFLAGS) $(MFWD) \ install-mktree install-programs $(install-support) \ install-include install-data install-config [EMAIL PROTECTED](RM) $(SRC)/.apaci.install.tmp @@ -218,7 +218,7 @@ # the non-verbose variant for package maintainers install-quiet: - @$(MAKE) -f $(MKF) $(MFLAGS) $(MFWD) QUIET=1 install + @$(MAKE) -f $(TOP)/$(MKF) $(MFLAGS) $(MFWD) QUIET=1 install # create the installation tree install-mktree: @@ -349,8 +349,8 @@ echo "[PRESERVING EXISTING DATA SUBDIR: $(root)$(datadir)/htdocs/]"; \ else \ echo "Copying tree $(TOP)/htdocs/ -> $(root)$(datadir)/htdocs/"; \ - (cd $(TOP)/htdocs/ && $(TAR) cf - *) |\ - (cd $(root)$(datadir)/htdocs/ && $(TAR) xf -); \ + (cd $(TOP)/htdocs/ && $(TAR) -hcf - *) |\ + (cd $(root)$(datadir)/htdocs/ && $(TAR) -xf -); \ find $(root)$(datadir)/htdocs/ -type d -exec chmod a+rx {} \; ; \ find $(root)$(datadir)/htdocs/ -type f -exec chmod a+r {} \; ; \ fi @@ -366,8 +366,8 @@ done; \ fi @echo "Copying tree $(TOP)/icons/ -> $(root)$(datadir)/icons/"; \ - (cd $(TOP)/icons/ && $(TAR) cf - *) |\ - (cd $(root)$(datadir)/icons/ && $(TAR) xf -); \ + (cd $(TOP)/icons/ && $(TAR) -hcf - *) |\ + (cd $(root)$(datadir)/icons/ && $(TAR) -xf -); \ find $(root)$(datadir)/icons/ -type d -exec chmod a+rx {} \; ;\ find $(root)$(datadir)/icons/ -type f -exec chmod a+r {} \; @echo "<=== [data]" @@ -437,7 +437,7 @@ # created by the build target clean: @echo "===> $(SRC)" - @$(MAKE) -f $(MKF) $(MFLAGS) $(MFWD) clean-std $(clean-support) + @$(MAKE) -f $(TOP)/$(MKF) $(MFLAGS) $(MFWD) clean-std $(clean-support) @echo "<=== $(SRC)" @$(RM) $(TOP)/$(SRC)/.apaci.build.ok @@ -460,14 +460,14 @@ # When --shadow is used we just remove the complete shadow tree. distclean: @if [ ".$(SRC)" = .src ]; then \ - $(MAKE) -f $(MKF) $(MFLAGS) $(MFWD) distclean-normal; \ + $(MAKE) -f $(TOP)/$(MKF) $(MFLAGS) $(MFWD) distclean-normal; \ else \ - $(MAKE) -f $(MKF) $(MFLAGS) $(MFWD) distclean-shadow; \ + $(MAKE) -f $(TOP)/$(MKF) $(MFLAGS) $(MFWD) distclean-shadow; \ fi distclean-normal: @echo "===> $(SRC)" - @$(MAKE) -f $(MKF) $(MFLAGS) $(MFWD) distclean-std $(distclean-support) + @$(MAKE) -f $(TOP)/$(MKF) $(MFLAGS) $(MFWD) distclean-std $(distclean-support) @echo "<=== $(SRC)" -$(RM) $(SRC)/Configuration.apaci -$(RM) $(SRC)/apaci @@ -490,7 +490,7 @@ distclean-shadow: $(RM) -r $(SRC) - $(RM) $(MKF) + $(RM) $(TOP)/$(MKF) [EMAIL PROTECTED] [ ".`ls $(TOP)/src.* 2>/dev/null`" = . ]; then \ echo "$(RM) Makefile"; \ $(RM) Makefile; \