2012-05-01 03:20:22 +04:00
|
|
|
#!/bin/sh
|
2012-05-21 15:12:37 +04:00
|
|
|
# This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
|
|
|
2012-05-01 03:20:22 +04:00
|
|
|
#
|
|
|
|
# Usage: ./update.sh <opus_src_directory>
|
|
|
|
#
|
|
|
|
# Copies the needed files from a directory containing the original
|
|
|
|
# libopus source, and applies any local patches we're carrying.
|
|
|
|
|
|
|
|
TARGET='.'
|
|
|
|
|
2014-03-06 04:44:42 +04:00
|
|
|
STATIC_FILES="COPYING celt/arm/arm2gnu.pl"
|
2012-05-01 03:20:22 +04:00
|
|
|
MK_FILES="opus_sources.mk celt_sources.mk silk_sources.mk \
|
2013-09-17 01:48:00 +04:00
|
|
|
opus_headers.mk celt_headers.mk silk_headers.mk"
|
2012-05-01 03:20:22 +04:00
|
|
|
|
|
|
|
# Make sure we have a source directory
|
|
|
|
if test -z $1 || ! test -r $1/include/opus.h; then
|
|
|
|
echo "Update the current directory from a source checkout"
|
|
|
|
echo "usage: $0 ../opus"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
# "parse" the makefile fragments to get the list of source files
|
|
|
|
# requires GNU sed extensions
|
2017-06-14 00:15:17 +03:00
|
|
|
SRC_FILES=$(sed -e ':a;N;$!ba;s/#[^\n]*\(\n\)/\1/g;s/\\\n//g;s/[A-Z0-9_]*[ \t]*=[ \t]*//g' \
|
2012-05-01 03:20:22 +04:00
|
|
|
$(for file in ${MK_FILES}; do echo "$1/${file}"; done))
|
|
|
|
|
|
|
|
# pre-release versions of the code don't list opus_custom.h
|
|
|
|
# in celt_headers.mk, so we must include it manually
|
|
|
|
HDR_FILES="include/opus_custom.h"
|
|
|
|
|
|
|
|
# make sure the necessary subdirectories exist
|
|
|
|
for file in ${SRC_FILES}; do
|
|
|
|
base=${file##*/}
|
|
|
|
dir="${file%"${base}"}"
|
|
|
|
if test ! -d "${TARGET}/${dir}"; then
|
|
|
|
cmd="mkdir -p ${TARGET}/${dir}"
|
|
|
|
echo ${cmd}
|
|
|
|
${cmd}
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
|
|
|
# copy files into the target directory
|
2014-01-10 00:44:24 +04:00
|
|
|
for file in ${STATIC_FILES} ${SRC_FILES} ${HDR_FILES}; do
|
2012-05-01 03:20:22 +04:00
|
|
|
cmd="cp $1/${file} ${TARGET}/${file}"
|
|
|
|
echo ${cmd}
|
|
|
|
${cmd}
|
|
|
|
done
|
|
|
|
|
2014-03-06 04:44:42 +04:00
|
|
|
sed \
|
|
|
|
-e s/@OPUS_ARM_MAY_HAVE_EDSP@/1/g \
|
|
|
|
-e s/@OPUS_ARM_MAY_HAVE_MEDIA@/1/g \
|
|
|
|
-e s/@OPUS_ARM_MAY_HAVE_NEON@/1/g \
|
|
|
|
$1/celt/arm/armopts.s.in > ${TARGET}/celt/arm/armopts.s
|
|
|
|
|
2012-05-01 03:20:22 +04:00
|
|
|
# query git for the revision we're copying from
|
|
|
|
if test -d $1/.git; then
|
2013-12-03 02:59:00 +04:00
|
|
|
version=$(cd $1 && git describe --tags --match 'v*' --dirty)
|
2012-05-01 03:20:22 +04:00
|
|
|
else
|
|
|
|
version="UNKNOWN"
|
|
|
|
fi
|
|
|
|
echo "copied from revision ${version}"
|
|
|
|
# update README revision
|
|
|
|
sed -e "s/^The git tag\/revision used was .*/The git tag\/revision used was ${version}./" \
|
|
|
|
${TARGET}/README_MOZILLA > ${TARGET}/README_MOZILLA+ && \
|
|
|
|
mv ${TARGET}/README_MOZILLA+ ${TARGET}/README_MOZILLA
|
2013-09-17 01:48:00 +04:00
|
|
|
# update compiled-in version string
|
2013-11-29 02:11:00 +04:00
|
|
|
sed -e "s/DEFINES\['OPUS_VERSION'\][ \t]*=[ \t]*'\".*\"'/DEFINES['OPUS_VERSION'] = '\"${version}-mozilla\"'/" \
|
|
|
|
${TARGET}/moz.build > ${TARGET}/moz.build+ && \
|
|
|
|
mv ${TARGET}/moz.build+ ${TARGET}/moz.build
|
2012-07-24 01:42:37 +04:00
|
|
|
|
2014-01-10 00:44:24 +04:00
|
|
|
python gen-sources.py $1
|
|
|
|
|
2012-07-24 01:42:37 +04:00
|
|
|
# apply outstanding local patches
|
2016-01-12 23:11:58 +03:00
|
|
|
patch -p3 < nonunified.patch
|