3 # Script to prepare the files for building a PCRE release. It does some
4 # processing of the documentation, detrails files, and creates pcre.h.generic
5 # and config.h.generic (for use by builders who can't run ./configure).
7 # You must run this script before runnning "make dist". If its first argument
8 # is "doc", it stops after preparing the documentation. There are no other
9 # arguments. The script makes use of the following files:
11 # 132html A Perl script that converts a .1 or .3 man page into HTML. It
12 # "knows" the relevant troff constructs that are used in the PCRE
15 # CheckMan A Perl script that checks man pages for typos in the mark up.
17 # CleanTxt A Perl script that cleans up the output of "nroff -man" by
18 # removing backspaces and other redundant text so as to produce
19 # a readable .txt file.
21 # Detrail A Perl script that removes trailing spaces from files.
24 # A file that is copied as index.html into the doc/html directory
25 # when the HTML documentation is built. It works like this so that
26 # doc/html can be deleted and re-created from scratch.
28 # README & NON-AUTOTOOLS-BUILD
29 # These files are copied into the doc/html directory, with .txt
30 # extensions so that they can by hyperlinked from the HTML
31 # documentation, because some people just go to the HTML without
32 # looking for text files.
35 # First, sort out the documentation. Remove pcredemo.3 first because it won't
36 # pass the markup check (it is created below, using markup that none of the
40 echo Processing documentation
44 # Check the remaining man pages
46 perl ../CheckMan *.1 *.3
47 if [ $? != 0 ] ; then exit 1; fi
49 # Make Text form of the documentation. It needs some mangling to make it
50 # tidy for online reading. Concatenate all the .3 stuff, but omit the
51 # individual function pages.
54 -----------------------------------------------------------------------------
55 This file contains a concatenation of the PCRE man pages, converted to plain
56 text format for ease of searching with a text editor, or for use on systems
57 that do not have a man page processor. The small individual files that give
58 synopses of each function in the library have not been included. Neither has
59 the pcredemo program. There are separate text files for the pcregrep and
61 -----------------------------------------------------------------------------
66 echo "Making pcre.txt"
67 for file in pcre pcre16 pcre32 pcrebuild pcrematching pcreapi pcrecallout \
68 pcrecompat pcrepattern pcresyntax pcreunicode pcrejit pcrepartial \
69 pcreprecompile pcreperform pcreposix pcrecpp pcresample \
70 pcrelimits pcrestack ; do
71 echo " Processing $file.3"
72 nroff -c -man $file.3 >$file.rawtxt
73 perl ../CleanTxt <$file.rawtxt >>pcre.txt
75 echo "------------------------------------------------------------------------------" >>pcre.txt
76 if [ "$file" != "pcresample" ] ; then
83 for file in pcretest pcregrep pcre-config ; do
85 nroff -c -man $file.1 >$file.rawtxt
86 perl ../CleanTxt <$file.rawtxt >$file.txt
91 # Make pcredemo.3 from the pcredemo.c source file
93 echo "Making pcredemo.3"
94 perl <<"END" >pcredemo.3
95 open(IN, "../pcredemo.c") || die "Failed to open pcredemo.c\n";
96 open(OUT, ">pcredemo.3") || die "Failed to open pcredemo.3\n";
97 print OUT ".\\\" Start example.\n" .
99 ". nr mE \\\\n(.f\n" .
106 ".\\\" End example.\n" .
123 if [ $? != 0 ] ; then exit 1; fi
126 # Make HTML form of the documentation.
128 echo "Making HTML documentation"
130 cp index.html.src html/index.html
131 cp ../README html/README.txt
132 cp ../NON-AUTOTOOLS-BUILD html/NON-AUTOTOOLS-BUILD.txt
135 base=`basename $file .1`
136 echo " Making $base.html"
137 perl ../132html -toc $base <$file >html/$base.html
140 # Exclude table of contents for function summaries. It seems that expr
141 # forces an anchored regex. Also exclude them for small pages that have
145 base=`basename $file .3`
147 if [ `expr $base : '.*_'` -ne 0 ] ; then toc="" ; fi
148 if [ "$base" = "pcresample" ] || \
149 [ "$base" = "pcrestack" ] || \
150 [ "$base" = "pcrecompat" ] || \
151 [ "$base" = "pcrelimits" ] || \
152 [ "$base" = "pcreperform" ] || \
153 [ "$base" = "pcreunicode" ] ; then
156 echo " Making $base.html"
157 perl ../132html $toc $base <$file >html/$base.html
158 if [ $? != 0 ] ; then exit 1; fi
161 # End of documentation processing; stop if only documentation required.
164 echo Documentation done
165 if [ "$1" = "doc" ] ; then exit; fi
167 # These files are detrailed; do not detrail the test data because there may be
168 # significant trailing spaces. Do not detrail RunTest.bat, because it has CRLF
169 # line endings and the detrail script removes all trailing white space. The
170 # configure files are also omitted from the detrailing. We don't bother with
171 # those pcre[16|32]_xx files that just define COMPILE_PCRE16 and then #include the
172 # common file, because they aren't going to change.
184 NON-AUTOTOOLS-BUILD \
200 pcre_chartables.c.dist \
226 pcre_string_utils.c \
232 pcre16_utf16_utils.c \
233 pcre32_utf32_utils.c \
234 pcre16_valid_utf16.c \
235 pcre32_valid_utf32.c \
238 pcre_scanner_unittest.cc \
242 pcrecpp_unittest.cc \
243 pcre_stringpiece.cc \
244 pcre_stringpiece.h.in \
245 pcre_stringpiece_unittest.cc \
254 perl ./Detrail $files doc/p* doc/html/*