diff options
author | Adrian Dudau <adrian.dudau@enea.com> | 2014-06-26 13:23:09 +0200 |
---|---|---|
committer | Adrian Dudau <adrian.dudau@enea.com> | 2014-06-26 13:24:09 +0200 |
commit | c7da892cb23d50d4d85746c9a0b6b14bf570989d (patch) | |
tree | e7136073f386d6156f51766c498c52c30c8df85f /scripts/generate-doc.sh | |
download | eclipse-poky-kepler-daisy.tar.gz |
initial commit for Enea Linux 4.0daisy
Migrated from the internal git server on the daisy-enea branch
Signed-off-by: Adrian Dudau <adrian.dudau@enea.com>
Diffstat (limited to 'scripts/generate-doc.sh')
-rwxr-xr-x | scripts/generate-doc.sh | 87 |
1 files changed, 87 insertions, 0 deletions
diff --git a/scripts/generate-doc.sh b/scripts/generate-doc.sh new file mode 100755 index 0000000..7feeb6b --- /dev/null +++ b/scripts/generate-doc.sh | |||
@@ -0,0 +1,87 @@ | |||
1 | #!/bin/sh | ||
2 | |||
3 | help() | ||
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 | |||
18 | fail () | ||
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 | |||
28 | CHECKOUT_TAG=0 | ||
29 | while getopts ":ht" opt; do | ||
30 | case $opt in | ||
31 | h) | ||
32 | help | ||
33 | ;; | ||
34 | t) | ||
35 | CHECKOUT_TAG=1 | ||
36 | ;; | ||
37 | esac | ||
38 | done | ||
39 | shift $(($OPTIND - 1)) | ||
40 | |||
41 | if [ $# -ne 2 ]; then | ||
42 | help | ||
43 | fi | ||
44 | |||
45 | if [ $CHECKOUT_TAG -eq 0 ]; then | ||
46 | REFERENCE=origin/$1 | ||
47 | else | ||
48 | REFERENCE=$1 | ||
49 | fi | ||
50 | PLUGIN_FOLDER=`readlink -f $2` | ||
51 | |||
52 | TOP=`pwd` | ||
53 | |||
54 | DOC_DIR=${PLUGIN_FOLDER}/docs | ||
55 | rm -rf ${DOC_DIR} | ||
56 | DOC_PLUGIN_DIR=${PLUGIN_FOLDER}/plugins/org.yocto.doc.user | ||
57 | DOC_HTML_DIR=${DOC_PLUGIN_DIR}/html/ | ||
58 | |||
59 | # git clone | ||
60 | DOC_GIT=${DOC_GIT:-git://git.yoctoproject.org/yocto-docs.git} | ||
61 | git clone ${DOC_GIT} ${DOC_DIR} || fail $? "git clone ${DOC_GIT}" | ||
62 | cd ${DOC_DIR} | ||
63 | git checkout ${REFERENCE} || fail $? "git checkout ${REFERENCE}" | ||
64 | COMMIT_ID=`git rev-parse HEAD` | ||
65 | |||
66 | # build and copy | ||
67 | DOCS="yocto-project-qs adt-manual kernel-dev \ | ||
68 | bsp-guide ref-manual dev-manual profile-manual" | ||
69 | |||
70 | cd documentation | ||
71 | ECLIPSE_TARGET_AVAILABLE=`make -q eclipse &> /dev/null; echo $?` | ||
72 | if [ ${ECLIPSE_TARGET_AVAILABLE} -ne 1 ]; then | ||
73 | echo "WARNING:" | ||
74 | echo "This version does not support generating eclipse help" | ||
75 | echo "Documentation will not be available in eclipse" | ||
76 | exit 1 | ||
77 | fi | ||
78 | |||
79 | for DOC in ${DOCS}; do | ||
80 | make DOC=${DOC} eclipse | ||
81 | cp -rf ${DOC}/eclipse/html/* ${DOC_HTML_DIR} | ||
82 | cp -f ${DOC}/eclipse/${DOC}-toc.xml ${DOC_HTML_DIR} | ||
83 | done | ||
84 | |||
85 | sed -e "s/@.*@/${COMMIT_ID}/" < ${DOC_PLUGIN_DIR}/about.html.in > ${DOC_PLUGIN_DIR}/about.html | ||
86 | |||
87 | cd ${TOP} | ||