Blame PrepareRelease

Packit 78a954
#/bin/sh
Packit 78a954
Packit 78a954
# Script to prepare the files for building a PCRE release. It does some
Packit 78a954
# processing of the documentation, detrails files, and creates pcre.h.generic
Packit 78a954
# and config.h.generic (for use by builders who can't run ./configure).
Packit 78a954
Packit 78a954
# You must run this script before runnning "make dist". If its first argument
Packit 78a954
# is "doc", it stops after preparing the documentation. There are no other
Packit 78a954
# arguments. The script makes use of the following files:
Packit 78a954
Packit 78a954
# 132html     A Perl script that converts a .1 or .3 man page into HTML. It
Packit 78a954
#             "knows" the relevant troff constructs that are used in the PCRE
Packit 78a954
#             man pages.
Packit 78a954
Packit 78a954
# CheckMan    A Perl script that checks man pages for typos in the mark up.
Packit 78a954
Packit 78a954
# CleanTxt    A Perl script that cleans up the output of "nroff -man" by
Packit 78a954
#             removing backspaces and other redundant text so as to produce
Packit 78a954
#             a readable .txt file.
Packit 78a954
Packit 78a954
# Detrail     A Perl script that removes trailing spaces from files.
Packit 78a954
Packit 78a954
# doc/index.html.src
Packit 78a954
#             A file that is copied as index.html into the doc/html directory
Packit 78a954
#             when the HTML documentation is built. It works like this so that
Packit 78a954
#             doc/html can be deleted and re-created from scratch.
Packit 78a954
Packit 78a954
# README & NON-AUTOTOOLS-BUILD
Packit 78a954
#             These files are copied into the doc/html directory, with .txt
Packit 78a954
#             extensions so that they can by hyperlinked from the HTML 
Packit 78a954
#             documentation, because some people just go to the HTML without
Packit 78a954
#             looking for text files.
Packit 78a954
Packit 78a954
Packit 78a954
# First, sort out the documentation. Remove pcredemo.3 first because it won't
Packit 78a954
# pass the markup check (it is created below, using markup that none of the
Packit 78a954
# other pages use).
Packit 78a954
Packit 78a954
cd doc
Packit 78a954
echo Processing documentation
Packit 78a954
Packit 78a954
/bin/rm -f pcredemo.3
Packit 78a954
Packit 78a954
# Check the remaining man pages
Packit 78a954
Packit 78a954
perl ../CheckMan *.1 *.3
Packit 78a954
if [ $? != 0 ] ; then exit 1; fi
Packit 78a954
Packit 78a954
# Make Text form of the documentation. It needs some mangling to make it
Packit 78a954
# tidy for online reading. Concatenate all the .3 stuff, but omit the
Packit 78a954
# individual function pages.
Packit 78a954
Packit 78a954
cat <<End >pcre.txt
Packit 78a954
-----------------------------------------------------------------------------
Packit 78a954
This file contains a concatenation of the PCRE man pages, converted to plain
Packit 78a954
text format for ease of searching with a text editor, or for use on systems
Packit 78a954
that do not have a man page processor. The small individual files that give
Packit 78a954
synopses of each function in the library have not been included. Neither has
Packit 78a954
the pcredemo program. There are separate text files for the pcregrep and
Packit 78a954
pcretest commands.
Packit 78a954
-----------------------------------------------------------------------------
Packit 78a954
Packit 78a954
Packit 78a954
End
Packit 78a954
Packit 78a954
echo "Making pcre.txt"
Packit 78a954
for file in pcre pcre16 pcre32 pcrebuild pcrematching pcreapi pcrecallout \
Packit 78a954
            pcrecompat pcrepattern pcresyntax pcreunicode pcrejit pcrepartial \
Packit 78a954
            pcreprecompile pcreperform pcreposix pcrecpp pcresample \
Packit 78a954
            pcrelimits pcrestack ; do
Packit 78a954
  echo "  Processing $file.3"
Packit 78a954
  nroff -c -man $file.3 >$file.rawtxt
Packit 78a954
  perl ../CleanTxt <$file.rawtxt >>pcre.txt
Packit 78a954
  /bin/rm $file.rawtxt
Packit 78a954
  echo "------------------------------------------------------------------------------" >>pcre.txt
Packit 78a954
  if [ "$file" != "pcresample" ] ; then
Packit 78a954
    echo " " >>pcre.txt
Packit 78a954
    echo " " >>pcre.txt
Packit 78a954
  fi
