tools/pcre/PrepareRelease
changeset 2762 d2d467bf1b5a
child 3831 babd0eee3c5e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/tools/pcre/PrepareRelease	Tue Jul 28 17:51:34 2009 -0400
     1.3 @@ -0,0 +1,214 @@
     1.4 +#/bin/sh
     1.5 +
     1.6 +# Script to prepare the files for building a PCRE release. It does some
     1.7 +# processing of the documentation, detrails files, and creates pcre.h.generic
     1.8 +# and config.h.generic (for use by builders who can't run ./configure).
     1.9 +
    1.10 +# You must run this script before runnning "make dist". It makes use of the
    1.11 +# following files:
    1.12 +
    1.13 +# 132html     A Perl script that converts a .1 or .3 man page into HTML. It
    1.14 +#             is called from MakeRelease. It "knows" the relevant troff
    1.15 +#             constructs that are used in the PCRE man pages.
    1.16 +
    1.17 +# CleanTxt    A Perl script that cleans up the output of "nroff -man" by
    1.18 +#             removing backspaces and other redundant text so as to produce
    1.19 +#             a readable .txt file.
    1.20 +
    1.21 +# Detrail     A Perl script that removes trailing spaces from files.
    1.22 +
    1.23 +# doc/index.html.src
    1.24 +#             A file that is copied as index.html into the doc/html directory
    1.25 +#             when the HTML documentation is built. It works like this so that
    1.26 +#             doc/html can be deleted and re-created from scratch.
    1.27 +
    1.28 +
    1.29 +# First, sort out the documentation
    1.30 +
    1.31 +cd doc
    1.32 +echo Processing documentation
    1.33 +
    1.34 +# Make Text form of the documentation. It needs some mangling to make it
    1.35 +# tidy for online reading. Concatenate all the .3 stuff, but omit the
    1.36 +# individual function pages.
    1.37 +
    1.38 +cat <<End >pcre.txt
    1.39 +-----------------------------------------------------------------------------
    1.40 +This file contains a concatenation of the PCRE man pages, converted to plain
    1.41 +text format for ease of searching with a text editor, or for use on systems
    1.42 +that do not have a man page processor. The small individual files that give
    1.43 +synopses of each function in the library have not been included. There are
    1.44 +separate text files for the pcregrep and pcretest commands.
    1.45 +-----------------------------------------------------------------------------
    1.46 +
    1.47 +
    1.48 +End
    1.49 +
    1.50 +echo "Making pcre.txt"
    1.51 +for file in pcre pcrebuild pcrematching pcreapi pcrecallout pcrecompat \
    1.52 +            pcrepattern pcresyntax pcrepartial pcreprecompile \
    1.53 +            pcreperform pcreposix pcrecpp pcresample pcrestack ; do
    1.54 +  echo "  Processing $file.3"
    1.55 +  nroff -c -man $file.3 >$file.rawtxt
    1.56 +  ../CleanTxt <$file.rawtxt >>pcre.txt
    1.57 +  /bin/rm $file.rawtxt
    1.58 +  echo "------------------------------------------------------------------------------" >>pcre.txt
    1.59 +  if [ "$file" != "pcresample" ] ; then
    1.60 +    echo " " >>pcre.txt
    1.61 +    echo " " >>pcre.txt
    1.62 +  fi
    1.63 +done
    1.64 +
    1.65 +# The three commands
    1.66 +for file in pcretest pcregrep pcre-config ; do
    1.67 +  echo Making $file.txt
    1.68 +  nroff -c -man $file.1 >$file.rawtxt
    1.69 +  ../CleanTxt <$file.rawtxt >$file.txt
    1.70 +  /bin/rm $file.rawtxt
    1.71 +done
    1.72 +
    1.73 +
    1.74 +# Make HTML form of the documentation.
    1.75 +
    1.76 +echo "Making HTML documentation"
    1.77 +/bin/rm html/*
    1.78 +cp index.html.src html/index.html
    1.79 +
    1.80 +for file in *.1 ; do
    1.81 +  base=`basename $file .1`
    1.82 +  echo "  Making $base.html"
    1.83 +  ../132html -toc $base <$file >html/$base.html
    1.84 +done
    1.85 +
    1.86 +# Exclude table of contents for function summaries. It seems that expr
    1.87 +# forces an anchored regex. Also exclude them for small pages that have
    1.88 +# only one section.
    1.89 +for file in *.3 ; do
    1.90 +  base=`basename $file .3`
    1.91 +  toc=-toc
    1.92 +  if [ `expr $base : '.*_'` -ne 0 ] ; then toc="" ; fi
    1.93 +  if [ "$base" = "pcresample" ] || \
    1.94 +     [ "$base" = "pcrestack" ]  || \
    1.95 +     [ "$base" = "pcrecompat" ] || \
    1.96 +     [ "$base" = "pcreperform" ] ; then
    1.97 +    toc=""
    1.98 +  fi
    1.99 +  echo "  Making $base.html"
   1.100 +  ../132html $toc $base <$file >html/$base.html
   1.101 +  if [ $? != 0 ] ; then exit 1; fi
   1.102 +done
   1.103 +
   1.104 +# End of documentation processing
   1.105 +
   1.106 +cd ..
   1.107 +echo Documentation done
   1.108 +
   1.109 +# These files are detrailed; do not detrail the test data because there may be
   1.110 +# significant trailing spaces. The configure files are also omitted from the
   1.111 +# detrailing.
   1.112 +
   1.113 +files="\
   1.114 +  Makefile.am \
   1.115 +  Makefile.in \
   1.116 +  configure.ac \
   1.117 +  README \
   1.118 +  LICENCE \
   1.119 +  COPYING \
   1.120 +  AUTHORS \
   1.121 +  NEWS \
   1.122 +  NON-UNIX-USE \
   1.123 +  INSTALL \
   1.124 +  132html \
   1.125 +  CleanTxt \
   1.126 +  Detrail \
   1.127 +  ChangeLog \
   1.128 +  CMakeLists.txt \
   1.129 +  RunGrepTest \
   1.130 +  RunTest \
   1.131 +  RunTest.bat \
   1.132 +  pcre-config.in \
   1.133 +  libpcre.pc.in \
   1.134 +  libpcrecpp.pc.in \
   1.135 +  config.h.in \
   1.136 +  pcre_printint.src \
   1.137 +  pcre_chartables.c.dist \
   1.138 +  pcredemo.c \
   1.139 +  pcregrep.c \
   1.140 +  pcretest.c \
   1.141 +  dftables.c \
   1.142 +  pcreposix.c \
   1.143 +  pcreposix.h \
   1.144 +  pcre.h.in \
   1.145 +  pcre_internal.h
   1.146 +  pcre_compile.c \
   1.147 +  pcre_config.c \
   1.148 +  pcre_dfa_exec.c \
   1.149 +  pcre_exec.c \
   1.150 +  pcre_fullinfo.c \
   1.151 +  pcre_get.c \
   1.152 +  pcre_globals.c \
   1.153 +  pcre_info.c \
   1.154 +  pcre_maketables.c \
   1.155 +  pcre_newline.c \
   1.156 +  pcre_ord2utf8.c \
   1.157 +  pcre_refcount.c \
   1.158 +  pcre_study.c \
   1.159 +  pcre_tables.c \
   1.160 +  pcre_try_flipped.c \
   1.161 +  pcre_ucp_searchfuncs.c \
   1.162 +  pcre_valid_utf8.c \
   1.163 +  pcre_version.c \
   1.164 +  pcre_xclass.c \
   1.165 +  pcre_scanner.cc \
   1.166 +  pcre_scanner.h \
   1.167 +  pcre_scanner_unittest.cc \
   1.168 +  pcrecpp.cc \
   1.169 +  pcrecpp.h \
   1.170 +  pcrecpparg.h.in \
   1.171 +  pcrecpp_unittest.cc \
   1.172 +  pcre_stringpiece.cc \
   1.173 +  pcre_stringpiece.h.in \
   1.174 +  pcre_stringpiece_unittest.cc \
   1.175 +  perltest.pl \
   1.176 +  ucp.h \
   1.177 +  ucpinternal.h \
   1.178 +  ucptable.h \
   1.179 +  makevp.bat \
   1.180 +  pcre.def \
   1.181 +  libpcre.def \
   1.182 +  libpcreposix.def"
   1.183 +
   1.184 +echo Detrailing
   1.185 +./Detrail $files doc/p* doc/html/*
   1.186 +
   1.187 +echo Doing basic configure to get default pcre.h and config.h
   1.188 +# This is in case the caller has set aliases (as I do - PH)
   1.189 +unset cp ls mv rm
   1.190 +./configure >/dev/null
   1.191 +
   1.192 +echo Converting pcre.h and config.h to generic forms
   1.193 +cp -f pcre.h pcre.h.generic
   1.194 +
   1.195 +perl <<'END'
   1.196 +  open(IN, "<config.h") || die "Can't open config.h: $!\n";
   1.197 +  open(OUT, ">config.h.generic") || die "Can't open config.h.generic: $!\n";
   1.198 +  while (<IN>)
   1.199 +    {
   1.200 +    if (/^#define\s(?!PACKAGE)(\w+)/)
   1.201 +      {
   1.202 +      print OUT "#ifndef $1\n";
   1.203 +      print OUT;
   1.204 +      print OUT "#endif\n";
   1.205 +      }
   1.206 +    else
   1.207 +      {
   1.208 +      print OUT;
   1.209 +      }
   1.210 +    }
   1.211 +  close IN;
   1.212 +  close OUT;
   1.213 +END
   1.214 +
   1.215 +echo Done
   1.216 +
   1.217 +#End