Annotation of embedaddon/pcre/PrepareRelease, revision 1.1.1.3

1.1       misho       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". 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:
                     10: 
                     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
                     13: #             man pages.
                     14: 
                     15: # CheckMan    A Perl script that checks man pages for typos in the mark up.
                     16: 
                     17: # CleanTxt    A Perl script that cleans up the output of "nroff -man" by
                     18: #             removing backspaces and other redundant text so as to produce
                     19: #             a readable .txt file.
                     20: 
                     21: # Detrail     A Perl script that removes trailing spaces from files.
                     22: 
                     23: # doc/index.html.src
                     24: #             A file that is copied as index.html into the doc/html directory
                     25: #             when the HTML documentation is built. It works like this so that
                     26: #             doc/html can be deleted and re-created from scratch.
                     27: 
                     28: 
                     29: # First, sort out the documentation. Remove pcredemo.3 first because it won't
                     30: # pass the markup check (it is created below, using markup that none of the
                     31: # other pages use).
                     32: 
                     33: cd doc
                     34: echo Processing documentation
                     35: 
                     36: /bin/rm -f pcredemo.3
                     37: 
                     38: # Check the remaining man pages
                     39: 
                     40: perl ../CheckMan *.1 *.3
                     41: if [ $? != 0 ] ; then exit 1; fi
                     42: 
                     43: # Make Text form of the documentation. It needs some mangling to make it
                     44: # tidy for online reading. Concatenate all the .3 stuff, but omit the
                     45: # individual function pages.
                     46: 
                     47: cat <<End >pcre.txt
                     48: -----------------------------------------------------------------------------
                     49: This file contains a concatenation of the PCRE man pages, converted to plain
                     50: text format for ease of searching with a text editor, or for use on systems
                     51: that do not have a man page processor. The small individual files that give
                     52: synopses of each function in the library have not been included. Neither has
                     53: the pcredemo program. There are separate text files for the pcregrep and
                     54: pcretest commands.
                     55: -----------------------------------------------------------------------------
                     56: 
                     57: 
                     58: End
                     59: 
                     60: echo "Making pcre.txt"
