build_draft.sh 4.1 KB

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