зеркало из https://github.com/mozilla/pjs.git
162 строки
3.8 KiB
Bash
Executable File
162 строки
3.8 KiB
Bash
Executable File
#!/bin/sh -x
|
|
|
|
|
|
|
|
# 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, Mail.com (kestes@staff.mail.com).
|
|
# Contributor(s):
|
|
|
|
|
|
destdir=/web/cgibins/cgi-forms/tinderbox
|
|
|
|
builddir=./build
|
|
|
|
|
|
config_script=./config.out
|
|
|
|
tinder_version='0.07'
|
|
|
|
# -------------------
|
|
# Build 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 "\$destdir = \"$destdir\";" \
|
|
-e "\$builddir = \"$builddir\";" \
|
|
-e "\$config_script=\"$config_script\";"\
|
|
-e '
|
|
use File::Basename;
|
|
print <<EOF;
|
|
# Makefile automatically generated by configure
|
|
|
|
# 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.
|
|
|
|
|
|
|
|
prefix=$destdir
|
|
builddir=$builddir
|
|
|
|
config_script=$config_script
|
|
|
|
all: build
|
|
ALL: all
|
|
|
|
build: mk_build_dirs build_files set_build_permissions
|
|
|
|
install: build mk_dest_dirs install_files
|
|
|
|
clean:
|
|
rm -rf \$(builddir)
|
|
|
|
set_build_permissions:
|
|
find \$(builddir)/bin -type f | xargs chmod 755
|
|
find \$(builddir)/clientbin -type f | xargs chmod 755
|
|
find \$(builddir)/gif -type f | xargs chmod 744
|
|
find \$(builddir)/lib -type f | xargs chmod 744
|
|
|
|
|
|
# automated file list is generated after this line
|
|
# ------------------------------------------------
|
|
|
|
EOF
|
|
|
|
while($_=<>) {
|
|
chomp $_;
|
|
my ($src_file) = $_;
|
|
my ($build_file) = $_;
|
|
my ($dest_file) = $_;
|
|
$build_file =~ s!\./src!\$\(builddir\)!;
|
|
$dest_file =~ s!\./src!\$\(prefix\)!;
|
|
$deps= qq(build_files: $build_file\n).
|
|
qq(install_files: $dest_file\n\n).
|
|
qq($build_file: $src_file Makefile config.out
|
|
\tperl \$(config_script) < $src_file > $build_file\n\n).
|
|
qq($dest_file: $build_file
|
|
\tcp -p $build_file $dest_file\n
|
|
);
|
|
$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 <<EOF;
|
|
|
|
DEST_DIRS = @dest_dirs
|
|
|
|
BUILD_DIRS = @build_dirs
|
|
|
|
mk_dest_dirs:
|
|
for D in \$(DEST_DIRS);do \\
|
|
mkdir -p \$\$D;\\
|
|
done
|
|
|
|
mk_build_dirs:
|
|
for D in \$(BUILD_DIRS);do \\
|
|
mkdir -p \$\$D;\\
|
|
done
|
|
|
|
EOF
|
|
' > Makefile
|
|
|
|
# -------------------
|
|
# Build Config.out
|
|
# -------------------
|
|
|
|
rm -rf $config_script
|
|
|
|
pwd=`/bin/pwd`
|
|
|
|
echo "#!perl - run from makefile with -n\n" >> $config_script
|
|
echo "while (<>) {" >> $config_script
|
|
|
|
echo " s!\#tinder_libdir\#!$destdir/lib',\n '$pwd/$builddir/lib!;" >> $config_script
|
|
echo " s!\#tinder_version\#!$tinder_version!;" >> $config_script
|
|
|
|
for cmd in perl gzip uudecode
|
|
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
|
|
|
|
echo "} continue {" >> $config_script
|
|
echo " print or die \"-p destination: \$!\\\\n\";" >> $config_script
|
|
echo "}" >> $config_script
|
|
|
|
|
|
exit 0;
|