Packit 78a954
done
Packit 78a954
Packit 78a954
# The three commands
Packit 78a954
for file in pcretest pcregrep pcre-config ; do
Packit 78a954
  echo Making $file.txt
Packit 78a954
  nroff -c -man $file.1 >$file.rawtxt
Packit 78a954
  perl ../CleanTxt <$file.rawtxt >$file.txt
Packit 78a954
  /bin/rm $file.rawtxt
Packit 78a954
done
Packit 78a954
Packit 78a954
Packit 78a954
# Make pcredemo.3 from the pcredemo.c source file
Packit 78a954
Packit 78a954
echo "Making pcredemo.3"
Packit 78a954
perl <<"END" >pcredemo.3
Packit 78a954
  open(IN, "../pcredemo.c") || die "Failed to open pcredemo.c\n";
Packit 78a954
  open(OUT, ">pcredemo.3") || die "Failed to open pcredemo.3\n";
Packit 78a954
  print OUT ".\\\" Start example.\n" .
Packit 78a954
            ".de EX\n" .
Packit 78a954
            ".  nr mE \\\\n(.f\n" .
Packit 78a954
            ".  nf\n" .
Packit 78a954
            ".  nh\n" .
Packit 78a954
            ".  ft CW\n" .
Packit 78a954
            "..\n" .
Packit 78a954
            ".\n" .
Packit 78a954
            ".\n" .
Packit 78a954
            ".\\\" End example.\n" .
Packit 78a954
            ".de EE\n" .
Packit 78a954
            ".  ft \\\\n(mE\n" .
Packit 78a954
            ".  fi\n" .
Packit 78a954
            ".  hy \\\\n(HY\n" .
Packit 78a954
            "..\n" .
Packit 78a954
            ".\n" .
Packit 78a954
            ".EX\n" ;
Packit 78a954
  while (<IN>)
Packit 78a954
    {
Packit 78a954
    s/\\/\\e/g;
Packit 78a954
    print OUT;
Packit 78a954
    }
Packit 78a954
  print OUT ".EE\n";
Packit 78a954
  close(IN);
Packit 78a954
  close(OUT);
