#!/bin/sh # The contents of this file are subject to the Mozilla Public # License Version 1.1 (the "License"); you may not use this file # except in compliance with the License. You may obtain a copy of # the License at http://www.mozilla.org/NPL/ # # Software distributed under the License is distributed on an "AS # IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or # implied. See the License for the specific language governing # rights and limitations under the License. # # The Original Code is the Tinderbox build tool. # # The Initial Developer of the Original Code is Netscape Communications # Corporation. Portions created by Netscape are # Copyright (C) 1998 Netscape Communications Corporation. All # Rights Reserved. # # complete rewrite by Ken Estes: # kestes@staff.mail.com Old work. # kestes@reefedge.com New work. # kestes@walrus.com Home. # Contributor(s): # Users can set these variables or accept the defaults. These # variables can either be set in configure (like in gnu configure) or # overridden in the makefile. # I do not wish to bother writing a command line parser in shell and # configure can not easily be extended to handle other directories. : ${prefix:=/home/tinderbox} : ${cgibin_prefix:="\$(prefix)/bin"} : ${htmldir:="/home/httpd/html/tinderbox"} : ${perl_flags:='-T'} : ${builddir:=./build} > /dev/null config_script='./config.out' tinder_version='0.09' # ------------------- # Build Makefile # ------------------- /bin/echo "Building Makefile" # build a makefile to copy our executables into place and perform # subsitutions on them #(cd src; find . -type f -print) | perl ( find ./src -type f -print) | \ egrep -v '/CVS/' | egrep -v '\#' | egrep -v '~' | \ perl \ -e "\$prefix = '$prefix';" \ -e "\$cgibin_prefix = '$cgibin_prefix';"\ -e "\$htmldir = '$htmldir';" \ -e "\$builddir = '$builddir';" \ -e "\$config_script='$config_script';"\ -e ' use File::Basename; # print Makefile Header print <) { chomp $_; my ($src_file) = $_; my ($build_file) = $_; my ($dest_file) = $_; $build_file =~ s!\./src!\$\(builddir\)!; if ($build_file =~ m/\.cgi$/) { $dest_file = '\'\$\(cgibin_prefix\)/\''.basename($dest_file); } else { $dest_file =~ s!\./src!\$\(prefix\)!; } $deps=< $build_file; @ chmod -w $build_file; $dest_file: $build_file @ if [ -f $dest_file ]; then chmod +w $dest_file; fi; cp -p $build_file $dest_file EOF2 ; $deps =~ s![ \t]+$!!mg; $deps =~ s!^ +!!mg; $deps =~ s!^\t\t+!\t!mg; $dest_dirs{File::Basename::dirname($dest_file)} = 1; $build_dirs{File::Basename::dirname($build_file)} = 1; print $deps; }; @dest_dirs = sort keys %dest_dirs; @build_dirs = sort keys %build_dirs; # print Makefile Footer print < Makefile # ------------------- # Build Config.out # ------------------- /bin/echo "Building config.out" rm -rf $config_script pwd=`/bin/pwd` /bin/echo -e "#!perl - this script is run from makefile with -n\n" >> $config_script /bin/echo -e "# This script is automatically genareated by configure." >> $config_script /bin/echo -e "# This script configures various global variables.\n" >> $config_script /bin/echo "while (<>) {" >> $config_script /bin/echo >> $config_script /bin/echo -e " # Set the library search path with suitable interposing directories." >> $config_script /bin/echo -e " s!\#tinder_libdir\#!$prefix/local_conf',\n '$prefix/default_conf',\n '$prefix/lib',\n '$pwd/$builddir/local_conf',\n '$pwd/$builddir/default_conf',\n '$pwd/$builddir/lib!;" >> $config_script /bin/echo >> $config_script /bin/echo " s!\#prefix\#!$prefix!;" >> $config_script /bin/echo " s!\#cgibin_prefix\#!$cgibin_prefix!;" >> $config_script /bin/echo " s!\#htmldir\#!$htmldir!;" >> $config_script /bin/echo >> $config_script /bin/echo " # Use Taint Perl mode for security." >> $config_script /bin/echo " s!\#perlflags\#!$perl_flags!;" >> $config_script /bin/echo " s!\#tinder_version\#!$tinder_version!;" >> $config_script # some bash seems to not interpolate the '\n' I wish I understood what # was going on here as MY bash does fine. I will leave this here # commeted out until I figure out what is going on. # /bin/echo "\n" >> $config_script /bin/echo >> $config_script /bin/echo -e " # Hard code various executable paths into the source for security reasons." >> $config_script for cmd in perl do full_cmd=`which $cmd 2> /dev/null ` if [ $? -ne 0 ]; then /bin/echo "Could not find program: $cmd" exit 9; fi /bin/echo " s!\#$cmd\#!$full_cmd!;" >> $config_script done /bin/echo -e "} continue {" >> $config_script /bin/echo -e " print or die \"-p destination: \$!\\\\n\";" >> $config_script /bin/echo -e "}" >> $config_script /bin/chmod +x $config_script exit 0;