mkdocumentation 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  1. #! /bin/sh
  2. #
  3. # mkdocumentation
  4. #
  5. # Create reference documentation for a POCO release.
  6. #
  7. # Usage:
  8. # mkdocumentation [-u] [-t <reltag>] [-f <compfile>] {<component>}
  9. #
  10. # -u: Upload file to release repository.
  11. # -t: Specify release tag.
  12. # -f <compfile>: Component list file
  13. # -c <config>: Build using the given configuration
  14. # <components>: Additional components to include
  15. #
  16. # Environment:
  17. # $POCO_BASE: POCO base directory (e.g., "/cygdrive/p/poco-1.2")
  18. #
  19. # Prerequisites:
  20. # PocoDoc must be in PATH
  21. #
  22. if [ "$POCO_BASE" = "" ] ; then
  23. echo "Error: POCO_BASE not set."
  24. exit 1
  25. fi
  26. make=make
  27. include=`dirname $0`
  28. build=$POCO_BASE/stage/docbuild
  29. dist=$POCO_BASE/releases
  30. docConfig=""
  31. read version <$POCO_BASE/VERSION
  32. osname=`uname -s | tr ' ' '_'`
  33. osarch=`uname -m | tr ' ' '_'`
  34. comps=""
  35. specfile=""
  36. tag=""
  37. config=""
  38. while [ "$1" != "" ] ;
  39. do
  40. if [ "$1" = "-f" ] ; then
  41. shift
  42. specfile=$1
  43. shift
  44. elif [ "$1" = "-t" ] ; then
  45. shift
  46. tag=$1
  47. shift
  48. elif [ "$1" = "-c" ] ; then
  49. shift
  50. config=$1
  51. shift
  52. elif [ "$1" = "-C" ] ; then
  53. shift
  54. docConfig="$docConfig --config=$1"
  55. shift
  56. elif [ "$1" = "-v" ] ; then
  57. shift
  58. version=$1
  59. shift
  60. else
  61. comps="$comps $1"
  62. shift
  63. fi
  64. done
  65. if [ -z "$docConfig" ] ; then
  66. docConfig=$POCO_BASE/PocoDoc/cfg/mkdocumentation.xml
  67. fi
  68. if [ "$specfile" != "" ] ; then
  69. while read c
  70. do
  71. comps="$comps $c"
  72. done <$specfile
  73. fi
  74. allcomps="Foundation XML JSON Util Net $comps"
  75. #
  76. # Clean build directory
  77. #
  78. echo "Cleaning build directory: $build"
  79. rm -rf $build
  80. mkdir -p $build
  81. mkdir -p $dist
  82. #
  83. # Copy POCO sources into build directory
  84. #
  85. echo "Copying sources"
  86. mkrelease -o $build $version $comps
  87. #
  88. # Make all files writeable
  89. #
  90. chmod -R +w $build
  91. #
  92. # Generate documentation
  93. #
  94. echo "Generating documentation"
  95. # Create a PocoDoc configuration file
  96. docVersion=$version
  97. if [ $tag ] ; then
  98. docVersion="$docVersion-$tag"
  99. fi
  100. docPath=$dist/poco-${docVersion}-doc
  101. includes=""
  102. for inc in `find $build -name include -print` ; do
  103. includes="$includes,-I$inc"
  104. done
  105. : ${CC:=gcc}
  106. : ${CXX:=g++}
  107. : ${CXXFLAGS:=-std=c++17}
  108. echo "CC=$CC" >>$build/PocoDoc.ini
  109. echo "CXX=$CXX" >>$build/PocoDoc.ini
  110. echo "CXXFLAGS=$CXXFLAGS" >>$build/PocoDoc.ini
  111. echo "PocoBuild=$build" >>$build/PocoDoc.ini
  112. echo "PocoBase=$POCO_BASE" >>$build/PocoDoc.ini
  113. echo "PocoDoc.output=$docPath" >>$build/PocoDoc.ini
  114. echo "PocoDoc.version=$docVersion" >> $build/PocoDoc.ini
  115. echo "Includes=$includes" >> $build/PocoDoc.ini
  116. PocoDoc $docConfig --config=$build/PocoDoc.ini
  117. cd $dist
  118. chmod -R ugo+rw poco-${docVersion}-doc
  119. chmod -R go+r poco-${docVersion}-doc
  120. tar cf poco-${docVersion}-doc.tar poco-${docVersion}-doc
  121. gzip -f poco-${docVersion}-doc.tar
  122. if [ -x /usr/bin/zip ] ; then
  123. /usr/bin/zip -r -q poco-${docVersion}-doc.zip poco-${docVersion}-doc
  124. fi
  125. echo "Done."