httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Randy Terbush <ra...@Covalent.NET>
Subject Re: [PATCH/PROPOSAL] binbuild script, take 1
Date Tue, 05 Jan 1999 00:49:28 GMT
This solution looks good. I have the following suggestions.

* Change to build binary only distribution
* Use standard Apache layout
* add 'make dist' target to call binbuild.sh
* create toplevel 'setup' script for install to mirror logical win32 name

With concensus, I'll work to make these changes since I know that Lars 
may not be available to make these changes.

-Randy

Lars Eilebrecht <Lars.Eilebrecht@unix-ag.org> writes:
> [1  <text/plain; iso-8859-1 (7bit)>]
> Hi,
> 
> I've developed a solution for building binary distributions
> (see attachments). I've only tested this first version on Linux,
> but want to throw it in here for discussion...
> 
> To test it perform the following steps:
> 
> - export a recent Apache version from cvs into a directory
>   with the name "apache-1.3.4-dev"
> - copy the file "config.layout" (from attachment) over the
>   original layout file
> - copy the scripts "binbuild.sh" and "findprg.sh" from the
>   attachment to "src/helpers"
> - cd into "apache-1.3.4-dev" and execute "src/helpers/binbuild.sh"
> 
> If no error occured you'll find the following two files
> in the parent directory:
> 
>  apache-1.3.4-dev-<GNU-triple>.tar.gz
>  apache-1.3.4-dev-<GNU-triple>.README
> 
> A user who wants to install the binary distribution has to
> execute the following commands:
> 
>   gtar -zxvf apache-1.3.4-dev-<GNU-triple>.tar.gz
>   cd apache-1.3.4-dev
>   ./install-bindist.sh /path/to/serverroot
> 
> Then the user should be able to start Apache with
> 
>   /path/to/serverroot/bin/apachectl start 
> 
> 
> Details about the distribution:
> 
> The binbuild scripts uses 'configure' with the options
>   --with-layout=BinaryDistribution
>   --enable-module=most
>   --enable-shared=max
> to build the distribution. 'BinaryDistribution' is a special
> path layout (from config.layout) that mimics the classical
> Apache path layout _without_ any absolute paths in it
> (apart from HTTPD_ROOT /usr/local/apache). This makes
> it possible for a user to install it in _any_ directory
> If "install-bindist.sh" is executed without an option
> /usr/local/apache is used. If a user chooses a different
> path the files apachectl and httpd.conf are modified
> accordingly.
> 
> During the build step Apache is installed with
> "make install-quiet root=bindist/" and install-bindist.sh simply
> copies the contents of the bindist directory into the new location
> (htdocs and .conf files are preserved if they already exist). 
> 
> Additionally the two files "INSTALL.bindist" and "README.bindist"
> are created by the binbuild script.
> The binary archive contains the standard source distribution
> and all bindist-stuff.
> 
> Any comments?
> 
> 
> ciao...
> -- 
> Lars Eilebrecht                         - He who knows, does not speak.
> sfx@unix-ag.org                    - He who speaks, does not know. (Lao Tsu)
> http://www.home.unix-ag.org/sfx/
> 
> [2 findprg.sh <text/plain; iso-8859-1 (7bit)>]
> #!/bin/sh
> #
> # Usage: findprg.sh <program-name>
> # Return value is the absolute path of the program if it was found.
> # Written by Lars Eilebrecht <lars@apache.org>.
> #
> # This script falls under the Apache License.
> # See http://www.apache.org/docs/LICENSE
> 
> 
> if [ ".`which $1`" != . ]
> then
>   echo `which $1`
>   exit 0
> else
>   PATH="/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin"
>   if [ ".`which $1`" != . ]
>   then
>     echo `which $1`
>     exit 0
>   else
>     exit 1
>   fi
> fi
> [3 binbuild.sh <text/plain; iso-8859-1 (7bit)>]
> #!/bin/sh
> #
> # binbuild.sh - Builds an Apache binary distribution.
> # Written by Lars Eilebrecht <lars@apache.org>.
> #
> # This script falls under the Apache License.
> # See http://www.apache.org/docs/LICENSE
> 
> 
> APDIR=$(basename $(pwd))
> VER=$(echo $APDIR |sed s/apache-//)
> OS=$(src/helpers/GuessOS)
> USER="$(src/helpers/buildinfo.sh -n %u@%h%d)"
> TAR="$(src/helpers/findprg.sh tar)"
> GTAR="$(src/helpers/findprg.sh gtar)"
> GZIP="$(src/helpers/findprg.sh gzip)"
> CONFIGPARAM="--with-layout=BinaryDistribution --enable-module=most --enable-shared=max"
> 
> echo "Building Apache binary distribution..."
> 
> ( echo "Build log for Apache binary distribution" && \
>   echo "----------------------------------------------------------------------" &&
\
>   ./configure $CONFIGPARAM && \
>   echo "----------------------------------------------------------------------" &&
\
>   make clean && \
>   rm -rf bindist install-bindist.sh *.bindist
>   echo "----------------------------------------------------------------------" &&
\
>   make && \
>   echo "----------------------------------------------------------------------" &&
\
>   make install-quiet root="bindist/" && \
>   echo "----------------------------------------------------------------------" &&
\
>   make clean && \
>   echo "----------------------------------------------------------------------" &&
\
>   echo "[EOF]" \
> ) > build.log 2>&1
> 
> ( echo " " && \
>   echo "Apache $VER binary distribution" && \
>   echo "================================" && \
>   echo " " && \
>   echo "This binary distribution is usable on a \"$OS\"" && \
>   echo "system and was built by \"$USER\"." && \
>   echo "" && \
>   echo "The distribution contains all standard Apache modules as shared" && \
>   echo "objects. This allows you to enable or disable particular modules" &&
\
>   echo "with the LoadModule/AddModule directives in the configuration file" &&
\
>   echo "without the need to re-compile Apache." && \
>   echo "" && \
>   echo "See \"INSTALL.bindist\" on how to install the distribution." && \
>   echo " " && \
>   echo "----------------------------------------------------------------------" &&
\
>   ./bindist/bin/httpd -V && \
>   echo "----------------------------------------------------------------------" \
> ) > README.bindist
> cp README.bindist ../apache-$VER-$OS.README
> 
> ( echo " " && \
>   echo "Apache $VER binary installation" && \
>   echo "================================" && \
>   echo " " && \
>   echo "To install this binary distribution you have to execute the" && \
>   echo "installation script \"install-bindist.sh\" in the top-level" && \
>   echo "directory of the distribution." && \
>   echo "The script takes the ServerRoot directory into which you want" && \
>   echo "to install Apache as an option. If you ommit the option the path" &&
\
>   echo "\"/usr/local/apache\" is used." && \
>   echo "Make sure you have write permissions in the target directory," && \
>   echo "e.g. switch to user \"root\" before you execute the script." && \
>   echo " " && \
>   echo "See \"README.bindist\" for further details about this distribution." &&
\
>   echo " " && \
>   echo "Please note that this distribution includes the complete Apache" && \
>   echo "source code. Therefore you may compile Apache yourself at any" && \
>   echo "time if you have a compiler installation on your system." && \
>   echo "See \"INSTALL\" for details on how to accomplish this." && \
>   echo " " \
> ) > INSTALL.bindist
> 
> ( echo "#!/bin/sh" && \
>   echo "#" && \
>   echo "# Usage: install-bindist.sh [ServerRoot]" && \
>   echo "# This script installs the Apache binary distribution and" && \
>   echo "# was automatically created by binbuild.sh." && \
>   echo " " && \
>   echo "if [ .\$1 = . ]" && \
>   echo "then" && \
>   echo "  SR=/usr/local/apache" && \
>   echo "else" && \
>   echo "  SR=\$1" && \
>   echo "fi" && \
>   echo "echo \"Installing binary distribution for platform $OS\"" && \
>   echo "echo \"into directory \$SR ...\"" && \
>   echo "./src/helpers/mkdir.sh \$SR" && \
>   echo "cp -a bindist/proxy \$SR/proxy" && \
>   echo "cp -a bindist/man \$SR/man" && \
>   echo "cp -a bindist/logs \$SR/logs" && \
>   echo "cp -a bindist/libexec \$SR/libexec" && \
>   echo "cp -a bindist/include \$SR/include" && \
>   echo "cp -a bindist/icons \$SR/icons" && \
>   echo "cp -a bindist/cgi-bin \$SR/cgi-bin" && \
>   echo "cp -a bindist/bin \$SR/bin" && \
>   echo "if [ -d \$SR/conf ]" && \
>   echo "then" && \
>   echo "  echo \"[Preserving existing configuration files.]\"" && \
>   echo "  cp -a bindist/conf/*.default \$SR/conf/" && \
>   echo "else" && \
>   echo "  cp -a bindist/conf \$SR/conf" && \
>   echo "fi" && \
>   echo "if [ -d \$SR/htdocs ]" && \
>   echo "then" && \
>   echo "  echo \"[Preserving existing htdocs directory.]\"" && \
>   echo "else" && \
>   echo "  cp -a bindist/htdocs \$SR/htdocs" && \
>   echo "fi" && \
>   echo "sed -e s%/usr/local/apache%\$SR/% \$SR/conf/httpd.conf.default > \$SR/conf/httpd.conf"
&& \
>   echo "sed -e s%PIDFILE=%PIDFILE=\$SR/% -e s%HTTPD=%HTTPD=\\\"\$SR/% -e \"s%/httpd$%/httpd
-d \$SR\\\"%\" bindist/bin/apachectl > \$SR/bin/apachectl" && \
>   echo " " && \
>   echo "echo \"Ready.\"" && \
>   echo "echo \" +--------------------------------------------------------+\"" &&
\
>   echo "echo \" | You now have successfully installed the Apache $VER   |\"" &&
\
>   echo "echo \" | HTTP server. To verify that Apache actually works      |\"" &&
\
>   echo "echo \" | correctly you now should first check the (initially    |\"" &&
\
>   echo "echo \" | created or preserved) configuration files              |\"" &&
\
>   echo "echo \" |                                                        |\"" &&
\
>   echo "echo \" |   \$SR/conf/{httpd,access,srm}.conf\"" && \
>   echo "echo \" |                                                        |\"" &&
\
>   echo "echo \" | and then you should be able to immediately fire up     |\"" &&
\
>   echo "echo \" | Apache the first time by running:                      |\"" &&
\
>   echo "echo \" |                                                        |\"" &&
\
>   echo "echo \" |   \$SR/bin/apachectl start \"" &&\
>   echo "echo \" |                                                        |\"" &&
\
>   echo "echo \" | Thanks for using Apache.       The Apache Group        |\"" &&
\
>   echo "echo \" |                                http://www.apache.org/  |\"" &&
\
>   echo "echo \" +--------------------------------------------------------+\"" &&
\
>   echo "echo \" \"" \
> ) > install-bindist.sh
> chmod 755 install-bindist.sh
> 
> sed -e "s%\"/htdocs%\"/usr/local/apache/htdocs%" \
>     -e "s%\"/icons%\"/usr/local/apache/icons%" \
>     -e "s%\"/cgi-bin%\"/usr/local/apache/cgi-bin%" \
>     -e "s%^ServerAdmin.*%ServerAdmin you@your.address%" \
>     -e "s%#ServerName.*%#ServerName localhost%" \
>     bindist/conf/httpd.conf.default > bindist/conf/httpd.conf
> cp bindist/conf/httpd.conf bindist/conf/httpd.conf.default
>  
> if [ ".`grep -i error build.log > /dev/null`" != . ]
> then
>   echo "ERROR: Failed to built Apache. See \"build.log\" for details."
>   exit 1;
> else
>   if [ ".$GTAR" != . ]
>   then
>     $GTAR -zcf ../apache-$VER-$OS.tar.gz -C .. --owner=root --group=root apache-$VER
>   else
>     if [ ".$TAR" != . ]
>     then
>       $TAR -cf ../apache-$VER-$OS.tar -C .. apache-$VER
>       if [ ".$GZIP" != . ]
>       then
>         $GZIP ../apache-$VER-$OS.tar
>       fi
>     else
>       echo "ERROR: Could not find a 'tar' program!"
>       echo "       Please execute the following commands manually:"
>       echo "         tar -cf ../apache-$VER-$OS.tar ."
>       echo "         gzip ../apache-$VER-$OS.tar"
>     fi
>   fi
> 
>   if [ -f ../apache-$VER-$OS.tar.gz ] && [ -f ../apache-$VER-$OS.README ]
>   then
>     echo "Ready."
>     echo "You can find the binary archive (apache-$VER-$OS.tar.gz)"
>     echo "and the readme file (apache-$VER-$OS.README) in the"
>     echo "parent directory."
>     exit 0;
>   else
>     exit 1;
>   fi
> fi
> [4 config.layout <text/plain; iso-8859-1 (7bit)>]
> ##
> ##  config.layout -- APACI Pre-defined Installation Path Layouts
> ##  (selectable with APACI's --with-layout=ID option)
> ##
> 
> #   Classical Apache path layout
> <Layout Apache>
>     prefix:        /usr/local/apache
>     exec_prefix:   $prefix
>     bindir:        $exec_prefix/bin
>     sbindir:       $exec_prefix/bin
>     libexecdir:    $exec_prefix/libexec
>     mandir:        $prefix/man
>     sysconfdir:    $prefix/conf
>     datadir:       $prefix
>     includedir:    $prefix/include
>     localstatedir: $prefix
>     runtimedir:    $localstatedir/logs
>     logfiledir:    $localstatedir/logs
>     proxycachedir: $localstatedir/proxy
> </Layout>
> 
> #   GNU standards conforming path layout
> <Layout GNU>
>     prefix:        /usr/local
>     exec_prefix:   $prefix
>     bindir:        $exec_prefix/bin
>     sbindir:       $exec_prefix/sbin
>     libexecdir:    $exec_prefix/libexec
>     mandir:        $prefix/man
>     sysconfdir:    $prefix/etc
>     datadir:       $prefix/share
>     includedir:    $prefix/include
>     localstatedir: $prefix/var
>     runtimedir:    $localstatedir/run
>     logfiledir:    $localstatedir/log
>     proxycachedir: $localstatedir/proxy
> </Layout>
> 
> #   Apache binary distribution path layout
> <Layout BinaryDistribution>
>     prefix:        /usr/local/apache
>     exec_prefix:
>     bindir:        bin
>     sbindir:       bin
>     libexecdir:    libexec
>     mandir:        man
>     sysconfdir:    conf
>     datadir:
>     includedir:    include
>     localstatedir:
>     runtimedir:    logs
>     logfiledir:    logs
>     proxycachedir: proxy
>     customized_sysconfdir:    1
>     customized_datadir:       1
>     customized_localstatedir: 1
>     customized_includedir:    1
> </Layout>

Mime
View raw message