diff --git a/mozilla/webtools/build/config.cgi b/mozilla/webtools/build/config.cgi index 80fd0f07c7a..1f79658c20c 100755 --- a/mozilla/webtools/build/config.cgi +++ b/mozilla/webtools/build/config.cgi @@ -25,38 +25,44 @@ # On submit, the cgi prints out a shell script that the user can # save to configure their build. -# Send comments, improvements, bugs to Steve Lamm (slamm@netscape.com). +# Send comments, improvements, bugs to Benjamin Smedberg use CGI; +use CGI::Carp qw(fatalsToBrowser); $query = new CGI; $field_separator = '<>'; $configure_in = 'configure-mirror/mozilla/configure.in'; -$chrome_color = '#F0A000'; $CVSROOT = ':pserver:anonymous@cvs-mirror.mozilla.org:/cvsroot'; $ENV{PATH} = "$ENV{PATH}:/opt/cvs-tools/bin:/usr/local/bin"; # for cvs & m4 %default = ( - 'MOZ_CO_MODULE', 'SeaMonkeyAll', - 'MOZ_CO_BRANCH', 'HEAD', - 'MOZ_OBJDIR', '@TOPSRCDIR@', - 'MOZ_CVS_FLAGS', '-q -z 3', - 'MOZ_CO_FLAGS', '-P', + 'MOZ_CO_MODULE', '', + 'MOZ_CVS_FLAGS', '', + 'MOZ_CO_FLAGS', '', + 'MOZ_OBJDIR', '@TOPSRCDIR@/obj-@CONFIG_GUESS@' ); # Set up pull by date -# + use POSIX qw(strftime); ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time); $default{MOZ_CO_DATE} = strftime("%d %b %Y %H:%M %Z", $sec,$min,$hour,$mday,$mon,$year); %fillin = %default; -$default_objdir_fillin='@TOPSRCDIR@/obj-@CONFIG_GUESS@'; -$fillin{MOZ_OBJDIR} = $default_objdir_fillin; $fillin{MOZ_MAKE_FLAGS}='-j4'; + if ($query->param()) { &parse_params; + if ($query->param("MOZ_CO_PROJECT").$query->param("MOZ_CO_MODULE") eq "") { + show_error("You must specify at least one of MOZ_CO_PROJECT or MOZ_CO_MODULE."); + exit 0; + } + if ($query->param("--enable-application") eq "") { + show_error("You must specify an application for --enable-application"); + exit 0; + } if ($query->param(preview) eq "1") { print "Content-type: text/html\n\n"; &print_script_preview; @@ -105,26 +111,20 @@ sub print_script_preview { Configurator Script Preview + + + + + + + - ); + +

Configurator Script Preview

