Andrew Top | 8b6b16e | 2018-07-25 17:44:41 -0700 | [diff] [blame] | 1 | #!/bin/sh |
| 2 | |
| 3 | # Copyright (c) 2011-2012 Xiph.Org Foundation and Mozilla Corporation |
| 4 | # |
| 5 | # This file is extracted from RFC6716. Please see that RFC for additional |
| 6 | # information. |
| 7 | # |
| 8 | # Redistribution and use in source and binary forms, with or without |
| 9 | # modification, are permitted provided that the following conditions |
| 10 | # are met: |
| 11 | # |
| 12 | # - Redistributions of source code must retain the above copyright |
| 13 | # notice, this list of conditions and the following disclaimer. |
| 14 | # |
| 15 | # - Redistributions in binary form must reproduce the above copyright |
| 16 | # notice, this list of conditions and the following disclaimer in the |
| 17 | # documentation and/or other materials provided with the distribution. |
| 18 | # |
| 19 | # - Neither the name of Internet Society, IETF or IETF Trust, nor the |
| 20 | # names of specific contributors, may be used to endorse or promote |
| 21 | # products derived from this software without specific prior written |
| 22 | # permission. |
| 23 | # |
| 24 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
| 25 | # ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
| 26 | # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
| 27 | # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER |
| 28 | # OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
| 29 | # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, |
| 30 | # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR |
| 31 | # PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF |
| 32 | # LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING |
| 33 | # NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
| 34 | # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 35 | |
| 36 | #Stop on errors |
| 37 | set -e |
| 38 | #Set the CWD to the location of this script |
| 39 | [ -n "${0%/*}" ] && cd "${0%/*}" |
| 40 | |
| 41 | toplevel=".." |
| 42 | destdir="opus_source" |
| 43 | |
| 44 | echo packaging source code |
| 45 | rm -rf "${destdir}" |
| 46 | mkdir "${destdir}" |
| 47 | mkdir "${destdir}/src" |
| 48 | mkdir "${destdir}/silk" |
| 49 | mkdir "${destdir}/silk/float" |
| 50 | mkdir "${destdir}/silk/fixed" |
| 51 | mkdir "${destdir}/celt" |
| 52 | mkdir "${destdir}/include" |
| 53 | for f in `cat "${toplevel}"/opus_sources.mk "${toplevel}"/celt_sources.mk \ |
| 54 | "${toplevel}"/silk_sources.mk "${toplevel}"/opus_headers.mk \ |
| 55 | "${toplevel}"/celt_headers.mk "${toplevel}"/silk_headers.mk \ |
| 56 | | grep '\.[ch]' | sed -e 's/^.*=//' -e 's/\\\\//'` ; do |
| 57 | cp -a "${toplevel}/${f}" "${destdir}/${f}" |
| 58 | done |
| 59 | cp -a "${toplevel}"/src/opus_demo.c "${destdir}"/src/ |
| 60 | cp -a "${toplevel}"/src/opus_compare.c "${destdir}"/src/ |
| 61 | cp -a "${toplevel}"/celt/opus_custom_demo.c "${destdir}"/celt/ |
| 62 | cp -a "${toplevel}"/Makefile.unix "${destdir}"/Makefile |
| 63 | cp -a "${toplevel}"/opus_sources.mk "${destdir}"/ |
| 64 | cp -a "${toplevel}"/celt_sources.mk "${destdir}"/ |
| 65 | cp -a "${toplevel}"/silk_sources.mk "${destdir}"/ |
| 66 | cp -a "${toplevel}"/README.draft "${destdir}"/README |
| 67 | cp -a "${toplevel}"/COPYING "${destdir}"/COPYING |
| 68 | cp -a "${toplevel}"/tests/run_vectors.sh "${destdir}"/ |
| 69 | |
| 70 | GZIP=-9 tar --owner=root --group=root --format=v7 -czf opus_source.tar.gz "${destdir}" |
| 71 | echo building base64 version |
| 72 | cat opus_source.tar.gz| base64 | tr -d '\n' | fold -w 64 | \ |
| 73 | sed -e 's/^/\<spanx style="vbare"\>###/' -e 's/$/\<\/spanx\>\<vspace\/\>/' > \ |
| 74 | opus_source.base64 |
| 75 | |
| 76 | |
| 77 | #echo '<figure>' > opus_compare_escaped.c |
| 78 | #echo '<artwork>' >> opus_compare_escaped.c |
| 79 | #echo '<![CDATA[' >> opus_compare_escaped.c |
| 80 | #cat opus_compare.c >> opus_compare_escaped.c |
| 81 | #echo ']]>' >> opus_compare_escaped.c |
| 82 | #echo '</artwork>' >> opus_compare_escaped.c |
| 83 | #echo '</figure>' >> opus_compare_escaped.c |
| 84 | |
| 85 | if [[ ! -d ../opus_testvectors ]] ; then |
| 86 | echo "Downloading test vectors..." |
| 87 | wget 'http://opus-codec.org/testvectors/opus_testvectors.tar.gz' |
| 88 | tar -C .. -xvzf opus_testvectors.tar.gz |
| 89 | fi |
| 90 | echo '<figure>' > testvectors_sha1 |
| 91 | echo '<artwork>' >> testvectors_sha1 |
| 92 | echo '<![CDATA[' >> testvectors_sha1 |
| 93 | (cd ../opus_testvectors; sha1sum *.bit *.dec) >> testvectors_sha1 |
| 94 | #cd opus_testvectors |
| 95 | #sha1sum *.bit *.dec >> ../testvectors_sha1 |
| 96 | #cd .. |
| 97 | echo ']]>' >> testvectors_sha1 |
| 98 | echo '</artwork>' >> testvectors_sha1 |
| 99 | echo '</figure>' >> testvectors_sha1 |
| 100 | |
| 101 | echo running xml2rfc |
| 102 | xml2rfc draft-ietf-codec-opus.xml draft-ietf-codec-opus.html & |
| 103 | xml2rfc draft-ietf-codec-opus.xml |
| 104 | wait |