Packit 78a954
END
Packit 78a954
if [ $? != 0 ] ; then exit 1; fi
Packit 78a954
Packit 78a954
Packit 78a954
# Make HTML form of the documentation.
Packit 78a954
Packit 78a954
echo "Making HTML documentation"
Packit 78a954
/bin/rm html/*
Packit 78a954
cp index.html.src html/index.html
Packit 78a954
cp ../README html/README.txt
Packit 78a954
cp ../NON-AUTOTOOLS-BUILD html/NON-AUTOTOOLS-BUILD.txt
Packit 78a954
Packit 78a954
for file in *.1 ; do
Packit 78a954
  base=`basename $file .1`
Packit 78a954
  echo "  Making $base.html"
Packit 78a954
  perl ../132html -toc $base <$file >html/$base.html
Packit 78a954
done
Packit 78a954
Packit 78a954
# Exclude table of contents for function summaries. It seems that expr
Packit 78a954
# forces an anchored regex. Also exclude them for small pages that have
Packit 78a954
# only one section.
Packit 78a954
Packit 78a954
for file in *.3 ; do
Packit 78a954
  base=`basename $file .3`
Packit 78a954
  toc=-toc
Packit 78a954
  if [ `expr $base : '.*_'` -ne 0 ] ; then toc="" ; fi
Packit 78a954
  if [ "$base" = "pcresample" ]  || \
Packit 78a954
     [ "$base" = "pcrestack" ]   || \
Packit 78a954
     [ "$base" = "pcrecompat" ]  || \
Packit 78a954
     [ "$base" = "pcrelimits" ]  || \
Packit 78a954
     [ "$base" = "pcreperform" ] || \
Packit 78a954
     [ "$base" = "pcreunicode" ] ; then
Packit 78a954
    toc=""
Packit 78a954
  fi
Packit 78a954
  echo "  Making $base.html"
Packit 78a954
  perl ../132html $toc $base <$file >html/$base.html
Packit 78a954
  if [ $? != 0 ] ; then exit 1; fi
Packit 78a954
done
Packit 78a954
Packit 78a954
# End of documentation processing; stop if only documentation required.
Packit 78a954
Packit 78a954
cd ..
Packit 78a954
echo Documentation done
Packit 78a954
if [ "$1" = "doc" ] ; then exit; fi
Packit 78a954
Packit 78a954
# These files are detrailed; do not detrail the test data because there may be
Packit 78a954
# significant trailing spaces. Do not detrail RunTest.bat, because it has CRLF
Packit 78a954
# line endings and the detrail script removes all trailing white space. The
Packit 78a954
# configure files are also omitted from the detrailing. We don't bother with
Packit 78a954
# those pcre[16|32]_xx files that just define COMPILE_PCRE16 and then #include the
Packit 78a954
# common file, because they aren't going to change.
Packit 78a954
Packit 78a954
files="\
Packit 78a954
  Makefile.am \
Packit 78a954
  Makefile.in \
Packit 78a954
  configure.ac \
Packit 78a954
  README \
Packit 78a954
  LICENCE \
Packit 78a954
  COPYING \
Packit 78a954
  AUTHORS \
Packit 78a954
  NEWS \
Packit 78a954
  NON-UNIX-USE \
Packit 78a954
  NON-AUTOTOOLS-BUILD \
Packit 78a954
  INSTALL \
Packit 78a954
  132html \
Packit 78a954
  CleanTxt \
Packit 78a954
  Detrail \
Packit 78a954
  ChangeLog \
Packit 78a954
  CMakeLists.txt \
Packit 78a954
  RunGrepTest \
Packit 78a954
  RunTest \
Packit 78a954
  pcre-config.in \
Packit 78a954
  libpcre.pc.in \
Packit 78a954
  libpcre16.pc.in \
Packit 78a954
  libpcre32.pc.in \
Packit 78a954
  libpcreposix.pc.in \
Packit 78a954
  libpcrecpp.pc.in \
Packit 78a954
  config.h.in \
Packit 78a954
  pcre_chartables.c.dist \
Packit 78a954
  pcredemo.c \
Packit 78a954
  pcregrep.c \
Packit 78a954
  pcretest.c \
Packit 78a954
  dftables.c \
Packit 78a954
  pcreposix.c \
Packit 78a954
  pcreposix.h \
Packit 78a954
  pcre.h.in \
Packit 78a954
  pcre_internal.h \
Packit 78a954
  pcre_byte_order.c \
Packit 78a954
  pcre_compile.c \
Packit 78a954
  pcre_config.c \
Packit 78a954
  pcre_dfa_exec.c \
Packit 78a954
  pcre_exec.c \
Packit 78a954
  pcre_fullinfo.c \
Packit 78a954
  pcre_get.c \
Packit 78a954
  pcre_globals.c \
Packit 78a954
  pcre_jit_compile.c \
Packit 78a954
  pcre_jit_test.c \
Packit 78a954
  pcre_maketables.c \
Packit 78a954
  pcre_newline.c \
Packit 78a954
  pcre_ord2utf8.c \
Packit 78a954
  pcre16_ord2utf16.c \
Packit 78a954
  pcre32_ord2utf32.c \
Packit 78a954
  pcre_printint.c \
Packit 78a954
  pcre_refcount.c \
Packit 78a954
  pcre_string_utils.c \
Packit 78a954
  pcre_study.c \
Packit 78a954
  pcre_tables.c \
Packit 78a954
  pcre_valid_utf8.c \
Packit 78a954
  pcre_version.c \
Packit 78a954
  pcre_xclass.c \
Packit 78a954
  pcre16_utf16_utils.c \
Packit 78a954
  pcre32_utf32_utils.c \
Packit 78a954
  pcre16_valid_utf16.c \
Packit 78a954
  pcre32_valid_utf32.c \
Packit 78a954
  pcre_scanner.cc \
Packit 78a954
  pcre_scanner.h \
Packit 78a954
  pcre_scanner_unittest.cc \
Packit 78a954
  pcrecpp.cc \
Packit 78a954
  pcrecpp.h \
Packit 78a954
  pcrecpparg.h.in \
Packit 78a954
  pcrecpp_unittest.cc \
Packit 78a954
  pcre_stringpiece.cc \
Packit 78a954
  pcre_stringpiece.h.in \
Packit 78a954
  pcre_stringpiece_unittest.cc \
Packit 78a954
  perltest.pl \
Packit 78a954
  ucp.h \
Packit 78a954
  makevp.bat \
Packit 78a954
  pcre.def \
Packit 78a954
  libpcre.def \
Packit 78a954
  libpcreposix.def"
Packit 78a954
Packit 78a954
echo Detrailing
Packit 78a954
perl ./Detrail $files doc/p* doc/html/*
Packit 78a954
Packit 78a954
echo Done
Packit 78a954
Packit 78a954
#End