2
##########################################################################
4
# PURPOSE Making MS HTML-help from the Subversion source documentation
5
# ====================================================================
6
# Copyright (c) 2000-2005 CollabNet. All rights reserved.
8
# This software is licensed as described in the file COPYING, which
9
# you should have received as part of this distribution. The terms
10
# are also available at http://subversion.tigris.org/license-1.html.
11
# If newer versions of this license are posted there, you may use a
12
# newer version instead, at your option.
14
# This software consists of voluntary contributions made by many
15
# individuals. For exact contribution history, see the revision
16
# history and logs, available at http://subversion.tigris.org/.
17
# ====================================================================
19
##########################################################################
20
# INCLUDED LIBRARY FILES
27
##########################################################################
28
# FUNCTION DECLARATIONS
34
##########################################################################
35
# CONSTANTS AND GLOBAL VARIABLES
36
# Sorces and destinations
37
my $g_PathDocRoot=&cmn_ValuePathfile('path_svnbook');
38
my $g_PathMiscIn=&cmn_ValuePathfile('path_setup_in');
39
my %g_FilesToCpAndConv=
41
'COPYING', 'subversion\SubversionLicense.txt',
42
'README', 'subversion\Readme.dist',
43
'doc\user\lj_article.txt', 'doc\lj_article.txt',
44
'doc\programmer\WritingChangeLogs.txt', 'doc\WritingChangeLogs.txt',
47
# Programs needed for making the documentation
51
'libxslt is needed for converting the XML-documentaion.',
53
'iconv is needed by libxslt and libxslt for converting the XML-documentaion.',
55
'libxml2 is needed by libxslt for converting the XML-documentaion.',
59
##########################################################################
63
##########################################################################
64
# FUNCTION DEFINITIONS
65
#-------------------------------------------------------------------------
67
# DOES This is the program's main function
72
my $RootSvnBook=&cmn_ValuePathfile('path_svnbook');
73
my $DocOut=&cmn_ValuePathfile('path_setup_in');
78
# Get absolute path of the current PWD's parent
79
$PathWinIsPack=getcwd;
80
$Pwd=basename($PathWinIsPack);
81
$PathWinIsPack =~ s/\//\\/g;
82
$PathWinIsPack =~ s/\\$Pwd$//;
84
# Make $DocOut to an absolute path
87
$DocOut = "$PathWinIsPack\\in\\doc";
90
#Make the out dir in "$RootSvnBook\src if needed
91
&MkDirP ("$RootSvnBook\\src\\out") unless (-e "$RootSvnBook\\src\\out");
93
#Check for needed programs
97
#Create the mk_htmlhelp.bat file from ..\templates\\mk_htmlhelp.bat and
98
#collected data, save it to $RootSvnBook\src\out\mk_htmlhelp.bat
101
tv_path_hhc => $g_Prog_hhc,
102
tv_bookdest => $DocOut
105
$CntMkHtmBat=&cmn_Template("$PathWinIsPack\\templates\\mk_htmlhelp.bat", \%Values);
107
open (FH_HHP, ">" . "$RootSvnBook\\src\\out\\mk_htmlhelp.bat");
108
print FH_HHP $CntMkHtmBat;
111
#Copy style sheet and background image to $RootSvnBook\src\out
112
system ("copy /Y ..\\templates\\svn-doc.css $RootSvnBook\\src\\out");
113
system ("copy /Y ..\\images\\svn_bck.png $RootSvnBook\\src\\out");
115
# Set the revision number in $RootSvnBook\src\en\book\version.xml
116
chdir "$RootSvnBook\\src\\en";
117
$CntVerXml=`svnversion .`;
120
open (FH_VERXML, ">" . "$RootSvnBook\\src\\en\\book\\version.xml");
121
print FH_VERXML "<!ENTITY svn.version \"Revision $CntVerXml\">";
125
chdir "$RootSvnBook\\src\\out";
126
system ("$RootSvnBook\\src\\out\\mk_htmlhelp.bat");
130
#-------------------------------------------------------------------------
131
# FUNCTION CheckForProgs
132
# DOES Checking if required programs exists
138
my $Prog2CheckDesc='';
141
# Fill the %PATH% in @SysPath
142
@SysPath = split (/;/, $ENV{PATH});
144
# Check for the needed programs who should be in the %PATH%
145
while (($Prog2CheckDesc, $Prog2Check) = each %g_ProgsInPath)
147
my $bProg2CheckExists=0;
151
if (-e "$_\\$Prog2Check")
153
$bProg2CheckExists=1;
158
if (! $bProg2CheckExists)
161
push @MissingProgs, $Prog2CheckDesc;
165
# Check for MS HTML help compiler
166
$g_Prog_hhc = &cmn_ValuePathfile('path_hhc');
167
$g_Prog_hhc = "$g_Prog_hhc\\hhc.exe";
169
if (! -e $g_Prog_hhc)
172
push @MissingProgs, 'Microsoft HTML Help Workshop is needed for making the HTML-help file';
174
$g_Prog_hhc = "\"$g_Prog_hhc\"";
178
my $Msg="One or more required programs needed for making the docs are missing:\n\n";
182
$Msg=$Msg . " - $_\n";
185
$Msg=$Msg . "\nPlease, check that everything are installed properly as described in\n";
186
$Msg=$Msg . "the documentation in packages\\win32-innosetup\\tools\\readme.txt\n";
187
Win32::MsgBox($Msg, 0+MB_ICONSTOP, 'ERROR: Missing required programs.');
192
#-------------------------------------------------------------------------
193
# FUNCTION CopyAndEolU2W
194
# DOES Converts Unix eol's to Windows eol's in a file and saves it to
202
while (($FileSrc, $FileDest) = each %g_FilesToCpAndConv)
204
$FileSrc = "$g_PathDocRoot\\$FileSrc";
205
$FileDest = "$g_PathMiscIn\\$FileDest";
206
print "Copying and converting EOL's from $FileSrc to $FileDest\n";
208
open (FH_SRC, $FileSrc);
216
$FileCnt = $FileCnt . $_;
225
open (FH_DEST, ">" . $FileDest);
226
print FH_DEST $FileCnt;
233
#-------------------------------------------------------------------------
235
# DOES Making a directory. Similar to unix's mkdir -p
245
@SubPaths = split (/\\/, $Dir);
251
$Dir2Make = "$Dir2Make\\$_";
260
system ("mkdir $Dir2Make");