1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/media/libopus/update.sh Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,77 @@ 1.4 +#!/bin/sh 1.5 +# This Source Code Form is subject to the terms of the Mozilla Public 1.6 +# License, v. 2.0. If a copy of the MPL was not distributed with this 1.7 +# file, You can obtain one at http://mozilla.org/MPL/2.0/. 1.8 + 1.9 +# 1.10 +# Usage: ./update.sh <opus_src_directory> 1.11 +# 1.12 +# Copies the needed files from a directory containing the original 1.13 +# libopus source, and applies any local patches we're carrying. 1.14 + 1.15 +TARGET='.' 1.16 + 1.17 +STATIC_FILES="COPYING celt/arm/arm2gnu.pl" 1.18 +MK_FILES="opus_sources.mk celt_sources.mk silk_sources.mk \ 1.19 + opus_headers.mk celt_headers.mk silk_headers.mk" 1.20 + 1.21 +# Make sure we have a source directory 1.22 +if test -z $1 || ! test -r $1/include/opus.h; then 1.23 + echo "Update the current directory from a source checkout" 1.24 + echo "usage: $0 ../opus" 1.25 + exit 1 1.26 +fi 1.27 + 1.28 +# "parse" the makefile fragments to get the list of source files 1.29 +# requires GNU sed extensions 1.30 +SRC_FILES=$(sed -e ':a;N;$!ba;s/#[^\n]*\(\n\)/\1/g;s/\\\n//g;s/[A-Z_]* = //g' \ 1.31 + $(for file in ${MK_FILES}; do echo "$1/${file}"; done)) 1.32 + 1.33 +# pre-release versions of the code don't list opus_custom.h 1.34 +# in celt_headers.mk, so we must include it manually 1.35 +HDR_FILES="include/opus_custom.h" 1.36 + 1.37 +# make sure the necessary subdirectories exist 1.38 +for file in ${SRC_FILES}; do 1.39 + base=${file##*/} 1.40 + dir="${file%"${base}"}" 1.41 + if test ! -d "${TARGET}/${dir}"; then 1.42 + cmd="mkdir -p ${TARGET}/${dir}" 1.43 + echo ${cmd} 1.44 + ${cmd} 1.45 + fi 1.46 +done 1.47 + 1.48 +# copy files into the target directory 1.49 +for file in ${STATIC_FILES} ${SRC_FILES} ${HDR_FILES}; do 1.50 + cmd="cp $1/${file} ${TARGET}/${file}" 1.51 + echo ${cmd} 1.52 + ${cmd} 1.53 +done 1.54 + 1.55 +sed \ 1.56 + -e s/@OPUS_ARM_MAY_HAVE_EDSP@/1/g \ 1.57 + -e s/@OPUS_ARM_MAY_HAVE_MEDIA@/1/g \ 1.58 + -e s/@OPUS_ARM_MAY_HAVE_NEON@/1/g \ 1.59 + $1/celt/arm/armopts.s.in > ${TARGET}/celt/arm/armopts.s 1.60 + 1.61 +# query git for the revision we're copying from 1.62 +if test -d $1/.git; then 1.63 + version=$(cd $1 && git describe --tags --match 'v*' --dirty) 1.64 +else 1.65 + version="UNKNOWN" 1.66 +fi 1.67 +echo "copied from revision ${version}" 1.68 +# update README revision 1.69 +sed -e "s/^The git tag\/revision used was .*/The git tag\/revision used was ${version}./" \ 1.70 + ${TARGET}/README_MOZILLA > ${TARGET}/README_MOZILLA+ && \ 1.71 + mv ${TARGET}/README_MOZILLA+ ${TARGET}/README_MOZILLA 1.72 +# update compiled-in version string 1.73 +sed -e "s/DEFINES\['OPUS_VERSION'\][ \t]*=[ \t]*'\".*\"'/DEFINES['OPUS_VERSION'] = '\"${version}-mozilla\"'/" \ 1.74 + ${TARGET}/moz.build > ${TARGET}/moz.build+ && \ 1.75 + mv ${TARGET}/moz.build+ ${TARGET}/moz.build 1.76 + 1.77 +python gen-sources.py $1 1.78 + 1.79 +# apply outstanding local patches 1.80 +# ... no patches to apply ...