--- code/trunk/maintain/MakeRelease 2007/03/06 12:27:42 99 +++ code/trunk/PrepareRelease 2007/06/13 15:17:05 183 @@ -1,21 +1,26 @@ #/bin/sh -# Script to make a PCRE release - -if [ ! "$1" ]; then - echo "*** Version number missing ***" - exit 1 -fi - -# The name of the release directory - -dir=pcre-$1 - -# But sometimes we just want to process the documentation - -if [ "$1" = "doconly" ] ; then - doconly=yes -fi +# Script to prepare the files for building a PCRE release. It does some +# processing of the documentation, detrails files, and creates pcre.h.generic +# and config.h.generic (for use by builders who can't run ./configure). + +# You must run this script before runnning "make dist". It makes use of the +# following files: + +# 132html A Perl script that converts a .1 or .3 man page into HTML. It +# is called from MakeRelease. It "knows" the relevant troff +# constructs that are used in the PCRE man pages. + +# CleanTxt A Perl script that cleans up the output of "nroff -man" by +# removing backspaces and other redundant text so as to produce +# a readable .txt file. + +# Detrail A Perl script that removes trailing spaces from files. + +# doc/index.html.src +# A file that is copied as index.html into the doc/html directory +# when the HTML documentation is built. It works like this so that +# doc/html can be deleted and re-created from scratch. # First, sort out the documentation @@ -45,7 +50,7 @@ pcreperform pcreposix pcrecpp pcresample pcrestack ; do echo " Processing $file.3" nroff -c -man $file.3 >$file.rawtxt - ../maintain/CleanTxt <$file.rawtxt >>pcre.txt + ../CleanTxt <$file.rawtxt >>pcre.txt /bin/rm $file.rawtxt echo "------------------------------------------------------------------------------" >>pcre.txt if [ "$file" != "pcresample" ] ; then @@ -54,24 +59,25 @@ fi done -# The two commands -for file in pcretest pcregrep ; do +# The three commands +for file in pcretest pcregrep pcre-config ; do echo Making $file.txt nroff -c -man $file.1 >$file.rawtxt - ../maintain/CleanTxt <$file.rawtxt >$file.txt + ../CleanTxt <$file.rawtxt >$file.txt /bin/rm $file.rawtxt done # Make HTML form of the documentation. +echo "Making HTML documentation" /bin/rm html/* -cp ../maintain/Index.html html/index.html +cp index.html.src html/index.html for file in *.1 ; do base=`basename $file .1` - echo Making $base.html - ../maintain/132html -toc $base <$file >html/$base.html + echo " Making $base.html" + ../132html -toc $base <$file >html/$base.html done # Exclude table of contents for function summaries. It seems that expr @@ -87,9 +93,9 @@ [ "$base" = "pcreperform" ] ; then toc="" fi - echo Making $base.html - ../maintain/132html $toc $base <$file >html/$base.html - if [ $? != 0 ] ; then exit 1; fi + echo " Making $base.html" + ../132html $toc $base <$file >html/$base.html + if [ $? != 0 ] ; then exit 1; fi done # End of documentation processing @@ -97,20 +103,36 @@ cd .. echo Documentation done -if [ "$doconly" = "yes" ] ; then - exit 0 -fi - -# These files are detrailed and copied; do not detrail the test data -# because there may be significant trailing spaces. The configure files -# are also omitted from the detrailing. - -files="Makefile.in configure.ac config.h.in \ - README LICENCE COPYING AUTHORS NEWS NON-UNIX-USE INSTALL ChangeLog \ +# These files are detrailed; do not detrail the test data because there may be +# significant trailing spaces. The configure files are also omitted from the +# detrailing. + +files="\ + Makefile.am \ + Makefile.in \ + configure.ac \ + README \ + LICENCE \ + COPYING \ + AUTHORS \ + NEWS \ + NON-UNIX-USE \ + INSTALL \ + 132html \ + CleanTxt \ + Detrail \ + ChangeLog \ + CMakeLists.txt \ + RunGrepTest \ + RunTest \ + RunTest.bat \ pcre-config.in \ libpcre.pc.in \ libpcrecpp.pc.in \ + config.h \ + config.h.in \ pcre_printint.src \ + pcre_chartables.c.dist \ pcredemo.c \ pcregrep.c \ pcretest.c \ @@ -118,6 +140,7 @@ pcreposix.c \ pcreposix.h \ pcre.h \ + pcre.h.in \ pcre_internal.h pcre_compile.c \ pcre_config.c \ @@ -153,54 +176,41 @@ ucpinternal.h \ ucptable.h \ makevp.bat \ - RunTest.bat \ pcre.def \ libpcre.def \ libpcreposix.def" -docfiles="doc/Tech.Notes doc/p*" - echo Detrailing -./maintain/Detrail $files doc/p* doc/html/* +./Detrail $files doc/p* doc/html/* -echo Building release -echo " " +echo Doing basic configure to get default pcre.h and config.h +# This is in case the caller has set aliases (as I do - PH) +unset cp ls mv rm +./configure >/dev/null + +echo Converting pcre.h and config.h to generic forms +cp -f pcre.h pcre.h.generic + +perl <<'END' + open(IN, "config.h.generic") || die "Can't open config.h.generic: $!\n"; + while () + { + if (/^#define\s(?!PACKAGE)(\w+)/) + { + print OUT "#ifndef $1\n"; + print OUT; + print OUT "#endif\n"; + } + else + { + print OUT; + } + } + close IN; + close OUT; +END -mkdir Releases/$dir -mkdir Releases/$dir/doc -mkdir Releases/$dir/testdata - -cp $files RunTest.in RunGrepTest.in configure install-sh mkinstalldirs \ - config.guess config.sub libpcre.a.dev ltmain.sh Releases/$dir -cp -r doc/* Releases/$dir/doc - -cp testdata/testinput1 testdata/testoutput1 \ - testdata/testinput2 testdata/testoutput2 \ - testdata/testinput3 testdata/testoutput3 \ - testdata/testinput4 testdata/testoutput4 \ - testdata/testinput5 testdata/testoutput5 \ - testdata/testinput6 testdata/testoutput6 \ - testdata/testinput7 testdata/testoutput7 \ - testdata/testinput8 testdata/testoutput8 \ - testdata/testinput9 testdata/testoutput9 \ - testdata/grepinput testdata/grepinputx \ - testdata/greplist testdata/grepoutput \ - testdata/grepinput8 testdata/grepoutput8 \ - Releases/$dir/testdata - -# Change the comparison command for testing to the standard one - -ne Releases/$dir/RunTest.in -with /dev/null -opt "ge/cf=cf//cf=diff/" -ne Releases/$dir/RunGrepTest.in -with /dev/null -opt "ge/cf=cf//cf=diff/" - -cd Releases - -tar cf $dir.tar $dir -gzip -v --best $dir.tar -gpg -sb $dir.tar.gz - -tar cf $dir.tar $dir -bzip2 -v -9 $dir.tar -gpg -sb $dir.tar.bz2 +echo Done #End