pjs/webtools/build/config.cgi

408 строки
13 KiB
Plaintext
Исходник Обычный вид История

1999-02-19 00:52:11 +03:00
#!/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.
#
1999-02-19 23:53:25 +03:00
# The Original Code is this file as it was released upon February 18, 1999.
1999-02-19 00:52:11 +03:00
#
# 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.
1999-02-19 23:53:25 +03:00
# 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).
1999-02-19 00:27:26 +03:00
use CGI;
$query = new CGI;
1999-02-20 04:11:02 +03:00
$field_separator = '<<fs>>';
$configure_in = 'configure-mirror/mozilla/configure.in';
1999-02-20 04:11:02 +03:00
$chrome_color = '#F0A000';
$CVSROOT = ':pserver:anonymous@cvs-mirror.mozilla.org:/cvsroot';
1999-03-06 00:26:04 +03:00
$ENV{PATH} = "$ENV{PATH}:/opt/cvs-tools/bin:/usr/local/bin"; # for cvs & m4
1999-02-20 04:11:02 +03:00
1999-02-19 00:27:26 +03:00
if ($query->param()) {
1999-02-20 05:20:59 +03:00
&parse_params;
if ($query->param(preview) eq "1") {
1999-02-20 05:20:59 +03:00
print "Content-type: text/html\n\n";
1999-02-20 04:11:02 +03:00
&print_script_preview;
exit 0;
} elsif ($query->param(saveas) eq "1") {
1999-02-20 05:20:59 +03:00
print "Content-type: text/saveas\n\n";
1999-02-20 04:11:02 +03:00
&print_script;
exit 0;
1999-02-20 04:11:02 +03:00
}
}
print "Content-type: text/html\n\n";
&print_configure_form;
## End main program
#########################################################
1999-02-20 04:11:02 +03:00
1999-02-20 05:20:59 +03:00
sub parse_params {
if ($query->param('nspr_option') eq 'userdefined') {
my $nspr_dir = $query->param('nspr_dir');
$nspr_dir =~ s@/$@@;
$nspr_dir =~ s@/lib$@@;
1999-02-20 05:20:59 +03:00
$query->param(-name=>'--with-nspr',
-values=>[$nspr_dir]);
1999-02-20 05:20:59 +03:00
}
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']);
}
1999-02-20 05:20:59 +03:00
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']);
}
}
1999-02-20 04:11:02 +03:00
sub print_script_preview {
1999-02-20 10:52:15 +03:00
my ($saveopts) = '';
foreach $param ($query->param()) {
if ($param =~ /^(MOZ_|--)/) {
next if $query->param($param) eq '';
$saveopts .= "$param=".$query->param($param).'&';
}
}
1999-02-20 05:20:59 +03:00
1999-02-20 04:11:02 +03:00
print qq(
<HTML>
<HEAD>
1999-02-20 09:36:03 +03:00
<TITLE>Configurator Script Preview</TITLE>
1999-02-20 04:11:02 +03:00
</HEAD>
<body BGCOLOR="#FFFFFF" TEXT="#000000"LINK="#0000EE" VLINK="#551A8B" ALINK="#FF0000">
1999-02-20 10:52:15 +03:00
<form action='.mozconfig' method='get'>
<input type='hidden' name='saveas' value='1'>);
1999-02-20 10:52:15 +03:00
foreach $param ($query->param()) {
if ($param =~ /^(MOZ_|--)/) {
next if $query->param($param) eq '';
print "<input type='hidden' name=$param value='".$query->param($param)."'>\n";
}
}
1999-02-20 09:36:03 +03:00
print qq(
<table cellspacing=2 cellpading=0 border=0 width=600><tr><td>
1999-02-20 10:52:15 +03:00
1999-02-20 05:20:59 +03:00
<font size='+1' face='Helvetica,Arial'><b>
1999-02-20 09:36:03 +03:00
Configurator Script Preview</b></font>
1999-02-20 10:52:15 +03:00
</td></tr><tr></tr><tr><td>
Check the script to make sure the options are correct. When you are done,
save this script as <code><b>~/.mozconfig</b></code>.
1999-02-20 10:52:15 +03:00
</td></tr></table>
<!--
1999-02-20 10:52:15 +03:00
<table cellpadding=0 cellspacing=1><tr><td>
<input type='submit' value='Save the script'>
1999-02-20 10:52:15 +03:00
</td></tr></table>
-->
1999-02-20 09:36:03 +03:00
1999-02-20 10:52:15 +03:00
<table cellspacing=2 cellpading=0 border=0><tr><td>
1999-02-20 09:36:03 +03:00
<table bgcolor="#FF0000" cellspacing=0 cellpadding=2 border=0><tr valign=middle><td align=center>
<table bgcolor="#FFFFFF" cellspacing=0 cellpadding=10 width="600" border=0><tr><td>
1999-02-20 04:11:02 +03:00
<pre>);
&print_script;
print qq(</pre>
</td></tr></table>
1999-02-20 10:52:15 +03:00
</td></tr></table>
</td></tr></table>
<table cellpadding=0 cellspacing=1><tr><td>
<input type='submit' value='Save the script'>
1999-02-20 10:52:15 +03:00
</td></tr></table>
<table cellspacing=0 cellpadding=0>
<tr><td colspan=3>
Save the script, then build the tree as follows,
1999-02-20 10:52:15 +03:00
</td></tr><tr><td>&nbsp;</td><td>
1.</td><td> <code>cvs co mozilla/client.mk</code>
</td></tr><tr><td></td><td>
2.</td><td> <code>cd mozilla</code>
1999-02-20 10:52:15 +03:00
</td></tr><tr><td></td><td>
3.</td><td> <code>gmake -f client.mk</code><br>
1999-02-20 10:52:15 +03:00
</td></tr><tr><td></td><td>
</td><td> (default targets = <code>checkout build</code>)
1999-02-20 10:52:15 +03:00
</td></tr>
</td></tr><tr><td>&nbsp;</td></tr><tr><td colspan=3>
Here is a shortcut you can use to run <code>viewer</code>
or <code>apprunner</code> when the tree is built,
1999-02-20 10:52:15 +03:00
</td></tr><tr><td></td><td>
1.</td><td> <code>cd &lt;objdir&gt;</code>
</td></tr><tr><td></td><td>
2a.</td><td> <code>gmake run_viewer
</td></tr><tr><td></td><td>
2b.</td><td> <code>gmake run_apprunner
<!--
1999-02-20 10:52:15 +03:00
</td></tr><tr><td>&nbsp;</td></tr><tr><td colspan=3>
<A NAME='places'>
The build searches for mozconfig in the following places,
1999-02-20 09:36:03 +03:00
</td></tr><tr><td></td><td></td><td>
If <code>\$MOZCONFIG</code> is set, use that file,
1999-02-20 10:52:15 +03:00
</td></tr><tr><td></td><td></td><td>
else try <code>&lt;topsrcdir&gt/mozconfig</code>
1999-02-20 10:52:15 +03:00
</td></tr><tr><td></td><td></td><td>
else try <code>\$HOME/.mozconfig</code>
-->
1999-02-20 10:52:15 +03:00
</td></tr></table>
<p>
<hr align=left width=600>
1999-02-20 05:20:59 +03:00
Send questions or comments to
&lt;<a href="mailto:slamm\@netscape.com?subject=About the Build Configurator">slamm\@netcape.com</a>&gt;.
1999-02-20 10:52:15 +03:00
</form>
1999-02-20 04:11:02 +03:00
);
}
sub print_script {
1999-02-19 23:17:25 +03:00
1999-02-20 04:11:02 +03:00
print "# sh\n";
print "# Build configuration script\n";
print "#\n";
1999-02-20 05:20:59 +03:00
print "# See http://www.mozilla.org/build/unix.html for build instructions.\n";
1999-02-20 04:11:02 +03:00
print "#\n";
print "\n";
1999-02-20 05:38:06 +03:00
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";
1999-02-20 04:11:02 +03:00
foreach $param ($query->param()) {
1999-02-19 23:17:25 +03:00
if ($param =~ /^MOZ_/) {
my $value = $query->param($param);
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";
1999-02-20 05:20:59 +03:00
$need_blank_line = 1;
1999-02-20 04:11:02 +03:00
}
}
print "\n" if $need_blank_line;
1999-02-20 05:38:06 +03:00
print "# Options for 'configure' (same as command-line options).\n";
1999-02-20 04:11:02 +03:00
foreach $param ($query->param()) {
if ($param =~ /^--/) {
1999-02-20 05:20:59 +03:00
next if $query->param($param) eq '';
1999-02-19 23:17:25 +03:00
print "ac_add_options $param";
print "=".$query->param($param) if $query->param($param) ne "yes";
print "\n";
}
1999-02-19 00:27:26 +03:00
}
1999-02-20 04:11:02 +03:00
}
sub print_configure_form {
mkdir 'configure-mirror', 0777 if not -d 'configure-mirror';
1999-03-06 00:26:04 +03:00
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';
1999-03-05 03:48:35 +03:00
# 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";
1999-02-19 23:17:25 +03:00
print qq(
1999-02-20 04:11:02 +03:00
<HTML>
<HEAD>
<TITLE>Mozilla Unix Build Configurator</TITLE>
</HEAD>
<body BGCOLOR="#FFFFFF" TEXT="#000000"LINK="#0000EE" VLINK="#551A8B" ALINK="#FF0000">
<font size='+1' face='Helvetica,Arial'><b>
Mozilla Unix Build Configurator</b></font><p>
<FORM action='config.cgi' method='POST' name='ff'>
<INPUT Type='hidden' name='preview' value='1'>
1999-02-20 10:52:15 +03:00
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.
<table><tr><td>
<input type="Submit" value="Preview Build Script">
</td></tr></table>
1999-02-20 04:11:02 +03:00
<table bgcolor="$chrome_color" cellspacing=0 cellpadding=0><tr><td>
<table bgcolor="#FFFFFF" cellspacing=0 cellpadding=0><tr><td>
<table cellspacing=0 cellpadding=1>
<!-- Check out options -->
1999-02-20 04:11:02 +03:00
<tr bgcolor="$chrome_color"><td>
<font face="Helvetica,Arial"><b>Check out options:</b></font><br>
1999-02-20 04:11:02 +03:00
</td></tr><tr><td>
<table cellpadding=0 cellspacing=0><tr><td>
Check out module
1999-02-20 04:11:02 +03:00
</td><td>
<input type="text" name="MOZ_CO_MODULE" value="SeaMonkeyEditor">
1999-02-20 04:11:02 +03:00
</td></tr><tr><td>
Check out branch
1999-02-20 04:11:02 +03:00
</td><td>
<input type="text" name="MOZ_CO_BRANCH" value="HEAD">
1999-02-20 04:11:02 +03:00
</td></tr></table>
</td></tr>
<!-- Object Directory -->
<tr bgcolor="$chrome_color"><td>
<font face="Helvetica,Arial"><b>
Object Directory:</b></font><br>
</td></tr><tr><td><table><tr><td>
1999-02-20 04:11:02 +03:00
<input type="radio" name="MOZ_OBJDIR" value="\@TOPSRCDIR\@" checked>
<code>mozilla</code></td><td> (i.e. In the source tree)<br></td></tr><tr><td>
1999-02-20 04:11:02 +03:00
<input type="radio" name="MOZ_OBJDIR" value="\@TOPSRCDIR\@/obj-\@CONFIG_GUESS\@">
<code>mozilla/obj-\@CONFIG_GUESS\@</code> </td><td>(e.g. <code>mozilla/obj-i686-pc-linux-gnu</code>)<br>
1999-02-20 04:11:02 +03:00
<!-- Take this option out for now...
<input type="radio" name="MOZ_OBJDIR" value="\@TOPSRCDIR\@/../obj-\@CONFIG_GUESS\@">
mozilla/../obj-\@CONFIG_GUESS\@(e.g. <code>mozilla/../obj-i686-pc-linux-gnu</code>)<br>
1999-02-20 04:11:02 +03:00
-->
</td></tr></table>
1999-02-20 04:11:02 +03:00
</td></tr>
<!-- NSPR -->
<tr bgcolor="$chrome_color"><td>
<font face="Helvetica,Arial"><b>NSPR to use:</b></font><br>
</td></tr><tr><td>
<input type="radio" name="nspr_option" value="tip" checked>
Build nspr from the tip (installs in <code>\@OBJDIR\@/nspr</code>)<br>
<input type="radio" name="nspr_option" value="userdefined" onclick="document.ff.nspr_dir.focus();">
NSPR is installed in
<input type="text" name="nspr_dir" onfocus="document.ff.nspr_option[1].checked=true;"><br>
<input type="radio" name="nspr_option" value="rpm">
NSPR is installed in /usr/lib (NSPR RPM installation)
</td></tr>
<!-- Threads -->
<tr bgcolor="$chrome_color"><td>
<font face="Helvetica,Arial"><b>Threads:</b></font><br>
</td></tr><tr><td>
NSPR and mozilla can both be built with or without
pthreads (POSIX threads). <br>
Check
<a href="http://www.mozilla.org/docs/refList/refNSPR/platforms.html">
the NSPR supported platforms</a>
to see if you can choose this option.<p>
<input type="checkbox" name="--with-pthreads" value="yes">
If the NSPR you selected was built with pthreads or you would like to
build nspr with pthreads select this option.<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
(Sets <code>USE_PTHREADS=1</code> for nspr,
and <code>--with-pthreads</code> for mozilla client.)
</td></tr>
1999-02-20 04:11:02 +03:00
<!-- Debug -->
<tr bgcolor="$chrome_color"><td>
<font face="Helvetica,Arial"><b>Debug option:</b></font><br>
</td></tr><tr><td>
<input type="radio" name="debug_option" value="yes" checked>
Enable debugging<br>
<input type="radio" name="debug_option" value="no">
Disable debugging<br>
<input type="radio" name="debug_option" value="userdefined" onclick="document.ff.debug_dirs.focus();">
1999-02-20 04:11:02 +03:00
Enable debugging but only for the following directories: <br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<input type="text" name="debug_dirs" size=50 onfocus="document.ff.debug_option[2].checked=true;"> (comma separated, no spaces)<br>
1999-02-20 04:11:02 +03:00
</td></tr>
</table>
</td></tr></table>
</td></tr></table>
<br>
<font size=+1 face="Helvetica,Arial"><b>
Options for "<code>configure</code>" script:</b></font><br>
1999-02-20 04:11:02 +03:00
<table bgcolor="$chrome_color" cellspacing=0 cellpadding=0><tr><td>
<table bgcolor="#FFFFFF" cellspacing=0 cellpadding=0><tr><td>
<table cellspacing=0 cellpadding=1>
);
open(OPTIONS, "m4 webify-configure.m4 $configure_in|")
or die "Error parsing configure.in\n";
1999-02-19 00:27:26 +03:00
foreach (<OPTIONS>) {
chomp;
1999-02-19 23:17:25 +03:00
($type, $prename, $name, $comment) = split /$field_separator/;
($dummy,$dummy2,$help) = split /\s+/, $comment, 3;
#$help =~ s/\\\$/\$/g;
1999-02-20 04:11:02 +03:00
next if $name eq 'debug';
1999-02-19 23:17:25 +03:00
if ($type eq "header") {
&header_option($comment);
} else {
eval "&${type}_option(\"--$prename-$name\",\"$help\");";
1999-02-19 00:27:26 +03:00
}
}
print qq(
</table>
1999-02-19 23:17:25 +03:00
</td></tr></table>
</td></tr></table>
1999-02-20 10:52:15 +03:00
<table><tr><td>
<input type="Submit" value="Preview Build Script">
</td></tr></table>
1999-02-19 00:27:26 +03:00
</form>
);
1999-02-19 23:17:25 +03:00
print "\n</body>\n</html>\n";
1999-02-19 00:27:26 +03:00
}
sub bool_option {
my ($name, $help) = @_;
print "<tr><td align=right>";
print "<INPUT type='checkbox' name='$name' value='yes'";
print " CHECKED" if $query->param($name) eq 'yes';
print ">";
print "</td><td>$name";
print "</td><td>$help</td></tr>";
1999-02-19 00:27:26 +03:00
}
sub string_option {
my ($name, $help) = @_;
print "<tr><td align=right>$name=</td><td align=left>";
print "<INPUT type='text' name='$name'";
print " value='".$query->param($name)."'" if defined $query->param($name);
print ">";
1999-02-19 00:27:26 +03:00
print "</td><td>$help</td></tr>\n";
}
1999-02-19 23:17:25 +03:00
sub bool_or_string_option {
my ($name, $help) = @_;
print "<tr><td align=right>";
print "<INPUT type='checkbox' name='$name'>";
print "</td><td>$name";
print "</td><td>$help</td></tr>\n";
print "<tr><td align=right>$name=</td><td align=left>";
print "<INPUT type='text' name='$name'>";
print "</td><td>$help</td></tr>\n";
}
sub header_option {
my ($header) = @_;
print qq(<tr bgcolor=$chrome_color><td colspan=3>
<b><font face="Arial,Helvetica">
$header
</font></b></td></tr>
);
}