media/libopus/update.sh

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rwxr-xr-x

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

michael@0 1 #!/bin/sh
michael@0 2 # This Source Code Form is subject to the terms of the Mozilla Public
michael@0 3 # License, v. 2.0. If a copy of the MPL was not distributed with this
michael@0 4 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
michael@0 5
michael@0 6 #
michael@0 7 # Usage: ./update.sh <opus_src_directory>
michael@0 8 #
michael@0 9 # Copies the needed files from a directory containing the original
michael@0 10 # libopus source, and applies any local patches we're carrying.
michael@0 11
michael@0 12 TARGET='.'
michael@0 13
michael@0 14 STATIC_FILES="COPYING celt/arm/arm2gnu.pl"
michael@0 15 MK_FILES="opus_sources.mk celt_sources.mk silk_sources.mk \
michael@0 16 opus_headers.mk celt_headers.mk silk_headers.mk"
michael@0 17
michael@0 18 # Make sure we have a source directory
michael@0 19 if test -z $1 || ! test -r $1/include/opus.h; then
michael@0 20 echo "Update the current directory from a source checkout"
michael@0 21 echo "usage: $0 ../opus"
michael@0 22 exit 1
michael@0 23 fi
michael@0 24
michael@0 25 # "parse" the makefile fragments to get the list of source files
michael@0 26 # requires GNU sed extensions
michael@0 27 SRC_FILES=$(sed -e ':a;N;$!ba;s/#[^\n]*\(\n\)/\1/g;s/\\\n//g;s/[A-Z_]* = //g' \
michael@0 28 $(for file in ${MK_FILES}; do echo "$1/${file}"; done))
michael@0 29
michael@0 30 # pre-release versions of the code don't list opus_custom.h
michael@0 31 # in celt_headers.mk, so we must include it manually
michael@0 32 HDR_FILES="include/opus_custom.h"
michael@0 33
michael@0 34 # make sure the necessary subdirectories exist
michael@0 35 for file in ${SRC_FILES}; do
michael@0 36 base=${file##*/}
michael@0 37 dir="${file%"${base}"}"
michael@0 38 if test ! -d "${TARGET}/${dir}"; then
michael@0 39 cmd="mkdir -p ${TARGET}/${dir}"
michael@0 40 echo ${cmd}
michael@0 41 ${cmd}
michael@0 42 fi
michael@0 43 done
michael@0 44
michael@0 45 # copy files into the target directory
michael@0 46 for file in ${STATIC_FILES} ${SRC_FILES} ${HDR_FILES}; do
michael@0 47 cmd="cp $1/${file} ${TARGET}/${file}"
michael@0 48 echo ${cmd}
michael@0 49 ${cmd}
michael@0 50 done
michael@0 51
michael@0 52 sed \
michael@0 53 -e s/@OPUS_ARM_MAY_HAVE_EDSP@/1/g \
michael@0 54 -e s/@OPUS_ARM_MAY_HAVE_MEDIA@/1/g \
michael@0 55 -e s/@OPUS_ARM_MAY_HAVE_NEON@/1/g \
michael@0 56 $1/celt/arm/armopts.s.in > ${TARGET}/celt/arm/armopts.s
michael@0 57
michael@0 58 # query git for the revision we're copying from
michael@0 59 if test -d $1/.git; then
michael@0 60 version=$(cd $1 && git describe --tags --match 'v*' --dirty)
michael@0 61 else
michael@0 62 version="UNKNOWN"
michael@0 63 fi
michael@0 64 echo "copied from revision ${version}"
michael@0 65 # update README revision
michael@0 66 sed -e "s/^The git tag\/revision used was .*/The git tag\/revision used was ${version}./" \
michael@0 67 ${TARGET}/README_MOZILLA > ${TARGET}/README_MOZILLA+ && \
michael@0 68 mv ${TARGET}/README_MOZILLA+ ${TARGET}/README_MOZILLA
michael@0 69 # update compiled-in version string
michael@0 70 sed -e "s/DEFINES\['OPUS_VERSION'\][ \t]*=[ \t]*'\".*\"'/DEFINES['OPUS_VERSION'] = '\"${version}-mozilla\"'/" \
michael@0 71 ${TARGET}/moz.build > ${TARGET}/moz.build+ && \
michael@0 72 mv ${TARGET}/moz.build+ ${TARGET}/moz.build
michael@0 73
michael@0 74 python gen-sources.py $1
michael@0 75
michael@0 76 # apply outstanding local patches
michael@0 77 # ... no patches to apply ...

mercurial