The R Project SVN R

Rev

Rev 4562 | Rev 5078 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 4562 Rev 4580
Line 1... Line 1...
1
#! @PERL@
1
#! @PERL@
2
#-*- mode: perl; perl-indent-level: 4; cperl-indent-level: 4 -*-
2
#-*- mode: perl; perl-indent-level: 4; cperl-indent-level: 4 -*-
3
#
3
#
4
# ${RHOME}/bin/build-help
4
# ${R_HOME}/bin/build-help
5
# Usage:  build-help [options]  [pkg] [lib]
5
# Usage:  build-help [options]  [pkg] [lib]
6
# Install all help files for package pkg to library lib
6
# Install all help files for package pkg to library lib
7
# (defaults are `${RHOME}/src/library/base' and the default library,
7
# (defaults are `${R_HOME}/src/library/base' and the default library,
8
#  `${RHOME}/library', respectively).
8
#  `${R_HOME}/library', respectively).
9
 
9
 
10
use File::Basename;
10
use File::Basename;
11
use Cwd;
11
use Cwd;
12
use Getopt::Long;
12
use Getopt::Long;
13
 
13
 
Line 15... Line 15...
15
		 "dosnames", "htmllists");
15
		 "dosnames", "htmllists");
16
GetOptions (@knownoptions) || usage();
16
GetOptions (@knownoptions) || usage();
17
 
17
 
18
$cwd=getcwd();
18
$cwd=getcwd();
19
if($opt_rhome){
19
if($opt_rhome){
20
    $RHOME=$opt_rhome;
20
    $R_HOME=$opt_rhome;
21
    print STDERR "RHOME from --rhome: `$RHOME'\n" if $opt_debug;
21
    print STDERR "R_HOME from --rhome: `$R_HOME'\n" if $opt_debug;
22
}
22
}
23
elsif($ENV{"RHOME"}){
23
elsif($ENV{"R_HOME"}){
24
    $RHOME=$ENV{"RHOME"};
24
    $R_HOME=$ENV{"R_HOME"};
25
    print STDERR "RHOME from ENV: `$RHOME'\n" if $opt_debug;
25
    print STDERR "R_HOME from ENV: `$R_HOME'\n" if $opt_debug;
26
}
26
}
27
else{
27
else{
28
    chdir(dirname($0) . "/..");
28
    chdir(dirname($0) . "/..");
29
    $RHOME=getcwd();
29
    $R_HOME=getcwd();
30
}
30
}
31
chdir($cwd);
31
chdir($cwd);
32
print STDERR "Current directory (cwd): `$cwd'\n" if $opt_debug;
32
print STDERR "Current directory (cwd): `$cwd'\n" if $opt_debug;
33
 
33
 
34
 
34
 
35
require "$RHOME/etc/Rdconvlib.pl";
35
require "$R_HOME/etc/Rdconvlib.pl";
36
require "$RHOME/etc/buildlib.pl";
36
require "$R_HOME/etc/buildlib.pl";
37
 
37
 
38
# if option --htmllists is set we only rebuild some list files and
38
# if option --htmllists is set we only rebuild some list files and
39
# exit
39
# exit
40
 
40
 
41
if($opt_htmllists){
41
if($opt_htmllists){
42
    build_htmlpkglist("$RHOME/library");
42
    build_htmlpkglist("$R_HOME/library");
43
 
43
 
44
    %anindex = read_anindex("$RHOME/library");
44
    %anindex = read_anindex("$R_HOME/library");
45
    %htmlindex = read_htmlindex("$RHOME/library");
45
    %htmlindex = read_htmlindex("$R_HOME/library");
46
 
46
 
47
    build_htmlfctlist("$RHOME/library");
47
    build_htmlfctlist("$R_HOME/library");
48
 
48
 
49
    exit 0;
49
    exit 0;
50
}
50
}
51
 
51
 
52
# default is to build all documentation formats
52
# default is to build all documentation formats
Line 83... Line 83...
83
# get %htmlindex and %anindex
83
# get %htmlindex and %anindex
84
 
84
 
85
%anindex = read_anindex($lib);
85
%anindex = read_anindex($lib);
86
if($opt_html){
86
if($opt_html){
87
    %htmlindex = read_htmlindex($lib);
87
    %htmlindex = read_htmlindex($lib);
88
    if ($lib ne "$RHOME/library") {
88
    if ($lib ne "$R_HOME/library") {
89
	%basehtmlindex = read_htmlindex("$RHOME/library");
89
	%basehtmlindex = read_htmlindex("$R_HOME/library");
90
	foreach $topic (keys %htmlindex) {
90
	foreach $topic (keys %htmlindex) {
91
	    $basehtmlindex{$topic} = $htmlindex{$topic};
91
	    $basehtmlindex{$topic} = $htmlindex{$topic};
92
	}
92
	}
93
	%htmlindex = %basehtmlindex;
93
	%htmlindex = %basehtmlindex;
94
    }
94
    }
Line 111... Line 111...
111
	    my $targetfile = $filenm{$manfilebase};
111
	    my $targetfile = $filenm{$manfilebase};
112
	    $destfile = "$dest/help/$targetfile";
112
	    $destfile = "$dest/help/$targetfile";
113
	    if(fileolder($destfile, $manage)) {
113
	    if(fileolder($destfile, $manage)) {
114
		$textflag = "text";
114
		$textflag = "text";
115
		open(nroffout, "| tbl | nroff -ms 2> /dev/null | " .
115
		open(nroffout, "| tbl | nroff -ms 2> /dev/null | " .
116
		     " ${RHOME}/bin/help.pretty > '$destfile'");
116
		     " ${R_HOME}/bin/help.pretty > '$destfile'");
117
		Rdconv($manfile, "nroff", "", -1);
117
		Rdconv($manfile, "nroff", "", -1);
118
	    }
118
	    }
119
	}
119
	}
120
 
120
 
121
	if($opt_html){
121
	if($opt_html){