#!/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 = 'mozilla/configure.in'; $chrome_color = '#F0A000'; $ENV{CVSROOT} = ':pserver:anonymous@cvs-mirror.mozilla.org:/cvsroot'; #$ENV{PATH} = "$ENV{PATH}:/usr/bin/ccs"; # for m4 if ($query->param()) { &parse_params; if ($query->param(preview) eq "yes") { print "Content-type: text/html\n\n"; &print_script_preview; } else { print "Content-type: text/saveas\n\n"; &print_script; } } else { print "Content-type: text/html\n\n"; &print_configure_form; } sub parse_params { if ($query->param('nspr_option') eq 'userdefined') { $query->param(-name=>'--with-nspr', -values=>[$query->param('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=>'MOZ_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('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 your options are correct. When you are done, save this script to \$HOME/.mozmyconfig.sh.*
);

  &print_script;

  print qq(
After the script is saved, build the tree with,
  1. cd mozilla
2. gmake -f client.mk
(default targets = "checkout build")
Steps to run the viewer,
1. cd <objdir>
2. gmake run_viewer
 
* The build searches for this script in the following places,
If \$MOZ_MYCONFIG is set, use that file,
else try <objdir>/myconfig.sh
else try <topsrcdir>/myconfig.sh
else try \$HOME/.mozmyconfig.sh

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 "# (client.mk also understands some 'configure' options.)\n"; foreach $param ($query->param()) { if ($param =~ /^MOZ_/) { next if $query->param($param) eq ''; print "mk_add_options $param=".$query->param($param)."\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 { system "cvs co mozilla/configure.in"; print qq( Mozilla Unix Build Configurator Mozilla 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.
Checkout options:
Module to checkout (default is SeaMonkeyEditor)
Branch to checkout (default is HEAD)
Object Directory:
mozilla (i.e. In the source tree)
mozilla/obj-\@CONFIG_GUESS\@ (e.g. mozilla/obj-i686-pc-linux-gnu)
Threads:
NSPR and mozilla can both be built with or without pthreads (POSIX threads).
Check the NSPR supported platforms to see if you can choose this option.

Build both NSPR and mozilla with pthreads
       (Sets USE_PTHREADS=1 for nspr, and --with-pthreads for mozilla client.)

NSPR to use:
Build nspr from the tip (installs in \@OBJDIR\@/nspr)
NSPR is installed in (omit trailing '/lib')
NSPR is installed in /usr/lib (NSPR RPM installation)
Debug option:
Enable debugging
Disable debugging
Enable debugging but only for the following directories:
       (comma separated, no spaces)

Options for `configure' script:
); 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") { &header_option($comment); } else { eval "&${type}_option(\"--$prename-$name\",\"$help\");"; } } print qq(
); print "\n\n\n"; } sub bool_option { my ($name, $help) = @_; print qq( $name $help ); } sub string_option { my ($name, $help) = @_; print "$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 ); }