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 # CleanTxt A Perl script that cleans up the output of "nroff -man" by
16 # removing backspaces and other redundant text so as to produce
17 # a readable .txt file.
19 # Detrail A Perl script that removes trailing spaces from files.
22 # A file that is copied as index.html into the doc/html directory
23 # when the HTML documentation is built. It works like this so that
24 # doc/html can be deleted and re-created from scratch.
27 # First, sort out the documentation
30 echo Processing documentation
32 # Make Text form of the documentation. It needs some mangling to make it
33 # tidy for online reading. Concatenate all the .3 stuff, but omit the
34 # individual function pages.
37 -----------------------------------------------------------------------------
38 This file contains a concatenation of the PCRE man pages, converted to plain
39 text format for ease of searching with a text editor, or for use on systems
40 that do not have a man page processor. The small individual files that give
41 synopses of each function in the library have not been included. Neither has
42 the pcredemo program. There are separate text files for the pcregrep and
44 -----------------------------------------------------------------------------
49 echo "Making pcre.txt"
50 for file in pcre pcrebuild pcrematching pcreapi pcrecallout pcrecompat \
51 pcrepattern pcresyntax pcrepartial pcreprecompile \
52 pcreperform pcreposix pcrecpp pcresample pcrestack ; do
53 echo " Processing $file.3"
54 nroff -c -man $file.3 >$file.rawtxt
55 ../CleanTxt <$file.rawtxt >>pcre.txt
57 echo "------------------------------------------------------------------------------" >>pcre.txt
58 if [ "$file" != "pcresample" ] ; then
65 for file in pcretest pcregrep pcre-config ; do
67 nroff -c -man $file.1 >$file.rawtxt
68 ../CleanTxt <$file.rawtxt >$file.txt
73 # Make pcredemo.3 from the pcredemo.c source file
75 echo "Making pcredemo.3"
76 perl <<"END" >pcredemo.3
77 open(IN, "../pcredemo.c") || die "Failed to open pcredemo.c\n";
78 open(OUT, ">pcredemo.3") || die "Failed to open pcredemo.3\n";
79 print OUT ".\\\" Start example.\n" .
81 ". nr mE \\\\n(.f\n" .
88 ".\\\" End example.\n" .
105 if [ $? != 0 ] ; then exit 1; fi
108 # Make HTML form of the documentation.
110 echo "Making HTML documentation"
112 cp index.html.src html/index.html
115 base=`basename $file .1`
116 echo " Making $base.html"
117 ../132html -toc $base <$file >html/$base.html
120 # Exclude table of contents for function summaries. It seems that expr
121 # forces an anchored regex. Also exclude them for small pages that have
125 base=`basename $file .3`
127 if [ `expr $base : '.*_'` -ne 0 ] ; then toc="" ; fi
128 if [ "$base" = "pcresample" ] || \
129 [ "$base" = "pcrestack" ] || \
130 [ "$base" = "pcrecompat" ] || \
131 [ "$base" = "pcreperform" ] ; then
134 echo " Making $base.html"
135 ../132html $toc $base <$file >html/$base.html
136 if [ $? != 0 ] ; then exit 1; fi
139 # End of documentation processing; stop if only documentation required.
142 echo Documentation done
143 if [ "$1" = "doc" ] ; then exit; fi
145 # These files are detrailed; do not detrail the test data because there may be
146 # significant trailing spaces. The configure files are also omitted from the
174 pcre_chartables.c.dist \
198 pcre_ucp_searchfuncs.c \
204 pcre_scanner_unittest.cc \
208 pcrecpp_unittest.cc \
209 pcre_stringpiece.cc \
210 pcre_stringpiece.h.in \
211 pcre_stringpiece_unittest.cc \
222 ./Detrail $files doc/p* doc/html/*
224 echo Doing basic configure to get default pcre.h and config.h
225 # This is in case the caller has set aliases (as I do - PH)
227 ./configure >/dev/null
229 echo Converting pcre.h and config.h to generic forms
230 cp -f pcre.h pcre.h.generic
233 open(IN, "<config.h") || die "Can't open config.h: $!\n";
234 open(OUT, ">config.h.generic") || die "Can't open config.h.generic: $!\n";
237 if (/^#define\s(?!PACKAGE)(\w+)/)
239 print OUT "#ifndef $1\n";
241 print OUT "#endif\n";