#!/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('nspr_option') eq 'userdefined') { my $nspr_dir = $query->param('nspr_dir'); $nspr_dir =~ s@/$@@; $nspr_dir =~ s@/lib$@@; $query->param(-name=>'--with-nspr', -values=>[$nspr_dir]); } #if ($query->param('nspr_option') eq 'rpm') { # $query->param(-name=>'--with-nspr', # -values=>['/usr']); #} if ($query->param('nspr_option') eq 'tip') { $query->param(-name=>'--with-nspr', -values=>['@OBJDIR@/nspr']); } if ($query->param('debug_option') eq 'userdefined') { $query->param(-name=>'--enable-debug', -values=>[$query->param('debug_dirs')]); } if ($query->param('pthreads_'.$query->param('nspr_option')) eq 'yes') { $query->param(-name=>'--with-pthreads', -values=>['yes']); } if ($query->param('debug_option') eq 'yes') { $query->param(-name=>'--enable-debug', -values=>['yes']); } } 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 ); foreach $param ($query->param()) { if ($param =~ /^(MOZ_|--)/) { next if $query->param($param) eq ''; print "\n"; } } print qq(
Configurator Script Preview
Check the script to make sure the options are correct. Then, save this script as ~/.mozconfig.
);

  &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 build)
 
Here is a shortcut you can use to run viewer or apprunner when the tree is built,
1. cd <objdir>
2a. gmake run_viewer
2b. gmake run_apprunner

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"; print "# Options for client.mk.\n"; print "# Note: client.mk also uses the following 'ac_add_options',\n"; print "# --with-nspr=blah\n"; print "# --with-pthreads\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 "mk_add_options $param=".$value."\n"; $need_blank_line = 1; } } print "\n" if $need_blank_line; print "# Options for 'configure' (same as command-line options).\n"; foreach $param ($query->param()) { if ($param =~ /^--/) { next if $query->param($param) eq ''; print "ac_add_options $param"; print "=".$query->param($param) if $query->param($param) ne "yes"; print "\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
This form produces a script that you can save and use to configure your mozilla build. If this form does not have some options you want, you can add them to the script later.
Check out options:
Check out module
Check out branch
Object Directory:
mozilla (build in the source tree)
mozilla/obj-\@CONFIG_GUESS\@ (use directory like  mozilla/obj-i686-pc-linux-gnu)
NSPR and Pthreads:
NSPR and mozilla can be build either with or without pthreads (POSIX threads). They should both be build the same way. Selecting Pthreads in the right column will cause mozilla to be built with be threads. For more information on NSPR and pthreads, check the NSPR supported platforms.
Build NSPR from the tip (installs in \@OBJDIR\@/nspr)   Use Pthreads for NSPR and mozilla
NSPR is installed in   NSPR was Built with Pthreads, so build mozilla with Pthreads
Debug option:
Enable debug symbols
Disable debug symbols
Enable debug symbols, but only for the following directories:
       (comma separated, no spaces)

Options for "configure" script (updated on the fly):
\n" if $inTable == 1; &header_option($comment); print "\n"; print qq(
); 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; #$help =~ s/\\\$/\$/g; next if $name eq 'debug'; if ($type eq "header") { print "
\n"; $inTable = 1; } else { eval "&${type}_option(\"--$prename-$name\",\"$help\");"; } } print "
); 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 qq( $header ); }