build_draft.sh 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  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}/silk/fixed/x86"
  48. mkdir "${destdir}/silk/fixed/arm"
  49. mkdir "${destdir}/silk/fixed/mips"
  50. mkdir "${destdir}/silk/x86"
  51. mkdir "${destdir}/silk/arm"
  52. mkdir "${destdir}/silk/mips"
  53. mkdir "${destdir}/celt"
  54. mkdir "${destdir}/celt/x86"
  55. mkdir "${destdir}/celt/arm"
  56. mkdir "${destdir}/celt/mips"
  57. mkdir "${destdir}/include"
  58. for f in `cat "${toplevel}"/opus_sources.mk "${toplevel}"/celt_sources.mk \
  59. "${toplevel}"/silk_sources.mk "${toplevel}"/opus_headers.mk \
  60. "${toplevel}"/celt_headers.mk "${toplevel}"/silk_headers.mk \
  61. | grep '\.[ch]' | sed -e 's/^.*=//' -e 's/\\\\//'` ; do
  62. cp -a "${toplevel}/${f}" "${destdir}/${f}"
  63. done
  64. cp -a "${toplevel}"/src/opus_demo.c "${destdir}"/src/
  65. cp -a "${toplevel}"/src/opus_compare.c "${destdir}"/src/
  66. cp -a "${toplevel}"/celt/opus_custom_demo.c "${destdir}"/celt/
  67. cp -a "${toplevel}"/Makefile.unix "${destdir}"/Makefile
  68. cp -a "${toplevel}"/opus_sources.mk "${destdir}"/
  69. cp -a "${toplevel}"/celt_sources.mk "${destdir}"/
  70. cp -a "${toplevel}"/silk_sources.mk "${destdir}"/
  71. cp -a "${toplevel}"/README.draft "${destdir}"/README
  72. cp -a "${toplevel}"/COPYING "${destdir}"/COPYING
  73. cp -a "${toplevel}"/tests/run_vectors.sh "${destdir}"/
  74. GZIP=-9 tar --owner=root --group=root --format=v7 -czf opus_source.tar.gz "${destdir}"
  75. echo building base64 version
  76. cat opus_source.tar.gz| base64 | tr -d '\n' | fold -w 64 | \
  77. sed -e 's/^/\<spanx style="vbare"\>###/' -e 's/$/\<\/spanx\>\<vspace\/\>/' > \
  78. opus_source.base64
  79. #echo '<figure>' > opus_compare_escaped.c
  80. #echo '<artwork>' >> opus_compare_escaped.c
  81. #echo '<![CDATA[' >> opus_compare_escaped.c
  82. #cat opus_compare.c >> opus_compare_escaped.c
  83. #echo ']]>' >> opus_compare_escaped.c
  84. #echo '</artwork>' >> opus_compare_escaped.c
  85. #echo '</figure>' >> opus_compare_escaped.c
  86. if [ ! -d ../opus_testvectors ] ; then
  87. echo "Downloading test vectors..."
  88. wget 'http://opus-codec.org/testvectors/opus_testvectors.tar.gz'
  89. tar -C .. -xvzf opus_testvectors.tar.gz
  90. fi
  91. echo '<figure>' > testvectors_sha1
  92. echo '<artwork>' >> testvectors_sha1
  93. echo '<![CDATA[' >> testvectors_sha1
  94. (cd ../opus_testvectors; sha1sum *.bit *.dec) >> testvectors_sha1
  95. #cd opus_testvectors
  96. #sha1sum *.bit *.dec >> ../testvectors_sha1
  97. #cd ..
  98. echo ']]>' >> testvectors_sha1
  99. echo '</artwork>' >> testvectors_sha1
  100. echo '</figure>' >> testvectors_sha1
  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