From 124f54c32de6452302ebd55094633e1591484073 Mon Sep 17 00:00:00 2001 From: "sfraser%netscape.com" Date: Mon, 18 Sep 2000 20:54:48 +0000 Subject: [PATCH] New Mac build scripts. NOT PART OF THE BUILD. --- build/mac/build_scripts/BuildMozilla.pl | 86 + build/mac/build_scripts/BuildMozillaDebug.pl | 86 + build/mac/build_scripts/CodeWarriorLib.pm | 470 +++ build/mac/build_scripts/MacCVS.pm | 204 ++ build/mac/build_scripts/Moz.pm | 564 ++++ build/mac/build_scripts/MozBuildFlags.pm | 203 ++ build/mac/build_scripts/MozBuildUtils.pm | 208 ++ build/mac/build_scripts/MozJar.pm | 431 +++ build/mac/build_scripts/MozPrefs.pm | 220 ++ build/mac/build_scripts/MozillaBuildList.pm | 2676 ++++++++++++++++++ build/mac/build_scripts/PullMozilla.pl | 49 + 11 files changed, 5197 insertions(+) create mode 100644 build/mac/build_scripts/BuildMozilla.pl create mode 100644 build/mac/build_scripts/BuildMozillaDebug.pl create mode 100644 build/mac/build_scripts/CodeWarriorLib.pm create mode 100644 build/mac/build_scripts/MacCVS.pm create mode 100644 build/mac/build_scripts/Moz.pm create mode 100644 build/mac/build_scripts/MozBuildFlags.pm create mode 100644 build/mac/build_scripts/MozBuildUtils.pm create mode 100644 build/mac/build_scripts/MozJar.pm create mode 100644 build/mac/build_scripts/MozPrefs.pm create mode 100644 build/mac/build_scripts/MozillaBuildList.pm create mode 100644 build/mac/build_scripts/PullMozilla.pl diff --git a/build/mac/build_scripts/BuildMozilla.pl b/build/mac/build_scripts/BuildMozilla.pl new file mode 100644 index 000000000000..260cbd188eb8 --- /dev/null +++ b/build/mac/build_scripts/BuildMozilla.pl @@ -0,0 +1,86 @@ +#!perl + +# +# The contents of this file are subject to the Netscape 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 mozilla.org code. +# +# 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. +# +# Contributor(s): +# + +# +# build script (optimized) +# +use Mac::Processes; +use MozillaBuildList; +use Cwd; +use Moz; + +#----------------------------------------------- +# hashes to hold build options +#----------------------------------------------- +my(%pull); +my(%build); +my(%options); +my(%optiondefines); + +#----------------------------------------------- +# configuration variables that globally affect what is built +#----------------------------------------------- +$DEBUG = 0; +$CARBON = 0; # turn on to build with TARGET_CARBON +$PROFILE = 0; +$GC_LEAK_DETECTOR = 0; # turn on to use GC leak detection +$INCLUDE_CLASSIC_SKIN = 1; + +#----------------------------------------------- +# configuration variables that affect the manner +# of building, but possibly affecting +# the outcome. +#----------------------------------------------- +$DIST_DIRECTORY = ":mozilla:dist:viewer:"; + +$ALIAS_SYM_FILES = $DEBUG; +$CLOBBER_LIBS = 1; # turn on to clobber existing libs and .xSYM files before + # building each project +# The following two options will delete all dist files (if you have $build{dist} turned on), +# but leave the directory structure intact. +$CLOBBER_DIST_ALL = 1; # turn on to clobber all aliases/files inside dist (headers/xsym/libs) +$CLOBBER_DIST_LIBS = 0; # turn on to clobber only aliases/files for libraries/sym files in dist +$CLOBBER_IDL_PROJECTS = 0; # turn on to clobber all IDL projects. + +#----------------------------------------------- +# configuration variables that are preferences for the build style, +# and do not affect what is built. +#----------------------------------------------- +$CodeWarriorLib::CLOSE_PROJECTS_FIRST + = 0; + # 1 = close then make (for development), + # 0 = make then close (for tinderbox). +$USE_TIMESTAMPED_LOGS = 0; +#----------------------------------------------- +# END OF CONFIG SWITCHES +#----------------------------------------------- + +my($cur_dir) = cwd(); +$cur_dir =~ s/:mozilla:build:mac:build_scripts$//; +chdir($cur_dir); +$MOZ_SRC = cwd(); + +my($do_checkout) = 0; +my($do_build) = 1; + +RunBuild($do_checkout, $do_build); diff --git a/build/mac/build_scripts/BuildMozillaDebug.pl b/build/mac/build_scripts/BuildMozillaDebug.pl new file mode 100644 index 000000000000..8d946ceab3e7 --- /dev/null +++ b/build/mac/build_scripts/BuildMozillaDebug.pl @@ -0,0 +1,86 @@ +#!perl + +# +# The contents of this file are subject to the Netscape 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 mozilla.org code. +# +# 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. +# +# Contributor(s): +# + +# +# build script (debug) +# +use Mac::Processes; +use MozillaBuildList; +use Cwd; +use Moz; + +#----------------------------------------------- +# hashes to hold build options +#----------------------------------------------- +my(%pull); +my(%build); +my(%options); +my(%optiondefines); + +#----------------------------------------------- +# configuration variables that globally affect what is built +#----------------------------------------------- +$DEBUG = 1; +$CARBON = 0; # turn on to build with TARGET_CARBON +$PROFILE = 0; +$GC_LEAK_DETECTOR = 0; # turn on to use GC leak detection +$INCLUDE_CLASSIC_SKIN = 1; + +#----------------------------------------------- +# configuration variables that affect the manner +# of building, but possibly affecting +# the outcome. +#----------------------------------------------- +$DIST_DIRECTORY = ":mozilla:dist:viewer_debug:"; + +$ALIAS_SYM_FILES = $DEBUG; +$CLOBBER_LIBS = 1; # turn on to clobber existing libs and .xSYM files before + # building each project +# The following two options will delete all dist files (if you have $build{dist} turned on), +# but leave the directory structure intact. +$CLOBBER_DIST_ALL = 1; # turn on to clobber all aliases/files inside dist (headers/xsym/libs) +$CLOBBER_DIST_LIBS = 0; # turn on to clobber only aliases/files for libraries/sym files in dist +$CLOBBER_IDL_PROJECTS = 0; # turn on to clobber all IDL projects. + +#----------------------------------------------- +# configuration variables that are preferences for the build style, +# and do not affect what is built. +#----------------------------------------------- +$CodeWarriorLib::CLOSE_PROJECTS_FIRST + = 1; + # 1 = close then make (for development), + # 0 = make then close (for tinderbox). +$USE_TIMESTAMPED_LOGS = 1; +#----------------------------------------------- +# END OF CONFIG SWITCHES +#----------------------------------------------- + +my($cur_dir) = cwd(); +$cur_dir =~ s/:mozilla:build:mac:build_scripts$//; +chdir($cur_dir); +$MOZ_SRC = cwd(); + +my($do_checkout) = 0; +my($do_build) = 1; + +RunBuild($do_checkout, $do_build); diff --git a/build/mac/build_scripts/CodeWarriorLib.pm b/build/mac/build_scripts/CodeWarriorLib.pm new file mode 100644 index 000000000000..76fc7918f891 --- /dev/null +++ b/build/mac/build_scripts/CodeWarriorLib.pm @@ -0,0 +1,470 @@ +#!perl +package CodeWarriorLib; + +=pod + +=head1 NAME + +CodeWarriorLib - supply interface to CodeWarrior + +=head1 SYNOPSIS + + #!perl + use CodeWarriorLib; + CodeWarriorLib::activate(); + $had_errors = CodeWarriorLib::build_project( + $project_path, $target_name, $recent_errors_file, $clean_build + ); + +=head1 DESCRIPTION + +Replaces the AppleScript library I. + +=over 4 + +=cut + +use strict; +use Cwd; +use Mac::Types; +use Mac::AppleEvents; +use Mac::AppleEvents::Simple; +use Mac::Processes; +use Mac::MoreFiles; +use Mac::StandardFile; +use File::Basename; + +use vars qw($VERSION); +$VERSION = '1.02'; + +my($app) = 'CWIE'; +my($scriptDir) = cwd(); + +# 0 == don't switch CWIE to front app in do_event(), 1 == do switch +# note: activate() still switches when called +$Mac::AppleEvents::Simple::SWITCH = 0; + +# supply your own path to the source here +#_test('PowerPudgeIV:mozilla:mozilla:'); + + +=pod + +=item _get_project($full_path) + +A private routine returning a reference to the open project with the given name, +or else the empty string (when that project is not open) + +full_path is a string identifying the project to be built and is of the form, +e.g., "HD:ProjectFolder:MyProject.mcp". It must be supplied. + +=cut + +sub _get_project ($) { + my( + $full_path, $candidate_projects + ) = @_; + $candidate_projects = _doc_named(basename($full_path, '*')); + if ($candidate_projects) { + my($cps) = _get_dobj($candidate_projects); + my($num) = AECountItems($cps); + if ($num) { # is a list + foreach (1 .. AECountItems($cps)) { + my($cp) = AEGetNthDesc($cps, $_); + if (lc $full_path eq lc _full_path($cp)) { + return($cp); + } + } + } else { # is only one, not a list + if (lc $full_path eq lc _full_path($cps)) { + return($cps); + } + } + } + return; +} + +=pod + +=item build_project + +Build a selected target of a project, saving any errors to a file, if supplied. + +full_path is a string identifying the project to be built and is of the form, +e.g., "HD:ProjectFolder:MyProject.mcp". It must be supplied. + +If target_name is the empty string, the current target of the selected project +will be built, else, target_name should be a string matching a target name in +the selected project. + +If error_path is the empty string, errors will not be saved to a file, +else, error_path should be the full path of a file to save error messages into. + +=cut + +$CodeWarriorLib::CLOSE_PROJECTS_FIRST = 0; # If true we close then make. If false, make then close. +my $last_project_built = ""; +my $last_project_was_closed = 0; + +sub build_project ($;$$$) { + my( + $full_path, $target_name, $error_path, + $remove_object, $p, $project_was_closed, $had_errors + ) = @_; + _close_errors_window(); + + if ($CodeWarriorLib::CLOSE_PROJECTS_FIRST && ($last_project_built ne $full_path)) + { + # If we're in "close first" mode, we don't close if the current project + # is the same as the previous one. + if ($last_project_was_closed) { + $p = _get_project($last_project_built); + _close($p); + } + $last_project_built = $full_path; + $last_project_was_closed = 0; # now refers to the new project + } + $project_was_closed = 0; + while (1) { + $p = _get_project($full_path); + if (!$p) { + if ($project_was_closed) { + print "### Error - request for project document failed after opening\n"; + die "### possibly CW Pro 4 bug: be sure to close your Find window\n"; + } + $project_was_closed = 1; + $last_project_was_closed = 1; + _open_file($full_path); + } else { + last; + } + } + + $had_errors = 0; + if ($target_name eq '') { + if ($remove_object) {_remove_object($p)} + _build($p); + } else { + if ($remove_object) {_remove_object($p, $target_name)} + _build($p, $target_name); + } + + if ($error_path ne '') { + _save_errors_window($error_path); + } + $had_errors = _close_errors_window(); + + if (!$CodeWarriorLib::CLOSE_PROJECTS_FIRST) + { + if ($project_was_closed) { + $p = _get_project($full_path); + _close($p); + } + } + + return($had_errors); +} + +=pod + +=item activate() + +Launches CodeWarrior and brings it to the front. + +Once found, path will be saved in ':idepath.txt' for future reference. +Edit or delete this file to change the location of the IDE. If app is +moved, C will prompt for a new location. + +First looks for an open CodeWarrior app. Second, tries to open previously +saved location in ':idepath.txt'. Third, tries to find it and allow user +to choose it with Navigation Services (if present). Fourth, uses good old +GUSI routines built-in to MacPerl for a Choose Directory dialog box. + +=cut + +sub activate () { + local(*F); + my($filepath, $appath, $psi) = (':idepath.txt'); + + foreach $psi (values(%Process)) { + if ($psi->processSignature() eq $app) { + $appath = $psi->processAppSpec(); + _save_appath($filepath, $appath); + last; + } + } + + if (!$appath || !-x $appath) { + $appath = _read_appath($filepath); + } + + if (!$appath || ! -x $appath) + { + # make sure that MacPerl is a front process + #ActivateApplication('McPL'); + MacPerl::Answer("Please locate the CodeWarrior application.", "OK"); + + # prompt user for the file name, and store it + my $macFile = StandardGetFile( 0, "APPL"); + if ( $macFile->sfGood() ) + { + $appath = $macFile->sfFile(); + } + else + { + die "Operation canceled\n"; + } + +# if (eval {require Mac::Navigation}) { +# my($options, $nav); +# Mac::Navigation->import(); +# $options = NavGetDefaultDialogOptions(); +# $options->message('Where is CodeWarrior IDE?'); +# $options->windowTitle('Find CodeWarrior IDE'); +# $nav = NavChooseObject($Application{$app}, $options); +# die "CodeWarrior IDE not found.\n" if (!$nav || !$nav->file(1)); +# $appath = $nav->file(1); +# } else { +# local(*D); +# my $cwd = `pwd`; +# $appath = _get_folder( +# 'Where is the CW IDE folder?', +# dirname($Application{$app}) +# ); +# die "CodeWarrior IDE not found.\n" if !$appath; +# opendir(D, $appath) or die $!; +# chdir($appath); +# foreach my $file (sort readdir (D)) { +# my(@app) = MacPerl::GetFileInfo($file); +# if ($app[0] && $app[1] && +# $app[1] eq 'APPL' && $app[0] eq $app +# ) { +# $appath .= $file; +# last; +# } +# } +# chomp($cwd); +# chdir($cwd); +# } + _save_appath($filepath, $appath); + } + + my($lp) = LaunchParam->new( + launchAppSpec => $appath, + launchControlFlags => launchContinue() + launchNoFileFlags() + ); + unless (LaunchApplication($lp)) { + unlink($filepath); + die $^E; + } +} + +=pod + +=item quit() + +Quits CodeWarrior. + +=cut + +sub quit() { + + $last_project_built = ""; + $last_project_was_closed = 0; + + my($evt) = do_event(qw/aevt quit/, $app); +} + + +sub _build ($;$) { + my($evt); + if ($_[1]) { + my($prm) = + q"'----':obj {form:name, want:type(TRGT), seld:TEXT(@), from:" . + AEPrint($_[0]) . '}'; + $evt = do_event(qw/CWIE MAKE/, $app, $prm, $_[1]); + } else { + my($prm) = q"'----':" . AEPrint($_[0]); + $evt = do_event(qw/CWIE MAKE/, $app, $prm); + } +} + +sub _remove_object ($;$) { + my($evt); + if ($_[1]) { + my($prm) = + q"'----':obj {form:name, want:type(TRGT), seld:TEXT(@), from:" . + AEPrint($_[0]) . '}'; + $evt = do_event(qw/CWIE RMOB/, $app, $prm, $_[1]); + } else { + my($prm) = q"'----':" . AEPrint($_[0]); + $evt = do_event(qw/CWIE RMOB/, $app, $prm); + } +} + +sub _open_file ($) { + my($prm) = + q"'----':obj {form:name, want:type(alis), " . + q"seld:TEXT(@), from:'null'()}"; + + do_event(qw/aevt odoc/, $app, $prm, $_[0]); +} + +sub _doc_named ($) { + my($prm) = + q"'----':obj {form:test, want:type(docu), from:'null'(), " . + q"seld:cmpd{relo:'= ', 'obj1':obj {form:prop, want:type" . + q"(prop), seld:type(pnam), from:'exmn'()}, 'obj2':TEXT(@)}}"; + + my($evt) = do_event(qw/core getd/, $app, $prm, $_[0]); + return($evt->{REPLY} eq 'aevt\ansr{}' ? undef : $evt); +} + +sub _full_path ($) { + my($obj) = $_[0]; + my($prm) = + q"'----':obj {form:prop, want:type(prop), seld:type(FILE), " . + q"from:" . AEPrint($_[0]) . q"}, rtyp:type(TEXT)"; + my($evt) = do_event(qw/core getd/, $app, $prm); + + return MacPerl::MakePath( + MacUnpack('fss ', ( + AEGetParamDesc($evt->{REP}, keyDirectObject()))->data()->get() + ) + ); +} + +sub _save_errors_window ($) { + my($prm) = + q"'----':obj {form:name, want:type(alis), seld:TEXT(@), from:'null'()}"; + do_event(qw/MMPR SvMs/, $app, $prm, $_[0]); +} + + +sub _close_errors_window () { + my($prm) = + q"'----':obj {form:name, want:type(cwin), " . + q"seld:TEXT(@), from:'null'()}"; + + my($evt) = do_event(qw/core clos/, $app, $prm, 'Errors & Warnings'); + return($evt->{REPLY} eq 'aevt\ansr{}' ? 1 : 0); +} + +sub _close () { + my($prm) = q"'----':" . AEPrint($_[0]); + do_event(qw/core clos/, $app, $prm); +} + +sub _get_dobj ($) { + return(AEGetParamDesc($_[0]->{REP}, keyDirectObject())); +} + +sub _get_folder ($$) { + require 'GUSI.ph'; + my($prompt, $default) = @_; + MacPerl::Choose( + GUSI::AF_FILE(), 0, $prompt, '', + GUSI::CHOOSE_DIR() + ($default ? &GUSI::CHOOSE_DEFAULT : 0), + $default + ); +} + +sub _save_appath ($$) { + + my($cwd) = cwd(); # remember the current working dir + chdir($scriptDir); # change dir to the script dir + + open(F, '>' . $_[0]) or die $!; + print F $_[1]; + close(F); + + chdir($cwd); # restore the cwd +} + +sub _read_appath ($) { + + my($filepath) = @_; + + my($cwd) = cwd(); # remember the current working dir + chdir($scriptDir); # change dir to the script dir + + if (! -e $filepath) { + return ""; + } + open(F, $filepath); + my($appath) = ; + close(F); + + chdir($cwd); # restore the cwd + return($appath); +} + + +sub _test ($) { + activate(); + my($path) = $_[0]; + build_project( + "${path}modules:xml:macbuild:XML.mcp", '', + "${path}build:mac:Mozilla.BuildLog.part" + ); +} + +1; + +=pod + +=back + +=head1 HISTORY + +=over 4 + +=item v1.02, September 23, 1998 + +Made fixes in finding and saving location of CodeWarrior IDE. + +=item v1.01, June 1, 1998 + +Made fixes to C in C, made C more robust +in finding CodeWarrior IDE, added global variable to NOT switch to IDE +for each sent event, a few other fixes. + +=item v1.00, May 30, 1998 + +First shot + +=back + + +=head1 AUTHORS + +Chris Nandor Fpudge@pobox.comE>, and the author of the +original I, Scott Collins Fscc@netscape.comE>. + +=head1 SEE ALSO + +BuildProject L. + +=head1 COPYRIGHT + +The contents of this file are subject to the Netscape 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 Mozilla Communicator client code, released +March 31, 1998. + +The Initial Developer of the Original Code is Netscape +Communications Corporation. Portions created by Netscape are +Copyright (C) 1998-1999 Netscape Communications Corporation. All +Rights Reserved. + +Contributor(s): + +=cut diff --git a/build/mac/build_scripts/MacCVS.pm b/build/mac/build_scripts/MacCVS.pm new file mode 100644 index 000000000000..854d59df0e35 --- /dev/null +++ b/build/mac/build_scripts/MacCVS.pm @@ -0,0 +1,204 @@ +#!perl -w +package MacCVS; + +# package Mac::Apps::MacCVS; this should really be the name of the package +# but due to our directory hierarchy in mozilla, I am not doing it + +require 5.004; +require Exporter; + +use strict; + +use vars qw($VERSION @ISA @EXPORT $MacCVSLib); +use Mac::StandardFile; +use Moz; +use Cwd; +use Exporter; +use File::Basename; + +@ISA = qw(Exporter); +@EXPORT = qw( new print checkout); +$VERSION = "1.00"; + +# Architecture: +# cvs session object: +# name - session name +# session_file - session file +# +# globals +# $MacCVSLib - location of MacCVS applescript library +# +# + +# +# utility routines +# + +# just like Mac::DoAppleScript, 1 is success, 0 is failure +sub _myDoAppleScript($) +{ + my($script) = @_; + my $asresult = MacPerl::DoAppleScript($script); + if ($asresult eq "0") + { + return 1; + } + else + { + print STDERR "AppleScript error: $asresult\n"; + print STDERR "AppleScript was: \n $script \n"; + return 0; + } +} + +# _useMacCVSLib +# returns 1 on success +# Search the include path for the file called MacCVSLib +sub _useMacCVSLib() +{ + unless ( defined($MacCVSLib) ) + { + my($libname) = "MacCVSLib"; +# try the directory we were run from + my($c) = dirname($0) . ":" . $libname; + if ( -e $c) + { + $MacCVSLib = $c; + } + else + { + # now search the include directories + foreach (@INC) + { + unless ( m/^Dev:Pseudo/ ) # This is some bizarre MacPerl special-case directory + { + $c = $_ . $libname; + if (-e $c) + { + $MacCVSLib = $c; + last; + } + } + } + } + if (! (-e $MacCVSLib)) + { + print STDERR "MacCVS lib could not be found! $MacCVSLib"; + return 0; + } + } + return 1; +} + + +# +# Session object methods +# + +sub new { + my ( $proto, $session_file) = @_; + my $class = ref($proto) || $proto; + my $self = {}; + + if ( defined($session_file) && ( -e $session_file) ) + { + $self->{"name"} = basename( $session_file ); + $self->{"session_file"} = $session_file; + bless $self, $class; + return $self; + } + else + { + print STDERR "MacCVS->new cvs file < $session_file > does not exist\n"; + return; + } +} + +# makes sure that the session is open +# assertSessionOpen() +# returns 1 on failure +sub assertSessionOpen() { + my ($self) = shift; + _useMacCVSLib() || die "Could not load MacCVSLib\n"; + my $script = <{session_file}") +END_OF_APPLESCRIPT + return _myDoAppleScript($script); +} + +# prints the cvs object, used mostly for debugging +sub print { + my($self) = shift; + print "MacCVS:: name: ", $self->{name}, " session file: ", $self->{session_file}, "\n"; +} + +# checkout( self, module, revision, date) +# MacCVS checkout command +# returns 1 on failure +sub checkout +{ + my($self, $module, $revision, $date ) = @_; + unless( defined ($module) ) { $module = ""; } # get rid of the pesky undefined warnings + unless( defined ($revision) ) { $revision = ""; } + unless( defined ($date) ) { $date = ""; } + + $self->assertSessionOpen() || return 1; + + my($revstring) = ($revision ne "") ? $revision : "(none)"; + my($datestring) = ($date ne "") ? $date : "(none)"; + + print "Checking out $module with revision $revstring, date $datestring\n"; + + my $script = <{name}", module:"$module", revision:"$revision", date:"$date" +END_OF_APPLESCRIPT + return _myDoAppleScript($script); +} + +1; +=pod + +=head1 NAME + +MacCVS - Interface to MacCVS + +=head1 SYNOPSIS + + use MacCVS; + $session = MacCVS->new( ) || die "cannot create session"; + $session->checkout([module] [revision] [date]) || die "Could not check out"; + +=head1 DESCRIPTION + +This is a MacCVS interface for talking to MacCVS Pro client. +MacCVSSession is the class used to manipulate the session + +=item new + MacCVS->new( ); + + Creates a new session. Returns undef on failure. + +=item checkout( [revision] [date] ) + + cvs checkout command. Revision and date are optional + returns 0 on failure + +=cut + +=head1 SEE ALSO + +=over + +=item MacCVS Home Page + +http://www.maccvs.org/ + +=back + +=head1 AUTHORS + +Aleks Totic atotic@netscape.com + +=cut + +__END__ diff --git a/build/mac/build_scripts/Moz.pm b/build/mac/build_scripts/Moz.pm new file mode 100644 index 000000000000..b7affbc17b1c --- /dev/null +++ b/build/mac/build_scripts/Moz.pm @@ -0,0 +1,564 @@ +=head1 NAME + +B - routines for automating CodeWarrior builds, and some extra-curricular activities related to building Mozilla + +=head1 SYNOPSIS + + use Moz; + + OpenErrorLog(":::BuildLog"); + StopForErrors(); + + $Moz::QUIET = 1; + InstallFromManifest(":projects:MANIFEST", $dist_dir); + + BuildProjectClean(":projects:SomeProject.mcp", "SomeTarget"); + MakeAlias(":projects:SomeProject.shlb", $dist_dir); + + DontStopForErrors(); + + BuildProject(":projects:SomeOtherProject.mcp", "SomeTarget"); + +=head1 DESCRIPTION + +B comprises the routines needed to slap CodeWarrior around, force it to build a sequence of projects, report the results, and a few other things. + +=cut + + + + +package Moz; +require Exporter; + +use Mac::Types; +use Mac::Events; +use Mac::Processes; +use File::Copy; + +@ISA = qw(Exporter); +@EXPORT = qw(current_directory full_path_to BuildProject BuildProjectClean OpenErrorLog MakeAlias StopForErrors DontStopForErrors InstallFromManifest InstallResources SetBuildNumber SetAgentString SetTimeBomb Delay ActivateApplication IsProcessRunning); +@EXPORT_OK = qw(CloseErrorLog UseCodeWarriorLib QUIET); + + use Cwd; + use File::Path; + use ExtUtils::Manifest 'maniread'; + + use CodeWarriorLib; + +sub current_directory() + { + my $current_directory = cwd(); + chop($current_directory) if ( $current_directory =~ m/:$/ ); + return $current_directory; + } + +sub full_path_to($) + { + my ($path) = @_; + if ( $path =~ m/^[^:]+$/ ) + { + $path = ":" . $path; + } + + if ( $path =~ m/^:/ ) + { + $path = current_directory() . $path; + } + + return $path; + } + +=head2 Setup + +Pretty much, everything is taken care of for you. + However, B does use a little compiled AppleScript library (the file CodeWarriorLib) for some of its communcication with CodeWarrior. + If this library isn't in the same directory as "Moz.pm", then you need to tell B where to find it. + Call C. + This routine is not exported by default, nor are you likely to need it. + +=cut + +sub UseCodeWarriorLib($) + { +# ($CodeWarriorLib) = @_; +# $CodeWarriorLib = full_path_to($CodeWarriorLib); + } + +$logging = 0; +$recent_errors_file = ""; +$stop_on_1st_error = 1; +$QUIET = 0; + + + +=head2 Logging all the errors and warnings - C, C + +The warnings and errors generated in the course of building projects can be logged to a file. +Tinderbox uses this facility to show why a remote build failed. + +Logging is off by default. + Start logging at any point in your build process with C. + Stop with C. + You never need to close the log explicitly, unless you want to just log a couple of projects in the middle of a big list. + C is not exported by default. + +=cut + +sub CloseErrorLog() + { + if ( $logging ) + { + close(ERROR_LOG); + $logging = 0; + StopForErrors() if $stop_on_1st_error; + } + } + + + +sub OpenErrorLog($) + { + my ($log_file) = @_; + + CloseErrorLog(); + if ( $log_file ) + { + $log_file = full_path_to($log_file); + + open(ERROR_LOG, ">$log_file") || die "Can't open logfile, check the file path.\n"; + MacPerl::SetFileInfo("CWIE", "TEXT", $log_file); + + $log_file =~ m/.+:(.+)/; + $recent_errors_file = full_path_to("$1.part"); + $logging = 1; + } + } + + +=head2 Stopping before it's too late - C, C + +When building a long list of projects, you decide whether to continue building subsequent projects when one fails. + By default, your build script will C after the first project that generates an error while building. + Change this behavior with C. + Re-enable it with C. + +=cut + +sub StopForErrors() + { + $stop_on_1st_error = 1; + + # Can't stop for errors unless we notice them. + # Can't notice them unless we are logging. + # If the user didn't explicitly request logging, log to a temporary file. + + if ( ! $recent_errors_file ) + { + OpenErrorLog("${TMPDIR}BuildResults"); + } + } + +sub DontStopForErrors() + { + $stop_on_1st_error = 0; + } + +sub log_message($) + { + if ( $logging ) + { + my ($message) = @_; + print ERROR_LOG $message; + } + } + +sub log_message_with_time($) + { + if ( $logging ) + { + my ($message) = @_; + my $time_stamp = localtime(); + log_message("$message ($time_stamp)\n"); + } + } + +sub log_recent_errors($) + { + my ($project_name) = @_; + my $found_errors = 0; + + if ( $logging ) + { + open(RECENT_ERRORS, "<$recent_errors_file"); + + while( ) + { + if ( /^Error/ || /^CouldnÕt find project file/ || /^Link Error/ ) + { +# if (!$found_errors) +# print $_; + $found_errors = 1; + } + print ERROR_LOG $_; + } + + close(RECENT_ERRORS); + unlink("$recent_errors_file"); + } + + if ( $stop_on_1st_error && $found_errors ) + { + print ERROR_LOG "### Build failed.\n"; + die "### Errors encountered building \"$project_name\".\n"; + } + } + +sub build_project($$$) + { + my ($project_path, $target_name, $clean_build) = @_; + $project_path = full_path_to($project_path); + +# $project_path =~ m/.+:(.+)/; +# my $project_name = $1; + + log_message_with_time("### Building \"$project_path\""); + + # Check that the given project exists + if (! -e $project_path) + { + print ERROR_LOG "### Build failed.\n"; + die "### Can't find project file \"$project_path\".\n"; + } + + print "Building \"$project_path\[$target_name\]\"\n"; + + $had_errors = CodeWarriorLib::build_project( + $project_path, $target_name, $recent_errors_file, $clean_build + ); + WaitNextEvent(); + +# $had_errors = +#MacPerl::DoAppleScript(<, C + +C and C are identical, except that the latter first removes object code. + In both, CodeWarrior opens the project if it wasn't already open; builds the given (or else current) target; and finally closes + the project, if it wasn't already open. + +=cut + +sub BuildProject($;$) + { + my ($project_path, $target_name) = @_; + build_project($project_path, $target_name, 0); + } + +sub BuildProjectClean($;$) + { + my ($project_path, $target_name) = @_; + build_project($project_path, $target_name, 1); + } + + +=head2 Miscellaneous + +C functions like C, except with better argument defaulting and more explicit error messages. + +=cut + +sub MakeAlias($$) + { + my ($old_file, $new_file) = @_; + + # if the directory to hold $new_file doesn't exist, create it + if ( ($new_file =~ m/(.+:)/) && !-d $1 ) + { + mkpath($1); + } + + # if a leaf name wasn't specified for $new_file, use the leaf from $old_file + if ( ($new_file =~ m/:$/) && ($old_file =~ m/.+:(.+)/) ) + { + $new_file .= $1; + } + + my $message = "Can't create a Finder alias (at \"$new_file\")\n for \"$old_file\"; because "; + + die "$message \"$old_file\" doesn't exist.\n" unless -e $old_file; + die "$message I won't replace an existing (non-alias) file with an alias.\n" if ( -e $new_file && ! -l $new_file ); + + # now: $old_file exists; $new_file doesn't (or else, is an alias already) + + if ( -l $new_file ) + { + # ...then see if it already points to $old_file + my $current_target = full_path_to(readlink($new_file)); + my $new_target = full_path_to($old_file); + + return if ( $current_target eq $new_target ); + # if the desired alias already exists and points to the right thing, then we're done + + unlink $new_file; + } + + symlink($old_file, $new_file) || die "$message symlink returned an unexpected error.\n"; + } + + +=pod + +C + +=cut + +sub InstallFromManifest($;$$) + { + my ($manifest_file, $dest_dir, $flat) = @_; + + $flat = 0 unless defined($flat); # if $flat, all rel. paths in MANIFEST get aliased to the root of $dest_dir + + $dest_dir ||= ":"; + + $manifest_file =~ m/(.+):/; + my $source_dir = $1; + + chop($dest_dir) if $dest_dir =~ m/:$/; + + #Mac::Events->import(); + WaitNextEvent(); + if ($flat) + { + print "Doing manifest on \"$manifest_file\" FLAT\n" unless $QUIET; + } + else + { + print "Doing manifest on \"$manifest_file\"\n" unless $QUIET; + } + + my $read = maniread(full_path_to($manifest_file)); + foreach $file (keys %$read) + { + next unless $file; + + $subdir = ":"; + if (!$flat && ($file =~ /:.+:/ )) + { + $subdir = $&; + } + + $file = ":$file" unless $file =~ m/^:/; + MakeAlias("$source_dir$file", "$dest_dir$subdir"); + } + } + + +=pod + +C + +=cut + +# parameters are path to MANIFEST file, destination dir, true (to make copies) or false (to make aliases) +sub InstallResources($;$;$) + { + my ($manifest_file, $dest_dir, $copy_files) = @_; + + $dest_dir ||= ":"; + mkpath($dest_dir) if !-d $dest_dir; + + $manifest_file =~ m/(.+):/; + my $source_dir = $1; + + chop($dest_dir) if $dest_dir =~ m/:$/; + + WaitNextEvent(); + print "Installing resources from \"$manifest_file\"\n" unless $QUIET; + + my $read = maniread(full_path_to($manifest_file)); + foreach $file (keys %$read) + { + next unless $file; + + if ($copy_files) + { + copy("$source_dir:$file", "$dest_dir:$file"); + } + else + { + MakeAlias("$source_dir:$file", "$dest_dir:$file"); + } + } + } + + + sub SetBuildNumber + { + + open (OUTPUT, ">:mozilla:config:build_number") || die "could not open buildnumber"; + + open (BDATE, "perl :mozilla:config:bdate.pl|"); + + while () { + print OUTPUT $_; + } + + close (BDATE); + close (OUTPUT); + + + + system ("perl :mozilla:config:aboutime.pl :mozilla:xpfe:appshell:public:nsBuildID.h :mozilla:config:build_number"); + system ("perl :mozilla:config:aboutime.pl :mozilla:xpfe:browser:resources:locale:en-US:navigator.dtd :mozilla:config:build_number"); + } + +sub SetAgentString +{ + + open (BDATE, ":mozilla:config:build_number") || die "could not open buildnumber"; + + while () { + $build_number = $_; + } + + close (BDATE); + + open (ORIGFILE, ":mozilla:cmd:macfe:restext:custom.r") || die "no original file"; + open (OUTPUT, ">:mozilla:cmd:macfe:restext:agent.r") || die "no output file"; + + chop($build_number); + + while () { + + $tempstring = $_; + if ($tempstring =~ "\#define VERSION_MAJOR_STR") { + $tempstring = "\#define VERSION_MAJOR_STR \"5.0a1-" . $build_number . " Development\"\n"; + } + print OUTPUT $tempstring; + } + + close (ORIGFILE); + close (OUTPUT); + + unlink (":mozilla:cmd:macfe:restext:custom.r"); + rename (":mozilla:cmd:macfe:restext:agent.r", ":mozilla:cmd:macfe:restext:custom.r"); +} + +sub SetTimeBomb($$) + +{ + my ($warn_days, $bomb_days) = @_; + + system("perl :mozilla:config:mac-set-timebomb.pl $warn_days $bomb_days"); + +} + +sub Delay($) + +{ + my ($delay_seconds) = @_; + + $now = time; + + $exit_time = $now + $delay_seconds; + + while ($exit_time > $now) { + $now = time; + } + +} + + +#//-------------------------------------------------------------------------------------------------- +#// ActivateApplication +#//-------------------------------------------------------------------------------------------------- + +sub ActivateApplication($) +{ + my ($appSignature) = @_; + my ($psi, $found); + my ($appPSN); + + $found = 0; + + foreach $psi (values(%Process)) + { + if ($psi->processSignature() eq $appSignature) + { + $appPSN = $psi->processNumber(); + $found = 1; + last; + } + } + + if ($found == 0) + { + return; + } + + SetFrontProcess($appPSN); + + while (GetFrontProcess() != $appPSN) + { + WaitNextEvent(); + } + +} + +#//-------------------------------------------------------------------------------------------------- +#// IsProcessRunning +#//-------------------------------------------------------------------------------------------------- + +sub IsProcessRunning($) +{ + my($processName, $psn, $psi) = @_; + while ( ($psn, $psi) = each(%Process) ) { + if ($psi->processName eq $processName) { return 1; } + } + return 0; +} + + +1; + +=head1 AUTHORS + +Scott Collins , Simon Fraser , Chris Yeh + +=head1 SEE ALSO + +BuildMozillaDebug.pl (et al), BuildList.pm, CodeWarriorLib (an AppleScript library) + +=head1 COPYRIGHT + +The contents of this file are subject to the Netscape 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 Mozilla Communicator client code, released +March 31, 1998. + +The Initial Developer of the Original Code is Netscape +Communications Corporation. Portions created by Netscape are +Copyright (C) 1998-1999 Netscape Communications Corporation. All +Rights Reserved. + +Contributor(s): + +=cut diff --git a/build/mac/build_scripts/MozBuildFlags.pm b/build/mac/build_scripts/MozBuildFlags.pm new file mode 100644 index 000000000000..884f8c232ad6 --- /dev/null +++ b/build/mac/build_scripts/MozBuildFlags.pm @@ -0,0 +1,203 @@ + +package MozBuildFlags; + +require 5.004; +require Exporter; + +# Package that attempts to read a file from the Preferences folder, +# and get build settings out of it + +use strict; +use Exporter; + +use MozPrefs; + +use vars qw(@ISA @EXPORT); + +@ISA = qw(Exporter); +@EXPORT = qw(SetupBuildParams); + + +#------------------------------------------------------------------------------- +# These 3 arrays are the 'master lists' to control what gets built. +# We use arrays here, instead of just intializing the hashes directly, +# so that we can start the build at a given stage using a stored key. +# +# Ordering in these arrays is important; it has to reflect the order in +# which the build occurs. +#------------------------------------------------------------------------------- + +my(@pull_flags) = +( + ["moz", 1], # pull everything needed for mozilla + ["runtime", 0] # used to just build runtime libs, up to NSPR +); + +my(@build_flags) = +( + ["all", 1], # 'all' must come first! + ["dist", 0], + ["dist_runtime", 0], + ["xpidl", 0], + ["idl", 0], + ["stubs", 0], + ["runtime", 0], + ["common", 0], + ["imglib", 0], + ["necko", 0], + ["security", 0], + ["browserutils", 0], + ["intl", 0], + ["nglayout", 0], + ["editor", 0], + ["viewer", 0], + ["xpapp", 0], + ["extensions", 0], + ["plugins", 0], + ["mailnews", 0], + ["apprunner", 0], + ["resources", 0] +); + +my(@options_flags) = +( + ["jar_manifests", 0], # use jar.mn files for resources, not MANIFESTs + ["jars", 0], # build jar files + ["transformiix", 0], # obsolete? + ["mathml", 0], + ["svg", 0], + ["mng", 1], + ["ldap", 0], + ["xmlextras", 0], + ["mailextras", 1], # mail importers + ["xptlink", 0] # xpt linker codewarrior plugin +); + + +#------------------------------------------------------------------------------- +# End of build flags +#------------------------------------------------------------------------------- + +#------------------------------------------------------------------------------- +# flagsArrayToHash +# +# Utility routine to migrate flag from a 2D array to a hash, where +# item[n][0] is the hash entry name, and item[n][1] is the hash entry value. +#------------------------------------------------------------------------------- + +sub flagsArrayToHash($$) +{ + my($src_array, $dest_hash) = @_; + + my($item); + foreach $item (@$src_array) + { + $dest_hash->{$item->[0]} = $item->[1]; + } +} + +#----------------------------------------------- +# printHash +# +# Utility routine to print a hash +#----------------------------------------------- +sub printHash($) +{ + my($hash_ref) = @_; + + print "Printing hash:\n"; + + my($key, $value); + + while (($key, $value) = each (%$hash_ref)) + { + print " $key $value\n"; + } +} + + +#------------------------------------------------------------------------------- +# SetPullFlags +#------------------------------------------------------------------------------- +sub SetPullFlags($) +{ + my($pull) = @_; + + flagsArrayToHash(\@pull_flags, $pull); +} + +#------------------------------------------------------------------------------- +# SetBuildFlags +#------------------------------------------------------------------------------- +sub SetBuildFlags($) +{ + my($build) = @_; + + flagsArrayToHash(\@build_flags, $build); +} + +#------------------------------------------------------------------------------- +# SetBuildOptions +#------------------------------------------------------------------------------- +sub SetBuildOptions($) +{ + my($options) = @_; + + flagsArrayToHash(\@options_flags, $options); +} + +#------------------------------------------------------------------------------- +# SetOptionDefines +#------------------------------------------------------------------------------- +sub SetOptionDefines($) +{ + my($optiondefines) = @_; + + # These should remain unchanged + $optiondefines->{"mathml"}{"MOZ_MATHML"} = 1; + $optiondefines->{"svg"}{"MOZ_SVG"} = 1; +} + + +#------------------------------------------------------------------------------- +# PropagateAllFlags +#------------------------------------------------------------------------------- +sub PropagateAllFlags($) +{ + my($build_array) = @_; + + # if "all" is set, set all the flags to 1 + unless ($build_array->[0][0] eq "all") { die "'all' must come first in the build array\n"; } + + if ($build_array->[0][1] == 1) + { + my($index); + foreach $index (@$build_array) + { + $index->[1] = 1; + } + } +} + +#------------------------------------------------------------------------------- +# SetupBuildParams +#------------------------------------------------------------------------------- +sub SetupBuildParams($$$$$) +{ + my($pull, $build, $options, $optiondefines, $prefs_file) = @_; + + # read the user pref file, that can change values in the array + ReadMozUserPrefs($prefs_file, \@pull_flags, \@build_flags, \@options_flags); + + PropagateAllFlags(\@build_flags); + + SetPullFlags($pull); + SetBuildFlags($build); + SetBuildOptions($options); + SetOptionDefines($optiondefines); + + #printHash($build); +} + + +1; diff --git a/build/mac/build_scripts/MozBuildUtils.pm b/build/mac/build_scripts/MozBuildUtils.pm new file mode 100644 index 000000000000..a2ec98f24568 --- /dev/null +++ b/build/mac/build_scripts/MozBuildUtils.pm @@ -0,0 +1,208 @@ + +package MozBuildUtils; + +require 5.004; +require Exporter; + +# Package that attempts to read a file from the Preferences folder, +# and get build settings out of it + +use strict; +use Exporter; + +use Moz; + +use vars qw(@ISA @EXPORT); + +@ISA = qw(Exporter); +@EXPORT = qw(GetDistDirectory BuildOneProject BuildIDLProject AskAndPersistFile DelayFor EmptyTree); + + +#-------------------------------------------------------------------------------------------------- +# GetDistDirectory +#-------------------------------------------------------------------------------------------------- +sub GetDistDirectory() +{ + if ($main::DIST_DIRECTORY eq "") { die "Dist directory not set\n"; } + return $main::DIST_DIRECTORY; +} + +#-------------------------------------------------------------------------------------------------- +# AskAndPersistFile stores the information about the user pick inside +# the file $session_storage +#-------------------------------------------------------------------------------------------------- +sub AskAndPersistFile($) +{ + my ($sessionStorage) = @_; + my $cvsfile; + + if (( -e $sessionStorage) && + open( SESSIONFILE, $sessionStorage )) + { + # Read in the path if available + $cvsfile = ; + chomp $cvsfile; + close SESSIONFILE; + if ( ! -e $cvsfile ) + { + print STDERR "$cvsfile has disappeared\n"; + undef $cvsfile; + } + } + unless (defined ($cvsfile)) + { + # make sure that MacPerl is a front process + ActivateApplication('McPL'); + MacPerl::Answer("Could not find your MacCVS session file. Please choose one", "OK"); + + # prompt user for the file name, and store it + my $macFile = StandardGetFile( 0, "McvD"); + if ( $macFile->sfGood() ) + { + $cvsfile = $macFile->sfFile(); + # save the choice if we can + if ( open (SESSIONFILE, ">" . $sessionStorage)) + { + printf SESSIONFILE $cvsfile, "\n"; + close SESSIONFILE; + } + else + { + print STDERR "Could not open storage file\n"; + } + } + } + return $cvsfile; +} + + +#-------------------------------------------------------------------------------------------------- +# BuildIDLProject +# +#-------------------------------------------------------------------------------------------------- + +sub BuildIDLProject($$) +{ + my ($project_path, $module_name) = @_; + + if ($main::CLOBBER_IDL_PROJECTS) + { + my($datafolder_path) = $project_path; + $datafolder_path =~ s/\.mcp$/ Data:/; # generate name of the project's data folder. + print STDERR "Deleting IDL data folder: $datafolder_path\n"; + EmptyTree($datafolder_path); + } + + BuildOneProject($project_path, "headers", 0, 0, 0); + BuildOneProject($project_path, $module_name.".xpt", 1, 0, 1); +} + + +#//-------------------------------------------------------------------------------------------------- +#// Build one project, and make the alias. Parameters +#// are project path, target name, make shlb alias (boolean), make xSYM alias (boolean) +#// +#// Note that this routine assumes that the target name and the shared libary name +#// are the same. +#//-------------------------------------------------------------------------------------------------- + +sub BuildOneProject($$$$$) +{ + my ($project_path, $target_name, $alias_shlb, $alias_xSYM, $component) = @_; + + unless ($project_path =~ m/^$main::BUILD_ROOT.+/) { return; } + + # $D becomes a suffix to target names for selecting either the debug or non-debug target of a project + my($D) = $main::DEBUG ? "Debug" : ""; + my($dist_dir) = GetDistDirectory(); + + # Put libraries in "Essential Files" folder, Components in "Components" folder + my($component_dir) = $component ? "Components:" : "Essential Files:"; + + my($project_dir) = $project_path; + $project_dir =~ s/:[^:]+$/:/; # chop off leaf name + + if ($main::CLOBBER_LIBS) + { + unlink "$project_dir$target_name"; # it's OK if these fail + unlink "$project_dir$target_name.xSYM"; + } + + BuildProject($project_path, $target_name); + + $alias_shlb ? MakeAlias("$project_dir$target_name", "$dist_dir$component_dir") : 0; + $alias_xSYM ? MakeAlias("$project_dir$target_name.xSYM", "$dist_dir$component_dir") : 0; +} + +#//-------------------------------------------------------------------------------------------------- +#// DelayFor +#// +#// Delay for the given number of seconds, allowing the script to be cancelled +#//-------------------------------------------------------------------------------------------------- + +sub DelayFor($) +{ + my($delay_secs) = @_; + + STDOUT->autoflush(1); + + my($end_time) = time() + $delay_secs; + + my($last_time); + my($cur_time) = time(); + + while ($cur_time < $end_time) + { + $cur_time = time(); + if ($cur_time > $last_time) + { + print "."; + $last_time = $cur_time; + } + } + + STDOUT->autoflush(0); +} + + +#//-------------------------------------------------------------------------------------------------- +#// Remove all files from a tree, leaving directories intact (except "CVS"). +#//-------------------------------------------------------------------------------------------------- + +sub EmptyTree($) +{ + my ($root) = @_; + #print "EmptyTree($root)\n"; + opendir(DIR, $root); + my $sub; + foreach $sub (readdir(DIR)) + { + my $fullpathname = $root.$sub; # -f, -d only work on full paths + + # Don't call empty tree for the alias of a directory. + # -d returns true for the alias of a directory, false for a broken alias) + + if (-d $fullpathname) + { + if (-l $fullpathname) # delete aliases + { + unlink $fullpathname; + next; + } + EmptyTree($fullpathname.":"); + if ($sub eq "CVS") + { + #print "rmdir $fullpathname\n"; + rmdir $fullpathname; + } + } + else + { + unless (unlink $fullpathname) { die "Failed to delete $fullpathname\n"; } + } + } + closedir(DIR); +} + + +1; diff --git a/build/mac/build_scripts/MozJar.pm b/build/mac/build_scripts/MozJar.pm new file mode 100644 index 000000000000..a6fbaf1469d1 --- /dev/null +++ b/build/mac/build_scripts/MozJar.pm @@ -0,0 +1,431 @@ +#!perl -w +package MozJar; + +# +# Module for creating jar files, either using a jar manifest, or +# simply jarring up folders on disk. +# + +require 5.004; +require Exporter; + +use strict; +use Archive::Zip; +use File::Path; + +use Mac::Files; + +use Moz; + +use vars qw( @ISA @EXPORT ); + +@ISA = qw(Exporter); +@EXPORT = qw(CreateJarFileFromDirectory WriteOutJarFiles); + + +#------------------------------------------------------------------------------- +# Add the contents of a directory to the zip file +# +#------------------------------------------------------------------------------- +sub _addDirToJar($$$$) +{ + my($dir, $jar_root, $zip, $compress) = @_; + + opendir(DIR, $dir) or die "Cannot open dir $dir\n"; + my @files = readdir(DIR); + closedir DIR; + + my $unix_jar_root = $jar_root; + $unix_jar_root =~ s|:|/|g; # colon to slash conversion + + my $file; + + foreach $file (@files) + { + my $filepath = $dir.":".$file; + + if (-d $filepath) + { + print "Adding files to jar from $filepath\n"; + _addDirToJar($filepath, $jar_root, $zip, $compress); + } + else + { + my $member = Archive::Zip::Member->newFromFile($filepath); + die "Failed to create zip file member $filepath\n" unless $member; + + my $unixName = $filepath; + $unixName =~ s|:|/|g; # colon to slash conversion + $unixName =~ s|^$unix_jar_root||; # relativise + + $member->fileName($unixName); + + # print "Adding $file as $unixName\n"; + + if ($compress) { + $member->desiredCompressionMethod(Archive::Zip::COMPRESSION_DEFLATED); + } else { + $member->desiredCompressionMethod(Archive::Zip::COMPRESSION_STORED); + } + + $zip->addMember($member); + } + } +} + +#------------------------------------------------------------------------------- +# Add the contents of a directory to the zip file +# +#------------------------------------------------------------------------------- + +sub CreateJarFileFromDirectory($$$) +{ + my($srcdir, $jarpath, $compress) = @_; + + my $zip = Archive::Zip->new(); + + _addDirToJar($srcdir, $srcdir, $zip, $compress); + + print "Saving zip file...\n"; + my $status = $zip->writeToFileNamed($jarpath); + if ($status == 0) { + print "Zipping completed successfully\n"; + } else { + print "Error saving zip file\n"; + } + + # set the file type/creator to something reasonable + MacPerl::SetFileInfo("ZIP ", "ZIP ", $jarpath); +} + + +#------------------------------------------------------------------------------- +# addToJarFile +# +# Add a file to a jar file +# +# Parameters: +# 1. Jar ID. Unix path of jar file inside chrome. +# 2. Abs path to jar.mn file (i.e. source) (mac breaks) +# 3. File source, relative to jar.mn path (mac breaks) +# 4. Abs path to the resulting .jar file (mac breaks) +# 5. Relative file path within the jar (unix breaks) +# 6. Reference to hash of jar files +# +#------------------------------------------------------------------------------- + +sub addToJarFile($$$$$$) +{ + my($jar_id, $jar_man_dir, $file_src, $jar_path, $file_jar_path, $jars) = @_; + + # print "addToJarFile with:\n $jar_man_dir\n $file_src\n $jar_path\n $file_jar_path\n"; + + unless ($jar_path =~ m/(.+:)([^:]+)$/) { die "Bad jar path $jar_path\n"; } + + my($target_dir) = $1; + my($jar_name) = $2; + + $target_dir =~ s/[^:]+$//; + + # print "¥ $target_dir $jar_name\n"; + + # find the source file + my($src) = $jar_man_dir.":".$file_src; + if ((!-e $src) && ($file_src =~ m/.+:([^:]+)$/)) # src does not exist. Fall back to looking for src in jar.mn dir + { + $file_src = $1; + $src = $jar_man_dir.":".$file_src; + + if (!-e $src) { + die "Can't find chrome file $src\n"; + } + } + + if ($main::options{jars}) + { + my($zip) = $jars->{$jar_id}; + unless ($zip) { die "Can't find Zip entry for $jar_id\n"; } + + # print "Adding $file_src to jar file $jar_path at $file_jar_path\n"; + + my($member) = Archive::Zip::Member->newFromFile($src); + unless ($member) { die "Failed to create zip file member $src\n"; } + + $member->fileName($file_jar_path); + + my($compress) = 1; + if ($compress) { + $member->desiredCompressionMethod(Archive::Zip::COMPRESSION_DEFLATED); + } else { + $member->desiredCompressionMethod(Archive::Zip::COMPRESSION_STORED); + } + + $zip->addMember($member); + } + else # copy file + { + my($rel_path) = $file_jar_path; + $rel_path =~ s|/|:|g; # slash to colons + + my($dir_name) = $jar_name; + $dir_name =~ s/\.jar$//; + + my($dst) = $target_dir.$dir_name.":".$rel_path; + + # print "Aliassing $src\n to\n$dst\n"; + MakeAlias($src, $dst); # don't check errors, otherwise we fail on replacement + } +} + + +#------------------------------------------------------------------------------- +# setupJarFile +# +# setup a zip for writing +#------------------------------------------------------------------------------- + +sub setupJarFile($$$) +{ + my($jar_id, $jar_path, $jar_hash) = @_; + + # print "Creating jar file $jar_id at $jar_path\n"; + + if ($main::options{jars}) + { + my($zip) = $jar_hash->{$jar_id}; + if (!$zip) # if we haven't made it already, do so + { + my($zip) = Archive::Zip->new(); + $jar_hash->{$jar_id} = $zip; + } + } + else + { + # installing files. + # nothing to do. MakeAlias creates dirs as needed. + + # add this jar to the list + $jar_hash->{$jar_id} = 1; + } +} + + +#------------------------------------------------------------------------------- +# closeJarFile +# +# We're done with this jar file _for this jar.mn_. We may add more entries +# to it later, so keep it open in the hash. +#------------------------------------------------------------------------------- +sub closeJarFile($$) +{ + my($jar_path, $jar_hash) = @_; + + # print "Closing jar file $jar_path\n"; + + if ($main::options{jars}) + { + + } + else + { + # installing files. + # nothing to do + } +} + + +#------------------------------------------------------------------------------- +# WriteOutJarFiles +# +# Now we dump out the jars +#------------------------------------------------------------------------------- +sub WriteOutJarFiles($$) +{ + my($chrome_dir, $jars) = @_; + + unless ($main::options{jars}) { return; } + + my($full_chrome_path) = Moz::full_path_to($chrome_dir); + + my($key); + foreach $key (keys %$jars) + { + my($zip) = $jars->{$key}; + + my($rel_path) = $key; + $rel_path =~ s/\//:/g; + + my($output_path) = $full_chrome_path.":".$rel_path; + + print "Writing zip file $key to $output_path\n"; + + # ensure the target dirs exist + my($path) = $output_path; + $path =~ s/\.jar$//; + mkpath($path); + + ($zip->writeToFileNamed($output_path) == Archive::Zip::AZ_OK) || die "Error writing jar $rel_path\n"; + + MacPerl::SetFileInfo("ZIP ", "ZIP ", $output_path); + } +} + + +#------------------------------------------------------------------------------- +# registerChromePackage +# +# Enter a chrome package into the installed-chrome.txt file +#------------------------------------------------------------------------------- +sub registerChromePackage($$$$) +{ + my($jar_file, $file_path, $chrome_dir, $jar_hash) = @_; + + my($manifest_subdir) = $jar_file; + $manifest_subdir =~ s/:/\//g; + + my($chrome_entry); + + if ($main::options{jars}) { + $chrome_entry = ",install,url,jar:resource:/Chrome/"; + $manifest_subdir.= "!/"; + } else { + $chrome_entry = ",install,url,resource:/Chrome/"; + $manifest_subdir =~ s/\.jar$/\//; + } + + # print "Entering $chrome_entry$manifest_subdir in installed-chrome.txt\n"; + + # for now, regiser for content, locale and skin + # we'll get the type from the path soon + my($type) = "content"; + + # ensure chrome_dir exists + mkpath($chrome_dir); + + my($inst_chrome) = ${chrome_dir}.":installed-chrome.txt"; + + open(CHROMEFILE, ">>${inst_chrome}") || die "Failed to open $inst_chrome\n"; + + print(CHROMEFILE "${type}${chrome_entry}${manifest_subdir}\n"); + $type = "locale"; + print(CHROMEFILE "${type}${chrome_entry}${manifest_subdir}\n"); + $type = "skin"; + print(CHROMEFILE "${type}${chrome_entry}${manifest_subdir}\n"); + + close(CHROMEFILE); +} + +#------------------------------------------------------------------------------- +# Create or add to a jar file from a jar.mn file. +# Both arguments are relative to the mozilla root dir. +# +# +#------------------------------------------------------------------------------- +sub CreateJarFromManifest($$$) +{ + my($jar_man_path, $dest_path, $jars) = @_; + + if ($main::options{jars}) { + print "Jarring from $jar_man_path\n"; + } else { + print "Installing files from $jar_man_path\n"; + } + + $jar_man_path = Moz::full_path_to($jar_man_path); + $dest_path = Moz::full_path_to($dest_path); + + # if the jars hash is empty, nuke installed-chrome.txt + if (! scalar(%$jars)) + { + print "Nuking chrome\n"; + my($installed_chrome) = $dest_path.":installed-chrome.txt"; + # unlink $installed_chrome; + } + + my $jar_man_dir = ""; + my $jar_man_file = ""; + + if ($jar_man_path =~ /(.+):([^:]+)$/) + { + $jar_man_dir = $1; # no trailing : + $jar_man_file = $2; + } + + # Keep a hash of jar files, keyed on relative jar path (e.g. "packages/core.jar") + # Entries are open Archive::Zips (if zipping), and installed-chrome entries. + + my($jar_id) = ""; # Current foo/bar.jar from jar.mn file + my($jar_file) = ""; # relative path to jar file (from $dest_path), with mac separators + my($full_jar_path); + + open(FILE, "<$jar_man_path") || die "could not open \"$jar_man_path\": $!"; + while () + { + my($line) = $_; + chomp($line); + + # print "$line\n"; + + if ($line =~ /^\s*\#.*$/) { # skip comments + next; + } + + if ($line =~/^([\w\d.\-\\\/]+)\:\s*$/) # line start jar file entries + { + $jar_id = $1; + $jar_file = $jar_id; + $jar_file =~ s|/|:|g; # slash to colons + $full_jar_path = $dest_path.":".$jar_file; + + setupJarFile($jar_id, $full_jar_path, $jars); + + } + elsif ($line =~ /^\s+([\w\d.\-\\\/]+)\s*(\([\w\d.\-\\\/]+\))?$\s*/) # jar file entry + { + my($file_dest) = $1; + my($file_src) = $2; + + if ($file_src) { + $file_src = substr($file_src, 1, -1); #strip the () + } else { + $file_src = $file_dest; + } + + $file_src =~ s|/|:|g; + + if ($jar_file ne "") # if jar is open, add to jar + { + if ($file_dest eq "manifest.rdf") # will change to contents.rdf + { + registerChromePackage($jar_file, $file_dest, $dest_path, $jars); + } + + addToJarFile($jar_id, $jar_man_dir, $file_src, $full_jar_path, $file_dest, $jars); + } + else + { + die "bad jar.mn format at $line\n"; + } + } + elsif ($line =~ /^\s*$/ ) # blank line + { + if ($jar_file ne "") #if a jar file is open, close it + { + closeJarFile($full_jar_path, $jars); + + $jar_file = ""; + $full_jar_path = ""; + } + } + } + + close(FILE); + + if ($jar_file ne "") #if a jar file is open, close it + { + closeJarFile($full_jar_path, $jars); + } + +} + +1; diff --git a/build/mac/build_scripts/MozPrefs.pm b/build/mac/build_scripts/MozPrefs.pm new file mode 100644 index 000000000000..b944b134cc27 --- /dev/null +++ b/build/mac/build_scripts/MozPrefs.pm @@ -0,0 +1,220 @@ + +package MozPrefs; + +require 5.004; +require Exporter; + +# Package that attempts to read a file from the Preferences folder, +# and get build settings out of it + +use strict; + +use Exporter; +use Mac::Files; + +use vars qw(@ISA @EXPORT); + +@ISA = qw(Exporter); +@EXPORT = qw(ReadMozUserPrefs); + + + +#------------------------------------------------------------------------------- +# +# GetPrefsFolder +# +#------------------------------------------------------------------------------- + +sub GetPrefsFolder() +{ + my($prefs_folder) = FindFolder(kOnSystemDisk, kPreferencesFolderType, 1); + return $prefs_folder; +} + + +#------------------------------------------------------------------------------- +# +# SetArrayValue +# +#------------------------------------------------------------------------------- +sub SetArrayValue($$$) +{ + my($array_ref, $index1, $index2) = @_; + + my($index); + foreach $index (@$array_ref) + { + if ($index->[0] eq $index1) + { + $index->[1] = $index2; + return 1; + } + } + + return 0; +} + + +#------------------------------------------------------------------------------- +# +# WriteDefaultPrefsFile +# +#------------------------------------------------------------------------------- + +sub WriteDefaultPrefsFile($) +{ + my($file_path) = @_; + + my($file_contents); + $file_contents = <<'EOS'; +% You can use this file to customize the Mozilla build system. +% The following kinds of lines are allowable: +% Comment lines, which start with a '%' in the first column +% Lines with modify the default build settings. Examples are: +% +% pull runtime 1 % just pull runtime +% options mng 1 % turn mng on +% build jars 0 % don't build jar files +% +EOS + + $file_contents =~ s/%/#/g; + + open(PREFS_FILE, "> $file_path") || die "Could not write default prefs file\n"; + print PREFS_FILE ($file_contents); + close(PREFS_FILE); + + MacPerl::SetFileInfo("McPL", "TEXT", $file_path); +} + + +#------------------------------------------------------------------------------- +# +# HandlePrefSet +# +#------------------------------------------------------------------------------- +sub HandlePrefSet($$$$) +{ + my($flags, $name, $value, $desc) = @_; + + if (SetArrayValue($flags, $name, $value)) { + print "Prefs set $desc flag $name to $value\n"; + } else { + die "$desc setting '$name' is not a valid option\n"; + } + +} + + +#------------------------------------------------------------------------------- +# +# HandleBuildFromPref +# +#------------------------------------------------------------------------------- +sub HandleBuildFromPref($$) +{ + my($build_array, $name) = @_; + + my($setting) = 0; + my($index); + foreach $index (@$build_array) + { + if ($index->[0] eq $name) { + $setting = 1; + } + + $index->[1] = $setting; + } + + if ($setting == 1) { + print "Building from $name onwards, as specified by prefs\n"; + } else { + printf "Failed to find buildfrom setting '$name'\n"; + } +} + + +#------------------------------------------------------------------------------- +# +# ReadPrefsFile +# +#------------------------------------------------------------------------------- + +sub ReadPrefsFile($$$$) +{ + my($file_path, $pull_flags, $build_flags, $options_flags) = @_; + + if (open(PREFS_FILE, "< $file_path")) + { + print "Reading build prefs from $file_path\n"; + + while () + { + my($line) = $_; + + if ($line =~ /^\#/ || $line =~ /^\s+$/) { # ignore comments and empty lines + next; + } + + if ($line =~ /^\s*(\w+)\s+(\w+)\s+(\w+)\s*/) + { + my($array_name) = $1; + my($option_name) = $2; + my($option_value) = $3; + + if ($array_name eq "pull") + { + HandlePrefSet($pull_flags, $option_name, $option_value, "Pull"); + } + elsif ($array_name eq "build") + { + HandlePrefSet($build_flags, $option_name, $option_value, "Build"); + } + elsif ($array_name eq "options") + { + HandlePrefSet($options_flags, $option_name, $option_value, "Options"); + } + else + { + print "Unknown pref option at $line\n"; + } + } + elsif ($line =~ /^\s*buildfrom\s+(\w+)/) + { + my($build_start) = $1; + HandleBuildFromPref($build_flags, $build_start); + } + else + { + print "Unknown pref option at $line\n"; + } + + } + + close(PREFS_FILE); + } + else + { + print "No prefs file found at $file_path; using defaults\n"; + WriteDefaultPrefsFile($file_path); + } +} + + +#------------------------------------------------------------------------------- +# +# ReadMozUserPrefs +# +#------------------------------------------------------------------------------- + +sub ReadMozUserPrefs($$$$) +{ + my($prefs_file_name, $pull_flags, $build_flags, $options_flags) = @_; + + my($prefs_path) = GetPrefsFolder(); + $prefs_path .= ":$prefs_file_name"; + + ReadPrefsFile($prefs_path, $pull_flags, $build_flags, $options_flags); +} + +1; diff --git a/build/mac/build_scripts/MozillaBuildList.pm b/build/mac/build_scripts/MozillaBuildList.pm new file mode 100644 index 000000000000..bd6f0c2de2cf --- /dev/null +++ b/build/mac/build_scripts/MozillaBuildList.pm @@ -0,0 +1,2676 @@ +#!perl -w +package MozillaBuildList; + +require 5.004; +require Exporter; + +use strict; +use vars qw( @ISA @EXPORT ); + +# perl includes +use Mac::StandardFile; +use Mac::Processes; +use Mac::Events; +use Mac::Files; +use Cwd; +use FileHandle; +use File::Path; +use File::Copy; + +# homegrown +use Moz; +use MozBuildUtils; +use MozBuildFlags; +use MozJar; +use MacCVS; + +@ISA = qw(Exporter); +@EXPORT = qw(ConfigureBuildSystem Checkout RunBuild BuildDist BuildProjects BuildCommonProjects BuildLayoutProjects BuildOneProject); + + +# NGLayoutBuildList builds the nglayout project +# it is configured by setting the following variables in the caller: +# Usage: +# caller variables that affect behaviour: +# DEBUG : 1 if we are building a debug version +# 3-part build process: checkout, dist, and build_projects +# Hack alert: +# NGLayout defines are located in :mozilla:config:mac:NGLayoutConfigInclude.h +# An alias "MacConfigInclude.h" to this file is created inside dist:config +# Note that the name of alias is different than the name of the file. This +# is to trick CW into including NGLayout defines + + +#//-------------------------------------------------------------------------------------------------- +#// Utility routines +#//-------------------------------------------------------------------------------------------------- + + +# assert that we are in the correct directory for the build +sub assertRightDirectory() +{ + unless (-e ":mozilla") + { + my($dir) = cwd(); + print STDERR "NGLayoutBuildList called from incorrect directory: $dir"; + } +} + +#//-------------------------------------------------------------------------------------------------- +#// InstallManifestRDF +#//-------------------------------------------------------------------------------------------------- + +sub InstallManifestRDF($$$$) +{ + my($src, $manifest_subdir, $type, $building_jars) = @_; + + my($dist_dir) = getDistDirectory(); + my $chrome_subdir = "Chrome:"; + my $chrome_dir = "$dist_dir" . $chrome_subdir; + + my($manifest_path) = $chrome_dir.$manifest_subdir; + + print "Installing manifest.rdf file in ".$manifest_path."\n"; + + MakeAlias($src, "$manifest_path"); + + open(CHROMEFILE, ">>${chrome_dir}installed-chrome.txt"); + + $manifest_subdir =~ tr(:)(/); + + if ($building_jars) + { + # remove trailing / from subdir + $manifest_subdir =~ s/\/$//; + print(CHROMEFILE "${type},install,url,jar:resource:/Chrome/${manifest_subdir}.jar!/\n"); + } + else + { + print(CHROMEFILE "${type},install,url,resource:/Chrome/${manifest_subdir}\n"); + } + + close(CHROMEFILE); +} + + +#//-------------------------------------------------------------------------------------------------- +#// InstallManifestRDFFiles Install manifest.rdf files and build installed_chrome.txt +#//-------------------------------------------------------------------------------------------------- + +sub InstallManifestRDFFiles() +{ + unless( $main::build{resources} ) { return; } + + my($dist_dir) = getDistDirectory(); + + my $chrome_subdir = "Chrome:"; + my $chrome_dir = "$dist_dir" . $chrome_subdir; + + my($building_jars) = $main::options{jars}; + + # nuke installed-chrome.txt + unlink ${chrome_dir}."installed-chrome.txt"; + + # install manifest RDF files + InstallManifestRDF(":mozilla:extensions:irc:xul:manifest.rdf", "packages:chatzilla:", "content", $building_jars); + InstallManifestRDF(":mozilla:extensions:irc:xul:manifest.rdf", "packages:chatzilla:", "locale", $building_jars); + InstallManifestRDF(":mozilla:extensions:irc:xul:manifest.rdf", "packages:chatzilla:", "skin", $building_jars); + + InstallManifestRDF(":mozilla:extensions:cview:resources:manifest.rdf", "packages:cview:", "content", $building_jars); + InstallManifestRDF(":mozilla:extensions:cview:resources:manifest.rdf", "packages:cview:", "locale", $building_jars); + InstallManifestRDF(":mozilla:extensions:cview:resources:manifest.rdf", "packages:cview:", "skin", $building_jars); + + if ($main::options{transformiix}) + { + my($transformiix_manifest) = ":mozilla:extensions:transformiix:source:examples:mozilla:transformiix:manifest.rdf"; + InstallManifestRDF($transformiix_manifest, "packages:transformiix:", "content", $building_jars); + InstallManifestRDF($transformiix_manifest, "packages:transformiix:", "locale", $building_jars); + InstallManifestRDF($transformiix_manifest, "packages:transformiix:", "skin", $building_jars); + } + + InstallManifestRDF(":mozilla:themes:classic:manifest.rdf", "skins:classic:", "skin", $building_jars); + InstallManifestRDF(":mozilla:themes:blue:manifest.rdf", "skins:blue:", "skin", $building_jars); + InstallManifestRDF(":mozilla:themes:modern:manifest.rdf", "skins:modern:", "skin", $building_jars); + + InstallManifestRDF(":mozilla:xpfe:communicator:resources:content:manifest.rdf", "packages:core:", "content", $building_jars); + InstallManifestRDF(":mozilla:xpfe:global:resources:content:manifest.rdf", "packages:widget-toolkit:", "content", $building_jars); + InstallManifestRDF(":mozilla:mailnews:base:resources:content:manifest.rdf", "packages:messenger:", "content", $building_jars); + + InstallManifestRDF(":mozilla:xpfe:communicator:resources:locale:en-US:manifest.rdf", "locales:en-US:", "locale", $building_jars); + + InstallManifestRDF(":mozilla:l10n:langpacks:en-DE:chrome:en-DE:manifest.rdf", "locales:en-DE:", "locale", $building_jars); + +} + + +#//-------------------------------------------------------------------------------------------------- +#// Configure Build System +#//-------------------------------------------------------------------------------------------------- + +my($UNIVERSAL_INTERFACES_VERSION) = 0x0320; + + +sub _genBuildSystemInfo() +{ + # always rebuild the configuration program. + BuildProjectClean(":mozilla:build:mac:tools:BuildSystemInfo:BuildSystemInfo.mcp", "BuildSystemInfo"); + + # delete the configuration file. + unlink(":mozilla:build:mac:BuildSystemInfo.pm"); + + # run the program. + system(":mozilla:build:mac:BuildSystemInfo"); + + # wait for the file to be created. + while (!(-e ":mozilla:build:mac:BuildSystemInfo.pm")) { WaitNextEvent(); } + + # wait for BuildSystemInfo to finish, so that we see correct results. + while (IsProcessRunning("BuildSystemInfo")) { WaitNextEvent(); } + + # now, evaluate the contents of the file. + open(F, ":mozilla:build:mac:BuildSystemInfo.pm"); + while () { eval; } + close(F); +} + +#//-------------------------------------------------------------------------------------------------- +#// ConfigureBuildSystem +#// +#// defines some build-system configuration variables. +#//-------------------------------------------------------------------------------------------------- +sub ConfigureBuildSystem() +{ + #// In the future, we may want to do configurations based on the actual build system itself. + #// _genBuildSystemInfo(); + + #// For now, if we discover a newer header file than existed in Universal Interfaces 3.2, + #// we'll assume that 3.3 or later is in use. + my($universal_interfaces) = getCodeWarriorPath("MacOS Support:Universal:Interfaces:CIncludes:"); + if (-e ($universal_interfaces . "ControlDefinitions.h")) { + $UNIVERSAL_INTERFACES_VERSION = 0x0330; + } + + #// Rename IC SDK folder in the Mac OS Support folder + my($ic_sdk_folder) = getCodeWarriorPath("MacOS Support:ICProgKit2.0.2"); + if( -e $ic_sdk_folder) + { + my($new_ic_folder_name) = getCodeWarriorPath("MacOS Support:(ICProgKit2.0.2)"); + rename ($ic_sdk_folder, $new_ic_folder_name); + # note that CodeWarrior doesn't descnet into folders with () the name + print "Mozilla no longer needs the Internet Config SDK to build:\n Renaming the 'ICProgKit2.0.2' folder to '(ICProgKit2.0.2)'\n"; + } + + printf("UNIVERSAL_INTERFACES_VERSION = 0x%04X\n", $UNIVERSAL_INTERFACES_VERSION); + + my($line, $config, $oldconfig, $define, $definevalue, $defines); + my($k, $l,); + + foreach $k (keys(%main::options)) + { + if ($main::options{$k}) + { + foreach $l (keys(%{$main::optiondefines{$k}})) + { + $my::defines{$l} = $main::optiondefines{$k}{$l}; + } + } + } + + my $config_headerfile = current_directory() . ":mozilla:config:mac:DefinesOptions.h"; + if (-e $config_headerfile) + { + open(CONFIG_HEADER, "< $config_headerfile") || die "Can't open configuration header, check the file path.\n"; + while ($line = ) + { + $oldconfig .= $line; + if ($line =~ m/#define (.*) (.*)\n/) + { + $define = $1; + $definevalue = $2; + if (exists ($my::defines{$define}) and ($my::defines{$define} == $definevalue)) + { + delete $my::defines{$define}; + $config .= $line; + } + } + } + close(CONFIG_HEADER); + } + + if (%my::defines) + { + foreach $k (keys(%my::defines)) + { + $config .= "#define " . $k . " " . $my::defines{$k} . "\n"; + } + } + + if (($config ne $oldconfig) || (!-e $config_headerfile)) + { + printf("Writing new DefinesOptions.h\n"); + open(CONFIG_HEADER, "> $config_headerfile") || die "Can't open configuration header, check the file path.\n"; + MacPerl::SetFileInfo("CWIE", "TEXT", $config_headerfile); + print CONFIG_HEADER ($config); + close(CONFIG_HEADER); + } +} + + +#----------------------------------------------- +# SetupBuildLog +#----------------------------------------------- +sub SetupBuildLog($) +{ + my($timestamped_log) = @_; + + if ($timestamped_log) + { + #Use time-stamped names so that you don't clobber your previous log file! + my $now = localtime(); + while ($now =~ s@:@.@) {} # replace all colons by periods + my $logdir = ":Build Logs:"; + if (!stat($logdir)) + { + print "Creating directory $logdir\n"; + mkdir $logdir, 0777 || die "Couldn't create directory $logdir"; + } + OpenErrorLog("$logdir$now"); + } + else + { + OpenErrorLog("NGLayoutBuildLog"); # Release build + #OpenErrorLog("Mozilla.BuildLog"); # Tinderbox requires that name + } +} + +#//-------------------------------------------------------------------------------------------------- +#// Check out everything +#//-------------------------------------------------------------------------------------------------- +sub Checkout() +{ + unless ( $main::pull{all} || $main::pull{moz} || $main::pull{runtime} ) { return;} + + # give application activation a chance to happen + WaitNextEvent(); + WaitNextEvent(); + WaitNextEvent(); + + assertRightDirectory(); + my($cvsfile) = AskAndPersistFile("::nglayout.cvsloc"); + my($session) = MacCVS->new( $cvsfile ); + unless (defined($session)) { die "Checkout aborted. Cannot create session file: $session" } + + # activate MacCVS + ActivateApplication('Mcvs'); + + my($nsprpub_tag) = "NSPRPUB_CLIENT_BRANCH"; + my($nss_tab) = "NSS_30_BRANCH"; + my($psm_tag) = "SECURITY_MAC_BRANCH"; + my($secbase_tag) = "SECURITY_CLIENT_BRANCH"; + my($ldapsdk_tag) = "LDAPCSDK_40_BRANCH"; + + #// + #// Checkout commands + #// + if ($main::pull{moz}) + { + $session->checkout("mozilla/nsprpub", $nsprpub_tag) || print "checkout of nsprpub failed\n"; + $session->checkout("mozilla/security/nss", $nss_tab) || print "checkout of security/nss failed\n"; + $session->checkout("mozilla/security/psm", $psm_tag) || print "checkout of security/psm failed\n"; + $session->checkout("mozilla/security/base", $secbase_tag) || print "checkout of security/base failed\n"; + $session->checkout("DirectorySDKSourceC", $ldapsdk_tag) || print "checkout of LDAP C SDK failed\n"; + $session->checkout("SeaMonkeyAll") || + print "MacCVS reported some errors checking out SeaMonkeyAll, but these are probably not serious.\n"; + } + elsif ($main::pull{runtime}) + { + $session->checkout("mozilla/build/mac") || print "checkout failure\n"; + $session->checkout("mozilla/lib/mac/InterfaceLib") || print "checkout failure\n"; + $session->checkout("mozilla/config/mac") || print "checkout failure\n"; + $session->checkout("mozilla/gc") || print "checkout failure\n"; + $session->checkout("mozilla/lib/mac/NSStartup") || print "checkout failure\n"; + $session->checkout("mozilla/lib/mac/NSStdLib") || print "checkout failure\n"; + $session->checkout("mozilla/lib/mac/NSRuntime") || print "checkout failure\n"; + $session->checkout("mozilla/lib/mac/MoreFiles") || print "checkout failure\n"; + $session->checkout("mozilla/lib/mac/MacMemoryAllocator") || print "checkout failure\n"; + $session->checkout("mozilla/nsprpub", $nsprpub_tag) || print "checkout failure\n"; + } +} + + +#//-------------------------------------------------------------------------------------------------- +#// Make resource aliases for one directory +#//-------------------------------------------------------------------------------------------------- + +sub BuildFolderResourceAliases($$) +{ + my($src_dir, $dest_dir) = @_; + + unless ($src_dir =~ m/^$main::BUILD_ROOT.+/) { return; } + + # get a list of all the resource files + opendir(SRCDIR, $src_dir) || die("can't open $src_dir"); + my(@resource_files) = readdir(SRCDIR); + closedir(SRCDIR); + + # make aliases for each one into the dest directory + print("Placing aliases to all files from $src_dir in $dest_dir\n"); + for ( @resource_files ) + { + next if $_ eq "CVS"; + #print(" Doing $_\n"); + if (-l $src_dir.$_) + { + print(" $_ is an alias\n"); + next; + } + my($file_name) = $src_dir . $_; + MakeAlias($file_name, $dest_dir); + } +} + + +#//-------------------------------------------------------------------------------------------------- +#// Recurse into the skin directories +#//-------------------------------------------------------------------------------------------------- + +sub ScanForManifestFiles($$$$) +{ + my($dir, $theme_root, $theme_name, $dist_dir) = @_; + + opendir(DIR, $dir) or die "Cannot open dir $dir\n"; + my @files = readdir(DIR); + closedir DIR; + + my $file; + + foreach $file (@files) + { + my $filepath = $dir.":".$file; + + if (-d $filepath) + { + # print "Looking for MANIFEST files in $filepath\n"; + ScanForManifestFiles($filepath, $theme_root, $theme_name, $dist_dir); + } + elsif ($file eq "MANIFEST") + { + # print "Doing manifest file $filepath\n"; + + # Get the dest path from the first line of the file + + open(MANIFEST, $filepath) || die "Could not open file $file"; + # Read in the path if available + my($dest_line) = ; + chomp $dest_line; + close MANIFEST; + + $dest_line =~ s|^#!dest[\t ]+|| || die "No destination line found in $filepath\n"; + + my($dest_path) = $dist_dir."chrome:skins:$theme_name:$dest_line"; + # print " Destination is $dest_path\n"; + + InstallResources($filepath, "$dest_path", 0); + } + } +} + +#//-------------------------------------------------------------------------------------------------- +#// Install skin files +#//-------------------------------------------------------------------------------------------------- + +sub InstallSkinFiles($) +{ + my($theme_name) = @_; + + unless( $main::build{resources} ) { return; } + assertRightDirectory(); + + my($dist_dir) = GetDistDirectory(); + my($themes_dir) = ":mozilla:themes:".$theme_name; + + print "Installing skin files from $themes_dir\n"; + ScanForManifestFiles($themes_dir, $themes_dir, $theme_name, $dist_dir); +} + +#//-------------------------------------------------------------------------------------------------- +#// Select a default skin +#//-------------------------------------------------------------------------------------------------- + +sub SetDefaultSkin($) +{ + my($skin) = @_; + + assertRightDirectory(); + + my($dist_dir) = GetDistDirectory(); + my($chrome_subdir) = $dist_dir."Chrome"; + + open(CHROMEFILE, ">>${chrome_subdir}:installed-chrome.txt") || die "Failed to open installed_chrome.txt\n"; + print(CHROMEFILE "skin,install,select,$skin\n"); + close(CHROMEFILE); +} + +#//-------------------------------------------------------------------------------------------------- +#// Recurse into the provider directories +#//-------------------------------------------------------------------------------------------------- + +sub ProScanForManifestFiles($$$$$) +{ + ## diff from ScanForManifestFiles() + my($dir, $theme_root, $provider, $theme_name, $dist_dir) = @_; + + opendir(DIR, $dir) or die "Cannot open dir $dir\n"; + my @files = readdir(DIR); + closedir DIR; + + my $file; + + foreach $file (@files) + { + my $filepath = $dir.":".$file; + + if (-d $filepath) + { + # print "Looking for MANIFEST files in $filepath\n"; + ## diff from ScanForManifestFiles() + ProScanForManifestFiles($filepath, $theme_root, $provider, $theme_name, $dist_dir); + } + elsif ($file eq "MANIFEST") + { + # print "Doing manifest file $filepath\n"; + + # Get the dest path from the first line of the file + + open(MANIFEST, $filepath) || die "Could not open file $file"; + # Read in the path if available + my($dest_line) = ; + chomp $dest_line; + close MANIFEST; + + $dest_line =~ s|^#!dest[\t ]+|| || die "No destination line found in $filepath\n"; + + ## diff from ScanForManifestFiles() + my($dest_path) = $dist_dir."chrome:$provider:$theme_name:$dest_line"; + # print " Destination is $dest_path\n"; + + InstallResources($filepath, "$dest_path", 0); + } + } +} + +#//-------------------------------------------------------------------------------------------------- +#// Install Provider files +#//-------------------------------------------------------------------------------------------------- + +sub InstallProviderFiles($$) +{ + ## diff from InstallSkinFiles() - new arg: provider + my($provider, $theme_name) = @_; + + # unless( $main::build{resources} ) { return; } + assertRightDirectory(); + + my($dist_dir) = GetDistDirectory(); + + ## diff from InstallSkinFiles() + my($themes_dir) = ":mozilla:l10n:langpacks:".$theme_name.":chrome:".$theme_name; + + print "Installing $provider files from $themes_dir\n"; + + ## diff from InstallSkinFiles() + ProScanForManifestFiles($themes_dir, $themes_dir, $provider, $theme_name, $dist_dir); +} + +### defaults +#//-------------------------------------------------------------------------------------------------- +#// Recurse into the defaults directories +#//-------------------------------------------------------------------------------------------------- + +sub DefScanForManifestFiles($$$$) +{ + my($dir, $theme_root, $theme_name, $dist_dir) = @_; + + opendir(DIR, $dir) or die "Cannot open dir $dir\n"; + my @files = readdir(DIR); + closedir DIR; + + my $file; + + foreach $file (@files) + { + my $filepath = $dir.":".$file; + + if (-d $filepath) + { + # print "Looking for MANIFEST files in $filepath\n"; + ## diff from ScanForManifestFiles() + DefScanForManifestFiles($filepath, $theme_root, $theme_name, $dist_dir); + } + elsif ($file eq "MANIFEST") + { + # print "Doing manifest file $filepath\n"; + + # Get the dest path from the first line of the file + + open(MANIFEST, $filepath) || die "Could not open file $file"; + # Read in the path if available + my($dest_line) = ; + chomp $dest_line; + close MANIFEST; + + $dest_line =~ s|^#!dest[\t ]+|| || die "No destination line found in $filepath\n"; + + ## diff from ScanForManifestFiles() + my($dest_path) = $dist_dir."defaults:$dest_line:$theme_name"; + # print " Destination is $dest_path\n"; + + InstallResources($filepath, "$dest_path", 0); + } + } +} + +#//-------------------------------------------------------------------------------------------------- +#// InstallLangPackFiles +#//-------------------------------------------------------------------------------------------------- + +sub InstallLangPackFiles($) +{ + my($theme_name) = @_; + + # unless( $main::build{resources} ) { return; } + assertRightDirectory(); + + my($dist_dir) = GetDistDirectory(); + + ## diff from InstallSkinFiles() + my($themes_dir) = ":mozilla:l10n:langpacks:".$theme_name.":defaults"; + + print "Installing default files from $themes_dir\n"; + + ## diff from InstallSkinFiles() + DefScanForManifestFiles($themes_dir, $themes_dir, $theme_name, $dist_dir); +} + +#//-------------------------------------------------------------------------------------------------- +#// InstallDefaultsFiles +#//-------------------------------------------------------------------------------------------------- + +sub InstallDefaultsFiles() +{ + unless( $main::build{resources} ) { return; } + assertRightDirectory(); + + # $D becomes a suffix to target names for selecting either the debug or non-debug target of a project + my($D) = $main::DEBUG ? "Debug" : ""; + my($dist_dir) = GetDistDirectory(); + + print("--- Starting Defaults copying ----\n"); + + # default folder + my($defaults_dir) = "$dist_dir" . "Defaults:"; + mkdir($defaults_dir, 0); + + { + my($default_wallet_dir) = "$defaults_dir"."wallet:"; + mkdir($default_wallet_dir, 0); + InstallResources(":mozilla:extensions:wallet:src:MANIFEST", "$default_wallet_dir"); + } + + # Default _profile_ directory stuff + { + my($default_profile_dir) = "$defaults_dir"."Profile:"; + mkdir($default_profile_dir, 0); + + copy(":mozilla:profile:defaults:bookmarks.html","$default_profile_dir"."bookmarks.html"); + copy(":mozilla:profile:defaults:panels.rdf","$default_profile_dir"."panels.rdf"); + copy(":mozilla:profile:defaults:localstore.rdf","$default_profile_dir"."localstore.rdf"); + copy(":mozilla:profile:defaults:search.rdf","$default_profile_dir"."search.rdf"); + copy(":mozilla:profile:defaults:mimeTypes.rdf","$default_profile_dir"."mimeTypes.rdf"); + + # make a dup in en-US + my($default_profile_dir_en_US) = "$default_profile_dir"."en-US:"; + mkdir($default_profile_dir_en_US, 0); + + copy(":mozilla:profile:defaults:bookmarks.html","$default_profile_dir_en_US"."bookmarks.html"); + copy(":mozilla:profile:defaults:panels.rdf","$default_profile_dir_en_US"."panels.rdf"); + copy(":mozilla:profile:defaults:localstore.rdf","$default_profile_dir_en_US"."localstore.rdf"); + copy(":mozilla:profile:defaults:search.rdf","$default_profile_dir_en_US"."search.rdf"); + copy(":mozilla:profile:defaults:mimeTypes.rdf","$default_profile_dir_en_US"."mimeTypes.rdf"); + } + + # Default _pref_ directory stuff + { + my($default_pref_dir) = "$defaults_dir"."Pref:"; + mkdir($default_pref_dir, 0); + InstallResources(":mozilla:xpinstall:public:MANIFEST_PREFS", "$default_pref_dir", 0); + InstallResources(":mozilla:modules:libpref:src:MANIFEST_PREFS", "$default_pref_dir", 0); + InstallResources(":mozilla:modules:libpref:src:init:MANIFEST", "$default_pref_dir", 0); + InstallResources(":mozilla:modules:libpref:src:mac:MANIFEST", "$default_pref_dir", 0); + } + + print("--- Defaults copying complete ----\n"); +} + +#//-------------------------------------------------------------------------------------------------- +#// InstallNonChromeResources +#//-------------------------------------------------------------------------------------------------- + +sub InstallNonChromeResources() +{ + unless( $main::build{resources} ) { return; } + assertRightDirectory(); + + # $D becomes a suffix to target names for selecting either the debug or non-debug target of a project + my($D) = $main::DEBUG ? "Debug" : ""; + my($dist_dir) = GetDistDirectory(); + + print("--- Starting Resource copying ----\n"); + + #// + #// Most resources should all go into the chrome dir eventually + #// + my($resource_dir) = "$dist_dir" . "res:"; + my($samples_dir) = "$resource_dir" . "samples:"; + + #// + #// Make aliases of resource files + #// + if (! $main::options{mathml}) + { + MakeAlias(":mozilla:layout:html:document:src:ua.css", "$resource_dir"); + } + else + { + #// Building MathML so include the mathml.css file in ua.css + MakeAlias(":mozilla:layout:mathml:content:src:mathml.css", "$resource_dir"); + copy(":mozilla:layout:html:document:src:ua.css", "$resource_dir"."ua.css"); + @ARGV = ("$resource_dir"."ua.css"); + do ":mozilla:layout:mathml:content:src:mathml-css.pl"; + } + + MakeAlias(":mozilla:layout:html:document:src:html.css", "$resource_dir"); + MakeAlias(":mozilla:layout:html:document:src:quirk.css", "$resource_dir"); + MakeAlias(":mozilla:layout:html:document:src:arrow.gif", "$resource_dir"); + MakeAlias(":mozilla:webshell:tests:viewer:resources:viewer.properties", "$resource_dir"); + MakeAlias(":mozilla:intl:uconv:src:charsetalias.properties", "$resource_dir"); + MakeAlias(":mozilla:intl:uconv:src:acceptlanguage.properties", "$resource_dir"); + MakeAlias(":mozilla:intl:uconv:src:maccharset.properties", "$resource_dir"); + MakeAlias(":mozilla:intl:uconv:src:charsetData.properties", "$resource_dir"); + MakeAlias(":mozilla:intl:uconv:src:acceptlanguage.properties", "$resource_dir"); + MakeAlias(":mozilla:intl:locale:src:langGroups.properties", "$resource_dir"); + MakeAlias(":mozilla:intl:locale:src:language.properties", "$resource_dir"); + + InstallResources(":mozilla:gfx:src:MANIFEST", "$resource_dir"."gfx:"); + + my($entitytab_dir) = "$resource_dir" . "entityTables"; + InstallResources(":mozilla:intl:unicharutil:tables:MANIFEST", "$entitytab_dir"); + + my($html_dir) = "$resource_dir" . "html:"; + InstallResources(":mozilla:layout:html:base:src:MANIFEST_RES", "$html_dir"); + + my($throbber_dir) = "$resource_dir" . "throbber:"; + BuildFolderResourceAliases(":mozilla:webshell:tests:viewer:throbber:", "$throbber_dir"); + + BuildFolderResourceAliases(":mozilla:webshell:tests:viewer:samples:", "$samples_dir"); + BuildFolderResourceAliases(":mozilla:webshell:tests:viewer:resources:", "$samples_dir"); + BuildFolderResourceAliases(":mozilla:xpfe:browser:samples:", "$samples_dir"); + + InstallResources(":mozilla:xpfe:browser:src:MANIFEST", "$samples_dir"); + MakeAlias(":mozilla:xpfe:browser:samples:sampleimages:", "$samples_dir"); + + my($rdf_dir) = "$resource_dir" . "rdf:"; + BuildFolderResourceAliases(":mozilla:rdf:resources:", "$rdf_dir"); + + my($domds_dir) = "$samples_dir" . "rdf:"; + InstallResources(":mozilla:rdf:tests:domds:resources:MANIFEST", "$domds_dir"); + + # QA Menu + InstallResources(":mozilla:intl:strres:tests:MANIFEST", "$resource_dir"); + + print("--- End Resource copying ----\n"); +} + + +#//-------------------------------------------------------------------------------------------------- +#// InstallComponentFiles +#//-------------------------------------------------------------------------------------------------- + +sub InstallComponentFiles() +{ + unless( $main::build{resources} ) { return; } + assertRightDirectory(); + + # $D becomes a suffix to target names for selecting either the debug or non-debug target of a project + my($D) = $main::DEBUG ? "Debug" : ""; + my($dist_dir) = GetDistDirectory(); + + print("--- Starting Text Components copying ----\n"); + + my($components_dir) = "$dist_dir" . "Components:"; + + # console + InstallResources(":mozilla:xpfe:components:console:MANIFEST", "$components_dir", 0); + + # sidebar + InstallResources(":mozilla:xpfe:components:sidebar:src:MANIFEST", "$components_dir"); + + print("--- Done Text Components copying ----\n"); +} + + +#//-------------------------------------------------------------------------------------------------- +#// InstallChromeFiles +#//-------------------------------------------------------------------------------------------------- + +sub InstallChromeFiles() +{ + unless( $main::build{resources} ) { return; } + assertRightDirectory(); + + # $D becomes a suffix to target names for selecting either the debug or non-debug target of a project + my($D) = $main::DEBUG ? "Debug" : ""; + my($dist_dir) = GetDistDirectory(); + + print("--- Starting Chrome copying ----\n"); + + #// + #// Most resources should all go into the chrome dir eventually + #// + my $chrome_subdir = "Chrome:"; + my $chrome_dir = "$dist_dir" . $chrome_subdir; + + my($packages_chrome_dir) = "$chrome_dir" . "packages:"; + my($locales_chrome_dir) = "$chrome_dir" . "locales:"; + + # Second level chrome directories + + my($core_packages_chrome_dir) = "$packages_chrome_dir" . "core:"; + my($messenger_packages_chrome_dir) = "$packages_chrome_dir" . "messenger:"; + my($widgettoolkit_packages_chrome_dir) = "$packages_chrome_dir" . "widget-toolkit:"; + + my($enUS_locales_chrome_dir) = "$locales_chrome_dir" . "en-US:"; + + # Third level chrome directories + + # navigator + my($navigator_core_packages_chrome_dir) = "$core_packages_chrome_dir" . "navigator:"; + my($navigatorContent) = "$navigator_core_packages_chrome_dir" . "content:"; + + my($navigator_enUS_locales_chrome_dir) = "$enUS_locales_chrome_dir" . "navigator:"; + my($navigatorLocale) = "$navigator_enUS_locales_chrome_dir" . "locale:"; + + # global + my($global_widgettoolkit_packages_chrome_dir) = "$widgettoolkit_packages_chrome_dir" . "global:"; + my($globalContent) = "$global_widgettoolkit_packages_chrome_dir" . "content:"; + + my($global_enUS_locales_chrome_dir) = "$enUS_locales_chrome_dir" . "global:"; + my($globalLocale) = "$global_enUS_locales_chrome_dir" . "locale:"; + + # communicator + my($communicator_core_packages_chrome_dir) = "$core_packages_chrome_dir" . "communicator:"; + my($communicatorContent) = "$communicator_core_packages_chrome_dir" . "content:"; + + my($communicator_enUS_locales_chrome_dir) = "$enUS_locales_chrome_dir" . "communicator:"; + my($communicatorLocale) = "$communicator_enUS_locales_chrome_dir" . "locale:"; + + # copy the chrome registry (don't alias it) + copy( ":mozilla:rdf:chrome:build:registry.rdf", "$chrome_dir" . "registry.rdf" ); + + MakeAlias(":mozilla:xpcom:base:xpcom.properties", "$globalLocale"); + + MakeAlias(":mozilla:intl:uconv:src:charsetTitles.properties","$globalLocale"); + + InstallResources(":mozilla:xpfe:browser:resources:content:MANIFEST", "$navigatorContent"); + InstallResources(":mozilla:xpfe:browser:resources:content:mac:MANIFEST", "$navigatorContent"); + InstallResources(":mozilla:xpfe:browser:resources:locale:en-US:MANIFEST", "$navigatorLocale", 0); + + # find + InstallResources(":mozilla:xpfe:components:find:resources:MANIFEST", "$globalContent"); + InstallResources(":mozilla:xpfe:components:find:resources:locale:en-US:MANIFEST", "$globalLocale"); + + # ucth + InstallResources(":mozilla:xpfe:components:ucth:resources:MANIFEST", "$globalContent"); + InstallResources(":mozilla:xpfe:components:ucth:resources:locale:en-US:MANIFEST", "$globalLocale"); + InstallResources(":mozilla:xpfe:components:xfer:resources:MANIFEST", "$globalContent"); + InstallResources(":mozilla:xpfe:components:xfer:resources:locale:en-US:MANIFEST", "$globalLocale"); + + #file picker + InstallResources(":mozilla:xpfe:components:filepicker:res:locale:en-US:MANIFEST", "$globalLocale"); + + # console + InstallResources(":mozilla:xpfe:components:console:resources:content:MANIFEST", "$globalContent", 0); + InstallResources(":mozilla:xpfe:components:console:resources:locale:en-US:MANIFEST", "$globalLocale", 0); + + # autocomplete + InstallResources(":mozilla:xpfe:components:autocomplete:resources:content:MANIFEST", "$globalContent", 0); + + # security + InstallResources(":mozilla:security:base:res:content:MANIFEST", "$communicatorContent"); + InstallResources(":mozilla:security:base:res:locale:en-us:MANIFEST", "$communicatorLocale"); + + # widget-toolkit + InstallResources(":mozilla:xpfe:global:resources:content:MANIFEST", "$globalContent"); + InstallResources(":mozilla:xpfe:global:resources:content:mac:MANIFEST", "$globalContent"); + InstallResources(":mozilla:xpfe:global:resources:locale:en-US:MANIFEST", "$globalLocale", 0); + InstallResources(":mozilla:xpfe:global:resources:locale:en-US:mac:MANIFEST", "$globalLocale", 0); + + # communicator + InstallResources(":mozilla:xpfe:communicator:resources:content:MANIFEST", "$communicatorContent"); + InstallResources(":mozilla:xpfe:communicator:resources:content:mac:MANIFEST", "$communicatorContent"); + InstallResources(":mozilla:xpfe:communicator:resources:locale:en-US:MANIFEST", "$communicatorLocale", 0); + + InstallResources(":mozilla:docshell:base:MANIFEST", "$globalLocale", 0); + + # xpinstall + { + my($xpinstallContent) = "$communicatorContent" . "xpinstall:"; + my($xpinstallLocale) = "$communicatorLocale" . "xpinstall:"; + + InstallResources(":mozilla:xpinstall:res:content:MANIFEST","$xpinstallContent", 0); + #XXX these InstallResources calls should be down below with the rest of the calls + InstallResources(":mozilla:xpinstall:res:locale:en-US:MANIFEST","$xpinstallLocale", 0); + InstallResources(":mozilla:xpinstall:res:content:MANIFEST","$xpinstallContent", 0); + } + + # profile + { + my($profileContent) = "$communicatorContent" . "profile:"; + my($profileLocale) = "$communicatorLocale" . "profile:"; + + #XXX these InstallResourses calls should be down below with the rest of the calls + InstallResources(":mozilla:profile:resources:content:MANIFEST", "$profileContent", 0); + InstallResources(":mozilla:profile:resources:locale:en-US:MANIFEST", "$profileLocale", 0); + InstallResources(":mozilla:profile:pref-migrator:resources:content:MANIFEST", "$profileContent", 0); + InstallResources(":mozilla:profile:pref-migrator:resources:locale:en-US:MANIFEST", "$profileLocale", 0); + } + + + #NECKO + { + my($necko_chrome_dir) = "$chrome_dir" . "necko:"; + my($necko_content_chrome_dir) = "$necko_chrome_dir" . "content:"; + my($necko_locale_chrome_dir) = "$necko_chrome_dir" . "locale:"; + InstallResources(":mozilla:netwerk:resources:content:MANIFEST", "$necko_content_chrome_dir"); + InstallResources(":mozilla:netwerk:resources:locale:en-US:MANIFEST", "$necko_locale_chrome_dir", 0); + } + + # layout locale hack + { + my($layout_locale_hack_dir) = "$communicatorLocale"."layout:"; + mkdir($layout_locale_hack_dir, 0); + InstallResources(":mozilla:layout:html:forms:src:MANIFEST_PROPERTIES", "$layout_locale_hack_dir", 0); + } + + # editor + { + my($editor_core_packages_chrome_dir) = "$core_packages_chrome_dir" . "editor:"; + my($editorContent) = "$editor_core_packages_chrome_dir" . "content:"; + + my($editor_enUS_locales_chrome_dir) = "$enUS_locales_chrome_dir" . "editor:"; + my($editorLocale) = "$editor_enUS_locales_chrome_dir" . "locale:"; + + InstallResources(":mozilla:editor:ui:composer:content:MANIFEST", "$editorContent", 0); + InstallResources(":mozilla:editor:ui:composer:locale:en-US:MANIFEST", "$editorLocale", 0); + InstallResources(":mozilla:editor:ui:dialogs:content:MANIFEST", "$editorContent", 0); + InstallResources(":mozilla:editor:ui:dialogs:locale:en-US:MANIFEST", "$editorLocale", 0); + } + + # mailnews + { + # Messenger is a top level component + my($messenger_chrome_dir) = "$chrome_dir" . "messenger:"; + + my($messenger_packages_chrome_dir) = "$packages_chrome_dir" . "messenger:"; + my($messenger_messenger_packages_chrome_dir) = "$messenger_packages_chrome_dir" . "messenger:"; + my($messengerContent) = "$messenger_messenger_packages_chrome_dir" . "content:"; + + my($messenger_enUS_locales_chrome_dir) = "$enUS_locales_chrome_dir" . "messenger:"; + my($messengerLocale) = "$messenger_enUS_locales_chrome_dir" . "locale:"; + + InstallResources(":mozilla:mailnews:base:resources:content:MANIFEST", "$messengerContent", 0); + InstallResources(":mozilla:mailnews:base:resources:content:mac:MANIFEST", "$messengerContent", 0); + InstallResources(":mozilla:mailnews:base:resources:locale:en-US:MANIFEST", "$messengerLocale", 0); + InstallResources(":mozilla:mailnews:base:prefs:resources:content:MANIFEST", "$messengerContent", 0); + InstallResources(":mozilla:mailnews:base:prefs:resources:locale:en-US:MANIFEST", "$messengerLocale", 0); + InstallResources(":mozilla:mailnews:base:search:resources:content:MANIFEST", "$messengerContent", 0); + InstallResources(":mozilla:mailnews:base:search:resources:locale:en-US:MANIFEST", "$messengerLocale", 0); + InstallResources(":mozilla:mailnews:mime:resources:content:MANIFEST", "$messengerContent", 0); + InstallResources(":mozilla:mailnews:mime:emitters:resources:content:MANIFEST", "$messengerContent", 0); + InstallResources(":mozilla:mailnews:local:resources:locale:en-US:MANIFEST", "$messengerLocale", 0); + InstallResources(":mozilla:mailnews:news:resources:content:MANIFEST", "$messengerContent", 0); + InstallResources(":mozilla:mailnews:news:resources:locale:en-US:MANIFEST", "$messengerLocale", 0); + + InstallResources(":mozilla:mailnews:imap:resources:locale:en-US:MANIFEST", "$messengerLocale", 0); + + InstallResources(":mozilla:mailnews:mime:resources:MANIFEST", "$messengerLocale", 0); + InstallResources(":mozilla:mailnews:mime:cthandlers:resources:MANIFEST", "$messengerLocale", 0); + + # messenger compose resides within messenger + my($messengercomposeContent) = "$messengerContent" . "messengercompose:"; + my($messengercomposeLocale) = "$messengerLocale" . "messengercompose:"; + InstallResources(":mozilla:mailnews:compose:resources:content:MANIFEST", "$messengercomposeContent", 0); + InstallResources(":mozilla:mailnews:compose:resources:locale:en-US:MANIFEST", "$messengercomposeLocale", 0); + InstallResources(":mozilla:mailnews:compose:prefs:resources:content:MANIFEST", "$messengercomposeContent", 0); + InstallResources(":mozilla:mailnews:compose:prefs:resources:locale:en-US:MANIFEST", "$messengercomposeLocale", 0); + + # addressbook resides within messenger + my($addressbookContent) = "$messengerContent" . "addressbook:"; + my($addressbookLocale) = "$messengerLocale" . "addressbook:"; + InstallResources(":mozilla:mailnews:addrbook:resources:content:MANIFEST", "$addressbookContent", 0); + InstallResources(":mozilla:mailnews:addrbook:resources:locale:en-US:MANIFEST", "$addressbookLocale", 0); + InstallResources(":mozilla:mailnews:addrbook:prefs:resources:content:MANIFEST", "$addressbookContent", 0); + InstallResources(":mozilla:mailnews:addrbook:prefs:resources:locale:en-US:MANIFEST", "$addressbookLocale", 0); + InstallResources(":mozilla:mailnews:absync:resources:locale:en-US:MANIFEST","$addressbookLocale", 0); + + # import + InstallResources(":mozilla:mailnews:import:resources:content:MANIFEST", "$messengerContent", 0); + InstallResources(":mozilla:mailnews:import:resources:locale:en-US:MANIFEST", "$messengerLocale", 0); + InstallResources(":mozilla:mailnews:import:eudora:resources:locale:en-US:MANIFEST", "$messengerLocale", 0); + InstallResources(":mozilla:mailnews:import:text:resources:locale:en-US:MANIFEST", "$messengerLocale", 0); + } + + # bookmarks + { + my($bookmarksContent) = "$communicatorContent"."bookmarks:"; + my($bookmarksLocale) = "$communicatorLocale"."bookmarks:"; + + InstallResources(":mozilla:xpfe:components:bookmarks:resources:MANIFEST-content", "$bookmarksContent"); + InstallResources(":mozilla:xpfe:components:bookmarks:resources:locale:en-US:MANIFEST", "$bookmarksLocale"); + } + + # directory + { + my($directoryContent) = "$communicatorContent"."directory:"; + my($directoryLocale) = "$communicatorLocale"."directory:"; + + InstallResources(":mozilla:xpfe:components:directory:MANIFEST-content", "$directoryContent"); + InstallResources(":mozilla:xpfe:components:directory:locale:en-US:MANIFEST", "$directoryLocale"); + } + + # regViewer + { + my($regviewerContent) = "$communicatorContent"."regviewer:"; + my($regviewerLocale) = "$communicatorLocale"."regviewer:"; + + InstallResources(":mozilla:xpfe:components:regviewer:MANIFEST-content", "$regviewerContent"); + InstallResources(":mozilla:xpfe:components:regviewer:locale:en-US:MANIFEST", "$regviewerLocale"); + } + + # history + { + my($historyContent) = "$communicatorContent"."history:"; + my($historyLocale) = "$communicatorLocale"."history:"; + + InstallResources(":mozilla:xpfe:components:history:resources:MANIFEST-content", "$historyContent"); + InstallResources(":mozilla:xpfe:components:history:resources:locale:en-US:MANIFEST", "$historyLocale"); + } + + # related + { + my($relatedContent) = "$communicatorContent"."related:"; + my($relatedLocale) = "$communicatorLocale"."related:"; + + InstallResources(":mozilla:xpfe:components:related:resources:MANIFEST-content", "$relatedContent"); + InstallResources(":mozilla:xpfe:components:related:resources:locale:en-US:MANIFEST", "$relatedLocale"); + } + + # search + { + my($searchContent) = "$communicatorContent"."search:"; + my($searchLocale) = "$communicatorLocale"."search:"; + my($searchPlugins) = "${dist_dir}Search Plugins"; + + InstallResources(":mozilla:xpfe:components:search:resources:MANIFEST-content", "$searchContent"); + InstallResources(":mozilla:xpfe:components:search:resources:locale:en-US:MANIFEST", "$searchLocale"); + + # Make copies (not aliases) of the various search files + InstallResources(":mozilla:xpfe:components:search:datasets:MANIFEST", "$searchPlugins", 1); + } + + # sidebar + { + my($sidebarContent) = "$communicatorContent"."sidebar:"; + my($sidebarLocale) = "$communicatorLocale"."sidebar:"; + + InstallResources(":mozilla:xpfe:components:sidebar:resources:MANIFEST-content", "$sidebarContent"); + InstallResources(":mozilla:xpfe:components:sidebar:resources:locale:en-US:MANIFEST", "$sidebarLocale"); + } + + # timebomb (aka tmbmb) + { + my($timebombContent) = "$communicatorContent"."timebomb:"; + my($timebombLocale) = "$communicatorLocale"."timebomb:"; + + InstallResources(":mozilla:xpfe:components:timebomb:resources:content:MANIFEST", "$timebombContent"); + InstallResources(":mozilla:xpfe:components:timebomb:resources:locale:en-US:MANIFEST", "$timebombLocale"); + } + + # prefs + { + my($prefContent) = "$communicatorContent"."pref:"; + my($prefLocale) = "$communicatorLocale"."pref:"; + + InstallResources(":mozilla:xpfe:components:prefwindow:resources:content:MANIFEST", "$prefContent", 0); + InstallResources(":mozilla:xpfe:components:prefwindow:resources:content:mac:MANIFEST", "$prefContent", 0); + InstallResources(":mozilla:xpfe:components:prefwindow:resources:locale:en-US:MANIFEST", "$prefLocale", 0); + } + + # wallet + { + my($walletContent) = "$communicatorContent"."wallet:"; + my($walletLocale) = "$communicatorLocale"."wallet:"; + + InstallResources(":mozilla:extensions:wallet:cookieviewer:MANIFEST", "$walletContent", 0); + InstallResources(":mozilla:extensions:wallet:signonviewer:MANIFEST", "$walletContent", 0); + InstallResources(":mozilla:extensions:wallet:walletpreview:MANIFEST", "$walletContent", 0); + InstallResources(":mozilla:extensions:wallet:editor:MANIFEST", "$walletContent", 0); + + InstallResources(":mozilla:extensions:wallet:cookieviewer:MANIFEST_PROPERTIES", "$walletLocale", 0); + InstallResources(":mozilla:extensions:wallet:signonviewer:MANIFEST_PROPERTIES", "$walletLocale", 0); + InstallResources(":mozilla:extensions:wallet:walletpreview:MANIFEST_PROPERTIES", "$walletLocale", 0); + InstallResources(":mozilla:extensions:wallet:editor:MANIFEST_PROPERTIES", "$walletLocale", 0); + InstallResources(":mozilla:extensions:wallet:src:MANIFEST_PROPERTIES", "$walletLocale", 0); + } + + # security + { + my($securityContent) = "$communicatorContent"."security:"; + my($securityLocale) = "$communicatorLocale"."security:"; + + InstallResources(":mozilla:caps:src:MANIFEST_PROPERTIES", "$securityLocale", 0); + } + + # Install skin files + InstallSkinFiles("classic"); # fix me + InstallSkinFiles("blue"); # fix me + InstallSkinFiles("modern"); # fix me + + # install locale provider + InstallProviderFiles("locales", "en-DE"); + # install defaults + InstallLangPackFiles("en-DE"); + + print("--- Chrome copying complete ----\n"); +} + + +#//-------------------------------------------------------------------------------------------------- +#// MakeNonChromeAliases +#//-------------------------------------------------------------------------------------------------- +sub MakeNonChromeAliases() +{ + unless( $main::build{resources} ) { return; } + assertRightDirectory(); + + InstallNonChromeResources(); + InstallDefaultsFiles(); + InstallComponentFiles(); +} + +#//-------------------------------------------------------------------------------------------------- +#// MakeResourceAliases +#//-------------------------------------------------------------------------------------------------- + +sub MakeResourceAliases() +{ + unless( $main::build{resources} ) { return; } + assertRightDirectory(); + + InstallChromeFiles(); + MakeNonChromeAliases(); +} + +#//-------------------------------------------------------------------------------------------------- +#// ProcessJarManifests +#//-------------------------------------------------------------------------------------------------- + +sub ProcessJarManifests() +{ + my($dist_dir) = GetDistDirectory(); + my($chrome_dir) = "$dist_dir"."Chrome"; + + # a hash of jars passed as context to the following calls + my(%jars); + + MozJar::CreateJarFromManifest(":mozilla:caps:src:jar.mn", $chrome_dir, \%jars); + MozJar::CreateJarFromManifest(":mozilla:docshell:base:jar.mn", $chrome_dir, \%jars); + MozJar::CreateJarFromManifest(":mozilla:editor:jar.mn", $chrome_dir, \%jars); + MozJar::CreateJarFromManifest(":mozilla:embedding:browser:chrome:jar.mn", $chrome_dir, \%jars); + MozJar::CreateJarFromManifest(":mozilla:embedding:browser:chrome:locale:en-US:jar.mn", $chrome_dir, \%jars); + MozJar::CreateJarFromManifest(":mozilla:extensions:irc:jar.mn", $chrome_dir, \%jars); + MozJar::CreateJarFromManifest(":mozilla:extensions:wallet:jar.mn", $chrome_dir, \%jars); + MozJar::CreateJarFromManifest(":mozilla:intl:uconv:src:jar.mn", $chrome_dir, \%jars); + MozJar::CreateJarFromManifest(":mozilla:layout:html:forms:src:jar.mn", $chrome_dir, \%jars); + MozJar::CreateJarFromManifest(":mozilla:mailnews:jar.mn", $chrome_dir, \%jars); + MozJar::CreateJarFromManifest(":mozilla:netwerk:resources:jar.mn", $chrome_dir, \%jars); + MozJar::CreateJarFromManifest(":mozilla:profile:pref-migrator:resources:jar.mn", $chrome_dir, \%jars); + MozJar::CreateJarFromManifest(":mozilla:profile:resources:jar.mn", $chrome_dir, \%jars); + MozJar::CreateJarFromManifest(":mozilla:rdf:tests:domds:resources:jar.mn", $chrome_dir, \%jars); + MozJar::CreateJarFromManifest(":mozilla:security:base:res:jar.mn", $chrome_dir, \%jars); + MozJar::CreateJarFromManifest(":mozilla:themes:blue:jar.mn", $chrome_dir, \%jars); + MozJar::CreateJarFromManifest(":mozilla:themes:classic:communicator:mac:jar.mn", $chrome_dir, \%jars); + MozJar::CreateJarFromManifest(":mozilla:themes:classic:communicator:search:mac:jar.mn", $chrome_dir, \%jars); + MozJar::CreateJarFromManifest(":mozilla:themes:classic:communicator:sidebar:mac:jar.mn", $chrome_dir, \%jars); + MozJar::CreateJarFromManifest(":mozilla:themes:classic:global:mac:jar.mn", $chrome_dir, \%jars); + MozJar::CreateJarFromManifest(":mozilla:themes:classic:jar.mn", $chrome_dir, \%jars); + MozJar::CreateJarFromManifest(":mozilla:themes:classic:navigator:mac:jar.mn", $chrome_dir, \%jars); + MozJar::CreateJarFromManifest(":mozilla:themes:modern:jar.mn", $chrome_dir, \%jars); + MozJar::CreateJarFromManifest(":mozilla:xpcom:base:jar.mn", $chrome_dir, \%jars); + MozJar::CreateJarFromManifest(":mozilla:xpfe:browser:jar.mn", $chrome_dir, \%jars); + MozJar::CreateJarFromManifest(":mozilla:xpfe:browser:resources:content:mac:jar.mn", $chrome_dir, \%jars); + MozJar::CreateJarFromManifest(":mozilla:xpfe:communicator:jar.mn", $chrome_dir, \%jars); + MozJar::CreateJarFromManifest(":mozilla:xpfe:communicator:resources:content:mac:jar.mn", $chrome_dir, \%jars); + MozJar::CreateJarFromManifest(":mozilla:xpfe:components:jar.mn", $chrome_dir, \%jars); + MozJar::CreateJarFromManifest(":mozilla:xpfe:components:prefwindow:resources:content:mac:jar.mn", $chrome_dir, \%jars); + MozJar::CreateJarFromManifest(":mozilla:xpfe:global:jar.mn", $chrome_dir, \%jars); + MozJar::CreateJarFromManifest(":mozilla:xpfe:global:resources:content:mac:jar.mn", $chrome_dir, \%jars); + MozJar::CreateJarFromManifest(":mozilla:xpfe:global:resources:locale:en-US:mac:jar.mn", $chrome_dir, \%jars); + MozJar::CreateJarFromManifest(":mozilla:xpinstall:res:jar.mn", $chrome_dir, \%jars); + + # bad jar.mn files +# MozJar::CreateJarFromManifest(":mozilla:extensions:xmlterm:jar.mn", $chrome_dir, \%jars); + + WriteOutJarFiles($chrome_dir, \%jars); +} + + +#//-------------------------------------------------------------------------------------------------- +#// BuildJarFiles +#//-------------------------------------------------------------------------------------------------- + +sub BuildJarFiles() +{ + unless( $main::build{resources} && $main::options{jars} ) { return; } + assertRightDirectory(); + + print("--- Starting JAR building ----\n"); + + ProcessJarManifests(); + + print("--- JAR building done ----\n"); +} + + +#//-------------------------------------------------------------------------------------------------- +#// Make library aliases +#//-------------------------------------------------------------------------------------------------- + +sub MakeLibAliases() +{ + my($dist_dir) = GetDistDirectory(); + + local(*F); + my($filepath, $appath, $psi) = (':mozilla:build:mac:idepath.txt'); + if (open(F, $filepath)) { + $appath = ; + close(F); + + #// ProfilerLib + if ($main::PROFILE) + { + my($profilerlibpath) = $appath; + $profilerlibpath =~ s/[^:]*$/MacOS Support:Profiler:Profiler Common:ProfilerLib/; + MakeAlias("$profilerlibpath", "$dist_dir"."Essential Files:"); + } + } + else { + print STDERR "Can't find $filepath\n"; + } +} + +#//-------------------------------------------------------------------------------------------------- +#// Build the runtime 'dist' directories +#//-------------------------------------------------------------------------------------------------- + +sub BuildRuntimeDist() +{ + unless ( $main::build{dist} || $main::build{dist_runtime} ) { return;} + assertRightDirectory(); + + my $distdirectory = ":mozilla:dist"; # the parent directory in dist, including all the headers + + print("--- Starting Runtime Dist export ----\n"); + + #MAC_COMMON + InstallFromManifest(":mozilla:build:mac:MANIFEST", "$distdirectory:mac:common:"); + InstallFromManifest(":mozilla:lib:mac:NSRuntime:include:MANIFEST", "$distdirectory:mac:common:"); + InstallFromManifest(":mozilla:lib:mac:NSStdLib:include:MANIFEST", "$distdirectory:mac:common:"); + InstallFromManifest(":mozilla:lib:mac:MoreFiles:MANIFEST", "$distdirectory:mac:common:morefiles:"); + + #GC_LEAK_DETECTOR + InstallFromManifest(":mozilla:gc:boehm:MANIFEST", "$distdirectory:gc:"); + + #INCLUDE + InstallFromManifest(":mozilla:config:mac:MANIFEST", "$distdirectory:config:"); + InstallFromManifest(":mozilla:config:mac:MANIFEST_config", "$distdirectory:config:"); + + #NSPR + InstallFromManifest(":mozilla:nsprpub:pr:include:MANIFEST", "$distdirectory:nspr:"); + InstallFromManifest(":mozilla:nsprpub:pr:src:md:mac:MANIFEST", "$distdirectory:nspr:mac:"); + InstallFromManifest(":mozilla:nsprpub:lib:ds:MANIFEST", "$distdirectory:nspr:"); + InstallFromManifest(":mozilla:nsprpub:lib:libc:include:MANIFEST", "$distdirectory:nspr:"); + InstallFromManifest(":mozilla:nsprpub:lib:msgc:include:MANIFEST", "$distdirectory:nspr:"); + + print("--- Runtime Dist export complete ----\n"); +} + + +#//-------------------------------------------------------------------------------------------------- +#// Build the client 'dist' directories +#//-------------------------------------------------------------------------------------------------- + +sub BuildClientDist() +{ + unless ( $main::build{dist} ) { return;} + assertRightDirectory(); + + my $distdirectory = ":mozilla:dist"; # the parent directory in dist, including all the headers + my $dist_dir = GetDistDirectory(); # the subdirectory with the libs and executable. + + print("--- Starting Client Dist export ----\n"); + + InstallFromManifest(":mozilla:lib:mac:Misc:MANIFEST", "$distdirectory:mac:common:"); + InstallFromManifest(":mozilla:lib:mac:Instrumentation:MANIFEST", "$distdirectory:mac:inst:"); + + #INCLUDE + + #// To get out defines in all the project, dummy alias NGLayoutConfigInclude.h into MacConfigInclude.h + MakeAlias(":mozilla:config:mac:NGLayoutConfigInclude.h", ":mozilla:dist:config:MacConfigInclude.h"); + + InstallFromManifest(":mozilla:include:MANIFEST", "$distdirectory:include:"); + + #INTL + #CHARDET + InstallFromManifest(":mozilla:intl:chardet:public:MANIFEST", "$distdirectory:chardet"); + + #UCONV + InstallFromManifest(":mozilla:intl:uconv:idl:MANIFEST_IDL", "$distdirectory:idl:"); + InstallFromManifest(":mozilla:intl:uconv:public:MANIFEST", "$distdirectory:uconv:"); + InstallFromManifest(":mozilla:intl:uconv:ucvlatin:MANIFEST", "$distdirectory:uconv:"); + InstallFromManifest(":mozilla:intl:uconv:ucvja:MANIFEST", "$distdirectory:uconv:"); +# InstallFromManifest(":mozilla:intl:uconv:ucvja2:MANIFEST", "$distdirectory:uconv:"); + InstallFromManifest(":mozilla:intl:uconv:ucvtw:MANIFEST", "$distdirectory:uconv:"); + InstallFromManifest(":mozilla:intl:uconv:ucvtw2:MANIFEST", "$distdirectory:uconv:"); + InstallFromManifest(":mozilla:intl:uconv:ucvcn:MANIFEST", "$distdirectory:uconv:"); + InstallFromManifest(":mozilla:intl:uconv:ucvko:MANIFEST", "$distdirectory:uconv:"); +# InstallFromManifest(":mozilla:intl:uconv:ucvth:MANIFEST", "$distdirectory:uconv:"); +# InstallFromManifest(":mozilla:intl:uconv:ucvvt:MANIFEST", "$distdirectory:uconv:"); + InstallFromManifest(":mozilla:intl:uconv:ucvibm:MANIFEST", "$distdirectory:uconv:"); + + #UNICHARUTIL + InstallFromManifest(":mozilla:intl:unicharutil:public:MANIFEST", "$distdirectory:unicharutil"); +# InstallFromManifest(":mozilla:intl:unicharutil:public:MANIFEST_IDL", "$distdirectory:idl:"); + + #LOCALE + InstallFromManifest(":mozilla:intl:locale:public:MANIFEST", "$distdirectory:locale:"); + InstallFromManifest(":mozilla:intl:locale:idl:MANIFEST_IDL", "$distdirectory:idl:"); + + #LWBRK + InstallFromManifest(":mozilla:intl:lwbrk:public:MANIFEST", "$distdirectory:lwbrk:"); + + #STRRES + InstallFromManifest(":mozilla:intl:strres:public:MANIFEST_IDL", "$distdirectory:idl:"); + + #JPEG + InstallFromManifest(":mozilla:jpeg:MANIFEST", "$distdirectory:jpeg:"); + + #LIBREG + InstallFromManifest(":mozilla:modules:libreg:include:MANIFEST", "$distdirectory:libreg:"); + + #XPCOM + InstallFromManifest(":mozilla:xpcom:base:MANIFEST_IDL", "$distdirectory:idl:"); + InstallFromManifest(":mozilla:xpcom:io:MANIFEST_IDL", "$distdirectory:idl:"); + InstallFromManifest(":mozilla:xpcom:ds:MANIFEST_IDL", "$distdirectory:idl:"); + InstallFromManifest(":mozilla:xpcom:threads:MANIFEST_IDL", "$distdirectory:idl:"); + InstallFromManifest(":mozilla:xpcom:components:MANIFEST_IDL", "$distdirectory:idl:"); + InstallFromManifest(":mozilla:xpcom:components:MANIFEST_COMPONENTS", "${dist_dir}Components:"); + + InstallFromManifest(":mozilla:xpcom:base:MANIFEST", "$distdirectory:xpcom:"); + InstallFromManifest(":mozilla:xpcom:components:MANIFEST", "$distdirectory:xpcom:"); + InstallFromManifest(":mozilla:xpcom:ds:MANIFEST", "$distdirectory:xpcom:"); + InstallFromManifest(":mozilla:xpcom:io:MANIFEST", "$distdirectory:xpcom:"); + InstallFromManifest(":mozilla:xpcom:threads:MANIFEST", "$distdirectory:xpcom:"); + InstallFromManifest(":mozilla:xpcom:proxy:public:MANIFEST", "$distdirectory:xpcom:"); + + InstallFromManifest(":mozilla:xpcom:reflect:xptinfo:public:MANIFEST", "$distdirectory:xpcom:"); + InstallFromManifest(":mozilla:xpcom:reflect:xptinfo:public:MANIFEST_IDL", "$distdirectory:idl:"); + InstallFromManifest(":mozilla:xpcom:reflect:xptcall:public:MANIFEST", "$distdirectory:xpcom:"); + + InstallFromManifest(":mozilla:xpcom:typelib:xpt:public:MANIFEST", "$distdirectory:xpcom:"); + + #ZLIB + InstallFromManifest(":mozilla:modules:zlib:src:MANIFEST", "$distdirectory:zlib:"); + + #LIBJAR + InstallFromManifest(":mozilla:modules:libjar:MANIFEST", "$distdirectory:libjar:"); + InstallFromManifest(":mozilla:modules:libjar:MANIFEST_IDL", "$distdirectory:idl:"); + + #LIBUTIL + InstallFromManifest(":mozilla:modules:libutil:public:MANIFEST", "$distdirectory:libutil:"); + + # APPFILELOCPROVIDER + InstallFromManifest(":mozilla:modules:appfilelocprovider:public:MANIFEST", "$distdirectory:appfilelocprovider:"); + + #SUN_JAVA + InstallFromManifest(":mozilla:sun-java:stubs:include:MANIFEST", "$distdirectory:sun-java:"); + InstallFromManifest(":mozilla:sun-java:stubs:macjri:MANIFEST", "$distdirectory:sun-java:"); + + #JS + InstallFromManifest(":mozilla:js:src:MANIFEST", "$distdirectory:js:"); + + #LIVECONNECT + InstallFromManifest(":mozilla:js:src:liveconnect:MANIFEST", "$distdirectory:liveconnect:"); + + #XPCONNECT + InstallFromManifest(":mozilla:js:src:xpconnect:idl:MANIFEST", "$distdirectory:idl:"); + InstallFromManifest(":mozilla:js:src:xpconnect:public:MANIFEST", "$distdirectory:xpconnect:"); + + #CAPS + InstallFromManifest(":mozilla:caps:include:MANIFEST", "$distdirectory:caps:"); + InstallFromManifest(":mozilla:caps:idl:MANIFEST", "$distdirectory:idl:"); + + #LIBPREF + InstallFromManifest(":mozilla:modules:libpref:public:MANIFEST", "$distdirectory:libpref:"); + InstallFromManifest(":mozilla:modules:libpref:public:MANIFEST_IDL", "$distdirectory:idl:"); + + #PROFILE + InstallFromManifest(":mozilla:profile:public:MANIFEST_IDL", "$distdirectory:idl:"); + + #PREF_MIGRATOR + InstallFromManifest(":mozilla:profile:pref-migrator:public:MANIFEST", "$distdirectory:profile:"); + + #LIBIMAGE + InstallFromManifest(":mozilla:modules:libimg:png:MANIFEST", "$distdirectory:libimg:"); + InstallFromManifest(":mozilla:modules:libimg:src:MANIFEST", "$distdirectory:libimg:"); + InstallFromManifest(":mozilla:modules:libimg:public:MANIFEST", "$distdirectory:libimg:"); + InstallFromManifest(":mozilla:modules:libimg:public_com:MANIFEST", "$distdirectory:libimg:"); + + #PLUGIN + InstallFromManifest(":mozilla:modules:plugin:nglsrc:MANIFEST", "$distdirectory:plugin:"); + InstallFromManifest(":mozilla:modules:plugin:public:MANIFEST", "$distdirectory:plugin:"); + InstallFromManifest(":mozilla:modules:oji:src:MANIFEST", "$distdirectory:oji:"); + InstallFromManifest(":mozilla:modules:oji:public:MANIFEST", "$distdirectory:oji:"); + + #DB + InstallFromManifest(":mozilla:db:mdb:public:MANIFEST", "$distdirectory:db:"); + InstallFromManifest(":mozilla:db:mork:build:MANIFEST", "$distdirectory:db:"); + + #DBM + InstallFromManifest(":mozilla:dbm:include:MANIFEST", "$distdirectory:dbm:"); + + #URILOADER + InstallFromManifest(":mozilla:uriloader:base:MANIFEST_IDL", "$distdirectory:idl:"); + InstallFromManifest(":mozilla:uriloader:exthandler:MANIFEST_IDL", "$distdirectory:idl:"); + + #NETWERK + InstallFromManifest(":mozilla:netwerk:base:public:MANIFEST", "$distdirectory:netwerk:"); + InstallFromManifest(":mozilla:netwerk:base:public:MANIFEST_IDL", "$distdirectory:idl:"); + InstallFromManifest(":mozilla:netwerk:socket:base:MANIFEST_IDL", "$distdirectory:idl:"); + InstallFromManifest(":mozilla:netwerk:protocol:about:public:MANIFEST_IDL", "$distdirectory:idl:"); + InstallFromManifest(":mozilla:netwerk:protocol:data:public:MANIFEST_IDL", "$distdirectory:idl:"); + #InstallFromManifest(":mozilla:netwerk:protocol:file:public:MANIFEST_IDL", "$distdirectory:idl:"); + InstallFromManifest(":mozilla:netwerk:protocol:http:public:MANIFEST_IDL", "$distdirectory:idl:"); + InstallFromManifest(":mozilla:netwerk:protocol:http:public:MANIFEST", "$distdirectory:netwerk:"); + InstallFromManifest(":mozilla:netwerk:protocol:jar:public:MANIFEST_IDL", "$distdirectory:idl:"); + InstallFromManifest(":mozilla:netwerk:protocol:res:public:MANIFEST_IDL", "$distdirectory:idl:"); + InstallFromManifest(":mozilla:netwerk:cache:public:MANIFEST", "$distdirectory:idl:"); + InstallFromManifest(":mozilla:netwerk:mime:public:MANIFEST", "$distdirectory:netwerk:"); + + #SECURITY + InstallFromManifest(":mozilla:extensions:psm-glue:public:MANIFEST", "$distdirectory:idl:"); + InstallFromManifest(":mozilla:extensions:psm-glue:src:MANIFEST", "$distdirectory:include:"); + + InstallFromManifest(":mozilla:security:base:public:MANIFEST", "$distdirectory:idl:"); + + InstallFromManifest(":mozilla:security:psm:lib:client:MANIFEST", "$distdirectory:security:"); + InstallFromManifest(":mozilla:security:psm:lib:protocol:MANIFEST", "$distdirectory:security:"); + + #EXTENSIONS + InstallFromManifest(":mozilla:extensions:cookie:MANIFEST", "$distdirectory:cookie:"); + InstallFromManifest(":mozilla:extensions:wallet:public:MANIFEST", "$distdirectory:wallet:"); + + #WEBSHELL + InstallFromManifest(":mozilla:webshell:public:MANIFEST", "$distdirectory:webshell:"); + InstallFromManifest(":mozilla:webshell:public:MANIFEST_IDL", "$distdirectory:idl:"); + InstallFromManifest(":mozilla:webshell:tests:viewer:public:MANIFEST", "$distdirectory:webshell:"); + + #LAYOUT + InstallFromManifest(":mozilla:layout:build:MANIFEST", "$distdirectory:layout:"); + InstallFromManifest(":mozilla:layout:base:public:MANIFEST", "$distdirectory:layout:"); + InstallFromManifest(":mozilla:layout:base:public:MANIFEST_IDL", "$distdirectory:idl:"); + InstallFromManifest(":mozilla:layout:html:content:public:MANIFEST", "$distdirectory:layout:"); + InstallFromManifest(":mozilla:layout:html:document:src:MANIFEST", "$distdirectory:layout:"); + InstallFromManifest(":mozilla:layout:html:document:public:MANIFEST", "$distdirectory:layout:"); + InstallFromManifest(":mozilla:layout:html:style:public:MANIFEST", "$distdirectory:layout:"); + InstallFromManifest(":mozilla:layout:html:style:src:MANIFEST", "$distdirectory:layout:"); + InstallFromManifest(":mozilla:layout:html:base:src:MANIFEST", "$distdirectory:layout:"); + InstallFromManifest(":mozilla:layout:html:forms:public:MANIFEST", "$distdirectory:layout:"); + InstallFromManifest(":mozilla:layout:html:table:public:MANIFEST", "$distdirectory:layout:"); + InstallFromManifest(":mozilla:layout:base:src:MANIFEST", "$distdirectory:layout:"); + InstallFromManifest(":mozilla:layout:events:public:MANIFEST", "$distdirectory:layout:"); + InstallFromManifest(":mozilla:layout:events:src:MANIFEST", "$distdirectory:layout:"); + InstallFromManifest(":mozilla:layout:xml:document:public:MANIFEST", "$distdirectory:layout:"); + InstallFromManifest(":mozilla:layout:xml:content:public:MANIFEST", "$distdirectory:layout:"); + InstallFromManifest(":mozilla:layout:xsl:document:src:MANIFEST_IDL", "$distdirectory:idl:"); + if ($main::options{svg}) + { + InstallFromManifest(":mozilla:layout:svg:base:public:MANIFEST", "$distdirectory:layout:"); + } + InstallFromManifest(":mozilla:layout:xul:base:public:Manifest", "$distdirectory:layout:"); + InstallFromManifest(":mozilla:layout:xbl:public:Manifest", "$distdirectory:layout:"); + + #GFX + InstallFromManifest(":mozilla:gfx:public:MANIFEST", "$distdirectory:gfx:"); + InstallFromManifest(":mozilla:gfx:idl:MANIFEST_IDL", "$distdirectory:idl:"); + + #VIEW + InstallFromManifest(":mozilla:view:public:MANIFEST", "$distdirectory:view:"); + + #DOM + InstallFromManifest(":mozilla:dom:public:MANIFEST", "$distdirectory:dom:"); + InstallFromManifest(":mozilla:dom:public:MANIFEST_IDL", "$distdirectory:idl:"); + InstallFromManifest(":mozilla:dom:public:base:MANIFEST", "$distdirectory:dom:"); + InstallFromManifest(":mozilla:dom:public:coreDom:MANIFEST", "$distdirectory:dom:"); + InstallFromManifest(":mozilla:dom:public:coreEvents:MANIFEST", "$distdirectory:dom:"); + InstallFromManifest(":mozilla:dom:public:events:MANIFEST", "$distdirectory:dom:"); + InstallFromManifest(":mozilla:dom:public:range:MANIFEST", "$distdirectory:dom:"); + InstallFromManifest(":mozilla:dom:public:html:MANIFEST", "$distdirectory:dom:"); + InstallFromManifest(":mozilla:dom:public:css:MANIFEST", "$distdirectory:dom:"); + InstallFromManifest(":mozilla:dom:src:jsurl:MANIFEST", "$distdirectory:dom:"); + InstallFromManifest(":mozilla:dom:src:base:MANIFEST", "$distdirectory:dom:"); + + #JSURL + InstallFromManifest(":mozilla:dom:src:jsurl:MANIFEST_IDL", "$distdirectory:idl:"); + + #HTMLPARSER + InstallFromManifest(":mozilla:htmlparser:src:MANIFEST", "$distdirectory:htmlparser:"); + + #EXPAT + InstallFromManifest(":mozilla:expat:xmlparse:MANIFEST", "$distdirectory:expat:"); + + #DOCSHELL + InstallFromManifest(":mozilla:docshell:base:MANIFEST_IDL", "$distdirectory:idl:"); + + #EMBEDDING + InstallFromManifest(":mozilla:embedding:browser:webbrowser:MANIFEST_IDL", "$distdirectory:idl:"); + InstallFromManifest(":mozilla:embedding:browser:setup:MANIFEST_IDL", "$distdirectory:idl:"); + + #WIDGET + InstallFromManifest(":mozilla:widget:public:MANIFEST", "$distdirectory:widget:"); + InstallFromManifest(":mozilla:widget:public:MANIFEST_IDL", "$distdirectory:idl:"); + InstallFromManifest(":mozilla:widget:src:mac:MANIFEST", "$distdirectory:widget:"); + InstallFromManifest(":mozilla:widget:timer:public:MANIFEST", "$distdirectory:widget:"); + + #RDF + InstallFromManifest(":mozilla:rdf:base:idl:MANIFEST", "$distdirectory:idl:"); + InstallFromManifest(":mozilla:rdf:base:public:MANIFEST", "$distdirectory:rdf:"); + InstallFromManifest(":mozilla:rdf:util:public:MANIFEST", "$distdirectory:rdf:"); + InstallFromManifest(":mozilla:rdf:content:public:MANIFEST", "$distdirectory:rdf:"); + InstallFromManifest(":mozilla:rdf:datasource:public:MANIFEST", "$distdirectory:rdf:"); + InstallFromManifest(":mozilla:rdf:build:MANIFEST", "$distdirectory:rdf:"); + InstallFromManifest(":mozilla:rdf:tests:domds:MANIFEST", "$distdirectory:idl:"); + + #CHROME + InstallFromManifest(":mozilla:rdf:chrome:public:MANIFEST", "$distdirectory:idl:"); + + #EDITOR + InstallFromManifest(":mozilla:editor:idl:MANIFEST", "$distdirectory:idl:"); + InstallFromManifest(":mozilla:editor:txmgr:idl:MANIFEST", "$distdirectory:idl:"); + InstallFromManifest(":mozilla:editor:public:MANIFEST", "$distdirectory:editor:"); + InstallFromManifest(":mozilla:editor:txmgr:public:MANIFEST", "$distdirectory:editor:txmgr"); + InstallFromManifest(":mozilla:editor:txtsvc:public:MANIFEST", "$distdirectory:editor:txtsvc"); + + #SILENTDL + #InstallFromManifest(":mozilla:silentdl:MANIFEST", "$distdirectory:silentdl:"); + + #XPINSTALL (the one and only!) + InstallFromManifest(":mozilla:xpinstall:public:MANIFEST", "$distdirectory:xpinstall:"); + + # XPFE COMPONENTS + InstallFromManifest(":mozilla:xpfe:components:public:MANIFEST", "$distdirectory:xpfe:components"); + InstallFromManifest(":mozilla:xpfe:components:public:MANIFEST_IDL", "$distdirectory:idl:"); + + my $dir = ''; + for $dir (qw(bookmarks find history related sample search shistory sidebar ucth urlbarhistory xfer)) + { + InstallFromManifest(":mozilla:xpfe:components:$dir:public:MANIFEST_IDL", "$distdirectory:idl:"); + } + + InstallFromManifest(":mozilla:xpfe:components:timebomb:MANIFEST", "$distdirectory:xpfe:"); + InstallFromManifest(":mozilla:xpfe:components:timebomb:MANIFEST_IDL", "$distdirectory:idl:"); + + # directory + InstallFromManifest(":mozilla:xpfe:components:directory:MANIFEST_IDL", "$distdirectory:idl:"); + # regviewer + InstallFromManifest(":mozilla:xpfe:components:regviewer:MANIFEST_IDL", "$distdirectory:idl:"); + # autocomplete + InstallFromManifest(":mozilla:xpfe:components:autocomplete:public:MANIFEST_IDL", "$distdirectory:idl:"); + + # XPAPPS + InstallFromManifest(":mozilla:xpfe:appshell:public:MANIFEST", "$distdirectory:xpfe:"); + InstallFromManifest(":mozilla:xpfe:appshell:public:MANIFEST_IDL", "$distdirectory:idl:"); + InstallFromManifest(":mozilla:xpfe:browser:public:MANIFEST_IDL", "$distdirectory:idl:"); + + # XML-RPC + InstallFromManifest(":mozilla:extensions:xml-rpc:idl:MANIFEST_IDL", "$distdirectory:idl:"); + + # MAILNEWS + InstallFromManifest(":mozilla:mailnews:public:MANIFEST", "$distdirectory:mailnews:"); + InstallFromManifest(":mozilla:mailnews:public:MANIFEST_IDL", "$distdirectory:idl:"); + InstallFromManifest(":mozilla:mailnews:base:public:MANIFEST", "$distdirectory:mailnews:"); + InstallFromManifest(":mozilla:mailnews:base:public:MANIFEST_IDL", "$distdirectory:idl:"); + InstallFromManifest(":mozilla:mailnews:base:build:MANIFEST", "$distdirectory:mailnews:"); + InstallFromManifest(":mozilla:mailnews:base:src:MANIFEST", "$distdirectory:mailnews:"); + InstallFromManifest(":mozilla:mailnews:base:util:MANIFEST", "$distdirectory:mailnews:"); + InstallFromManifest(":mozilla:mailnews:base:search:public:MANIFEST", "$distdirectory:mailnews:"); + InstallFromManifest(":mozilla:mailnews:base:search:public:MANIFEST_IDL", "$distdirectory:idl:"); + InstallFromManifest(":mozilla:mailnews:compose:public:MANIFEST", "$distdirectory:mailnews:"); + InstallFromManifest(":mozilla:mailnews:compose:public:MANIFEST_IDL", "$distdirectory:idl:"); + InstallFromManifest(":mozilla:mailnews:compose:build:MANIFEST", "$distdirectory:mailnews:"); + InstallFromManifest(":mozilla:mailnews:db:msgdb:public:MANIFEST", "$distdirectory:mailnews:"); + InstallFromManifest(":mozilla:mailnews:db:msgdb:build:MANIFEST", "$distdirectory:mailnews:"); + InstallFromManifest(":mozilla:mailnews:local:public:MANIFEST", "$distdirectory:mailnews:"); + InstallFromManifest(":mozilla:mailnews:local:build:MANIFEST", "$distdirectory:mailnews:"); + InstallFromManifest(":mozilla:mailnews:local:src:MANIFEST", "$distdirectory:mailnews:"); + InstallFromManifest(":mozilla:mailnews:imap:public:MANIFEST", "$distdirectory:mailnews:"); + InstallFromManifest(":mozilla:mailnews:imap:build:MANIFEST", "$distdirectory:mailnews:"); + InstallFromManifest(":mozilla:mailnews:imap:src:MANIFEST", "$distdirectory:mailnews:"); + InstallFromManifest(":mozilla:mailnews:mime:public:MANIFEST", "$distdirectory:mailnews:"); + InstallFromManifest(":mozilla:mailnews:mime:public:MANIFEST_IDL", "$distdirectory:idl:"); + InstallFromManifest(":mozilla:mailnews:mime:src:MANIFEST", "$distdirectory:mailnews:"); + InstallFromManifest(":mozilla:mailnews:mime:build:MANIFEST", "$distdirectory:mailnews:"); + InstallFromManifest(":mozilla:mailnews:mime:emitters:src:MANIFEST", "$distdirectory:mailnews:"); + InstallFromManifest(":mozilla:mailnews:news:public:MANIFEST", "$distdirectory:mailnews:"); + InstallFromManifest(":mozilla:mailnews:news:build:MANIFEST", "$distdirectory:mailnews:"); + InstallFromManifest(":mozilla:mailnews:addrbook:public:MANIFEST", "$distdirectory:mailnews:"); + InstallFromManifest(":mozilla:mailnews:addrbook:public:MANIFEST_IDL", "$distdirectory:idl:"); + InstallFromManifest(":mozilla:mailnews:addrbook:src:MANIFEST", "$distdirectory:mailnews:"); + InstallFromManifest(":mozilla:mailnews:addrbook:build:MANIFEST", "$distdirectory:mailnews:"); + + #LDAP + if ($main::options{ldap}) + { + InstallFromManifest(":mozilla:directory:c-sdk:ldap:include:MANIFEST", "$distdirectory:directory:"); + InstallFromManifest(":mozilla:directory:xpcom:base:public:MANIFEST", "$distdirectory:directory:"); + InstallFromManifest(":mozilla:directory:xpcom:base:public:MANIFEST_IDL", "$distdirectory:idl:"); + } + + #XMLEXTRAS + if ($main::options{xmlextras}) + { + InstallFromManifest(":mozilla:extensions:xmlextras:base:public:MANIFEST_IDL", "$distdirectory:idl:"); + InstallFromManifest(":mozilla:extensions:xmlextras:soap:public:MANIFEST_IDL", "$distdirectory:idl:"); + } + + print("--- Client Dist export complete ----\n"); +} + + +#//-------------------------------------------------------------------------------------------------- +#// Build the 'dist' directory +#//-------------------------------------------------------------------------------------------------- + +sub BuildDist() +{ + unless ( $main::build{dist} || $main::build{dist_runtime} ) { return;} + assertRightDirectory(); + + # activate MacPerl + ActivateApplication('McPL'); + + my $distdirectory = ":mozilla:dist"; # the parent directory in dist, including all the headers + my $dist_dir = GetDistDirectory(); # the subdirectory with the libs and executable. + if ($main::CLOBBER_DIST_ALL) + { + print "Clobbering dist in 5 seconds. Press command-. to stop\n"; + + DelayFor(5); + + print "Clobbering all files inside :mozilla:dist:\n"; + EmptyTree($distdirectory.":"); + } + else + { + if ($main::CLOBBER_DIST_LIBS) + { + print "Clobbering library aliases and executables inside ".$dist_dir."\n"; + EmptyTree($dist_dir); + } + } + + # we really do not need all these paths, but many client projects include them + mkpath([ ":mozilla:dist:", ":mozilla:dist:client:", ":mozilla:dist:client_debug:", ":mozilla:dist:client_stubs:" ]); + mkpath([ ":mozilla:dist:viewer:", ":mozilla:dist:viewer_debug:" ]); + + #make default plugins folder so that apprunner won't go looking for 3.0 and 4.0 plugins. + mkpath([ ":mozilla:dist:viewer:Plugins", ":mozilla:dist:viewer_debug:Plugins"]); + mkpath([ ":mozilla:dist:client:Plugins", ":mozilla:dist:client_debug:Plugins"]); + + BuildRuntimeDist(); + BuildClientDist(); + + print("--- Dist export complete ----\n"); +} + + +#//-------------------------------------------------------------------------------------------------- +#// Build stub projects +#//-------------------------------------------------------------------------------------------------- + +sub BuildStubs() +{ + + unless( $main::build{stubs} ) { return; } + assertRightDirectory(); + + print("--- Starting Stubs projects ----\n"); + + #// + #// Clean projects + #// + BuildProjectClean(":mozilla:lib:mac:NSStdLib:NSStdLib.mcp", "Stubs"); + + print("--- Stubs projects complete ----\n"); +} + + + +#//-------------------------------------------------------------------------------------------------- +#// Build IDL projects +#//-------------------------------------------------------------------------------------------------- + +sub getCodeWarriorPath($) +{ + my($subfolder)=@_; + my($filepath, $appath) = (':mozilla:build:mac:idepath.txt'); + if (open(F, $filepath)) { + $appath = ; + close(F); + + my($codewarrior_root) = $appath; + $codewarrior_root =~ s/[^:]*$//; + return ($codewarrior_root . $subfolder); + } else { + print("Can't locate CodeWarrior IDE.\n"); + die; + } +} + +sub getCodeWarriorIDEName() +{ + my($subfolder)=@_; + my($filepath, $appath) = (':mozilla:build:mac:idepath.txt'); + if (open(F, $filepath)) { + $appath = ; + close(F); + + my(@codewarrior_path) = split(/:/, $appath); + return pop(@codewarrior_path); + } else { + print("Can't locate CodeWarrior IDE.\n"); + die; + } +} + +sub getModificationDate($) +{ + my($filePath)=@_; + my($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size, + $atime,$mtime,$ctime,$blksize,$blocks) = stat($filePath); + return $mtime; +} + +sub BuildIDLProjects() +{ + unless( $main::build{idl} ) { return; } + assertRightDirectory(); + + print("--- Starting IDL projects ----\n"); + + if ( $main::build{xpidl} ) + { + #// see if the xpidl compiler/linker has been rebuilt by comparing modification dates. + my($codewarrior_plugins) = getCodeWarriorPath("CodeWarrior Plugins:"); + my($compiler_path) = $codewarrior_plugins . "Compilers:xpidl"; + my($linker_path) = $codewarrior_plugins . "Linkers:xpt Linker"; + my($compiler_modtime) = (-e $compiler_path ? getModificationDate($compiler_path) : 0); + my($linker_modtime) = (-e $linker_path ? getModificationDate($linker_path) : 0); + + #// build the IDL compiler itself. + BuildProject(":mozilla:xpcom:typelib:xpidl:macbuild:xpidl.mcp", "build all"); + + #// was the compiler/linker rebuilt? if so, then clobber IDL projects as we go. + if (getModificationDate($compiler_path) > $compiler_modtime || getModificationDate($linker_path) > $linker_modtime) + { + $main::CLOBBER_IDL_PROJECTS = 1; + print("XPIDL tools have been updated, will clobber all IDL data folders.\n"); + + # in this situation, we need to quit and restart the IDE to pick up the new plugin + # sadly, this seems to crash MacPerl or CodeWarrior, so disabled for now. +# CodeWarriorLib::quit(); +# WaitNextEvent(); +# CodeWarriorLib::activate(); +# WaitNextEvent(); + } + } + + BuildIDLProject(":mozilla:xpcom:macbuild:XPCOMIDL.mcp", "xpcom"); + + # security base + BuildIDLProject(":mozilla:security:base:macbuild:securityBaseIDL.mcp", "securityBase"); + + # necko + BuildIDLProject(":mozilla:netwerk:macbuild:netwerkIDL.mcp","necko"); + BuildIDLProject(":mozilla:uriloader:macbuild:uriLoaderIDL.mcp", "uriloader"); + BuildIDLProject(":mozilla:uriloader:extprotocol:mac:extProtocolIDL.mcp", "extprotocol"); + + # psm glue + BuildIDLProject(":mozilla:extensions:psm-glue:macbuild:psmglueIDL.mcp", "psmglue"); + + BuildIDLProject(":mozilla:modules:libpref:macbuild:libprefIDL.mcp", "libpref"); + BuildIDLProject(":mozilla:modules:libutil:macbuild:libutilIDL.mcp", "libutil"); + BuildIDLProject(":mozilla:modules:libjar:macbuild:libjarIDL.mcp", "libjar"); + BuildIDLProject(":mozilla:modules:plugin:macbuild:pluginIDL.mcp", "plugin"); + BuildIDLProject(":mozilla:modules:oji:macbuild:ojiIDL.mcp", "oji"); + BuildIDLProject(":mozilla:js:macbuild:XPConnectIDL.mcp", "xpconnect"); + BuildIDLProject(":mozilla:dom:macbuild:domIDL.mcp", "dom"); + + BuildIDLProject(":mozilla:dom:src:jsurl:macbuild:JSUrlDL.mcp", "jsurl"); + + BuildIDLProject(":mozilla:gfx:macbuild:gfxIDL.mcp", "gfx"); + BuildIDLProject(":mozilla:widget:macbuild:widgetIDL.mcp", "widget"); + BuildIDLProject(":mozilla:editor:macbuild:EditorIDL.mcp", "editor"); + BuildIDLProject(":mozilla:editor:txmgr:macbuild:txmgrIDL.mcp", "txmgr"); + BuildIDLProject(":mozilla:profile:macbuild:ProfileServicesIDL.mcp", "profileservices"); + BuildIDLProject(":mozilla:profile:pref-migrator:macbuild:prefmigratorIDL.mcp", "prefm"); + + BuildIDLProject(":mozilla:layout:macbuild:layoutIDL.mcp", "layout"); + + BuildIDLProject(":mozilla:rdf:macbuild:RDFIDL.mcp", "rdf"); + BuildIDLProject(":mozilla:rdf:tests:domds:macbuild:DOMDataSourceIDL.mcp", "domds"); + + BuildIDLProject(":mozilla:rdf:chrome:build:chromeIDL.mcp", "chrome"); + + BuildIDLProject(":mozilla:webshell:macbuild:webshellIDL.mcp", "webshell"); + BuildIDLProject(":mozilla:docshell:macbuild:docshellIDL.mcp", "docshell"); + BuildIDLProject(":mozilla:embedding:browser:macbuild:browserIDL.mcp", "embeddingbrowser"); + + BuildIDLProject(":mozilla:extensions:wallet:macbuild:walletIDL.mcp","wallet"); + BuildIDLProject(":mozilla:extensions:xml-rpc:macbuild:xml-rpcIDL.mcp","xml-rpc"); + BuildIDLProject(":mozilla:xpfe:components:bookmarks:macbuild:BookmarksIDL.mcp", "bookmarks"); + BuildIDLProject(":mozilla:xpfe:components:directory:DirectoryIDL.mcp", "directory"); + BuildIDLProject(":mozilla:xpfe:components:regviewer:RegViewerIDL.mcp", "regviewer"); + BuildIDLProject(":mozilla:xpfe:components:history:macbuild:historyIDL.mcp", "history"); + BuildIDLProject(":mozilla:xpfe:components:shistory:macbuild:shistoryIDL.mcp", "shistory"); + BuildIDLProject(":mozilla:xpfe:components:related:macbuild:RelatedIDL.mcp", "related"); + BuildIDLProject(":mozilla:xpfe:components:search:macbuild:SearchIDL.mcp", "search"); + BuildIDLProject(":mozilla:xpfe:components:macbuild:mozcompsIDL.mcp", "mozcomps"); + BuildIDLProject(":mozilla:xpfe:components:timebomb:macbuild:timebombIDL.mcp", "tmbm"); + BuildIDLProject(":mozilla:xpfe:components:urlbarhistory:macbuild:urlbarhistoryIDL.mcp", "urlbarhistory"); + BuildIDLProject(":mozilla:xpfe:components:autocomplete:macbuild:AutoCompleteIDL.mcp", "autocomplete"); + + BuildIDLProject(":mozilla:xpfe:appshell:macbuild:appshellIDL.mcp", "appshell"); + + BuildIDLProject(":mozilla:xpfe:browser:macbuild:mozBrowserIDL.mcp", "mozBrowser"); + + BuildIDLProject(":mozilla:xpinstall:macbuild:xpinstallIDL.mcp", "xpinstall"); + + BuildIDLProject(":mozilla:mailnews:base:macbuild:msgCoreIDL.mcp", "mailnews"); + BuildIDLProject(":mozilla:mailnews:compose:macbuild:msgComposeIDL.mcp", "MsgCompose"); + BuildIDLProject(":mozilla:mailnews:local:macbuild:msglocalIDL.mcp", "MsgLocal"); + BuildIDLProject(":mozilla:mailnews:news:macbuild:msgnewsIDL.mcp", "MsgNews"); + BuildIDLProject(":mozilla:mailnews:addrbook:macbuild:msgAddrbookIDL.mcp", "MsgAddrbook"); + BuildIDLProject(":mozilla:mailnews:absync:macbuild:abSyncIDL.mcp", "AbSyncSvc"); + BuildIDLProject(":mozilla:mailnews:db:macbuild:msgDBIDL.mcp", "MsgDB"); + BuildIDLProject(":mozilla:mailnews:imap:macbuild:msgimapIDL.mcp", "MsgImap"); + BuildIDLProject(":mozilla:mailnews:mime:macbuild:mimeIDL.mcp", "Mime"); + BuildIDLProject(":mozilla:mailnews:import:macbuild:msgImportIDL.mcp", "msgImport"); + + BuildIDLProject(":mozilla:caps:macbuild:CapsIDL.mcp", "caps"); + + BuildIDLProject(":mozilla:intl:locale:macbuild:nsLocaleIDL.mcp", "nsLocale"); + BuildIDLProject(":mozilla:intl:strres:macbuild:strresIDL.mcp", "nsIStringBundle"); + BuildIDLProject(":mozilla:intl:unicharutil:macbuild:unicharutilIDL.mcp", "unicharutil"); + BuildIDLProject(":mozilla:intl:uconv:macbuild:uconvIDL.mcp", "uconv"); + + if ($main::options{ldap}) + { + BuildIDLProject(":mozilla:directory:xpcom:macbuild:mozldapIDL.mcp", "mozldap"); + } + + if ($main::options{xmlextras}) + { + BuildIDLProject(":mozilla:extensions:xmlextras:macbuild:xmlextrasIDL.mcp", "xmlextras"); + } + + # xpt_link MPW tool, needed for merging xpt files (release build) + + if ($main::build{xptlink}) + { + my($codewarrior_msl) = getCodeWarriorPath("MSL:MSL_C:MSL_MacOS:"); + if ( ! -e $codewarrior_msl . "Lib:PPC:MSL C.PPC MPW(NL).Lib") { + print("MSL PPC MPW Lib not found... Let's build it.\n"); + BuildProject($codewarrior_msl . "Project:PPC:MSL C.PPC MPW.mcp", "MSL C.PPC MPW"); + } + BuildOneProject(":mozilla:xpcom:typelib:xpidl:macbuild:xpidl.mcp", "xpt_link", 0, 0, 0); + } + + print("--- IDL projects complete ----\n"); +} + +#//-------------------------------------------------------------------------------------------------- +#// Build runtime projects +#//-------------------------------------------------------------------------------------------------- + +sub BuildRuntimeProjects() +{ + unless( $main::build{runtime} ) { return; } + assertRightDirectory(); + + print("--- Starting Runtime projects ----\n"); + + # $D becomes a suffix to target names for selecting either the debug or non-debug target of a project + my($D) = $main::DEBUG ? "Debug" : ""; + + #// + #// Shared libraries + #// + if ( $main::CARBON ) + { + if ( $main::CARBONLITE ) { + BuildProject(":mozilla:lib:mac:InterfaceLib:Interface.mcp", "Carbon Interfaces (Lite)"); + } + else { + BuildProject(":mozilla:lib:mac:InterfaceLib:Interface.mcp", "Carbon Interfaces"); + } + } + else + { + if ($UNIVERSAL_INTERFACES_VERSION >= 0x0330) { + BuildProject(":mozilla:lib:mac:InterfaceLib:Interface.mcp", "MacOS Interfaces (3.3)"); + } else { + BuildProject(":mozilla:lib:mac:InterfaceLib:Interface.mcp", "MacOS Interfaces"); + } + } + + #// Build all of the startup libraries, for Application, Component, and Shared Libraries. These are + #// required for all subsequent libraries in the system. + BuildProject(":mozilla:lib:mac:NSStartup:NSStartup.mcp", "NSStartup.all"); + + #// for NSRuntime under Carbon, don't use BuildOneProject to alias the shlb or the xsym since the + #// target names differ from the output names. Make them by hand instead. + if ( $main::CARBON ) { + if ($main::PROFILE) { + BuildOneProject(":mozilla:lib:mac:NSRuntime:NSRuntime.mcp", "NSRuntimeCarbonProfil.shlb", 0, 0, 0); + } + else { + BuildOneProject(":mozilla:lib:mac:NSRuntime:NSRuntime.mcp", "NSRuntimeCarbon$D.shlb", 0, 0, 0); + } + MakeAlias(":mozilla:lib:mac:NSRuntime:NSRuntime$D.shlb", ":mozilla:dist:viewer_debug:Essential Files:"); + if ( $main::ALIAS_SYM_FILES ) { + MakeAlias(":mozilla:lib:mac:NSRuntime:NSRuntime$D.shlb.xSYM", ":mozilla:dist:viewer_debug:Essential Files:"); + } + } + else { + if ($main::PROFILE) { + BuildOneProject(":mozilla:lib:mac:NSRuntime:NSRuntime.mcp", "NSRuntimeProfil.shlb", 0, 0, 0); + MakeAlias(":mozilla:lib:mac:NSRuntime:NSRuntime$D.shlb", ":mozilla:dist:viewer_debug:Essential Files:"); + if ( $main::ALIAS_SYM_FILES ) { + MakeAlias(":mozilla:lib:mac:NSRuntime:NSRuntime$D.shlb.xSYM", ":mozilla:dist:viewer_debug:Essential Files:"); + } + } + else { + BuildOneProject(":mozilla:lib:mac:NSRuntime:NSRuntime.mcp", "NSRuntime$D.shlb", 1, $main::ALIAS_SYM_FILES, 0); + } + } + + BuildProject(":mozilla:lib:mac:MoreFiles:build:MoreFilesPPC.mcp", "MoreFiles.o"); + + #// for MemAllocator under Carbon, right now we have to use the MSL allocators because sfraser's heap zones + #// don't exist in Carbon. Just use different targets. Since this is a static library, we don't have to fuss + #// with the aliases and target name mismatches like we did above. + if ( $main::CARBON ) { + BuildProject(":mozilla:lib:mac:MacMemoryAllocator:MemAllocator.mcp", "MemAllocatorCarbon$D.o"); + } + else { + if ($main::GC_LEAK_DETECTOR) { + BuildProject(":mozilla:gc:boehm:macbuild:gc.mcp", "gc.ppc.lib"); + MakeAlias(":mozilla:gc:boehm:macbuild:gc.PPC.lib", ":mozilla:dist:gc:gc.PPC.lib"); + BuildProject(":mozilla:lib:mac:MacMemoryAllocator:MemAllocator.mcp", "MemAllocatorGC.o"); + } else { + BuildProject(":mozilla:lib:mac:MacMemoryAllocator:MemAllocator.mcp", "MemAllocator$D.o"); + } + } + + BuildOneProject(":mozilla:lib:mac:NSStdLib:NSStdLib.mcp", "NSStdLib$D.shlb", 1, $main::ALIAS_SYM_FILES, 0); + + #// for NSPR under Carbon, have to link against some additional static libraries when NOT building with TARGET_CARBON. + if ( $main::CARBON ) { + BuildOneProject(":mozilla:nsprpub:macbuild:NSPR20PPC.mcp", "NSPR20$D.shlb (Carbon)", 0, 0, 0); + MakeAlias(":mozilla:nsprpub:macbuild:NSPR20$D.shlb", ":mozilla:dist:viewer_debug:Essential Files:"); + if ($main::ALIAS_SYM_FILES) { + MakeAlias(":mozilla:nsprpub:macbuild:NSPR20$D.shlb.xSYM", ":mozilla:dist:viewer_debug:Essential Files:"); + } + } else { + BuildOneProject(":mozilla:nsprpub:macbuild:NSPR20PPC.mcp", "NSPR20$D.shlb", 1, $main::ALIAS_SYM_FILES, 0); + } + + print("--- Runtime projects complete ----\n"); +} + + +#//-------------------------------------------------------------------------------------------------- +#// Build common projects +#//-------------------------------------------------------------------------------------------------- + +sub BuildCommonProjects() +{ + unless( $main::build{common} ) { return; } + assertRightDirectory(); + + # $D becomes a suffix to target names for selecting either the debug or non-debug target of a project + my($D) = $main::DEBUG ? "Debug" : ""; + + + print("--- Starting Common projects ----\n"); + + #// + #// Shared libraries + #// + + BuildOneProject(":mozilla:modules:libreg:macbuild:libreg.mcp", "libreg$D.shlb", 1, $main::ALIAS_SYM_FILES, 0); + BuildOneProject(":mozilla:xpcom:macbuild:xpcomPPC.mcp", "xpcom$D.shlb", 1, $main::ALIAS_SYM_FILES, 0); + BuildOneProject(":mozilla:js:macbuild:JavaScript.mcp", "JavaScript$D.shlb", 1, $main::ALIAS_SYM_FILES, 0); + BuildOneProject(":mozilla:js:macbuild:JSLoader.mcp", "JSLoader$D.shlb", 1, $main::ALIAS_SYM_FILES, 1); + BuildOneProject(":mozilla:js:macbuild:LiveConnect.mcp", "LiveConnect$D.shlb", 1, $main::ALIAS_SYM_FILES, 0); + + BuildOneProject(":mozilla:modules:zlib:macbuild:zlib.mcp", "zlib$D.shlb", 1, $main::ALIAS_SYM_FILES, 0); + BuildOneProject(":mozilla:modules:zlib:macbuild:zlib.mcp", "zlib$D.Lib", 0, 0, 0); + BuildOneProject(":mozilla:modules:libjar:macbuild:libjar.mcp", "libjar$D.shlb", 1, $main::ALIAS_SYM_FILES, 1); + BuildOneProject(":mozilla:modules:libjar:macbuild:libjar.mcp", "libjar$D.Lib", 0, 0, 0); + + BuildOneProject(":mozilla:modules:oji:macbuild:oji.mcp", "oji$D.shlb", 1, $main::ALIAS_SYM_FILES, 0); + BuildOneProject(":mozilla:caps:macbuild:Caps.mcp", "Caps$D.shlb", 1, $main::ALIAS_SYM_FILES, 1); + BuildOneProject(":mozilla:modules:libpref:macbuild:libpref.mcp", "libpref$D.shlb", 1, $main::ALIAS_SYM_FILES, 1); + BuildOneProject(":mozilla:js:macbuild:XPConnect.mcp", "XPConnect$D.shlb", 1, $main::ALIAS_SYM_FILES, 1); + BuildOneProject(":mozilla:modules:libutil:macbuild:libutil.mcp", "libutil$D.shlb", 1, $main::ALIAS_SYM_FILES, 0); + + BuildOneProject(":mozilla:db:mork:macbuild:mork.mcp", "Mork$D.shlb", 1, $main::ALIAS_SYM_FILES, 1); + BuildOneProject(":mozilla:dbm:macbuild:DBM.mcp", "DBM$D.o", 0, 0, 0); + + #// Static libraries + # Static Lib + BuildOneProject(":mozilla:modules:appfilelocprovider:macbuild:appfilelocprovider.mcp", "appfilelocprovider$D.o", 0, 0, 0); + MakeAlias(":mozilla:modules:appfilelocprovider:macbuild:appfilelocprovider$D.o", ":mozilla:dist:appfilelocprovider:"); + + + + print("--- Common projects complete ----\n"); +} + +#//-------------------------------------------------------------------------------------------------- +#// Build imglib projects +#//-------------------------------------------------------------------------------------------------- + +sub BuildImglibProjects() +{ + unless( $main::build{imglib} ) { return; } + + # $D becomes a suffix to target names for selecting either the debug or non-debug target of a project + my($D) = $main::DEBUG ? "Debug" : ""; + + print("--- Starting Imglib projects ----\n"); + + BuildOneProject(":mozilla:jpeg:macbuild:JPEG.mcp", "JPEG$D.o", 0, 0, 0); + BuildOneProject(":mozilla:modules:libimg:macbuild:png.mcp", "png$D.o", 0, 0, 0); + BuildOneProject(":mozilla:modules:libimg:macbuild:libimg.mcp", "libimg$D.shlb", 1, $main::ALIAS_SYM_FILES, 0); + BuildOneProject(":mozilla:modules:libimg:macbuild:gifdecoder.mcp", "gifdecoder$D.shlb", 1, $main::ALIAS_SYM_FILES, 1); + BuildOneProject(":mozilla:modules:libimg:macbuild:pngdecoder.mcp", "pngdecoder$D.shlb", 1, $main::ALIAS_SYM_FILES, 1); + BuildOneProject(":mozilla:modules:libimg:macbuild:jpgdecoder.mcp", "jpgdecoder$D.shlb", 1, $main::ALIAS_SYM_FILES, 1); + + # MNG + if ($main::options{mng}) + { + BuildOneProject(":mozilla:modules:libimg:macbuild:mng.mcp", "mng$D.o", 0, 0, 0); + BuildOneProject(":mozilla:modules:libimg:macbuild:mngdecoder.mcp", "mngdecoder$D.shlb", 1, $main::ALIAS_SYM_FILES, 1); + } + + print("--- Imglib projects complete ----\n"); +} # imglib + + +#//-------------------------------------------------------------------------------------------------- +#// Build international projects +#//-------------------------------------------------------------------------------------------------- + +sub BuildInternationalProjects() +{ + unless( $main::build{intl} ) { return; } + + # $D becomes a suffix to target names for selecting either the debug or non-debug target of a project + my($D) = $main::DEBUG ? "Debug" : ""; + + print("--- Starting International projects ----\n"); + + BuildOneProject(":mozilla:intl:chardet:macbuild:chardet.mcp", "chardet$D.shlb", 1, $main::ALIAS_SYM_FILES, 1); + BuildOneProject(":mozilla:intl:uconv:macbuild:uconv.mcp", "uconv$D.shlb", 1, $main::ALIAS_SYM_FILES, 1); + BuildOneProject(":mozilla:intl:uconv:macbuild:ucvlatin.mcp", "ucvlatin$D.shlb", 1, $main::ALIAS_SYM_FILES, 1); + BuildOneProject(":mozilla:intl:uconv:macbuild:ucvja.mcp", "ucvja$D.shlb", 1, $main::ALIAS_SYM_FILES, 1); + BuildOneProject(":mozilla:intl:uconv:macbuild:ucvtw.mcp", "ucvtw$D.shlb", 1, $main::ALIAS_SYM_FILES, 1); + BuildOneProject(":mozilla:intl:uconv:macbuild:ucvtw2.mcp", "ucvtw2$D.shlb", 1, $main::ALIAS_SYM_FILES, 1); + BuildOneProject(":mozilla:intl:uconv:macbuild:ucvcn.mcp", "ucvcn$D.shlb", 1, $main::ALIAS_SYM_FILES, 1); + BuildOneProject(":mozilla:intl:uconv:macbuild:ucvko.mcp", "ucvko$D.shlb", 1, $main::ALIAS_SYM_FILES, 1); + BuildOneProject(":mozilla:intl:uconv:macbuild:ucvibm.mcp", "ucvibm$D.shlb", 1, $main::ALIAS_SYM_FILES, 1); + BuildOneProject(":mozilla:intl:unicharutil:macbuild:unicharutil.mcp", "unicharutil$D.shlb", 1, $main::ALIAS_SYM_FILES, 1); + BuildOneProject(":mozilla:intl:locale:macbuild:locale.mcp", "nslocale$D.shlb", 1, $main::ALIAS_SYM_FILES, 1); + BuildOneProject(":mozilla:intl:lwbrk:macbuild:lwbrk.mcp", "lwbrk$D.shlb", 1, $main::ALIAS_SYM_FILES, 1); + BuildOneProject(":mozilla:intl:strres:macbuild:strres.mcp", "strres$D.shlb", 1, $main::ALIAS_SYM_FILES, 1); + +# BuildOneProject(":mozilla:intl:uconv:macbuild:ucvja2.mcp", "ucvja2$D.shlb", 1, $main::ALIAS_SYM_FILES, 1); +# BuildOneProject(":mozilla:intl:uconv:macbuild:ucvvt.mcp", "ucvvt$D.shlb", 1, $main::ALIAS_SYM_FILES, 1); +# BuildOneProject(":mozilla:intl:uconv:macbuild:ucvth.mcp", "ucvth$D.shlb", 1, $main::ALIAS_SYM_FILES, 1); + + print("--- International projects complete ----\n"); +} # intl + + +#//-------------------------------------------------------------------------------------------------- +#// Build Necko projects +#//-------------------------------------------------------------------------------------------------- + +sub BuildNeckoProjects() +{ + unless( $main::build{necko} ) { return; } + + # $D becomes a suffix to target names for selecting either the debug or non-debug target of a project + my($D) = $main::DEBUG ? "Debug" : ""; + + print("--- Starting Necko projects ----\n"); + + if ( $main::CARBON ) { + BuildOneProject(":mozilla:netwerk:macbuild:netwerk.mcp", "Necko$D.shlb (Carbon)", 0, 0, 0); + MakeAlias(":mozilla:netwerk:macbuild:Necko$D.shlb", ":mozilla:dist:viewer_debug:Components:"); + if ($main::ALIAS_SYM_FILES) { + MakeAlias(":mozilla:netwerk:macbuild:Necko$D.shlb.xSYM", ":mozilla:dist:viewer_debug:Components:"); + } + } else { + BuildOneProject(":mozilla:netwerk:macbuild:netwerk.mcp", "Necko$D.shlb", 1, $main::ALIAS_SYM_FILES, 1); + } + + BuildOneProject(":mozilla:netwerk:macbuild:netwerk2.mcp", "Necko2$D.shlb", 1, $main::ALIAS_SYM_FILES, 1); + BuildOneProject(":mozilla:dom:src:jsurl:macbuild:JSUrl.mcp", "JSUrl$D.shlb", 1, $main::ALIAS_SYM_FILES, 1); + + print("--- Necko projects complete ----\n"); +} # necko + + +#//-------------------------------------------------------------------------------------------------- +#// Build Security projects +#//-------------------------------------------------------------------------------------------------- + +sub makeprops +{ + @ARGV = @_; + + do ":mozilla:security:psm:ui:makeprops.pl"; +} + +sub BuildSecurityProjects() +{ + unless( $main::build{security} ) { return; } + + # $D becomes a suffix to target names for selecting either the debug or non-debug target of a project + my($D) = $main::DEBUG ? "Debug" : ""; + my $dist_dir = GetDistDirectory(); # the subdirectory with the libs and executable. + + print("--- Starting Security projects ----\n"); + + BuildOneProject(":mozilla:security:nss:macbuild:NSS.mcp","NSS$D.o", 0, 0, 0); + BuildOneProject(":mozilla:security:psm:lib:macbuild:PSMClient.mcp","PSMClient$D.o", 0, 0, 0); + BuildOneProject(":mozilla:security:psm:lib:macbuild:PSMProtocol.mcp","PSMProtocol$D.o", 0, 0, 0); + BuildOneProject(":mozilla:security:psm:macbuild:PersonalSecurityMgr.mcp","PSMStubs$D.shlb", 0, 0, 0); + BuildOneProject(":mozilla:extensions:psm-glue:macbuild:PSMGlue.mcp","PSMGlue$D.shlb", 1, $main::ALIAS_SYM_FILES, 1); + + # make properties files for PSM User Interface + my($src_dir) = ":mozilla:security:psm:ui:"; + + opendir(DIR,$src_dir) || die "can't open directory $src_dir\n"; + my(@prop_files) = grep { /\.properties.in$/ } readdir(DIR); + closedir DIR; + my($psm_data_dir) = $dist_dir."psmdata:"; + mkdir($psm_data_dir, 0); + my($dest_dir) = $psm_data_dir."UI:"; + mkdir($dest_dir, 0); + my($file); + foreach $file (@prop_files) { + $file =~ /(.+\.properties)\.in$/; + &makeprops($src_dir.$file, $dest_dir.$1); + } + + + my($doc_dir) = $psm_data_dir."doc:"; + mkdir($doc_dir, 0); + opendir(DOC_DIR,":mozilla:security:psm:doc") || die ("Unable to open PSM doc directory"); + my(@doc_files); + @doc_files = readdir(DOC_DIR); + closedir(DOC_DIR); + foreach $file (@doc_files) { + copy(":mozilla:security:psm:doc:".$file, $doc_dir.$file); + } + + print("--- Security projects complete ----\n"); +} # Security + + +#//-------------------------------------------------------------------------------------------------- +#// Build Browser utils projects +#//-------------------------------------------------------------------------------------------------- + +sub BuildBrowserUtilsProjects() +{ + unless( $main::build{browserutils} ) { return; } + + # $D becomes a suffix to target names for selecting either the debug or non-debug target of a project + my($D) = $main::DEBUG ? "Debug" : ""; + + print("--- Starting Browser utils projects ----\n"); + + BuildOneProject(":mozilla:uriloader:macbuild:uriLoader.mcp", "uriLoader$D.shlb", 1, $main::ALIAS_SYM_FILES, 1); + BuildOneProject(":mozilla:uriloader:extprotocol:mac:extProtocol.mcp", "extProtocol$D.shlb", 1, $main::ALIAS_SYM_FILES, 1); + + BuildOneProject(":mozilla:profile:macbuild:profile.mcp", "profile$D.shlb", 1, $main::ALIAS_SYM_FILES, 1); + BuildOneProject(":mozilla:profile:pref-migrator:macbuild:prefmigrator.mcp", "prefm$D.shlb", 1, $main::ALIAS_SYM_FILES, 1); + + BuildOneProject(":mozilla:extensions:cookie:macbuild:cookie.mcp", "Cookie$D.shlb", 1, $main::ALIAS_SYM_FILES, 1); + BuildOneProject(":mozilla:extensions:wallet:macbuild:wallet.mcp", "Wallet$D.shlb", 1, $main::ALIAS_SYM_FILES, 1); + BuildOneProject(":mozilla:extensions:wallet:macbuild:walletviewers.mcp", "WalletViewers$D.shlb", 1, $main::ALIAS_SYM_FILES, 1); + + BuildOneProject(":mozilla:rdf:chrome:build:chrome.mcp", "ChomeRegistry$D.shlb", 1, $main::ALIAS_SYM_FILES, 1); + + BuildOneProject(":mozilla:rdf:tests:domds:macbuild:DOMDataSource.mcp", "DOMDataSource$D.shlb", 1, $main::ALIAS_SYM_FILES, 1); + + print("--- Browser utils projects complete ----\n"); +} # browserutils + + +#//-------------------------------------------------------------------------------------------------- +#// Build NGLayout +#//-------------------------------------------------------------------------------------------------- + +sub BuildLayoutProjects() +{ + unless( $main::build{nglayout} ) { return; } + assertRightDirectory(); + + # $D becomes a suffix to target names for selecting either the debug or non-debug target of a project + my($D) = $main::DEBUG ? "Debug" : ""; + my($dist_dir) = GetDistDirectory(); + + print("--- Starting Layout projects ---\n"); + + open(OUTPUT, ">:mozilla:layout:build:gbdate.h") || die "could not open gbdate.h"; + my($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime; + # localtime returns year minus 1900 + $year = $year + 1900; + printf(OUTPUT "#define PRODUCT_VERSION \"%04d%02d%02d\"\n", $year, 1+$mon, $mday); + close(OUTPUT); + #// + #// Build Layout projects + #// + + BuildOneProject(":mozilla:expat:macbuild:expat.mcp", "expat$D.o", 0, 0, 0); + BuildOneProject(":mozilla:htmlparser:macbuild:htmlparser.mcp", "htmlparser$D.shlb", 1, $main::ALIAS_SYM_FILES, 1); + BuildOneProject(":mozilla:gfx:macbuild:gfx.mcp", "gfx$D.shlb", 1, $main::ALIAS_SYM_FILES, 0); + BuildOneProject(":mozilla:dom:macbuild:dom.mcp", "dom$D.shlb", 1, $main::ALIAS_SYM_FILES, 0); + BuildOneProject(":mozilla:modules:plugin:macbuild:plugin.mcp", "plugin$D.shlb", 1, $main::ALIAS_SYM_FILES, 1); + BuildOneProject(":mozilla:layout:macbuild:layoutxsl.mcp", "layoutxsl$D.o", 0, 0, 0); + if ($main::options{mathml}) + { + BuildOneProject(":mozilla:layout:macbuild:layoutmathml.mcp", "layoutmathml$D.o", 0, 0, 0); + } + else + { + BuildOneProject(":mozilla:layout:macbuild:layoutmathml.mcp", "layoutmathml$D.o stub", 0, 0, 0); + } + if ($main::options{svg}) + { + BuildOneProject(":mozilla:layout:macbuild:layoutsvg.mcp", "layoutsvg$D.o", 0, 0, 0); + } + else + { + BuildOneProject(":mozilla:layout:macbuild:layoutsvg.mcp", "layoutsvg$D.o stub", 0, 0, 0); + } + BuildOneProject(":mozilla:layout:macbuild:layout.mcp", "layout$D.shlb", 1, $main::ALIAS_SYM_FILES, 1); + BuildOneProject(":mozilla:view:macbuild:view.mcp", "view$D.shlb", 1, $main::ALIAS_SYM_FILES, 1); + BuildOneProject(":mozilla:widget:macbuild:widget.mcp", "widget$D.shlb", 1, $main::ALIAS_SYM_FILES, 0); + BuildOneProject(":mozilla:docshell:macbuild:docshell.mcp", "docshell$D.shlb", 1, $main::ALIAS_SYM_FILES, 1); + BuildOneProject(":mozilla:webshell:embed:mac:RaptorShell.mcp", "RaptorShell$D.shlb", 1, $main::ALIAS_SYM_FILES, 0); + + #// XXX this is here because of a very TEMPORARY dependency + BuildOneProject(":mozilla:rdf:macbuild:rdf.mcp", "RDFLibrary$D.shlb", 1, $main::ALIAS_SYM_FILES, 1); + + BuildOneProject(":mozilla:xpinstall:macbuild:xpinstall.mcp", "xpinstall$D.shlb", 1, $main::ALIAS_SYM_FILES, 1); + BuildOneProject(":mozilla:xpinstall:macbuild:xpistub.mcp", "xpistub$D.shlb", 1, $main::ALIAS_SYM_FILES, 0); + if (!($main::PROFILE)) { + BuildOneProject(":mozilla:xpinstall:wizard:mac:macbuild:MIW.mcp", "Mozilla Installer$D", 0, 0, 0); + } + print("--- Layout projects complete ---\n"); +} + + +#//-------------------------------------------------------------------------------------------------- +#// Build Editor Projects +#//-------------------------------------------------------------------------------------------------- + +sub BuildEditorProjects() +{ + unless( $main::build{editor} ) { return; } + assertRightDirectory(); + + # $D becomes a suffix to target names for selecting either the debug or non-debug target of a project + my($D) = $main::DEBUG ? "Debug" : ""; + my($dist_dir) = GetDistDirectory(); + + print("--- Starting Editor projects ----\n"); + + BuildOneProject(":mozilla:editor:txmgr:macbuild:txmgr.mcp", "EditorTxmgr$D.shlb", 1, $main::ALIAS_SYM_FILES, 1); + BuildOneProject(":mozilla:editor:txtsvc:macbuild:txtsvc.mcp", "TextServices$D.shlb", 1, $main::ALIAS_SYM_FILES, 1); + BuildOneProject(":mozilla:editor:macbuild:editor.mcp", "EditorCore$D.shlb", 1, $main::ALIAS_SYM_FILES, 1); + + print("--- Editor projects complete ----\n"); +} + + +#//-------------------------------------------------------------------------------------------------- +#// Build Viewer Projects +#//-------------------------------------------------------------------------------------------------- + +sub BuildViewerProjects() +{ + unless( $main::build{viewer} ) { return; } + assertRightDirectory(); + + # $D becomes a suffix to target names for selecting either the debug or non-debug target of a project + my($D) = $main::DEBUG ? "Debug" : ""; + my($dist_dir) = GetDistDirectory(); + + print("--- Starting Viewer projects ----\n"); + + BuildOneProject(":mozilla:webshell:tests:viewer:mac:viewer.mcp", "viewer$D", 0, 0, 0); + BuildOneProject(":mozilla:embedding:browser:macbuild:webBrowser.mcp", "webBrowser$D.shlb", 1, $main::ALIAS_SYM_FILES, 1); + + print("--- Viewer projects complete ----\n"); +} + + +#//-------------------------------------------------------------------------------------------------- +#// Build XPApp Projects +#//-------------------------------------------------------------------------------------------------- + +sub BuildXPAppProjects() +{ + unless( $main::build{xpapp} ) { return; } + assertRightDirectory(); + + # $D becomes a suffix to target names for selecting either the debug or non-debug target of a project + my($D) = $main::DEBUG ? "Debug" : ""; + my($dist_dir) = GetDistDirectory(); + + print("--- Starting XPApp projects ----\n"); + + # Components + BuildOneProject(":mozilla:xpfe:components:find:macbuild:FindComponent.mcp", "FindComponent$D.shlb", 1, $main::ALIAS_SYM_FILES, 1); + BuildOneProject(":mozilla:xpfe:components:ucth:macbuild:ucth.mcp", "ucth$D.shlb", 1, $main::ALIAS_SYM_FILES, 1); + BuildOneProject(":mozilla:xpfe:components:xfer:macbuild:xfer.mcp", "xfer$D.shlb", 1, $main::ALIAS_SYM_FILES, 1); + BuildOneProject(":mozilla:xpfe:components:regviewer:RegViewer.mcp", "RegViewer$D.shlb", 1, $main::ALIAS_SYM_FILES, 1); + BuildOneProject(":mozilla:xpfe:components:shistory:macbuild:shistory.mcp", "shistory$D.shlb", 1, $main::ALIAS_SYM_FILES, 1); + BuildOneProject(":mozilla:xpfe:components:macbuild:appcomps.mcp", "appcomps$D.shlb", 1, $main::ALIAS_SYM_FILES, 1); + + # Applications + BuildOneProject(":mozilla:xpfe:appshell:macbuild:AppShell.mcp", "AppShell$D.shlb", 1, $main::ALIAS_SYM_FILES, 1); + BuildOneProject(":mozilla:xpfe:browser:macbuild:mozBrowser.mcp", "mozBrowser$D.shlb", 1, $main::ALIAS_SYM_FILES, 1); + + print("--- XPApp projects complete ----\n"); +} + + +#//-------------------------------------------------------------------------------------------------- +#// Build Extensions Projects +#//-------------------------------------------------------------------------------------------------- + +sub BuildExtensionsProjects() +{ + unless( $main::build{extensions} ) { return; } + assertRightDirectory(); + + # $D becomes a suffix to target names for selecting either the debug or non-debug target of a project + my($D) = $main::DEBUG ? "Debug" : ""; + my($dist_dir) = GetDistDirectory(); + + print("--- Starting Extensions projects ----\n"); + + my($chrome_subdir) = "Chrome:"; + my($chrome_dir) = "$dist_dir"."$chrome_subdir"; + + # Chatzilla + my($packages_chrome_dir) = "$chrome_dir" . "packages:"; + my($chatzilla_packages_chrome_dir) = "$packages_chrome_dir"."chatzilla:"; + my($chatzilla_chatzilla_packages_chrome_dir) = "$chatzilla_packages_chrome_dir"."chatzilla:"; + + my($chatzillaContent) = "$chatzilla_chatzilla_packages_chrome_dir"."content:"; + + my($chatzillaLocale) = "$chatzilla_chatzilla_packages_chrome_dir"."locale:"; + + my($chatzillaSkin) = "$chatzilla_chatzilla_packages_chrome_dir"."skin:"; + + + my($chatzillaContentLibJS) = "$chatzillaContent"."lib:js:"; + my($chatzillaContentLibXul) = "$chatzillaContent"."lib:xul:"; + InstallResources(":mozilla:extensions:irc:js:lib:MANIFEST", "$chatzillaContentLibJS"); + InstallResources(":mozilla:extensions:irc:js:lib:MANIFEST_COMPONENTS", "${dist_dir}Components"); + InstallResources(":mozilla:extensions:irc:xul:lib:MANIFEST", "$chatzillaContentLibXul"); + InstallResources(":mozilla:extensions:irc:xul:content:MANIFEST", "$chatzillaContent"); + InstallResources(":mozilla:extensions:irc:xul:skin:MANIFEST", "$chatzillaSkin"); + + my($chatzillaSkinImages) = "$chatzillaSkin"."images:"; + InstallResources(":mozilla:extensions:irc:xul:skin:images:MANIFEST", "$chatzillaSkinImages"); + InstallResources(":mozilla:extensions:irc:xul:locale:en-US:MANIFEST", "$chatzillaLocale", 0); + + # XML-RPC (whatever that is) + InstallFromManifest(":mozilla:extensions:xml-rpc:src:MANIFEST_COMPONENTS", "${dist_dir}Components"); + + # Component viewer + my($cview_cview_packages_chrome_dir) = "$packages_chrome_dir"."cview:cview:"; + + my($cviewContent) = "$cview_cview_packages_chrome_dir"."content:"; + my($cviewLocale) = "$cview_cview_packages_chrome_dir"."locale:"; + my($cviewSkin) = "$cview_cview_packages_chrome_dir"."skin:"; + + InstallResources(":mozilla:extensions:cview:resources:content:MANIFEST", "$cviewContent"); + InstallResources(":mozilla:extensions:cview:resources:skin:MANIFEST", "$cviewSkin"); + InstallResources(":mozilla:extensions:cview:resources:locale:en-US:MANIFEST", "$cviewLocale", 0); + + # Transformiix + if ($main::options{transformiix}) + { + BuildOneProject(":mozilla:extensions:transformiix:macbuild:transformiix.mcp", "transformiix$D.shlb", 1, $main::ALIAS_SYM_FILES, 1); + + my($transformiix_transformiix_packages_chrome_dir) = "$packages_chrome_dir"."transformiix:transformiix:"; + + my($transformiixContent) = "$transformiix_transformiix_packages_chrome_dir"."content:"; + my($transformiixLocale) = "$transformiix_transformiix_packages_chrome_dir"."locale:"; + my($transformiixSkin) = "$transformiix_transformiix_packages_chrome_dir"."skin:"; + + InstallResources(":mozilla:extensions:transformiix:source:examples:mozilla:transformiix:content:MANIFEST", "$transformiixContent"); + InstallResources(":mozilla:extensions:transformiix:source:examples:mozilla:transformiix:skin:MANIFEST", "$transformiixSkin"); + InstallResources(":mozilla:extensions:transformiix:source:examples:mozilla:transformiix:locale:en-US:MANIFEST", "$transformiixLocale", 0); + } + + # LDAP Client + if ($main::options{ldap}) + { + BuildOneProject(":mozilla:directory:c-sdk:ldap:libraries:macintosh:LDAPClient.mcp", "LDAPClient$D.shlb", 1, $main::ALIAS_SYM_FILES, 0); + BuildOneProject(":mozilla:directory:xpcom:macbuild:mozldap.mcp", "mozldap$D.shlb", 1, $main::ALIAS_SYM_FILES, 1); + } + + # XML Extras + if ($main::options{xmlextras}) + { + BuildOneProject(":mozilla:extensions:xmlextras:macbuild:xmlextras.mcp", "xmlextras$D.shlb", 1, $main::ALIAS_SYM_FILES, 1); + } + + print("--- Extensions projects complete ----\n"); +} + +#//-------------------------------------------------------------------------------------------------- +#// Build Plugins Projects +#//-------------------------------------------------------------------------------------------------- + +sub ImportXMLProject($$) +{ + my ($xml_path, $project_path) = @_; + my ($codewarrior_ide_name) = getCodeWarriorIDEName(); + my $ascript = < $project_modtime) { + print("MRJPlugin.mcp is out of date, reimporting from MRJPlugin.xml.\n"); + # delete the old project file. + unlink($project_path); + # import the xml project. + ImportXMLProject(full_path_to($xml_path), full_path_to($project_path)); + } + + # Build MRJPlugin + BuildProject($project_path, "MRJPlugin"); + # Build MRJPlugin.jar (if Java tools exist) + my($linker_path) = getCodeWarriorPath("CodeWarrior Plugins:Linkers:Java Linker"); + if (-e $linker_path) { + print("CodeWarrior Java tools detected, building MRJPlugin.jar.\n"); + BuildProject($project_path, "MRJPlugin.jar"); + } + # Copy MRJPlugin, MRJPlugin.jar to appropriate plugins folder. + my($plugin_dist) = GetDistDirectory() . "Plugins:"; + MakeAlias($plugin_path . "MRJPlugin", $plugin_dist); + MakeAlias($plugin_path . "MRJPlugin.jar", $plugin_dist); +} + +#//-------------------------------------------------------------------------------------------------- +#// Build MailNews Projects +#//-------------------------------------------------------------------------------------------------- + +sub BuildMailNewsProjects() +{ + unless( $main::build{mailnews} ) { return; } + assertRightDirectory(); + + # $D becomes a suffix to target names for selecting either the debug or non-debug target of a project + my($D) = $main::DEBUG ? "Debug" : ""; + my($dist_dir) = GetDistDirectory(); + + print("--- Starting MailNews projects ----\n"); + + BuildOneProject(":mozilla:mailnews:base:util:macbuild:msgUtil.mcp", "MsgUtil$D.lib", 0, 0, 0); + BuildOneProject(":mozilla:mailnews:base:macbuild:msgCore.mcp", "mailnews$D.shlb", 1, $main::ALIAS_SYM_FILES, 1); + BuildOneProject(":mozilla:mailnews:compose:macbuild:msgCompose.mcp", "MsgCompose$D.shlb", 1, $main::ALIAS_SYM_FILES, 1); + BuildOneProject(":mozilla:mailnews:db:macbuild:msgDB.mcp", "MsgDB$D.shlb", 1, $main::ALIAS_SYM_FILES, 1); + BuildOneProject(":mozilla:mailnews:local:macbuild:msglocal.mcp", "MsgLocal$D.shlb", 1, $main::ALIAS_SYM_FILES, 1); + BuildOneProject(":mozilla:mailnews:imap:macbuild:msgimap.mcp", "MsgImap$D.shlb", 1, $main::ALIAS_SYM_FILES, 1); + BuildOneProject(":mozilla:mailnews:news:macbuild:msgnews.mcp", "MsgNews$D.shlb", 1, $main::ALIAS_SYM_FILES, 1); + BuildOneProject(":mozilla:mailnews:addrbook:macbuild:msgAddrbook.mcp", "MsgAddrbook$D.shlb", 1, $main::ALIAS_SYM_FILES, 1); + BuildOneProject(":mozilla:mailnews:absync:macbuild:AbSync.mcp", "AbSyncSvc$D.shlb", 1, $main::ALIAS_SYM_FILES, 1); + BuildOneProject(":mozilla:mailnews:mime:macbuild:mime.mcp", "Mime$D.shlb", 1, $main::ALIAS_SYM_FILES, 1); + BuildOneProject(":mozilla:mailnews:mime:emitters:macbuild:mimeEmitter.mcp", "mimeEmitter$D.shlb", 1, $main::ALIAS_SYM_FILES, 1); + BuildOneProject(":mozilla:mailnews:mime:cthandlers:vcard:macbuild:vcard.mcp", "vcard$D.shlb", 1, $main::ALIAS_SYM_FILES, 1); + BuildOneProject(":mozilla:mailnews:mime:cthandlers:smimestub:macbuild:smime.mcp", "smime$D.shlb", 1, $main::ALIAS_SYM_FILES, 1); + BuildOneProject(":mozilla:mailnews:mime:cthandlers:signstub:macbuild:signed.mcp", "signed$D.shlb", 1, $main::ALIAS_SYM_FILES, 1); +# BuildOneProject(":mozilla:mailnews:mime:cthandlers:calendar:macbuild:calendar.mcp", "calendar$D.shlb", 1, $main::ALIAS_SYM_FILES, 1); + BuildOneProject(":mozilla:mailnews:import:macbuild:msgImport.mcp", "msgImport$D.shlb", 1, $main::ALIAS_SYM_FILES, 1); + BuildOneProject(":mozilla:mailnews:import:text:macbuild:msgImportText.mcp", "msgImportText$D.shlb", 1, $main::ALIAS_SYM_FILES, 1); + BuildOneProject(":mozilla:mailnews:import:eudora:macbuild:msgImportEudora.mcp", "msgImportEudora$D.shlb", 1, $main::ALIAS_SYM_FILES, 1); + + print("--- MailNews projects complete ----\n"); +} + +#//-------------------------------------------------------------------------------------------------- +#// Build Mozilla +#//-------------------------------------------------------------------------------------------------- + +sub BuildMozilla() +{ + unless( $main::build{apprunner} ) { return; } + + assertRightDirectory(); + # $D becomes a suffix to target names for selecting either the debug or non-debug target of a project + my($D) = $main::DEBUG ? "Debug" : ""; + BuildOneProject(":mozilla:xpfe:bootstrap:macbuild:apprunner.mcp", "apprunner$D", 0, 0, 1); + + + # build tool to create Component Registry in release builds only. + if (!($main::DEBUG)) { + BuildOneProject(":mozilla:xpcom:tools:registry:macbuild:RegXPCOM.mcp", "RegXPCOM", 0, 0, 1); + } + + # copy command line documents into the Apprunner folder and set correctly the signature + my($dist_dir) = GetDistDirectory(); + my($cmd_file_path) = ":mozilla:xpfe:bootstrap:"; + my($cmd_file) = ""; + + $cmd_file = "Mozilla Select Profile"; + copy( $cmd_file_path . "Mozilla_Select_Profile", $dist_dir . $cmd_file ); + MacPerl::SetFileInfo("MOZZ", "CMDL", $dist_dir . $cmd_file); + + $cmd_file = "Mozilla Profile Wizard"; + copy( $cmd_file_path . "Mozilla_Profile_Wizard", $dist_dir . $cmd_file ); + MacPerl::SetFileInfo("MOZZ", "CMDL", $dist_dir . $cmd_file); + + $cmd_file = "Mozilla Profile Manager"; + copy( $cmd_file_path . "Mozilla_Profile_Manager", $dist_dir . $cmd_file ); + MacPerl::SetFileInfo("MOZZ", "CMDL", $dist_dir . $cmd_file); + + $cmd_file = "Mozilla Profile Migration"; + copy( $cmd_file_path . "Mozilla_Installer", $dist_dir . $cmd_file ); + MacPerl::SetFileInfo("MOZZ", "CMDL", $dist_dir . $cmd_file); + + $cmd_file = "Mozilla Addressbook"; + copy( $cmd_file_path . "Mozilla_Addressbook", $dist_dir . $cmd_file ); + MacPerl::SetFileInfo("MOZZ", "CMDL", $dist_dir . $cmd_file); + + $cmd_file = "Mozilla Editor"; + copy( $cmd_file_path . "Mozilla_Editor", $dist_dir . $cmd_file ); + MacPerl::SetFileInfo("MOZZ", "CMDL", $dist_dir . $cmd_file); + + $cmd_file = "Mozilla Message Compose"; + copy( $cmd_file_path . "Mozilla_Message_Compose", $dist_dir . $cmd_file ); + MacPerl::SetFileInfo("MOZZ", "CMDL", $dist_dir . $cmd_file); + + $cmd_file = "Mozilla Messenger"; + copy( $cmd_file_path . "Mozilla_Messenger", $dist_dir . $cmd_file ); + MacPerl::SetFileInfo("MOZZ", "CMDL", $dist_dir . $cmd_file); + + $cmd_file = "Mozilla Preferences"; + copy( $cmd_file_path . "Mozilla_Preference", $dist_dir . $cmd_file ); + MacPerl::SetFileInfo("MOZZ", "CMDL", $dist_dir . $cmd_file); + + $cmd_file = "NSPR Logging"; + copy( $cmd_file_path . "Mozilla_NSPR_Log", $dist_dir . $cmd_file ); + MacPerl::SetFileInfo("MOZZ", "CMDL", $dist_dir . $cmd_file); + + $cmd_file = "Mozilla JavaScript Console"; + copy( $cmd_file_path . "Mozilla_JavaScript_Console", $dist_dir . $cmd_file ); + MacPerl::SetFileInfo("MOZZ", "CMDL", $dist_dir . $cmd_file); + + $cmd_file = "Mozilla Bloat URLs"; + copy( $cmd_file_path . "Mozilla_Bloat_URLs", $dist_dir . $cmd_file ); + MacPerl::SetFileInfo("MOZZ", "CMDL", $dist_dir . $cmd_file); + copy( ":mozilla:build:bloaturls.txt", $dist_dir . "bloaturls.txt" ); +} + + +#//-------------------------------------------------------------------------------------------------- +#// Build everything +#//-------------------------------------------------------------------------------------------------- + +sub BuildProjects() +{ + MakeLibAliases(); + + # activate CodeWarrior + ActivateApplication('CWIE'); + + BuildIDLProjects(); + BuildStubs(); + BuildRuntimeProjects(); + BuildCommonProjects(); + BuildImglibProjects(); + BuildNeckoProjects(); + BuildSecurityProjects(); + BuildBrowserUtilsProjects(); + BuildInternationalProjects(); + BuildLayoutProjects(); + BuildEditorProjects(); + BuildViewerProjects(); + BuildXPAppProjects(); + BuildExtensionsProjects(); + BuildPluginsProjects(); + BuildMailNewsProjects(); + BuildMozilla(); + + # do this last so as not to pollute dist with non-include files + # before building projects. + # activate CodeWarrior + ActivateApplication('McPL'); + + if ($main::options{jar_manifests}) + { + MakeNonChromeAliases(); # Defaults, JS components etc. + + BuildJarFiles(); + } + else + { + MakeResourceAliases(); + # this builds installed_chrome.txt + InstallManifestRDFFiles(); + } + + # Set the default skin to be classic + SetDefaultSkin("classic/1.0"); +} + +#//-------------------------------------------------------------------------------------------------- +#// RunBuild +#//-------------------------------------------------------------------------------------------------- +sub RunBuild($$) +{ + my($do_pull, $do_build) = @_; + + SetupBuildLog($main::USE_TIMESTAMPED_LOGS); + + StopForErrors(); + #DontStopForErrors(); + + SetupBuildParams(\%main::pull, \%main::build, \%main::options, \%main::optiondefines, "Mozilla debug build prefs"); + + ConfigureBuildSystem(); + + if ($do_pull) { + Checkout(); + } + + unless ($do_build) { return; } + + if (!$main::DEBUG) { + SetBuildNumber(); + } + + chdir($main::MOZ_SRC); + BuildDist(); + + chdir($main::MOZ_SRC); + BuildProjects(); + + print "Build complete\n"; +} + diff --git a/build/mac/build_scripts/PullMozilla.pl b/build/mac/build_scripts/PullMozilla.pl new file mode 100644 index 000000000000..3ac665106368 --- /dev/null +++ b/build/mac/build_scripts/PullMozilla.pl @@ -0,0 +1,49 @@ +#!perl + +# +# The contents of this file are subject to the Netscape 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 mozilla.org code. +# +# 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. +# +# Contributor(s): +# + +# +# nglayout pull script +# +use Mac::Processes; +use MozillaBuildList; +use Cwd; +use Moz; + +#----------------------------------------------- +# hashes to hold build options +#----------------------------------------------- +my(%pull); +my(%build); +my(%options); +my(%optiondefines); + + +my($cur_dir) = cwd(); +$cur_dir =~ s/:mozilla:build:mac:build_scripts$//; +chdir($cur_dir); +$MOZ_SRC = cwd(); + +my($do_checkout) = 1; +my($do_build) = 0; + +RunBuild($do_checkout, $do_build);