#!/usr/bonsaitools/bin/perl -- # -*- Mode: perl; indent-tabs-mode: nil -*- # # The contents of this file are subject to the Netscape Public License # Version 1.0 (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 this file as it was released upon February 18, 1999. # # 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. # config.cgi - Configure a mozilla build. # Outputs a form of configure options. # 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). use CGI; $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 if ($query->param()) { &parse_params; if ($query->param(preview) eq "1") { print "Content-type: text/html\n\n"; &print_script_preview; exit 0; } elsif ($query->param(saveas) eq "1") { print "Content-type: text/saveas\n\n"; &print_script; exit 0; } } print "Content-type: text/html\n\n"; &print_configure_form; ## End main program ######################################################### sub parse_params { if ($query->param('MOZ_OBJDIR') eq '@TOPSRCDIR@') { $query->param(-name=>'MOZ_OBJDIR', -values=>['']); } } sub print_script_preview { my ($saveopts) = ''; foreach $param ($query->param()) { if ($param =~ /^(MOZ_|--)/) { next if $query->param($param) eq ''; $saveopts .= "$param=".$query->param($param).'&'; } } print qq( Configurator Script Preview ); print qq(
Configurator Script Preview
Check the script to make sure the options are correct. Then, save this script as ~/.mozconfig.
); foreach $param ($query->param()) { if ($param =~ /^(MOZ_|--)/) { next if $query->param($param) eq ''; print "\n"; } } print qq(
);

  &print_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 usual build steps.
configure will pick up the options in your .mozconfig script.

Check out the Build Configuator FAQ for more information.


Send questions or comments to <slamm\@netcape.com>.
); } sub print_script { print "# sh\n"; print "# Build configuration script\n"; print "#\n"; print "# See http://www.mozilla.org/build/unix.html for build instructions.\n"; print "#\n"; print "\n"; foreach $param ($query->param()) { if ($param =~ /^MOZ_/) { my $value = $query->param($param); $value =~ s/\s+$//; $value =~ s/^\s+//; next if $value eq ''; next if $param eq 'MOZ_CO_MODULE' and $value eq 'SeaMonkeyEditor'; next if $param eq 'MOZ_CO_BRANCH' and $value eq 'HEAD'; print "# Options for client.mk.\n" if not $have_client_mk_options; print "mk_add_options $param=".$value."\n"; $have_client_mk_options = 1; } } print "\n" if $have_client_mk_options; foreach $param ($query->param()) { if ($param =~ /^--/) { next if $query->param($param) eq ''; print "# Options for 'configure' (same as command-line options).\n" if not $have_configure_options; print "ac_add_options $param"; print "=".$query->param($param) if $query->param($param) ne "yes"; print "\n"; $have_configure_options = 1; } } if (not $have_client_mk_options and not $have_configure_options) { print "\n# No script needed. Only default values were selected\n"; } } sub print_configure_form { mkdir 'configure-mirror', 0777 if not -d 'configure-mirror'; system 'echo :pserver:anonymous@cvs-mirror.mozilla.org:/cvsroot Ay=0=a%0bZ | cat > configure-mirror/.cvspass' if not -f 'configure-mirror/.cvspass'; link 'config.cgi', '.mozconfig' if not -f '.mozconfig'; # Set the HOME variable to pick up '.cvspass' for cvs login system "cd configure-mirror && HOME=. cvs -d $CVSROOT co mozilla/configure.in > /dev/null 2>&1"; print qq( Mozilla Unix Build Configurator
Unix Build Configurator
The mozilla Unix build system is designed to build without 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.
Options for "client.mk":
Check out options:
Check out module
Check out branch
Object Directory:
mozilla Build in the source tree. (default)
mozilla/obj-`config.guess` (e.g. mozilla/obj-i686-pc-linux-gnu)

Options for "configure" script (updated on the fly):
\n"; print qq(
); my @unhandled_options = (); open(OPTIONS, "m4 webify-configure.m4 $configure_in|") or die "Error parsing configure.in\n"; foreach () { chomp; ($type, $prename, $name, $comment) = split /$field_separator/; ($dummy,$dummy2,$help) = split /\s+/, $comment, 3; if ($type eq 'header') { &header_option($comment); } elsif ($type eq 'unhandled') { push @unhandled_options, $comment; } else { eval "&${type}_option(\"--$prename-$name\",\"$help\");"; } } header_option("Options not handled by Configurator" ." (Add them to the script by hand)"); foreach $comment (@unhandled_options) { $comment =~ s/\\\$/\$/g; my ($dummy,$option,$help) = split /\s+/, $comment, 3; print "\n"; } print "
 $option   $help


Send questions or comments to <slamm\@netcape.com>. ); print "\n\n\n"; } sub bool_option { my ($name, $help) = @_; print ""; print "param($name) eq 'yes'; print ">"; print "$name"; print "   $help"; } sub string_option { my ($name, $help) = @_; print "$name="; print "param($name); print ">"; print " $help\n"; } sub bool_or_string_option { my ($name, $help) = @_; print ""; print ""; print "$name"; print "$help\n"; print "$name="; print ""; print "$help\n"; } sub header_option { my ($header) = @_; print "\n" if $inTable == 1; print qq( $header ); print "
\n"; $inTable = 1; }