xref: /aosp_15_r20/external/libopus/doc/build_draft.sh (revision a58d3d2adb790c104798cd88c8a3aff4fa8b82cc)
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
37set -e
38#Set the CWD to the location of this script
39[ -n "${0%/*}" ] && cd "${0%/*}"
40
41toplevel=".."
42destdir="opus_source"
43
44echo packaging source code
45rm -rf "${destdir}"
46mkdir "${destdir}"
47mkdir "${destdir}/src"
48mkdir "${destdir}/silk"
49mkdir "${destdir}/silk/float"
50mkdir "${destdir}/silk/fixed"
51mkdir "${destdir}/silk/fixed/x86"
52mkdir "${destdir}/silk/fixed/arm"
53mkdir "${destdir}/silk/fixed/mips"
54mkdir "${destdir}/silk/x86"
55mkdir "${destdir}/silk/arm"
56mkdir "${destdir}/silk/mips"
57mkdir "${destdir}/celt"
58mkdir "${destdir}/celt/x86"
59mkdir "${destdir}/celt/arm"
60mkdir "${destdir}/celt/mips"
61mkdir "${destdir}/include"
62for f in `cat "${toplevel}"/opus_sources.mk "${toplevel}"/celt_sources.mk \
63 "${toplevel}"/silk_sources.mk "${toplevel}"/opus_headers.mk \
64 "${toplevel}"/celt_headers.mk "${toplevel}"/silk_headers.mk \
65 | grep '\.[ch]' | sed -e 's/^.*=//' -e 's/\\\\//'` ; do
66  cp -a "${toplevel}/${f}" "${destdir}/${f}"
67done
68cp -a "${toplevel}"/src/opus_demo.c "${destdir}"/src/
69cp -a "${toplevel}"/src/opus_compare.c "${destdir}"/src/
70cp -a "${toplevel}"/celt/opus_custom_demo.c "${destdir}"/celt/
71cp -a "${toplevel}"/Makefile.unix "${destdir}"/Makefile
72cp -a "${toplevel}"/opus_sources.mk "${destdir}"/
73cp -a "${toplevel}"/celt_sources.mk "${destdir}"/
74cp -a "${toplevel}"/silk_sources.mk "${destdir}"/
75cp -a "${toplevel}"/README.draft "${destdir}"/README
76cp -a "${toplevel}"/COPYING "${destdir}"/COPYING
77cp -a "${toplevel}"/tests/run_vectors.sh "${destdir}"/
78
79GZIP=-9 tar --owner=root --group=root --format=v7 -czf opus_source.tar.gz "${destdir}"
80echo building base64 version
81cat opus_source.tar.gz| base64 | tr -d '\n' | fold -w 64 | \
82 sed -e 's/^/\<spanx style="vbare"\>###/' -e 's/$/\<\/spanx\>\<vspace\/\>/' > \
83 opus_source.base64
84
85
86#echo '<figure>' > opus_compare_escaped.c
87#echo '<artwork>' >> opus_compare_escaped.c
88#echo '<![CDATA[' >> opus_compare_escaped.c
89#cat opus_compare.c >> opus_compare_escaped.c
90#echo ']]>' >> opus_compare_escaped.c
91#echo '</artwork>' >> opus_compare_escaped.c
92#echo '</figure>' >> opus_compare_escaped.c
93
94if [ ! -d ../opus_testvectors ] ; then
95  echo "Downloading test vectors..."
96  wget 'http://opus-codec.org/testvectors/opus_testvectors.tar.gz'
97  tar -C .. -xvzf opus_testvectors.tar.gz
98fi
99echo '<figure>' > testvectors_sha1
100echo '<artwork>' >> testvectors_sha1
101echo '<![CDATA[' >> testvectors_sha1
102(cd ../opus_testvectors; sha1sum *.bit *.dec) >> testvectors_sha1
103#cd opus_testvectors
104#sha1sum *.bit *.dec >> ../testvectors_sha1
105#cd ..
106echo ']]>' >> testvectors_sha1
107echo '</artwork>' >> testvectors_sha1
108echo '</figure>' >> testvectors_sha1
109
110echo running xml2rfc
111xml2rfc draft-ietf-codec-opus.xml draft-ietf-codec-opus.html &
112xml2rfc draft-ietf-codec-opus.xml
113wait
114