summaryrefslogtreecommitdiff
path: root/ndb/home/bin/ndbdoxy.pl
blob: 89b7de8440e388949ae64e326ac53f8b0a52ec07 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
#!/usr/local/bin/perl
#
#  ndbdoxy.pl  Executes doxygen on a checked out version of NDB Cluster
#
#  Written by Lars Thalmann, 2003.

use strict;
umask 000;

# -----------------------------------------------------------------------------
#   Settings
# -----------------------------------------------------------------------------

my $root = "/home/elathal/public_html/cvsdoxy";

$ENV{LD_LIBRARY_PATH} = "/usr/local/lib:/opt/as/local/lib";
$ENV{LD_LIBRARY_PATH} = $ENV{LD_LIBRARY_PATH} . ":/opt/as/forte6/SUNWspro/lib";
$ENV{PATH} = $ENV{PATH} . ":/usr/local/bin:/opt/as/local/bin";
$ENV{PATH} = $ENV{PATH} . ":/opt/as/local/teTeX/bin/sparc-sun-solaris2.8";

my $DOXYGEN =   "doxygen";
my $PDFLATEX =  "pdflatex";
my $MAKEINDEX = "makeindex";

# -----------------------------------------------------------------------------
#   Argument handling
# -----------------------------------------------------------------------------

if (@ARGV != 3) { 
    print<<END; 
Usage:
    ndbdoxy.pl <module> <title> <version>

    where
      <module>   is cvsdoxy module to doxgenify
      <title>    is title of report
      <version>  is version of NDB Cluster
END
    exit;
}
my $module = $ARGV[0];
my $title =  $ARGV[1];
my $version =  $ARGV[2];
my $destdir = ".";

# -----------------------------------------------------------------------------
#  Execute Doxygen -g
# -----------------------------------------------------------------------------

if (-r "${root}/doxyfiles/${module}.doxyfile") {
    system("cd ${destdir}; \
            cp ${root}/doxyfiles/${module}.doxyfile Doxyfile");
} elsif (-r "${root}/doxyfiles/default.doxyfile") {
    system("cd ${destdir}; \
            cp ${root}/doxyfiles/default.doxyfile Doxyfile");
} else {
    system("cd ${destdir}; $DOXYGEN -g");
}

# -----------------------------------------------------------------------------
#  HTML Footer
# -----------------------------------------------------------------------------

if (-r "${root}/doxyfiles/htmlfooter") {
    system("cd ${destdir}; \
            cp ${root}/doxyfiles/htmlfooter footer.html");
	
    open (INFILE, "< ${destdir}/footer.html") 
	or die "Error opening ${destdir}/footer.html.\n";
    open (OUTFILE, "> ${destdir}/footer.html.new") 
	or die "Error opening ${destdir}/footer.html.new.\n";
    while (<INFILE>) {
	if (/(.*)DATE(.*)$/) {
	    print OUTFILE $1 . localtime() . $2;
	} else {
	    print OUTFILE;
	}
    }
    close INFILE;
    close OUTFILE;
    
    system("mv ${destdir}/footer.html.new ${destdir}/footer.html");
} else {
    print("Warning: No ${root}/doxyfiles/${module}.htmlfooter");
}

# -----------------------------------------------------------------------------
#  Execute Doxygen 
# -----------------------------------------------------------------------------

system("cd ${destdir}; $DOXYGEN");

# -----------------------------------------------------------------------------
#  Change a little in refman.tex
# -----------------------------------------------------------------------------

open (INFILE, "< ${destdir}/latex/refman.tex") 
    or die "Error opening ${destdir}/latex/refman.tex.\n";
open (OUTFILE, "> ${destdir}/latex/refman.tex.new") 
    or die "Error opening ${destdir}/latex/refman.tex.new.\n";

while (<INFILE>) 
{
    if (/(.*)Reference Manual(.*)$/) {
	print OUTFILE $1 . 
	    "\\mbox{}\\vspace{-3cm}\\mbox{}" .
	    "\\hrule\\bigskip\\bigskip\\bigskip\\bigskip" .
	    "\\Huge{" . $title . "}" . $2;
    } elsif (/(.*)Generated by Doxygen 1.2.1[0-9](.*)$/) {
	print OUTFILE $1 . 
	    "\\begin{center}" . 
	    "\\LARGE{MySQL AB}" .
	    "\\end{center}".
	    "\\hfill\\bigskip\\bigskip\\bigskip\\hrule" . 
	    "\\bigskip\\bigskip\\bigskip\\bigskip\\bigskip" .
	    "\\bigskip\\bigskip\\bigskip\\bigskip\\bigskip" .
	    "\\bigskip\\bigskip NDB Cluster Release " . $version .
	    "\\bigskip\\bigskip\\bigskip\\bigskip\\bigskip\\hfill" .
	    $2;
    } elsif (/\\chapter\{File Index\}/) {
	print OUTFILE "\%\\chapter{File Index}\n";
    } elsif (/\\input{files}/) {
	print OUTFILE "\%\\input{files}\n";
    } elsif (/\\chapter\{Page Index\}/) {
	print OUTFILE "\%\\chapter{Page Index}\n";
    } elsif (/\\input{pages}/) {
	print OUTFILE "\%\\input{pages}\n";
    } else {
	print OUTFILE;
    }
}

close INFILE;
close OUTFILE;
    
system("mv ${destdir}/latex/refman.tex.new ${destdir}/latex/refman.tex");

# -----------------------------------------------------------------------------
#  Change a little in doxygen.sty
# -----------------------------------------------------------------------------

open (INFILE, "< ${destdir}/latex/doxygen.sty") 
    or die "Error opening INFILE.\n";
open (OUTFILE, "> ${destdir}/latex/doxygen.sty.new") 
    or die "Error opening OUTFILE.\n";

while (<INFILE>) 
{
    if (/\\rfoot/) {
	print OUTFILE "\\rfoot[\\fancyplain{}{\\bfseries\\small \\copyright~Copyright 2003 MySQL AB\\hfill support-cluster\@mysql.com}]{}\n";
    } elsif (/\\lfoot/) {
	print OUTFILE "\\lfoot[]{\\fancyplain{}{\\bfseries\\small support-cluster\@mysql.com\\hfill \\copyright~Copyright 2003 MySQL AB}}\n";
    } else {
	print OUTFILE;
    }
}

close INFILE;
close OUTFILE;
    
system("mv ${destdir}/latex/doxygen.sty.new ${destdir}/latex/doxygen.sty");

# -----------------------------------------------------------------------------
#  Other
# -----------------------------------------------------------------------------

#system("cd ${root}/tmp/${module}; \
#        mkdir html.tar; \
#        cd html.tar; \
#        cp -r ../html ${module}; \
#        tar cf ${module}.html.tar ${module}; \
#        /usr/local/bin/gzip ${module}.html.tar; \
#        /bin/rm -rf ${root}/tmp/${module}/html.tar/${module}");

#system("cd ${destdir}/latex/; \
#        $PDFLATEX refman.tex \
#        $MAKEINDEX refman.idx \
#        $PDFLATEX refman.tex \
#        mv -f refman.pdf ${module}.pdf");

print<<END;
Execute:
    latex refman; makeindex refman; latex refman
END