/vendor/pcre/PrepareRelease

http://github.com/feyeleanor/RubyGoLightly · #! · 214 lines · 184 code · 30 blank · 0 comment · 0 complexity · 196e682bcad7bdd549b5c523818076bc MD5 · raw file

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