1.1.1.2   misho      61: for file in pcre pcre16 pcrebuild pcrematching pcreapi pcrecallout pcrecompat \
1.1       misho      62:             pcrepattern pcresyntax pcreunicode pcrejit pcrepartial \
                     63:             pcreprecompile pcreperform pcreposix pcrecpp pcresample \
                     64:             pcrelimits pcrestack ; do
                     65:   echo "  Processing $file.3"
                     66:   nroff -c -man $file.3 >$file.rawtxt
                     67:   perl ../CleanTxt <$file.rawtxt >>pcre.txt
                     68:   /bin/rm $file.rawtxt
                     69:   echo "------------------------------------------------------------------------------" >>pcre.txt
                     70:   if [ "$file" != "pcresample" ] ; then
                     71:     echo " " >>pcre.txt
                     72:     echo " " >>pcre.txt
                     73:   fi
                     74: done
                     75: 
                     76: # The three commands
                     77: for file in pcretest pcregrep pcre-config ; do
                     78:   echo Making $file.txt
                     79:   nroff -c -man $file.1 >$file.rawtxt
                     80:   perl ../CleanTxt <$file.rawtxt >$file.txt
                     81:   /bin/rm $file.rawtxt
                     82: done
                     83: 
                     84: 
                     85: # Make pcredemo.3 from the pcredemo.c source file
                     86: 
                     87: echo "Making pcredemo.3"
                     88: perl <<"END" >pcredemo.3
                     89:   open(IN, "../pcredemo.c") || die "Failed to open pcredemo.c\n";
                     90:   open(OUT, ">pcredemo.3") || die "Failed to open pcredemo.3\n";
                     91:   print OUT ".\\\" Start example.\n" .
                     92:             ".de EX\n" .
                     93:             ".  nr mE \\\\n(.f\n" .
                     94:             ".  nf\n" .
                     95:             ".  nh\n" .
                     96:             ".  ft CW\n" .
                     97:             "..\n" .
                     98:             ".\n" .
                     99:             ".\n" .
                    100:             ".\\\" End example.\n" .
                    101:             ".de EE\n" .
                    102:             ".  ft \\\\n(mE\n" .
                    103:             ".  fi\n" .
                    104:             ".  hy \\\\n(HY\n" .
                    105:             "..\n" .
                    106:             ".\n" .
                    107:             ".EX\n" ;
                    108:   while (<IN>)
                    109:     {
                    110:     s/\\/\\e/g;
                    111:     print OUT;
                    112:     }
                    113:   print OUT ".EE\n";
                    114:   close(IN);
                    115:   close(OUT);
                    116: END
                    117: if [ $? != 0 ] ; then exit 1; fi
                    118: 
                    119: 
                    120: # Make HTML form of the documentation.
                    121: 
                    122: echo "Making HTML documentation"
                    123: /bin/rm html/*
                    124: cp index.html.src html/index.html
                    125: 
                    126: for file in *.1 ; do
                    127:   base=`basename $file .1`
                    128:   echo "  Making $base.html"
                    129:   perl ../132html -toc $base <$file >html/$base.html
                    130: done
                    131: 
                    132: # Exclude table of contents for function summaries. It seems that expr
                    133: # forces an anchored regex. Also exclude them for small pages that have
                    134: # only one section.
                    135: 
                    136: for file in *.3 ; do
                    137:   base=`basename $file .3`
                    138:   toc=-toc
                    139:   if [ `expr $base : '.*_'` -ne 0 ] ; then toc="" ; fi
                    140:   if [ "$base" = "pcresample" ]  || \
                    141:      [ "$base" = "pcrestack" ]   || \
                    142:      [ "$base" = "pcrecompat" ]  || \
                    143:      [ "$base" = "pcrelimits" ]  || \
                    144:      [ "$base" = "pcreperform" ] || \
                    145:      [ "$base" = "pcreunicode" ] ; then
                    146:     toc=""
                    147:   fi
                    148:   echo "  Making $base.html"
                    149:   perl ../132html $toc $base <$file >html/$base.html
                    150:   if [ $? != 0 ] ; then exit 1; fi
                    151: done
                    152: 
                    153: # End of documentation processing; stop if only documentation required.
                    154: 
                    155: cd ..
                    156: echo Documentation done
                    157: if [ "$1" = "doc" ] ; then exit; fi
                    158: 
                    159: # These files are detrailed; do not detrail the test data because there may be
                    160: # significant trailing spaces. Do not detrail RunTest.bat, because it has CRLF
                    161: # line endings and the detrail script removes all trailing white space. The
1.1.1.2   misho     162: # configure files are also omitted from the detrailing. We don't bother with
                    163: # those pcre16_xx files that just define COMPILE_PCRE16 and then #include the
                    164: # common file, because they aren't going to change.
1.1       misho     165: 
                    166: files="\
                    167:   Makefile.am \
                    168:   Makefile.in \
                    169:   configure.ac \
                    170:   README \
                    171:   LICENCE \
                    172:   COPYING \
                    173:   AUTHORS \
                    174:   NEWS \
                    175:   NON-UNIX-USE \
1.1.1.3 ! misho     176:   NON-AUTOTOOLS-BUILD \
1.1       misho     177:   INSTALL \
                    178:   132html \
                    179:   CleanTxt \
                    180:   Detrail \
                    181:   ChangeLog \
                    182:   CMakeLists.txt \
                    183:   RunGrepTest \
                    184:   RunTest \
                    185:   pcre-config.in \
                    186:   libpcre.pc.in \
1.1.1.2   misho     187:   libpcre16.pc.in \
1.1       misho     188:   libpcreposix.pc.in \
                    189:   libpcrecpp.pc.in \
                    190:   config.h.in \
                    191:   pcre_chartables.c.dist \
                    192:   pcredemo.c \
                    193:   pcregrep.c \
                    194:   pcretest.c \
                    195:   dftables.c \
                    196:   pcreposix.c \
                    197:   pcreposix.h \
                    198:   pcre.h.in \
                    199:   pcre_internal.h
1.1.1.2   misho     200:   pcre_byte_order.c \
1.1       misho     201:   pcre_compile.c \
                    202:   pcre_config.c \
                    203:   pcre_dfa_exec.c \
                    204:   pcre_exec.c \
                    205:   pcre_fullinfo.c \
                    206:   pcre_get.c \
                    207:   pcre_globals.c \
                    208:   pcre_jit_compile.c \
                    209:   pcre_jit_test.c \
                    210:   pcre_maketables.c \
                    211:   pcre_newline.c \
                    212:   pcre_ord2utf8.c \
1.1.1.2   misho     213:   pcre16_ord2utf16.c \
                    214:   pcre_printint.c \
1.1       misho     215:   pcre_refcount.c \
1.1.1.2   misho     216:   pcre_string_utils.c \
1.1       misho     217:   pcre_study.c \
                    218:   pcre_tables.c \
                    219:   pcre_ucp_searchfuncs.c \
                    220:   pcre_valid_utf8.c \
                    221:   pcre_version.c \
                    222:   pcre_xclass.c \
1.1.1.2   misho     223:   pcre16_utf16_utils.c \
                    224:   pcre16_valid_utf16.c \
1.1       misho     225:   pcre_scanner.cc \
                    226:   pcre_scanner.h \
                    227:   pcre_scanner_unittest.cc \
                    228:   pcrecpp.cc \
                    229:   pcrecpp.h \
                    230:   pcrecpparg.h.in \
                    231:   pcrecpp_unittest.cc \
                    232:   pcre_stringpiece.cc \
                    233:   pcre_stringpiece.h.in \
                    234:   pcre_stringpiece_unittest.cc \
                    235:   perltest.pl \
                    236:   ucp.h \
                    237:   ucpinternal.h \
                    238:   ucptable.h \
                    239:   makevp.bat \
                    240:   pcre.def \
                    241:   libpcre.def \
                    242:   libpcreposix.def"
                    243: 
                    244: echo Detrailing
                    245: perl ./Detrail $files doc/p* doc/html/*
                    246: 
                    247: echo Doing basic configure to get default pcre.h and config.h
                    248: # This is in case the caller has set aliases (as I do - PH)
                    249: unset cp ls mv rm
                    250: ./configure >/dev/null
                    251: 
                    252: echo Converting pcre.h and config.h to generic forms
                    253: cp -f pcre.h pcre.h.generic
                    254: 
                    255: perl <<'END'
                    256:   open(IN, "<config.h") || die "Can't open config.h: $!\n";
                    257:   open(OUT, ">config.h.generic") || die "Can't open config.h.generic: $!\n";
                    258:   while (<IN>)
                    259:     {
                    260:     if (/^#define\s(?!PACKAGE)(\w+)/)
                    261:       {
                    262:       print OUT "#ifndef $1\n";
                    263:       print OUT;
                    264:       print OUT "#endif\n";
                    265:       }
                    266:     else
                    267:       {
                    268:       print OUT;
                    269:       }
                    270:     }
                    271:   close IN;
                    272:   close OUT;
                    273: END
                    274: 
                    275: echo Done
                    276: 
                    277: #End

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>