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 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204
|
#!/bin/csh -fb
#
# Creates ASCII manual pages in ASCMAN/man/man{1,...} sudirectories from
# nroff manual pages in SEDMAN/man/man{1,...} subdirectories.
# The ASCMAN/man/man{1,...} sudirectories are created if they do not exist.
# Also can create HTML version of the manpages.
#
# Requires groff to be installed and accessible.
#
# $1 = directory where aimk is installed
# $2 = "ge" "geee" "sge" or "sgeee"
# $3 = 0 or 1 - flag if man pages in ASCII format should be created
# $4 = 0 or 1 - flag if man pages in HTML format should be created
# $5 = 0 or 1 - checkout man pages with "-kv" flag
# $6 = name of the cvs module which will be checked out (default gridengine/doc/man)
# $7 = directory where the man pages will be built (default <source dir>/MANSBUILD_<product name>)
#
#___INFO__MARK_BEGIN__
##########################################################################
#
# The Contents of this file are made available subject to the terms of
# the Sun Industry Standards Source License Version 1.2
#
# Sun Microsystems Inc., March, 2001
#
#
# Sun Industry Standards Source License Version 1.2
# =================================================
# The contents of this file are subject to the Sun Industry Standards
# Source License Version 1.2 (the "License"); You may not use this file
# except in compliance with the License. You may obtain a copy of the
# License at http://gridengine.sunsource.net/Gridengine_SISSL_license.html
#
# Software provided under this License is provided on an "AS IS" basis,
# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
# See the License for the specific provisions governing your rights and
# obligations concerning the Software.
#
# The Initial Developer of the Original Code is: Sun Microsystems, Inc.
#
# Copyright: 2001 by Sun Microsystems, Inc.
#
# All Rights Reserved.
#
##########################################################################
#___INFO__MARK_END__
umask 022
set MANBUILDDIR = $1/MANSBUILD_$2
set MANMODE = $2
set MANASC = $3
set MANHTML = $4
set KVMAN = $5
if ( $#argv > 5 ) then
set CVS_MODULE = $6
else
set CVS_MODULE = gridengine/doc/man
endif
if ( $#argv > 6 ) then
set MANBUILDDIR = $7
endif
echo "Removing old manpages in $MANBUILDDIR"
\rm -rf $MANBUILDDIR
mkdir -p $MANBUILDDIR
# Take CVSROOT from current CVS direcotry
#
setenv CVSROOT `cat CVS/Root`
setenv CVSBRANCH ""
if ( $KVMAN == 1 ) then
if ( -f CVS/Tag ) then
setenv CVSBRANCH `sed 's/^[TN]//' CVS/Tag`
echo "==> Using CVS branch: ${CVSBRANCH}"
setenv CVSBRANCH "-r $CVSBRANCH"
endif
endif
cd $MANBUILDDIR
if ( $KVMAN == 1 ) then
set MANSRCDIR = $MANBUILDDIR/MANSRC
echo "Checking out manpage sources"
cvs -q co $CVSBRANCH -P -kv -d MANSRC $CVS_MODULE
else
set MANSRCDIR = $1/../doc/man
endif
#
# Changes magic strings in the checked-in man page versions into SGE
# SGEEE, etc. as appropriate.
# Creates the changed man pages in SEDMAN/man/man{1,...} subdirectories,
# which are created if they do not exist.
#
# Requires sed to be installed and accessible.
if ( $MANMODE == "ge" ) then
set xxQS_NAMExx = "Grid Engine"
set xxQS_NAME_Sxx = "GE"
set xxqs_name_sxx = "ge"
set xxRELxx = "GE 6.2"
else if ( $MANMODE == "sge" ) then
set xxQS_NAMExx = "Sun Grid Engine"
set xxQS_NAME_Sxx = "SGE"
set xxqs_name_sxx = "sge"
set xxRELxx = "SGE 6.2"
else
echo error wrong MANMODE=$MANMODE. Exit
exit 1
endif
# Build the list of the available sections
set SECTION_LIST = ""
foreach n ( 1 2 3 4 5 6 7 8 )
if ( -d $MANSRCDIR/man${n} ) then
if ( "$SECTION_LIST" == "" ) then
set SECTION_LIST = $n
else
set SECTION_LIST = "$SECTION_LIST $n"
endif
endif
end
echo "Building SEDMAN pages"
foreach n ( $SECTION_LIST )
mkdir -p $MANBUILDDIR/SEDMAN/man/man${n} >& /dev/null
if ( ! -d $MANBUILDDIR/SEDMAN/man/man${n} ) then
echo "Error: Couldn't create subdirectory SEDMAN/man/man${n}."
exit 1
endif
foreach f ( $MANSRCDIR/man${n}/*.${n} )
echo Processing $f
sed -e "s/xxQS_NAMExx/$xxQS_NAMExx/g" \
-e "s/xxQS_NAME_Sxx/$xxQS_NAME_Sxx/g" \
-e "s/xxqs_name_sxx/$xxqs_name_sxx/g" \
-e "s/xxRELxx/$xxRELxx/g" $f >! $MANBUILDDIR/SEDMAN/man/man${n}/`basename $f`
end
end
#
# process the seded man pages with groff
#
if ( "$MANASC" == 1 ) then
echo "Building ASCMAN from sedman pages"
foreach n ( $SECTION_LIST )
mkdir -p $MANBUILDDIR/ASCMAN/man/man${n} >& /dev/null
if ( ! -d $MANBUILDDIR/ASCMAN/man/man${n} ) then
echo "Error: Couldn't create subdirectory ASCMAN/man/man${n}."
exit 1
endif
cd $MANBUILDDIR/SEDMAN/man
foreach f ( man${n}/*.${n} )
echo Processing $f
groff -man -t -Tascii $f >! $MANBUILDDIR/ASCMAN/man/man${n}/`basename $f .${n}`
end
end
endif
#
# build html man pages from sedman with man2html
#
if ( "$MANHTML" == 1 ) then
echo "Building HTML from sedman pages"
foreach n ( $SECTION_LIST )
mkdir -p $MANBUILDDIR/HTMLMAN/htmlman${n}
foreach i ($MANBUILDDIR/SEDMAN/man/man${n}/*)
echo Processing $i
set bn = `basename $i .${n}`
# man -M$MANBUILDDIR/SEDMAN/man/ $bn | man2html -solaris > $MANBUILDDIR/HTMLMAN/htmlman${n}/${bn}.html
set secopt = -s
if ( Linux == `uname` ) then
set secopt = ""
endif
man -M$MANBUILDDIR/SEDMAN/man/ $secopt $n $bn | man2html -cgiurl '../htmlman$section/$title.html' -solaris | sed '2s/BODY/BODY BGCOLOR=white/' > $MANBUILDDIR/HTMLMAN/htmlman${n}/${bn}.html
end
end
#
# generate an index file
#
cp $1/scripts/template.html $MANBUILDDIR/HTMLMAN/index.html
foreach n ( $SECTION_LIST )
echo "<H3>Section $n</H3>" >> $MANBUILDDIR/HTMLMAN/index.html
echo '<P><UL>' >> $MANBUILDDIR/HTMLMAN/index.html
foreach f ($MANBUILDDIR/HTMLMAN/htmlman${n}/*)
set base = `basename $f`
set title = `basename $base .html`
echo '<LI><A HREF=' >> $MANBUILDDIR/HTMLMAN/index.html
echo "htmlman${n}/$base" target="PAGE">> $MANBUILDDIR/HTMLMAN/index.html
echo ">$title</A>" >> $MANBUILDDIR/HTMLMAN/index.html
end
echo '</UL></P>' >> $MANBUILDDIR/HTMLMAN/index.html
end
echo '</BODY></HTML>' >> $MANBUILDDIR/HTMLMAN/index.html
endif
|