Blame PrepareRelease

Packit 504f36
#/bin/sh
Packit 504f36
Packit 504f36
# Script to prepare the files for building a PCRE2 release. It does some
Packit 504f36
# processing of the documentation, detrails files, and creates pcre2.h.generic
Packit 504f36
# and config.h.generic (for use by builders who can't run ./configure).
Packit 504f36
Packit 504f36
# You must run this script before runnning "make dist". If its first argument
Packit 504f36
# is "doc", it stops after preparing the documentation. There are no other
Packit 504f36
# arguments. The script makes use of the following files:
Packit 504f36
Packit 504f36
# 132html     A Perl script that converts a .1 or .3 man page into HTML. It
Packit 504f36
#             "knows" the relevant troff constructs that are used in the PCRE2
Packit 504f36
#             man pages.
Packit 504f36
Packit 504f36
# CheckMan    A Perl script that checks man pages for typos in the mark up.
Packit 504f36
Packit 504f36
# CleanTxt    A Perl script that cleans up the output of "nroff -man" by
Packit 504f36
#             removing backspaces and other redundant text so as to produce
Packit 504f36
#             a readable .txt file.
Packit 504f36
Packit 504f36
# Detrail     A Perl script that removes trailing spaces from files.
Packit 504f36
Packit 504f36
# doc/index.html.src
Packit 504f36
#             A file that is copied as index.html into the doc/html directory
Packit 504f36
#             when the HTML documentation is built. It works like this so that
Packit 504f36
#             doc/html can be deleted and re-created from scratch.
Packit 504f36
Packit 504f36
# README & NON-AUTOTOOLS-BUILD
Packit 504f36
#             These files are copied into the doc/html directory, with .txt
Packit 504f36
#             extensions so that they can by hyperlinked from the HTML
Packit 504f36
#             documentation, because some people just go to the HTML without
Packit 504f36
#             looking for text files.
Packit 504f36
Packit 504f36
Packit 504f36
# First, sort out the documentation. Remove pcre2demo.3 first because it won't
Packit 504f36
# pass the markup check (it is created below, using markup that none of the
Packit 504f36
# other pages use).
Packit 504f36
Packit 504f36
cd doc
Packit 504f36
echo Processing documentation
Packit 504f36
Packit 504f36
/bin/rm -f pcre2demo.3
Packit 504f36
Packit 504f36
# Check the remaining man pages
Packit 504f36
Packit 504f36
perl ../CheckMan *.1 *.3
Packit 504f36
if [ $? != 0 ] ; then exit 1; fi
Packit 504f36
Packit 504f36
# Make Text form of the documentation. It needs some mangling to make it
Packit 504f36
# tidy for online reading. Concatenate all the .3 stuff, but omit the
Packit 504f36
# individual function pages.
Packit 504f36
Packit 504f36
cat <<End >pcre2.txt
Packit 504f36
-----------------------------------------------------------------------------
Packit 504f36
This file contains a concatenation of the PCRE2 man pages, converted to plain
Packit 504f36
text format for ease of searching with a text editor, or for use on systems
Packit 504f36
that do not have a man page processor. The small individual files that give
Packit 504f36
synopses of each function in the library have not been included. Neither has
Packit 504f36
the pcre2demo program. There are separate text files for the pcre2grep and
Packit 504f36
pcre2test commands.
Packit 504f36
-----------------------------------------------------------------------------
Packit 504f36
Packit 504f36
Packit 504f36
End
Packit 504f36
Packit 504f36
echo "Making pcre2.txt"
Packit 504f36
for file in pcre2 pcre2api pcre2build pcre2callout pcre2compat pcre2jit \
Packit 504f36
            pcre2limits pcre2matching pcre2partial pcre2pattern pcre2perform \
Packit 504f36
            pcre2posix pcre2sample pcre2serialize pcre2syntax \
Packit 504f36
            pcre2unicode ; do
Packit 504f36
  echo "  Processing $file.3"
Packit 504f36
  nroff -c -man $file.3 >$file.rawtxt
Packit 504f36
  perl ../CleanTxt <$file.rawtxt >>pcre2.txt
Packit 504f36
  /bin/rm $file.rawtxt
