github的一些开源项目
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

257 lines
7.5 KiB

  1. #/bin/sh
  2. # Script to prepare the files for building a PCRE2 release. It does some
  3. # processing of the documentation, detrails files, and creates pcre2.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". If its first argument
  6. # is "doc", it stops after preparing the documentation. There are no other
  7. # arguments. The script makes use of the following files:
  8. # 132html A Perl script that converts a .1 or .3 man page into HTML. It
  9. # "knows" the relevant troff constructs that are used in the PCRE2
  10. # man pages.
  11. # CheckMan A Perl script that checks man pages for typos in the mark up.
  12. # CleanTxt A Perl script that cleans up the output of "nroff -man" by
  13. # removing backspaces and other redundant text so as to produce
  14. # a readable .txt file.
  15. # Detrail A Perl script that removes trailing spaces from files.
  16. # doc/index.html.src
  17. # A file that is copied as index.html into the doc/html directory
  18. # when the HTML documentation is built. It works like this so that
  19. # doc/html can be deleted and re-created from scratch.
  20. # README & NON-AUTOTOOLS-BUILD
  21. # These files are copied into the doc/html directory, with .txt
  22. # extensions so that they can by hyperlinked from the HTML
  23. # documentation, because some people just go to the HTML without
  24. # looking for text files.
  25. # First, sort out the documentation. Remove pcre2demo.3 first because it won't
  26. # pass the markup check (it is created below, using markup that none of the
  27. # other pages use).
  28. cd doc
  29. echo Processing documentation
  30. /bin/rm -f pcre2demo.3
  31. # Check the remaining man pages
  32. perl ../CheckMan *.1 *.3
  33. if [ $? != 0 ] ; then exit 1; fi
  34. # Make Text form of the documentation. It needs some mangling to make it
  35. # tidy for online reading. Concatenate all the .3 stuff, but omit the
  36. # individual function pages.
  37. cat <<End >pcre2.txt
  38. -----------------------------------------------------------------------------
  39. This file contains a concatenation of the PCRE2 man pages, converted to plain
  40. text format for ease of searching with a text editor, or for use on systems
  41. that do not have a man page processor. The small individual files that give
  42. synopses of each function in the library have not been included. Neither has
  43. the pcre2demo program. There are separate text files for the pcre2grep and
  44. pcre2test commands.
  45. -----------------------------------------------------------------------------
  46. End
  47. echo "Making pcre2.txt"
  48. for file in pcre2 pcre2api pcre2build pcre2callout pcre2compat pcre2jit \
  49. pcre2limits pcre2matching pcre2partial pcre2pattern pcre2perform \
  50. pcre2posix pcre2sample pcre2serialize pcre2syntax \
  51. pcre2unicode ; do
  52. echo " Processing $file.3"
  53. nroff -c -man $file.3 >$file.rawtxt
  54. perl ../CleanTxt <$file.rawtxt >>pcre2.txt
  55. /bin/rm $file.rawtxt
  56. echo "------------------------------------------------------------------------------" >>pcre2.txt
  57. if [ "$file" != "pcre2sample" ] ; then
  58. echo " " >>pcre2.txt
  59. echo " " >>pcre2.txt
  60. fi
  61. done
  62. # The three commands
  63. for file in pcre2test pcre2grep pcre2-config ; do
  64. echo Making $file.txt
  65. nroff -c -man $file.1 >$file.rawtxt
  66. perl ../CleanTxt <$file.rawtxt >$file.txt
  67. /bin/rm $file.rawtxt
  68. done
  69. # Make pcre2demo.3 from the pcre2demo.c source file
  70. echo "Making pcre2demo.3"
  71. perl <<"END" >pcre2demo.3
  72. use Time::Piece;
  73. open(VH, "<", "../src/config.h.generic") || die "Failed to open src/config.h.generic\n";
  74. open(IN, "../src/pcre2demo.c") || die "Failed to open src/pcre2demo.c\n";
  75. open(OUT, ">pcre2demo.3") || die "Failed to open pcre2demo.3\n";
  76. my $version;
  77. while (<VH>)
  78. {
  79. chomp;
  80. if ( /^#define PACKAGE_STRING "([^"]+)"/ ) { $version = $1 ; last }
  81. }
  82. my $t = localtime;
  83. print OUT ".TH PCRE2DEMO 3 \"", $t->strftime('%e %B %Y'), '" "', $version, "\"\n" .
  84. ".\\\"AUTOMATICALLY GENERATED BY PrepareRelease - do not EDIT!\n" .
  85. ".SH NAME\n" .
  86. "PCRE2DEMO - A demonstration C program for PCRE2\n" .
  87. ".SH \"SOURCE CODE\"\n" .
  88. ".rs\n" .
  89. ".sp\n" .
  90. ".\\\" Start example.\n" .
  91. ".de EX\n" .
  92. ". do ds mF \\\\n[.fam]\n" .
  93. ". nr mE \\\\n(.f\n" .
  94. ". nf\n" .
  95. ". nh\n" .
  96. ". do fam C\n" .
  97. ". ft CW\n" .
  98. "..\n" .
  99. ".\n" .
  100. ".\n" .
  101. ".\\\" End example.\n" .
  102. ".de EE\n" .
  103. ". do fam \\\\*(mF\n" .
  104. ". ft \\\\n(mE\n" .
  105. ". fi\n" .
  106. ". hy \\\\n(HY\n" .
  107. "..\n" .
  108. ".\n" .
  109. ".RS -7\n" .
  110. ".EX\n" ;
  111. while (<IN>)
  112. {
  113. s/\\/\\e/g;
  114. print OUT;
  115. }
  116. print OUT ".EE\n";
  117. close(IN);
  118. close(OUT);
  119. END
  120. if [ $? != 0 ] ; then exit 1; fi
  121. # Make HTML form of the documentation.
  122. echo "Making HTML documentation"
  123. /bin/rm html/*
  124. cp index.html.src html/index.html
  125. cp ../README html/README.txt
  126. cp ../NON-AUTOTOOLS-BUILD html/NON-AUTOTOOLS-BUILD.txt
  127. for file in *.1 ; do
  128. base=`basename $file .1`
  129. echo " Making $base.html"
  130. perl ../132html -toc $base <$file >html/$base.html
  131. done
  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. for file in *.3 ; do
  136. base=`basename $file .3`
  137. toc=-toc
  138. if [ `expr $base : '.*_'` -ne 0 ] ; then toc="" ; fi
  139. if [ "$base" = "pcre2sample" ] || \
  140. [ "$base" = "pcre2compat" ] || \
  141. [ "$base" = "pcre2demo" ] || \
  142. [ "$base" = "pcre2limits" ] || \
  143. [ "$base" = "pcre2unicode" ] ; then
  144. toc=""
  145. fi
  146. echo " Making $base.html"
  147. perl ../132html $toc $base <$file >html/$base.html
  148. if [ $? != 0 ] ; then exit 1; fi
  149. done
  150. # End of documentation processing; stop if only documentation required.
  151. cd ..
  152. echo Documentation done
  153. if [ "$1" = "doc" ] ; then exit; fi
  154. # These files are detrailed; do not detrail the test data because there may be
  155. # significant trailing spaces. Do not detrail RunTest.bat, because it has CRLF
  156. # line endings and the detrail script removes all trailing white space. The
  157. # configure files are also omitted from the detrailing.
  158. files="\
  159. Makefile.am \
  160. configure.ac \
  161. README \
  162. LICENCE \
  163. COPYING \
  164. AUTHORS \
  165. NEWS \
  166. NON-AUTOTOOLS-BUILD \
  167. INSTALL \
  168. 132html \
  169. CleanTxt \
  170. Detrail \
  171. ChangeLog \
  172. CMakeLists.txt \
  173. RunGrepTest \
  174. RunTest \
  175. pcre2-config.in \
  176. perltest.sh \
  177. libpcre2-8.pc.in \
  178. libpcre2-16.pc.in \
  179. libpcre2-32.pc.in \
  180. libpcre2-posix.pc.in \
  181. src/pcre2_dftables.c \
  182. src/pcre2.h.in \
  183. src/pcre2_auto_possess.c \
  184. src/pcre2_compile.c \
  185. src/pcre2_config.c \
  186. src/pcre2_context.c \
  187. src/pcre2_convert.c \
  188. src/pcre2_dfa_match.c \
  189. src/pcre2_error.c \
  190. src/pcre2_extuni.c \
  191. src/pcre2_find_bracket.c \
  192. src/pcre2_internal.h \
  193. src/pcre2_intmodedep.h \
  194. src/pcre2_jit_compile.c \
  195. src/pcre2_jit_match.c \
  196. src/pcre2_jit_misc.c \
  197. src/pcre2_jit_test.c \
  198. src/pcre2_maketables.c \
  199. src/pcre2_match.c \
  200. src/pcre2_match_data.c \
  201. src/pcre2_newline.c \
  202. src/pcre2_ord2utf.c \
  203. src/pcre2_pattern_info.c \
  204. src/pcre2_printint.c \
  205. src/pcre2_string_utils.c \
  206. src/pcre2_study.c \
  207. src/pcre2_substring.c \
  208. src/pcre2_tables.c \
  209. src/pcre2_ucd.c \
  210. src/pcre2_ucp.h \
  211. src/pcre2_valid_utf.c \
  212. src/pcre2_xclass.c \
  213. src/pcre2demo.c \
  214. src/pcre2grep.c \
  215. src/pcre2posix.c \
  216. src/pcre2posix.h \
  217. src/pcre2test.c"
  218. echo Detrailing
  219. perl ./Detrail $files doc/p* doc/html/*
  220. echo Done
  221. #End