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.
29 # First, sort out the documentation. Remove pcredemo.3 first because it won't
30 # pass the markup check (it is created below, using markup that none of the
34 echo Processing documentation
38 # Check the remaining man pages
40 perl ../CheckMan *.1 *.3
41 if [ $? != 0 ] ; then exit 1; fi
43 # Make Text form of the documentation. It needs some mangling to make it
44 # tidy for online reading. Concatenate all the .3 stuff, but omit the
45 # individual function pages.
48 -----------------------------------------------------------------------------
49 This file contains a concatenation of the PCRE man pages, converted to plain
50 text format for ease of searching with a text editor, or for use on systems
51 that do not have a man page processor. The small individual files that give
52 synopses of each function in the library have not been included. Neither has
53 the pcredemo program. There are separate text files for the pcregrep and
55 -----------------------------------------------------------------------------
60 echo "Making pcre.txt"
61 for file in pcre pcre16 pcre32 pcrebuild pcrematching pcreapi pcrecallout \
62 pcrecompat pcrepattern pcresyntax pcreunicode pcrejit pcrepartial \
63 pcreprecompile pcreperform pcreposix pcrecpp pcresample \
64 pcrelimits pcrestack ; do
65 echo " Processing $file.3"
66 nroff -c -man $file.3 >$file.rawtxt
67 perl ../CleanTxt <$file.rawtxt >>pcre.txt
69 echo "------------------------------------------------------------------------------" >>pcre.txt
70 if [ "$file" != "pcresample" ] ; then
77 for file in pcretest pcregrep pcre-config ; do
79 nroff -c -man $file.1 >$file.rawtxt
80 perl ../CleanTxt <$file.rawtxt >$file.txt
85 # Make pcredemo.3 from the pcredemo.c source file
87 echo "Making pcredemo.3"
88 perl <<"END" >pcredemo.3
89 open(IN, "../pcredemo.c") || die "Failed to open pcredemo.c\n";
90 open(OUT, ">pcredemo.3") || die "Failed to open pcredemo.3\n";
91 print OUT ".\\\" Start example.\n" .
93 ". nr mE \\\\n(.f\n" .
100 ".\\\" End example.\n" .
117 if [ $? != 0 ] ; then exit 1; fi
120 # Make HTML form of the documentation.
122 echo "Making HTML documentation"
124 cp index.html.src html/index.html
127 base=`basename $file .1`
128 echo " Making $base.html"
129 perl ../132html -toc $base <$file >html/$base.html
132 # Exclude table of contents for function summaries. It seems that expr
133 # forces an anchored regex. Also exclude them for small pages that have
137 base=`basename $file .3`
139 if [ `expr $base : '.*_'` -ne 0 ] ; then toc="" ; fi
140 if [ "$base" = "pcresample" ] || \
141 [ "$base" = "pcrestack" ] || \
142 [ "$base" = "pcrecompat" ] || \
143 [ "$base" = "pcrelimits" ] || \
144 [ "$base" = "pcreperform" ] || \
145 [ "$base" = "pcreunicode" ] ; then
148 echo " Making $base.html"
149 perl ../132html $toc $base <$file >html/$base.html
150 if [ $? != 0 ] ; then exit 1; fi
153 # End of documentation processing; stop if only documentation required.
156 echo Documentation done
157 if [ "$1" = "doc" ] ; then exit; fi
159 # These files are detrailed; do not detrail the test data because there may be
160 # significant trailing spaces. Do not detrail RunTest.bat, because it has CRLF
161 # line endings and the detrail script removes all trailing white space. The
162 # configure files are also omitted from the detrailing. We don't bother with
163 # those pcre[16|32]_xx files that just define COMPILE_PCRE16 and then #include the
164 # common file, because they aren't going to change.
176 NON-AUTOTOOLS-BUILD \
192 pcre_chartables.c.dist \
218 pcre_string_utils.c \
221 pcre_ucp_searchfuncs.c \
225 pcre16_utf16_utils.c \
226 pcre32_utf32_utils.c \
227 pcre16_valid_utf16.c \
228 pcre32_valid_utf32.c \
231 pcre_scanner_unittest.cc \
235 pcrecpp_unittest.cc \
236 pcre_stringpiece.cc \
237 pcre_stringpiece.h.in \
238 pcre_stringpiece_unittest.cc \
249 perl ./Detrail $files doc/p* doc/html/*