Packit 504f36
  echo "------------------------------------------------------------------------------" >>pcre2.txt
Packit 504f36
  if [ "$file" != "pcre2sample" ] ; then
Packit 504f36
    echo " " >>pcre2.txt
Packit 504f36
    echo " " >>pcre2.txt
Packit 504f36
  fi
Packit 504f36
done
Packit 504f36
Packit 504f36
# The three commands
Packit 504f36
for file in pcre2test pcre2grep pcre2-config ; do
Packit 504f36
  echo Making $file.txt
Packit 504f36
  nroff -c -man $file.1 >$file.rawtxt
Packit 504f36
  perl ../CleanTxt <$file.rawtxt >$file.txt
Packit 504f36
  /bin/rm $file.rawtxt
Packit 504f36
done
Packit 504f36
Packit 504f36
Packit 504f36
# Make pcre2demo.3 from the pcre2demo.c source file
Packit 504f36
Packit 504f36
echo "Making pcre2demo.3"
Packit 504f36
perl <<"END" >pcre2demo.3
Packit 504f36
  open(IN, "../src/pcre2demo.c") || die "Failed to open src/pcre2demo.c\n";
Packit 504f36
  open(OUT, ">pcre2demo.3") || die "Failed to open pcre2demo.3\n";
Packit 504f36
  print OUT ".\\\" Start example.\n" .
Packit 504f36
            ".de EX\n" .
Packit 504f36
            ".  nr mE \\\\n(.f\n" .
Packit 504f36
            ".  nf\n" .
Packit 504f36
            ".  nh\n" .
Packit 504f36
            ".  ft CW\n" .
Packit 504f36
            "..\n" .
Packit 504f36
            ".\n" .
Packit 504f36
            ".\n" .
Packit 504f36
            ".\\\" End example.\n" .
Packit 504f36
            ".de EE\n" .
Packit 504f36
            ".  ft \\\\n(mE\n" .
Packit 504f36
            ".  fi\n" .
Packit 504f36
            ".  hy \\\\n(HY\n" .
Packit 504f36
            "..\n" .
Packit 504f36
            ".\n" .
Packit 504f36
            ".EX\n" ;
Packit 504f36
  while (<IN>)
Packit 504f36
    {
Packit 504f36
    s/\\/\\e/g;
Packit 504f36
    print OUT;
Packit 504f36
    }
Packit 504f36
  print OUT ".EE\n";
Packit 504f36
  close(IN);
Packit 504f36
  close(OUT);
