зеркало из https://github.com/mozilla/gecko-dev.git
portability fix for xargs
record the arguments to ./configure find all the full paths for build commands on build machine
This commit is contained in:
Родитель
2dcf8c98a0
Коммит
66b53f0897
|
@ -79,10 +79,43 @@ $tinder_version = '0.09';
|
|||
@replacements = qw(
|
||||
prefix cgibin_prefix html_prefix
|
||||
builddir config_script
|
||||
xargs_single CONFIGURE_ARGS
|
||||
);
|
||||
|
||||
@cmds = qw(perl);
|
||||
@cmds = (
|
||||
|
||||
# commands tinderbox uses
|
||||
'perl',
|
||||
|
||||
# these commands are used by the Makefile not by tinderbox
|
||||
|
||||
'find',
|
||||
'egrep',
|
||||
'xargs',
|
||||
'rm',
|
||||
'echo',
|
||||
'mkdir',
|
||||
'chmod',
|
||||
|
||||
);
|
||||
|
||||
# xargs takes one of these arguments
|
||||
# this is very OS specific
|
||||
|
||||
@XARGS_SINGLE_ARGS = ('-l1', '-L1', '-n1');
|
||||
|
||||
|
||||
@ORIG_ARGS = @ARGV;
|
||||
$PROGRAM = $0;
|
||||
|
||||
$CONFIGURE_ARGS= (
|
||||
"# Configure was run like this:\n\n".
|
||||
"# \t".
|
||||
$PROGRAM.
|
||||
"\t\'".
|
||||
join ("\' \\\n\#\t\'", @ORIG_ARGS).
|
||||
"\'".
|
||||
"");
|
||||
|
||||
Getopt::Long::config('require_order', 'auto_abbrev', 'ignore_case');
|
||||
|
||||
|
@ -100,11 +133,47 @@ GetOptions(
|
|||
usage() if $help;
|
||||
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
$CMD{$cmd} = $full_cmd;
|
||||
}
|
||||
|
||||
my $arg;
|
||||
foreach $arg (@XARGS_SINGLE_ARGS) {
|
||||
my $output = `$CMD{'echo'} /bin/true | $CMD{'xargs'} $arg $CMD{'echo'}`;
|
||||
if ($output eq "/bin/true\n") {
|
||||
$xargs_single=$arg;
|
||||
last;
|
||||
}
|
||||
}
|
||||
|
||||
# Build Makefile
|
||||
#------------------------------------------------------------
|
||||
# Build a makefile to copy our executables into place and perform
|
||||
# subsitutions on them.
|
||||
|
||||
|
||||
print STDERR "Building Makefile\n";
|
||||
|
||||
open(MAKEFILE_IN, "<Makefile.in") or
|
||||
|
@ -229,6 +298,10 @@ print CONFIG_SCRIPT <<EOF4;
|
|||
# This script is automatically generated by configure.
|
||||
# This script configures various global variables.
|
||||
|
||||
|
||||
$CONFIGURE_ARGS
|
||||
|
||||
|
||||
while (<>) {
|
||||
# Set the library search path with suitable interposing directories.
|
||||
|
||||
|
@ -247,34 +320,21 @@ while (<>) {
|
|||
s!\#perlflags\#!$perl_flags!;
|
||||
s!\#tinder_version\#!$tinder_version!;
|
||||
|
||||
# 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 " # Hard code various executable paths into ";
|
||||
print CONFIG_SCRIPT "the source for security reasons.\n";
|
||||
foreach $cmd (sort keys %CMD) {
|
||||
my $full_cmd = $CMD{$cmd};
|
||||
print CONFIG_SCRIPT " s!\#$cmd\#!$full_cmd!;\n";
|
||||
}
|
||||
print CONFIG_SCRIPT "\n";
|
||||
print CONFIG_SCRIPT " s!\#xargs_single\#!$xargs_single!;\n";
|
||||
}
|
||||
|
||||
print CONFIG_SCRIPT " s!\#$cmd\#!$full_cmd!;";
|
||||
}
|
||||
|
||||
print CONFIG_SCRIPT <<EOF5;
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче