File: build_lazutils_html.sh

package info (click to toggle)
lazarus 1.2.4%2Bdfsg2-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 170,220 kB
  • ctags: 115,165
  • sloc: pascal: 1,386,898; xml: 257,878; sh: 2,935; java: 603; makefile: 549; perl: 297; sql: 174; ansic: 137
file content (127 lines) | stat: -rwxr-xr-x 3,307 bytes parent folder | download | duplicates (4)
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
#!/usr/bin/env bash
#
# Author: Mattias Gaertner
#
# Creates the fpdoc HTML output for the Lazutils package
# Creates an chm file, if HTMLFMT is set to chm,
# otherwise it create html docs
#
# Usage: $0 <fpdoc-program-path> <footer-path> <fpcdocs-dir (http://svn.freepascal.org/svn/fpcdocs/trunk)>
# Example: $0 fpdoc ../locallclfooter.xml ../../../fpcdocs

#set -x
set -e

FPDoc=$1
if [ -z $FPDoc ]; then
  FPDoc=fpdoc
fi
FPDocFooter=$2
FPCDocDir=$3

PackageName=lazutils
XMLSrcDir=../xml/lazutils/
PasSrcDir=../../components/lazutils/
InputFileList=inputfile.txt

# list with units in a preseeded order.
# missing units will be dropped from this list, other units added.
# units not in import order will mutilate links.

PreorderUnitList=( lazutilsstrconsts luresstrings lazutf8sysutils lazmethodlist avglvltree )
PreorderUnitList+=( lazutf8 lazutf16 masks fileutil lazutf8classes lconvencoding paswstring )
PreorderUnitList+=( lazlogger lazdbglog lazfileutils lazfilecache  lazutils )
PreorderUnitList+=( laz2_xmlutils laz2_dom laz2_xmlread laz2_xmlwrite )
PreorderUnitList+=( laz_dom laz_xmlread laz_xmlwrite )
PreorderUnitList+=( laz_xmlcfg laz2_xmlcfg  laz_xmlstreaming )
#------------------

inarray() 
{ local tofind=$1  element; 
 shift; for element; do [[ $element = "$tofind" ]] && return; done; return 1; 
} 
# Usage: inarray "$value" "${array[@]}"


UnitListArr=()

# create output directory
mkdir -p $PackageName

# create unit list
cd $PasSrcDir
FindUnitList=(*.pas)
cd -

# test for preorder unit existance, add them to unitlist.
for preorder in ${PreorderUnitList[@]}; do
  if [ -f $PasSrcDir/$preorder.pp ]
  then
    UnitListArr+=($preorder.pp)
  fi  
  if [ -f $PasSrcDir/$preorder.pas ]
  then
    UnitListArr+=($preorder.pas)
  fi  
done

#echo 1 ${UnitListArr[@]}

for foundunit in ${FindUnitList[@]}; do
  if ! inarray "$foundunit" "${UnitListArr[@]}" 
  then
    UnitListArr+=($foundunit)  
  fi   
done

UnitList=
for foundunit in ${UnitListArr[@]}; do
  UnitList+="$foundunit "
done

# echo 2 $UnitList

# create description file list
DescrFiles=''
for unit in $UnitList; do
  ShortFile=${unit%.pp}
  ShortFile=${ShortFile%.pas}
  DescrFiles="$DescrFiles --descr=../$XMLSrcDir$ShortFile.xml"
done

# create input file list
CurInputFileList=$PackageName/$InputFileList
rm -f $CurInputFileList
for unit in $UnitList; do
  echo ../${PasSrcDir}$unit -Fi../${PasSrcDir}include >> $CurInputFileList
done

if [ -z "$HTMLFMT" ]; then
  HTMLFMT=html
fi

FPDocParams="--content=lazutils.xct --package=lazutils --descr=../${XMLSrcDir}lazutils.xml --format=$HTMLFMT"
if [ "$HTMLFMT" == "chm" ]; then
  FPDocParams="$FPDocParams --css-file=../fpdoc.css --auto-toc --auto-index --make-searchable --output=lazutils.chm"
fi
if [ -n "$FOOTERDATE" ]; then
  FPDocParams="$FPDocParams --footer-date=$FOOTERDATE"
fi
if [ -n "$FPDocFooter" ]; then
  FPDocParams="$FPDocParams --footer=$FPDocFooter"
fi
if [ -n "$FPCDocDir" ]; then
  if [ "$HTMLFMT" == "chm" ]; then
    FPDocParams="$FPDocParams --import=$FPCDocDir/rtl.xct,ms-its:rtl.chm::/ --import=$FPCDocDir/fcl.xct,ms-its:fcl.chm::/"
  else
    FPDocParams="$FPDocParams --import=$FPCDocDir/rtl.xct,../rtl/ --import=$FPCDocDir/fcl.xct,../fcl/"
  fi
fi

cd $PackageName
pwd
$FPDoc $DescrFiles --input=@$InputFileList $FPDocParams
cd -
   
# end.