Packit 504f36
END
Packit 504f36
if [ $? != 0 ] ; then exit 1; fi
Packit 504f36
Packit 504f36
Packit 504f36
# Make HTML form of the documentation.
Packit 504f36
Packit 504f36
echo "Making HTML documentation"
Packit 504f36
/bin/rm html/*
Packit 504f36
cp index.html.src html/index.html
Packit 504f36
cp ../README html/README.txt
Packit 504f36
cp ../NON-AUTOTOOLS-BUILD html/NON-AUTOTOOLS-BUILD.txt
Packit 504f36
Packit 504f36
for file in *.1 ; do
Packit 504f36
  base=`basename $file .1`
Packit 504f36
  echo "  Making $base.html"
Packit 504f36
  perl ../132html -toc $base <$file >html/$base.html
Packit 504f36
done
Packit 504f36
Packit 504f36
# Exclude table of contents for function summaries. It seems that expr
Packit 504f36
# forces an anchored regex. Also exclude them for small pages that have
Packit 504f36
# only one section.
Packit 504f36
Packit 504f36
for file in *.3 ; do
Packit 504f36
  base=`basename $file .3`
Packit 504f36
  toc=-toc
Packit 504f36
  if [ `expr $base : '.*_'` -ne 0 ] ; then toc="" ; fi
Packit 504f36
  if [ "$base" = "pcre2sample" ]  || \
Packit 504f36
     [ "$base" = "pcre2compat" ]  || \
Packit 504f36
     [ "$base" = "pcre2limits" ]  || \
Packit 504f36
     [ "$base" = "pcre2unicode" ] ; then
Packit 504f36
    toc=""
Packit 504f36
  fi
Packit 504f36
  echo "  Making $base.html"
Packit 504f36
  perl ../132html $toc $base <$file >html/$base.html
Packit 504f36
  if [ $? != 0 ] ; then exit 1; fi
Packit 504f36
done
Packit 504f36
Packit 504f36
# End of documentation processing; stop if only documentation required.
Packit 504f36
Packit 504f36
cd ..
Packit 504f36
echo Documentation done
Packit 504f36
if [ "$1" = "doc" ] ; then exit; fi
Packit 504f36
Packit 504f36
# These files are detrailed; do not detrail the test data because there may be
Packit 504f36
# significant trailing spaces. Do not detrail RunTest.bat, because it has CRLF
Packit 504f36
# line endings and the detrail script removes all trailing white space. The
Packit 504f36
# configure files are also omitted from the detrailing.
Packit 504f36
Packit 504f36
files="\
Packit 504f36
  Makefile.am \
Packit 504f36
  configure.ac \
Packit 504f36
  README \
Packit 504f36
  LICENCE \
Packit 504f36
  COPYING \
Packit 504f36
  AUTHORS \
Packit 504f36
  NEWS \
Packit 504f36
  NON-AUTOTOOLS-BUILD \
Packit 504f36
  INSTALL \
Packit 504f36
  132html \
Packit 504f36
  CleanTxt \
Packit 504f36
  Detrail \
Packit 504f36
  ChangeLog \
Packit 504f36
  CMakeLists.txt \
Packit 504f36
  RunGrepTest \
Packit 504f36
  RunTest \
Packit 504f36
  pcre2-config.in \
Packit 504f36
  perltest.sh \
Packit 504f36
  libpcre2-8.pc.in \
Packit 504f36
  libpcre2-16.pc.in \
Packit 504f36
  libpcre2-32.pc.in \
Packit 504f36
  libpcre2-posix.pc.in \
Packit 504f36
  src/dftables.c \
Packit 504f36
  src/pcre2.h.in \
Packit 504f36
  src/pcre2_auto_possess.c \
Packit 504f36
  src/pcre2_compile.c \
Packit 504f36
  src/pcre2_config.c \
Packit 504f36
  src/pcre2_context.c \
Packit 504f36
  src/pcre2_convert.c \
Packit 504f36
  src/pcre2_dfa_match.c \
Packit 504f36
  src/pcre2_error.c \
Packit 504f36
  src/pcre2_extuni.c \
Packit 504f36
  src/pcre2_find_bracket.c \
Packit 504f36
  src/pcre2_internal.h \
Packit 504f36
  src/pcre2_intmodedep.h \
Packit 504f36
  src/pcre2_jit_compile.c \
Packit 504f36
  src/pcre2_jit_match.c \
Packit 504f36
  src/pcre2_jit_misc.c \
Packit 504f36
  src/pcre2_jit_test.c \
Packit 504f36
  src/pcre2_maketables.c \
Packit 504f36
  src/pcre2_match.c \
Packit 504f36
  src/pcre2_match_data.c \
Packit 504f36
  src/pcre2_newline.c \
Packit 504f36
  src/pcre2_ord2utf.c \
Packit 504f36
  src/pcre2_pattern_info.c \
Packit 504f36
  src/pcre2_printint.c \
Packit 504f36
  src/pcre2_string_utils.c \
Packit 504f36
  src/pcre2_study.c \
Packit 504f36
  src/pcre2_substring.c \
Packit 504f36
  src/pcre2_tables.c \
Packit 504f36
  src/pcre2_ucd.c \
Packit 504f36
  src/pcre2_ucp.h \
Packit 504f36
  src/pcre2_valid_utf.c \
Packit 504f36
  src/pcre2_xclass.c \
Packit 504f36
  src/pcre2demo.c \
Packit 504f36
  src/pcre2grep.c \
Packit 504f36
  src/pcre2posix.c \
Packit 504f36
  src/pcre2posix.h \
Packit 504f36
  src/pcre2test.c"
Packit 504f36
Packit 504f36
echo Detrailing
Packit 504f36
perl ./Detrail $files doc/p* doc/html/*
Packit 504f36
Packit 504f36
echo Done
Packit 504f36
Packit 504f36
#End