From e283ba1b66f59a1ee9880b9fed8b01376770bef2 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Simo=20F=C3=A4lt?= <simo.falt@digia.com>
Date: Wed, 3 Oct 2012 14:24:07 +0300
Subject: [PATCH] Added html doc generation to mksrc.sh

Added support to create html docs in addition to qch file.
Added also exit switch, to stop the script after doc build.

Change-Id: I4bc3f6c7cf3458de2396979fbf5a1ccae478133b
Reviewed-by: Jerome Pasion <jerome.pasion@digia.com>
Reviewed-by: Sergio Ahumada <sergio.ahumada@digia.com>
Reviewed-by: Iikka Eklund <iikka.eklund@digia.com>
---
 release-tools/mksrc.sh | 42 ++++++++++++++++++++++++++++++++----------
 1 file changed, 32 insertions(+), 10 deletions(-)

diff --git a/release-tools/mksrc.sh b/release-tools/mksrc.sh
index f61e07c..aac2510 100755
--- a/release-tools/mksrc.sh
+++ b/release-tools/mksrc.sh
@@ -23,6 +23,7 @@ QTSHORTVER=0.0
 QTGITTAG=.sha1s
 PACK_TIME=`date '+%Y-%m-%d'`
 DOCS=generate
+EXIT_AFTER_DOCS=false
 DO_TAG=false
 DO_FETCH=true
 MULTIPACK=no
@@ -37,14 +38,15 @@ function usage()
   echo "./mksrc.sh -u <file_url_to_git_repo> -v <version> [-m][-d][-i sub][-l lic][-p patch][-t revision]"
   echo "where -u is path to git repo and -v is version"
   echo "Optional parameters:"
-  echo "-m             one is able to tar each sub module separately"
-  echo "--no-docs      skip generating documentation"
-  echo "--tag          also tag the repository"
-  echo "-N             don't use git fetch to update submodules"
-  echo "-i submodule   will exclude the submodule from final package "
-  echo "-l license     license type, will default to 'opensource', if set to 'commercial' all the necessary patches will be applied for commercial build"
-  echo "-p patch file  patch file (.sh) to execute, example: change_licenses.sh"
-  echo "-t revision    committish to pack (tag name, branch name or SHA-1)"
+  echo "-m                  one is able to tar each sub module separately"
+  echo "--no-docs           skip generating documentation"
+  echo "--tag               also tag the repository"
+  echo "-N                  don't use git fetch to update submodules"
+  echo "-i submodule        will exclude the submodule from final package "
+  echo "-l license          license type, will default to 'opensource', if set to 'commercial' all the necessary patches will be applied for commercial build"
+  echo "-p patch file       patch file (.sh) to execute, example: change_licenses.sh"
+  echo "-t revision         committish to pack (tag name, branch name or SHA-1)"
+  echo "--exit-after-docs   exit after creating doc arhives (without creating src archives)"
 }
 
 function cleanup()
@@ -163,6 +165,11 @@ while test $# -gt 0; do
       REPO_TAG=$1
       shift
     ;;
+    --exit-after-docs)
+      shift
+      EXIT_AFTER_DOCS=true
+      shift
+    ;;
     *)
       echo "Error: Unknown option $1"
       usage
@@ -297,7 +304,7 @@ if [ $DOCS = generate ]; then
   cd $DOC_BUILD/$PACKAGE_NAME
   # Build bootstrapped qdoc
   echo "DOC: configuring build"
-  ./configure -developer-build -opensource -confirm-license -nomake examples -nomake tests -release -fast
+  ./configure -developer-build -opensource -confirm-license -nomake examples -nomake tests -release -fast -no-pch -no-qpa-platform-guard
   # Run qmake in each module, as this generates the .pri files that tell qdoc what docs to generate
   QMAKE=$PWD/qtbase/bin/qmake
   echo "DOC: running $QMAKE and qmake_all for submodules"
@@ -312,7 +319,22 @@ if [ $DOCS = generate ]; then
   # Generate the offline docs and qt.qch
   echo "DOC: Generate the offline docs and qt.qch"
   (cd qtdoc ; $QMAKE ; make qmake_all ; LD_LIBRARY_PATH=$PWD/../qttools/lib make qch_docs)
-  # Put the generated docs back into the clean source directory
+  (cd qtdoc ; $QMAKE ; LD_LIBRARY_PATH=$PWD/../qttools/lib make online_docs)
+
+  # exit if so wanted, to speed up
+  if [ $EXIT_AFTER_DOCS = true ]; then
+    cd $DOC_BUILD/$PACKAGE_NAME/qtdoc/doc
+    cp $CUR_DIR/$PACKAGE_NAME/$QTGITTAG html/
+    cp $CUR_DIR/$PACKAGE_NAME/$QTGITTAG qch/
+    tar cJf $CUR_DIR/online_doc.tar.xz html/
+    tar cJf $CUR_DIR/offline_doc.tar.xz qch/
+    cd $CUR_DIR
+    rm -rf $DOC_BUILD
+    cleanup
+    exit
+  fi # $EXIT_AFTER_DOCS
+
+# Put the generated docs back into the clean source directory
   echo "DOC: Put the generated docs back into the clean source directory"
   mv $DOC_BUILD/$PACKAGE_NAME/qtdoc/doc/html $CUR_DIR/$PACKAGE_NAME/qtdoc/doc
   mv $DOC_BUILD/$PACKAGE_NAME/qtdoc/doc/qch $CUR_DIR/$PACKAGE_NAME/qtdoc/qch
-- 
GitLab