| 1 |
#/bin/sh
|
| 2 |
|
| 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).
|
| 6 |
|
| 7 |
# You must run this script before runnning "make dist". It makes use of the
|
| 8 |
# following files:
|
| 9 |
|
| 10 |
# 132html A Perl script that converts a .1 or .3 man page into HTML. It
|
| 11 |
# is called from MakeRelease. It "knows" the relevant troff
|
| 12 |
# constructs that are used in the PCRE man pages.
|
| 13 |
|
| 14 |
# CleanTxt A Perl script that cleans up the output of "nroff -man" by
|
| 15 |
# removing backspaces and other redundant text so as to produce
|
| 16 |
# a readable .txt file.
|
| 17 |
|
| 18 |
# Detrail A Perl script that removes trailing spaces from files.
|
| 19 |
|
| 20 |
# doc/index.html.src
|
| 21 |
# A file that is copied as index.html into the doc/html directory
|
| 22 |
# when the HTML documentation is built. It works like this so that
|
| 23 |
# doc/html can be deleted and re-created from scratch.
|
| 24 |
|
| 25 |
|
| 26 |
# First, sort out the documentation
|
| 27 |
|
| 28 |
cd doc
|
| 29 |
echo Processing documentation
|
| 30 |
|
| 31 |
# Make Text form of the documentation. It needs some mangling to make it
|
| 32 |
# tidy for online reading. Concatenate all the .3 stuff, but omit the
|
| 33 |
# individual function pages.
|
| 34 |
|
| 35 |
cat <<End >pcre.txt
|
| 36 |
-----------------------------------------------------------------------------
|
| 37 |
This file contains a concatenation of the PCRE man pages, converted to plain
|
| 38 |
text format for ease of searching with a text editor, or for use on systems
|
| 39 |
that do not have a man page processor. The small individual files that give
|
| 40 |
synopses of each function in the library have not been included. There are
|
| 41 |
separate text files for the pcregrep and pcretest commands.
|
| 42 |
-----------------------------------------------------------------------------
|
| 43 |
|
| 44 |
|
| 45 |
End
|
| 46 |
|
| 47 |
echo "Making pcre.txt"
|
| 48 |
for file in pcre pcrebuild pcrematching pcreapi pcrecallout pcrecompat \
|
| 49 |
pcrepattern pcresyntax pcrepartial pcreprecompile \
|
| 50 |
pcreperform pcreposix pcrecpp pcresample pcrestack ; do
|
| 51 |
echo " Processing $file.3"
|
| 52 |
nroff -c -man $file.3 >$file.rawtxt
|
| 53 |
../CleanTxt <$file.rawtxt >>pcre.txt
|
| 54 |
/bin/rm $file.rawtxt
|
| 55 |
echo "------------------------------------------------------------------------------" >>pcre.txt
|
| 56 |
if [ "$file" != "pcresample" ] ; then
|
| 57 |
echo " " >>pcre.txt
|
| 58 |
echo " " >>pcre.txt
|
| 59 |
fi
|
| 60 |
done
|
| 61 |
|
| 62 |
# The three commands
|
| 63 |
for file in pcretest pcregrep pcre-config ; do
|
| 64 |
echo Making $file.txt
|
| 65 |
nroff -c -man $file.1 >$file.rawtxt
|
| 66 |
../CleanTxt <$file.rawtxt >$file.txt
|
| 67 |
/bin/rm $file.rawtxt
|
| 68 |
done
|
| 69 |
|
| 70 |
|
| 71 |
# Make HTML form of the documentation.
|
| 72 |
|
| 73 |
echo "Making HTML documentation"
|
| 74 |
/bin/rm html/*
|
| 75 |
cp index.html.src html/index.html
|
| 76 |
|
| 77 |
for file in *.1 ; do
|
| 78 |
base=`basename $file .1`
|
| 79 |
echo " Making $base.html"
|
| 80 |
../132html -toc $base <$file >html/$base.html
|
| 81 |
done
|
| 82 |
|
| 83 |
# Exclude table of contents for function summaries. It seems that expr
|
| 84 |
# forces an anchored regex. Also exclude them for small pages that have
|
| 85 |
# only one section.
|
| 86 |
for file in *.3 ; do
|
| 87 |
base=`basename $file .3`
|
| 88 |
toc=-toc
|
| 89 |
if [ `expr $base : '.*_'` -ne 0 ] ; then toc="" ; fi
|
| 90 |
if [ "$base" = "pcresample" ] || \
|
| 91 |
[ "$base" = "pcrestack" ] || \
|
| 92 |
[ "$base" = "pcrecompat" ] || \
|
| 93 |
[ "$base" = "pcreperform" ] ; then
|
| 94 |
toc=""
|
| 95 |
fi
|
| 96 |
echo " Making $base.html"
|
| 97 |
../132html $toc $base <$file >html/$base.html
|
| 98 |
if [ $? != 0 ] ; then exit 1; fi
|
| 99 |
done
|
| 100 |
|
| 101 |
# End of documentation processing
|
| 102 |
|
| 103 |
cd ..
|
| 104 |
echo Documentation done
|
| 105 |
|
| 106 |
# These files are detrailed; do not detrail the test data because there may be
|
| 107 |
# significant trailing spaces. The configure files are also omitted from the
|
| 108 |
# detrailing.
|
| 109 |
|
| 110 |
files="\
|
| 111 |
Makefile.am \
|
| 112 |
Makefile.in \
|
| 113 |
configure.ac \
|
| 114 |
README \
|
| 115 |
LICENCE \
|
| 116 |
COPYING \
|
| 117 |
AUTHORS \
|
| 118 |
NEWS \
|
| 119 |
NON-UNIX-USE \
|
| 120 |
INSTALL \
|
| 121 |
132html \
|
| 122 |
CleanTxt \
|
| 123 |
Detrail \
|
| 124 |
ChangeLog \
|
| 125 |
CMakeLists.txt \
|
| 126 |
RunGrepTest \
|
| 127 |
RunTest \
|
| 128 |
RunTest.bat \
|
| 129 |
pcre-config.in \
|
| 130 |
libpcre.pc.in \
|
| 131 |
libpcrecpp.pc.in \
|
| 132 |
config.h \
|
| 133 |
config.h.in \
|
| 134 |
pcre_printint.src \
|
| 135 |
pcre_chartables.c.dist \
|
| 136 |
pcredemo.c \
|
| 137 |
pcregrep.c \
|
| 138 |
pcretest.c \
|
| 139 |
dftables.c \
|
| 140 |
pcreposix.c \
|
| 141 |
pcreposix.h \
|
| 142 |
pcre.h.in \
|
| 143 |
pcre_internal.h
|
| 144 |
pcre_compile.c \
|
| 145 |
pcre_config.c \
|
| 146 |
pcre_dfa_exec.c \
|
| 147 |
pcre_exec.c \
|
| 148 |
pcre_fullinfo.c \
|
| 149 |
pcre_get.c \
|
| 150 |
pcre_globals.c \
|
| 151 |
pcre_info.c \
|
| 152 |
pcre_maketables.c \
|
| 153 |
pcre_newline.c \
|
| 154 |
pcre_ord2utf8.c \
|
| 155 |
pcre_refcount.c \
|
| 156 |
pcre_study.c \
|
| 157 |
pcre_tables.c \
|
| 158 |
pcre_try_flipped.c \
|
| 159 |
pcre_ucp_searchfuncs.c \
|
| 160 |
pcre_valid_utf8.c \
|
| 161 |
pcre_version.c \
|
| 162 |
pcre_xclass.c \
|
| 163 |
pcre_scanner.cc \
|
| 164 |
pcre_scanner.h \
|
| 165 |
pcre_scanner_unittest.cc \
|
| 166 |
pcrecpp.cc \
|
| 167 |
pcrecpp.h \
|
| 168 |
pcrecpparg.h.in \
|
| 169 |
pcrecpp_unittest.cc \
|
| 170 |
pcre_stringpiece.cc \
|
| 171 |
pcre_stringpiece.h.in \
|
| 172 |
pcre_stringpiece_unittest.cc \
|
| 173 |
perltest.pl \
|
| 174 |
ucp.h \
|
| 175 |
ucpinternal.h \
|
| 176 |
ucptable.h \
|
| 177 |
makevp.bat \
|
| 178 |
pcre.def \
|
| 179 |
libpcre.def \
|
| 180 |
libpcreposix.def"
|
| 181 |
|
| 182 |
echo Detrailing
|
| 183 |
./Detrail $files doc/p* doc/html/*
|
| 184 |
|
| 185 |
echo Doing basic configure to get default pcre.h and config.h
|
| 186 |
# This is in case the caller has set aliases (as I do - PH)
|
| 187 |
unset cp ls mv rm
|
| 188 |
./configure >/dev/null
|
| 189 |
|
| 190 |
echo Converting pcre.h and config.h to generic forms
|
| 191 |
cp -f pcre.h pcre.h.generic
|
| 192 |
|
| 193 |
perl <<'END'
|
| 194 |
open(IN, "<config.h") || die "Can't open config.h: $!\n";
|
| 195 |
open(OUT, ">config.h.generic") || die "Can't open config.h.generic: $!\n";
|
| 196 |
while (<IN>)
|
| 197 |
{
|
| 198 |
if (/^#define\s(?!PACKAGE)(\w+)/)
|
| 199 |
{
|
| 200 |
print OUT "#ifndef $1\n";
|
| 201 |
print OUT;
|
| 202 |
print OUT "#endif\n";
|
| 203 |
}
|
| 204 |
else
|
| 205 |
{
|
| 206 |
print OUT;
|
| 207 |
}
|
| 208 |
}
|
| 209 |
close IN;
|
| 210 |
close OUT;
|
| 211 |
END
|
| 212 |
|
| 213 |
echo Done
|
| 214 |
|
| 215 |
#End
|