summaryrefslogtreecommitdiffstats
path: root/scripts/generate-doc.sh
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/generate-doc.sh')
-rwxr-xr-xscripts/generate-doc.sh88
1 files changed, 88 insertions, 0 deletions
diff --git a/scripts/generate-doc.sh b/scripts/generate-doc.sh
new file mode 100755
index 0000000..90205ee
--- /dev/null
+++ b/scripts/generate-doc.sh
@@ -0,0 +1,88 @@
1#!/bin/sh
2
3help()
4{
5 echo "Generate and add eclipse help from yocto's documentation"
6 echo "Usage: [DOC_GIT=url_of_repo] $0 BRANCH_NAME PLUGIN_FOLDER"
7 echo " [DOC_GIT=url_of_repo] $0 -t TAG_NAME PLUGIN_FOLDER"
8 echo ""
9 echo "Options:"
10 echo "-h - display this help and exit"
11 echo "-t TAG_NAME - tag to build the documentation upon"
12 echo "BRANCH_NAME - branch to build the documentation upon"
13 echo "PLUGIN_FOLDER - root folder of the eclipse-poky project"
14 echo "DOC_GIT - use this repo for documentation. Defaults to git://git.pokylinux.org/yocto-docs.git if not set"
15 exit 1
16}
17
18fail ()
19{
20 local retval=$1
21 shift $1
22 echo "[Fail $retval]: $*"
23 echo "BUILD_TOP=${BUILD_TOP}"
24 cd ${TOP}
25 exit ${retval}
26}
27
28CHECKOUT_TAG=0
29while getopts ":ht" opt; do
30 case $opt in
31 h)
32 help
33 ;;
34 t)
35 CHECKOUT_TAG=1
36 ;;
37 esac
38done
39shift $(($OPTIND - 1))
40
41if [ $# -ne 2 ]; then
42 help
43fi
44
45if [ $CHECKOUT_TAG -eq 0 ]; then
46 REFERENCE=origin/$1
47else
48 REFERENCE=$1
49fi
50PLUGIN_FOLDER=`readlink -f $2`
51
52TOP=`pwd`
53
54DOC_DIR=${PLUGIN_FOLDER}/docs
55rm -rf ${DOC_DIR}
56DOC_PLUGIN_DIR=${PLUGIN_FOLDER}/plugins/org.yocto.doc.user
57DOC_HTML_DIR=${DOC_PLUGIN_DIR}/html/
58
59# git clone
60DOC_GIT=${DOC_GIT:-git://git.yoctoproject.org/yocto-docs.git}
61
62git clone ${DOC_GIT} ${DOC_DIR} || fail $? "git clone ${DOC_GIT}"
63cd ${DOC_DIR}
64git checkout ${REFERENCE} || fail $? "git checkout ${REFERENCE}"
65COMMIT_ID=`git rev-parse HEAD`
66
67# build and copy
68DOCS="yocto-project-qs adt-manual kernel-dev \
69 bsp-guide ref-manual dev-manual profile-manual"
70
71cd documentation
72ECLIPSE_TARGET_AVAILABLE=`make -q eclipse &> /dev/null; echo $?`
73if [ ${ECLIPSE_TARGET_AVAILABLE} -ne 1 ]; then
74 echo "WARNING:"
75 echo "This version does not support generating eclipse help"
76 echo "Documentation will not be available in eclipse"
77 exit 1
78fi
79
80for DOC in ${DOCS}; do
81 make DOC=${DOC} eclipse
82 cp -rf ${DOC}/eclipse/html/* ${DOC_HTML_DIR}
83 cp -f ${DOC}/eclipse/${DOC}-toc.xml ${DOC_HTML_DIR}
84done
85
86sed -e "s/@.*@/${COMMIT_ID}/" < ${DOC_PLUGIN_DIR}/about.html.in > ${DOC_PLUGIN_DIR}/about.html
87
88cd ${TOP}