- print qq( - -
- - - -
- -
- - - Configurator Script Preview -
- Check the script to make sure the options are correct. - Then, save this script as $HOME/.mozconfig. -
+

Check the script to make sure the options are correct. + Then, save this script as $HOME/.mozconfig.

@@ -134,8 +134,7 @@ sub print_script_preview { my $value = $query->param($param); $value =~ s/\s+$//; $value =~ s/^\s+//; - next if $param =~ /^--/ and $value eq ''; - next if $param =~ /^MOZ_/ and $value eq $default{$param}; + next if $value eq ''; print "\n"; @@ -144,88 +143,53 @@ sub print_script_preview { my $script = &print_script; - if ($script eq '') { - print ""; - print "No script needed. Only default values were selected.

\n"; - print ""; - } else { print qq( - +

$script
- -
- -
- -
- -
-
$script
-
-
-
-
- -
- -
- ); - } - - print qq( - - -
-Save the script, then build the tree as follows, -
  - 1. cvs co mozilla/client.mk -
- 2. cd mozilla -
- 3. gmake -f client.mk
-
- (default targets: checkout depend build) -
 
-
-If you do not want to use client.mk, -then use your favorite build steps, and -configure will -pick up the options in your .mozconfig script. -

- Questions? See the - - Configurator FAQ.
- - Back to the Unix Build Instructions -

-


- Send questions or comments to - <slamm\@netcape.com>. +

+

Save the script, then build the tree as follows, +

    +
  1. cvs co mozilla/client.mk +
  2. cd mozilla +
  3. gmake -f client.mk checkout +
  4. gmake -f client.mk build +
+ +

+ Questions? See the + + Configurator FAQ and the + the build instructions. + +

Maintained by + Benjamin Smedberg <bsmedberg@covad.net>
); } sub print_script { my $out = ''; - $out = "# sh\n"; $out .= "# Build configuration script\n"; - $out .= "#\n"; - $out .= "# See http://www.mozilla.org/build/unix.html for build instructions.\n"; + $out = "#\n"; + $out .= "# See http://www.mozilla.org/build/ for build instructions.\n"; $out .= "#\n"; $out .= "\n"; foreach $param ($query->param()) { if ($param =~ /^MOZ_/) { - my $value = $query->param($param); + my @values = $query->param($param); + my $value; + if (scalar(@values) > 1) { + $value = join(",", @values); + } + else { + $value = $values[0]; + } $value =~ s/\s+$//; $value =~ s/^\s+//; - next if $value eq $default{$param}; + next if $value eq ''; $value = "\"$value\"" if $value =~ /\s/; $out .= "# Options for client.mk.\n" unless $have_client_mk_options; $out .= "mk_add_options $param=".$value."\n"; @@ -261,118 +225,80 @@ sub print_configure_form { print qq( - Mozilla Unix Build Configurator + Mozilla Build Configurator + + + + + + + - +
- -
- - - -
+

Unix Build Configurator

-
- - Unix Build Configurator - -
- The mozilla Unix Build System is designed to work free of any user set - options. However, should you need to tweak an option, the - Configurator is here to help.

- This form produces a script that you can use to configure your build. - The script saves you the trouble of setting environment - variables for client.mk - or typing command-line options for configure. -

+

The mozilla Unix Build System has a few required build parameters, and + additional optional parameters. This build configurator may help you to + tweak the build options. You should read + the build configuration overview + before using this tool. -
- -
+

- - Options for "client.mk": -
+

Options for client.mk

-
-
- +
+

Check out options:

- -
+ Pull by date  + +
-
+

Object Directory:

- - + -
- Check out options:
-
-
- Check out module - +

MOZ_CO_PROJECT: (select one or more)
+ + + +

MOZ_CO_MODULE: (extra modules)
-

- CVS flags - - cvs  - -  co  - -
- CVS flags:
+ cvs  co  + +

  - Pull by date -

- -
-
- - Object Directory:
-
-   - mozilla Build in the source tree. (default)
-   - - ); - print '(e.g. mozilla/obj-i686-pc-linux-gnu)' - if $fillin{MOZ_OBJDIR} eq $default{MOZ_OBJDIR}; - print qq( -
-
- - Make options:
-
-   - Parallel build using +

  (e.g. mozilla/obj-i686-pc-linux-gnu)
+ +  mozilla Build in the source tree. + + +

+

Make options:

+ +  Parallel build using -
-
-
-
- -
- - Options for "configure" script (updated on the fly):
- -
- \n"; + print "
- +

Options for configure script

); my @unhandled_options = (); @@ -399,6 +325,8 @@ sub print_configure_form { } push @options, $oldline; + print "
"; + foreach $line (@options) { ($type, $prename, $name, $comment) = split /$field_separator/, $line; ($dummy,$dummy2,$help) = split /\s+/, $comment, 3; @@ -417,29 +345,22 @@ sub print_configure_form { foreach $comment (@unhandled_options) { $comment =~ s/\\\$/\$/g; my ($dummy,$option,$help) = split /\s+/, $comment, 3; - print "\n"; + print "
 $option   $help
 $option    $help\n"; } - print "
\n"; print qq( -
- - -
- -
+

- Questions? See the +

Questions? See the Configurator FAQ.
- - Back to the Unix Build Instructions -

-


- Send questions or comments to - <slamm\@netcape.com>. + Back to the Build Instructions + +
Maintained by + Benjamin Smedberg <bsmedberg@covad.net>
); print "\n\n\n"; @@ -453,7 +374,7 @@ sub bool_option { print " CHECKED" if $query->param($name) eq 'yes'; print ">"; print "$name"; - print "   $help"; + print "   $help"; } sub string_option { @@ -463,7 +384,7 @@ sub string_option { print "param($name); print ">"; - print " $help\n"; + print " $help\n"; } sub bool_or_string_option { @@ -471,21 +392,46 @@ sub bool_or_string_option { print ""; print ""; - print "$name"; - print "$help\n"; - print "$name="; + print "$name"; + print "$help\n"; + print "$name="; print ""; - print "$help\n"; + print "$help\n"; } sub header_option { my ($header) = @_; - print "\n" if $inTable == 1; - print qq( - - $header - + + print "" if $inTable; + + print qq( +
+

$header

+ ); - print "
\n"; $inTable = 1; } + +sub show_error { + my ($msg) = @_; + + print "Content-type: text/html\n\n"; + print qq( + + + Mozilla Build Configurator - Error + + + + + + + + + +

Configuration Error

+

$msg + +

Go back + ); +}