diff --git a/mozilla/webtools/tinderbox2/Makefile.in b/mozilla/webtools/tinderbox2/Makefile.in new file mode 100644 index 00000000000..5e6556fdb91 --- /dev/null +++ b/mozilla/webtools/tinderbox2/Makefile.in @@ -0,0 +1,125 @@ +# 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): Stephen Lamm (slamm@yahoo-inc.com) + +# Files are processed by the perl script ./config.out as they are copied +# from the source tree to the build tree. + +# Files are installed without change from the build directory into the +# tree rooted at prefix. + + +# Makefile Variables +#------------------------------------------------------------ + +# the prefix where most of the binaries will be install +prefix=@prefix@ + +# the directory where the cgibin files must go +cgibin_prefix=@cgibin_prefix@ + +# the root of the html directory +html_prefix=@html_prefix@ + +# where files will be built before they are installed +builddir=@builddir@ + +config_script=@config_script@ +confdir=localconf + +# Makefile Targets +#------------------------------------------------------------ + +all: build +ALL: all + +build: make_build_dirs build_files set_build_permissions + +install: build make_install_dirs install_files + +clean: + @echo + @echo "----- Cleaning Build Directory-----" + @echo + rm -rf $(builddir) + + +# We do not accidently wish to edit to the 'binary' version of these +# files so ensure the build dir copies are not writable. + +set_build_permissions: + @echo + @echo "----- Setting Build directory permissions -----" + find $(builddir) -type f | xargs chmod 444 + find $(builddir)/bin -type f | xargs chmod 555 + find $(builddir)/test -type f -name 'gen*' | xargs chmod 555 + find $(builddir)/clientbin -type f | xargs chmod 555 + +compile_all_code: build + @echo + @echo "----- Testing if perl can compile code -----" + find $(builddir) -type f | \ + egrep -v -i "readme|\.gif|/test/|addimage.cgi|images.pm|bustagestats.cgi|Storable.pm" | \ + xargs -l perl -T -c + +compile_bin_code: build + @echo + @echo "----- Testing if perl can compile all files in the bin directory -----" + find $(builddir)/bin -type f | \ + egrep -v -i "readme|\.gif|/test/|addimage.cgi|images.pm|bustagestats.cgi|Storable.pm" | \ + xargs -l perl -T -c + +gen_test: compile_bin_code + rm -rf $(html_prefix) + perl $(builddir)/test/genbuilds.tst + perl $(builddir)/test/gennotices.tst + perl $(builddir)/test/genbugs.tst + $(builddir)/bin/tinder.cgi --daemon-mode + +link_test: + find $(builddir) -type f -print | \ + egrep -v -i "test|mage" | \ + xargs egrep -i " $$target; \ + chmod -w $$target; \ + echo "Staging $$source" 2>&1; \ + }; tb2StageFile + +INSTALL_FILE := \ + tb2InstallFile() { \ + source=$$1; \ + target=$$2; \ + if [ -f $$target ]; then chmod +w $$target; fi; \ + echo "Install $$source -> $$target" 2>&1; \ + cp -p $$source $$target; \ + }; tb2InstallFile + +# Automated file list is generated after this line +#------------------------------------------------------------ + diff --git a/mozilla/webtools/tinderbox2/configure b/mozilla/webtools/tinderbox2/configure index 6ea371474b1..91dc686d8c1 100755 --- a/mozilla/webtools/tinderbox2/configure +++ b/mozilla/webtools/tinderbox2/configure @@ -1,7 +1,5 @@ -#!/bin/sh - - - +#!/usr/bin/perl -w +# # 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 @@ -24,270 +22,271 @@ # kestes@staff.mail.com Old work. # kestes@reefedge.com New work. # kestes@walrus.com Home. -# Contributor(s): +# Contributor(s): Stephen Lamm (slamm@yahoo-inc.com) +use Cwd; +use Getopt::Long; +use File::Basename; +use File::Find; # 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. +sub usage { + my $usage=< /dev/null +Getopt::Long::config('require_order', 'auto_abbrev', 'ignore_case'); -# Different versions of Unix have different requirements for echo. I -# have no intention of becoming a portable shell expert. Make the -# echo command a variable and let the users figure out what works for -# them. +GetOptions( + 'help|h' => \$help, + 'prefix=s' => \$prefix, + 'cgibin-prefix=s' => \$cgibin_prefix, + 'html-prefix=s' => \$html_prefix, + 'perl=s' => \$perl_cmd, + 'perl-flags=s' => \$perl_flags, + 'build-dir=s' => \$builddir, + 'config-script=s' => \$config_script, + ) or usage(); - # this is for statments which do not need '\n' interpolation -: ${echo:="/bin/echo"} - # this is for statements which need '\n' interpolation -: ${echoe:="/bin/echo -e"} - -config_script='./config.out' -tinder_version='0.09' +usage() if $help; -# ------------------- -# Build Makefile -# ------------------- +# Build Makefile +#------------------------------------------------------------ +# Build a makefile to copy our executables into place and perform +# subsitutions on them. -$echo "Building Makefile" +print STDERR "Building Makefile\n"; -# build a makefile to copy our executables into place and perform -# subsitutions on them +open(MAKEFILE_IN, "Makefile") or + die "Unable to open Makefile: $!\n"; -# Makefile Variables -# ------------------ +while () { + # perform substitutions -# the prefix where most of the binaries will be install -prefix=$prefix + if (/@\S*@/) { + for my $replace (@replacements) { + s/\@$replace\@/eval "\$$replace"/ge; + } + } + + print MAKEFILE $_; +} -# the directory where the cgibin files must go -cgibin_prefix=$cgibin_prefix +close(MAKEFILE_IN) or + die "Unable to close Makefile: $!\n"; -# the root of the html directory -htmldir=$htmldir +# Add Makefile build/install rules +#------------------------------------------------------------ -# where files will be built before they are installed -builddir=$builddir +# Get the list of source files +my @source_files = (); +my %install_dirs=(); +my %build_dirs=(); +my @build_files=(); +my @install_files=(); -config_script=$config_script -confdir=localconf +sub wanted_source_files { + return if /^\#/ or /~$/; + $File::Find::prune = 1, return if $_ eq 'CVS'; + return unless -T $_; + push @source_files, $File::Find::name; +} -# this is for statments which do not need '\'\\\\n\'' interpolation -echo=/bin/echo +find(\&wanted_source_files, 'src'); -# this is for statements which need '\'\\\\n\'' interpolation -echoe="/bin/echo -e" +for my $src_file (@source_files) { + my $build_file = $src_file; + my $install_file = $src_file; + $build_file =~ s/^src/\$(builddir)/; -# Makefile Targets -# ---------------- + if ($build_file =~ m/\.cgi$/) { + $install_file = '$(cgibin_prefix)/'.basename($install_file); + } else { + $install_file =~ s/^src/\$(prefix)/; + } -all: build -ALL: all + push @build_files, $build_file; + push @install_files, $install_file; + $install_dirs{File::Basename::dirname($install_file)} = 1; + $build_dirs{File::Basename::dirname($build_file)} = 1; -build: mk_build_dirs build_files set_build_permissions + $deps=<) { - 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; + \@\$(STAGE_FILE) \$\< \$\@ -$dest_file: $build_file - @ if [ -f $dest_file ]; then chmod +w $dest_file; fi; - cp -p $build_file $dest_file +$install_file: $build_file + \@\$(INSTALL_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 $deps; +} - # print Makefile Footer +foreach $build_file (@build_files) { + print MAKEFILE "build_files: $build_file\n"; +} - print < Makefile -# ------------------- -# Build Config.out -# ------------------- +# Build config.out +#------------------------------------------------------------ -$echo "Building config.out" +print STDERR "Building config.out\n"; -rm -rf $config_script +# this file will exist only if we have run this script before. -pwd=`/bin/pwd` +unlink($config_script); -$echoe "#!perl - this script is run from makefile with -n\n" >> $config_script -$echoe "# This script is automatically genareated by configure." >> $config_script -$echoe "# This script configures various global variables.\n" >> $config_script +my $pwd = cwd; -$echo "while (<>) {" >> $config_script - -$echo >> $config_script -$echoe " # Set the library search path with suitable interposing directories." >> $config_script - -$echoe " 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 - -$echo >> $config_script - -$echo " s!\#prefix\#!$prefix!;" >> $config_script -$echo " s!\#cgibin_prefix\#!$cgibin_prefix!;" >> $config_script -$echo " s!\#htmldir\#!$htmldir!;" >> $config_script - -$echo >> $config_script - -$echo " # Use Taint Perl mode for security." >> $config_script -$echo " s!\#perlflags\#!$perl_flags!;" >> $config_script -$echo " s!\#tinder_version\#!$tinder_version!;" >> $config_script +open(CONFIG_SCRIPT, ">$config_script") + or die "Unable to open $config_script: $!\n"; -# 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. +print CONFIG_SCRIPT <> $config_script +# This script is automatically generated by configure. +# This script configures various global variables. -$echo >> $config_script +while (<>) { + # Set the library search path with suitable interposing directories. -$echoe " # Hard code various executable paths into the source for security reasons." >> $config_script + s!\#tinder_libdir\#!$prefix/local_conf', + '$prefix/default_conf', + '$prefix/lib', + '$pwd/$builddir/local_conf', + '$pwd/$builddir/default_conf', + '$pwd/$builddir/lib!; -for cmd in perl -do - full_cmd=`which $cmd 2> /dev/null ` - if [ $? -ne 0 ]; then - $echo "Could not find program: $cmd" - exit 9; - fi - $echo " s!\#$cmd\#!$full_cmd!;" >> $config_script -done + s!\#prefix\#!$prefix!; + s!\#cgibin_prefix\#!$cgibin_prefix!; + s!\#html_prefix\#!$html_prefix!; -$echoe "} continue {" >> $config_script -$echoe " print or die \"-p destination: \$!\\\\n\";" >> $config_script -$echoe "}" >> $config_script + # Use Taint Perl mode for security. + s!\#perlflags\#!$perl_flags!; + s!\#tinder_version\#!$tinder_version!; -/bin/chmod +x $config_script + # Hard code various executable paths into the source for security reasons. +EOF4 + +for my $cmd (@cmds) { + + my $variable = $cmd.'_cmd'; + + my $explicit_cmd = $$variable; + + if ($explicit_cmd) { + # Use explicitly set command path if defined + $full_cmd = $explicit_cmd; + } else { + + # Search for command in the $PATH and assume that this is in the + # same place on the machine where the files are installed. + + $full_cmd=`which $cmd 2> /dev/null`; + chomp($full_cmd); + + if ($? != 0) { + print STDERR "Could not find program: $cmd\n"; + exit 9; + } + } + + print CONFIG_SCRIPT " s!\#$cmd\#!$full_cmd!;"; +} + +print CONFIG_SCRIPT <