[97cc04c] | 1 | #! /bin/sh |
---|
| 2 | # |
---|
| 3 | # RTEMS Tools Project (http://www.rtems.org/) |
---|
| 4 | # Copyright 2015-2016 Chris Johns (chrisj@rtems.org) |
---|
| 5 | # All rights reserved. |
---|
| 6 | # |
---|
| 7 | # This file is part of the RTEMS Tools package in 'rtems-tools'. |
---|
| 8 | # |
---|
| 9 | # Redistribution and use in source and binary forms, with or without |
---|
| 10 | # modification, are permitted provided that the following conditions are met: |
---|
| 11 | # |
---|
| 12 | # 1. Redistributions of source code must retain the above copyright notice, |
---|
| 13 | # this list of conditions and the following disclaimer. |
---|
| 14 | # |
---|
| 15 | # 2. Redistributions in binary form must reproduce the above copyright notice, |
---|
| 16 | # this list of conditions and the following disclaimer in the documentation |
---|
| 17 | # and/or other materials provided with the distribution. |
---|
| 18 | # |
---|
| 19 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
---|
| 20 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
---|
| 21 | # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
---|
| 22 | # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE |
---|
| 23 | # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
---|
| 24 | # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
---|
| 25 | # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
---|
| 26 | # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
---|
| 27 | # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
---|
| 28 | # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
---|
| 29 | # POSSIBILITY OF SUCH DAMAGE. |
---|
| 30 | # |
---|
| 31 | |
---|
| 32 | # |
---|
| 33 | # This worker script to build the doco. |
---|
| 34 | # |
---|
| 35 | echo "RTEMS Documentation Release builder, v0.1" |
---|
| 36 | |
---|
| 37 | # |
---|
[ead5f49] | 38 | # Defaults. |
---|
[97cc04c] | 39 | # |
---|
[ead5f49] | 40 | . ${release_top}/rtems-release-defaults |
---|
[97cc04c] | 41 | |
---|
| 42 | # |
---|
| 43 | # Only build if sphinx-build is present on the system. |
---|
| 44 | # |
---|
| 45 | if [ "`command -v sphinx-build`"no = no ]; then |
---|
| 46 | echo "warning: documentation not built" |
---|
| 47 | exit 0 |
---|
| 48 | fi |
---|
| 49 | |
---|
| 50 | # |
---|
| 51 | # Common package start. |
---|
| 52 | # |
---|
| 53 | . ./rtems-release-package-start |
---|
| 54 | |
---|
| 55 | # |
---|
| 56 | # The workspace pwd |
---|
| 57 | # |
---|
| 58 | ws_pwd=${PWD} |
---|
| 59 | |
---|
| 60 | # |
---|
| 61 | # Get the documentation, create the tarball and stamp. |
---|
| 62 | # |
---|
| 63 | echo "git clone ${git_remote} ${git_local}" |
---|
| 64 | git clone ${git_remote} ${git_local} |
---|
| 65 | |
---|
| 66 | cd ${git_local} |
---|
[f370800] | 67 | echo "git fetch origin" |
---|
| 68 | git fetch origin |
---|
| 69 | echo "git archive --format=tar --prefix=${prefix}/ origin/${version}" |
---|
| 70 | git archive --format=tar --prefix=${prefix}/ origin/${version} | \ |
---|
[bcd2dd3] | 71 | ${comp} > ../${prefix}-unstamped.tar.${comp_ext} |
---|
[59c9105] | 72 | cd .. |
---|
[97cc04c] | 73 | |
---|
[de96950] | 74 | # |
---|
| 75 | # Stamp the source and package |
---|
| 76 | # |
---|
[bcd2dd3] | 77 | echo "tar ${comp_tar}xf ../${prefix}-unstamped.tar.${comp_ext}" |
---|
| 78 | tar ${comp_tar}xf ${prefix}-unstamped.tar.${comp_ext} |
---|
[de96950] | 79 | |
---|
| 80 | cd ${prefix} |
---|
| 81 | # |
---|
| 82 | # This is a hack until I add support for the VERSION file created below. |
---|
| 83 | # |
---|
| 84 | cat wscript | sed -e "s/^version[[:space:]].*=.*$/version = '${release}'/g" > wscript.tmp |
---|
| 85 | rm -f wscript |
---|
| 86 | mv wscript.tmp wscript |
---|
| 87 | echo "Creating VERSION: ${release}" |
---|
| 88 | echo "[version]" > VERSION |
---|
| 89 | echo "release = ${release}" >> VERSION |
---|
| 90 | cd .. |
---|
| 91 | |
---|
| 92 | echo "tar cf - ${prefix}" |
---|
[bcd2dd3] | 93 | tar cf - ${prefix} | ${comp} > ../${prefix}.tar.${comp_ext} |
---|
[de96950] | 94 | |
---|
[bcd2dd3] | 95 | echo "Created: ${release}/${prefix}.tar.${comp_ext}" |
---|
[de96950] | 96 | |
---|
[97cc04c] | 97 | # |
---|
[59c9105] | 98 | # Build the docs. |
---|
[97cc04c] | 99 | # |
---|
[59c9105] | 100 | mkdir install |
---|
[de96950] | 101 | cd ${prefix} |
---|
[5284997] | 102 | ./waf distclean configure --prefix=../install/${prefix} --pdf --singlehtml |
---|
[59c9105] | 103 | ./waf build install |
---|
| 104 | cd .. |
---|
| 105 | |
---|
| 106 | # |
---|
| 107 | # Package the docs, PDF first. |
---|
| 108 | # |
---|
| 109 | mkdir ${top}/${release}/docs |
---|
| 110 | cd install |
---|
[bcd2dd3] | 111 | echo "Creating DOC all rtems-${release}-docs-all.tar.${comp_ext}" |
---|
| 112 | tar cf - * | ${comp} > ${top}/${release}/docs/rtems-${release}-docs-all.tar.${comp_ext} |
---|
[59c9105] | 113 | for p in $(find . -name \*.pdf) |
---|
| 114 | do |
---|
| 115 | manual=$(echo $(basename $p) | sed -e "s/\\..*//") |
---|
[5284997] | 116 | base=$(dirname $p) |
---|
| 117 | # |
---|
| 118 | # Compress the PDF and move it out of the way. |
---|
| 119 | # |
---|
[bcd2dd3] | 120 | echo "Creating PDF rtems-${release}-${manual}.pdf.${comp_ext}" |
---|
| 121 | ${comp} $p |
---|
| 122 | mv $p.${comp_ext} ${top}/${release}/docs/rtems-${release}-${manual}.pdf.${comp_ext} |
---|
[5284997] | 123 | # |
---|
| 124 | # Create the single html manual |
---|
| 125 | # |
---|
[bcd2dd3] | 126 | echo "Creating SingleHTML rtems-${release}-${manual}.html.${comp_ext}" |
---|
[5284997] | 127 | mv ${base}/${manual}.html ${base}/rtems-${release}-${manual}.html |
---|
[bcd2dd3] | 128 | ${comp} ${base}/rtems-${release}-${manual}.html |
---|
| 129 | mv ${base}/rtems-${release}-${manual}.html.${comp_ext} ${top}/${release}/docs/. |
---|
[5284997] | 130 | # |
---|
| 131 | # Tar the multi-page html and install. |
---|
| 132 | # |
---|
[bcd2dd3] | 133 | echo "Creating HTML rtems-${release}-${manual}-html.tar.${comp_ext}" |
---|
| 134 | tar cf - ${base}/${manual} | \ |
---|
| 135 | ${comp} > ${top}/${release}/docs/rtems-${release}-${manual}-html.tar.${comp_ext} |
---|
[59c9105] | 136 | done |
---|
[97cc04c] | 137 | cd .. |
---|
| 138 | |
---|
| 139 | # |
---|
| 140 | # Comman package end. |
---|
| 141 | # |
---|
| 142 | . ${top}/rtems-release-package-end |
---|
| 143 | |
---|
[5284997] | 144 | cd ${release}/docs |
---|
| 145 | rm -f ${checksum}sum.txt |
---|
| 146 | for f in $(ls -1) |
---|
| 147 | do |
---|
| 148 | if [ ! -d ${f} ]; then |
---|
| 149 | csum=$(${checksum} -q ${f}) |
---|
| 150 | echo "${csum} ${f}" >> ${checksum}sum.txt |
---|
| 151 | fi |
---|
| 152 | done |
---|
| 153 | cd .. |
---|
| 154 | |
---|
| 155 | echo "Created: ${release}/docs/${checksum}sum.txt" |
---|
| 156 | echo "Created: ${release}/docs" |
---|
| 157 | |
---|
[97cc04c] | 158 | exit 0 |
---|