Adding dynamic modules.mk support.

This commit is contained in:
mcafee%netscape.com 2002-04-20 02:15:40 +00:00
parent 40e48d4927
commit e4a39af6b1

View File

@ -119,29 +119,26 @@ sub run_shell_command {
return $output;
}
# Global and Compare routine for Find()
# Global and Compare routines for Find()
my @foundMakefiles;
sub FindMakefiles
{
# Don't descend into CVS dirs.
/CVS/ and $File::Find::prune = 1;
if($_ eq "Makefile.in") {
#print "$File::Find::dir $_\n";
$_ =~ s/.in//; # Strip off the ".in"
$File::Find::dir =~ s/^mozilla\///; # Strip off mozilla/
#$_ =~ s/mozilla//;
push(@foundMakefiles, "$File::Find::dir/$_");
} else {
#print " $File::Find::dir $_\n";
}
sub FindMakefiles {
# Don't descend into CVS dirs.
/CVS/ and $File::Find::prune = 1;
if($_ eq "Makefile.in") {
#print "$File::Find::dir $_\n";
}
$_ =~ s/.in//; # Strip off the ".in"
$File::Find::dir =~ s/^mozilla\///; # Strip off mozilla/
#$_ =~ s/mozilla//;
push(@foundMakefiles, "$File::Find::dir/$_");
} else {
#print " $File::Find::dir $_\n";
}
}
# main
@ -195,6 +192,8 @@ sub FindMakefiles
# Map modules list to directories list.
my @dirs;
my $dirs_string = "";
my $dirs_string_no_mozilla = ""; # dirs_string, stripping off mozilla/
my $dirs_cmd = "echo $modules_string | mozilla/config/module2dir\.pl --list-only";
print "\nGenerating directories list...\n";
@ -203,6 +202,11 @@ sub FindMakefiles
@dirs = split(' ', $dirs_string); # Create dirs array for find command.
$dirs_string_no_mozilla = $dirs_string;
$dirs_string_no_mozilla =~ s/mozilla\/+//g;
print "dirs_string_no_mozilla = $dirs_string_no_mozilla\n";
# Checkout directories.
unless($skip_cvs) {
print "\nChecking out directories...\n";
@ -235,9 +239,10 @@ sub FindMakefiles
}
# Stomp on generated file, or open a new one.
my $cmd = "cp mozilla/tools/module-deps/allmakefiles.stub mozilla/allmakefiles.sh";
print "$cmd\n";
system("$cmd");
print "\nGenerating allmakefiles.sh ...\n";
my $allmakefiles_cmd = "cp mozilla/tools/module-deps/allmakefiles.stub mozilla/allmakefiles.sh";
print "$allmakefiles_cmd\n";
system("$allmakefiles_cmd");
# Open copy of stub file.
open ALLMAKEFILES, ">>mozilla/allmakefiles.sh";
@ -254,9 +259,7 @@ sub FindMakefiles
}
print ALLMAKEFILES "\"\n\n";
print ALLMAKEFILES "add_makefiles \"\$MAKEFILES_bootstrap\"";
close ALLMAKEFILES;
#print "Configuring nspr ... \n";
@ -264,15 +267,85 @@ sub FindMakefiles
#my $nspr_configure_cmd = "./configure";
#system("$nspr_configure_cmd");
print "Configuring ... \n";
print "\nConfiguring ... \n";
unlink("$basedir/mozilla/config.cache");
chdir("$basedir/mozilla");
my $configure_cmd = "./configure --enable-standalone-modules=$root_modules";
my $configure_cmd = "./configure --enable-standalone-modules=$root_modules --disable-ldap";
$rv = run_shell_command("$configure_cmd");
#
# Construct a build/unix/modules.mk file, this let's us do
# a top-level build instead of n gmake -C <dir> commands.
#
chdir("$basedir");
# Look for previously generated modules.mk file.
my $generated_modulesmk_file = 0;
if(-e "mozilla/build/unix/modules.mk") {
open MODULESMK, "mozilla/allmakefiles.sh";
while(<MODULESMK>) {
if(/# Generated by bootstrap.pl/) {
$generated_modulesmk_file = 1;
}
}
close MODULESMK;
if($generated_modulesmk_file == 0) {
print "Error: non-generated mozilla/build/unix/modules.mk found.\n";
exit 1;
}
}
# Stomp on generated file, or open a new one.
print "\nGenerating modules.mk ...\n";
my $modulesmk_cmd = "cp mozilla/tools/module-deps/modules.mk.stub mozilla/build/unix/modules.mk";
print "$modulesmk_cmd\n";
system("$modulesmk_cmd");
# Open copy of stub file.
open MODULESMK, ">>mozilla/build/unix/modules.mk";
# Add in our hack
print MODULESMK "BUILD_MODULE_DIRS := config build include $dirs_string_no_mozilla\n";
# Recursively decend the tree looking for Makefiles
#File::Find::find(\&FindMakefiles, @dirs);
# Write Makefiles out to allmakefiles.sh.
#foreach (@foundMakefiles) {
# print MODULESMK "$_\n";
#}
close MODULESMK;
exit(1);
# Now try and build.
# Not a top-level build, but build each directory.
print "Building ... \n";
print "\nBuilding ... \n";
print "basedir = $basedir\n";
chdir($basedir);