tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

update.sh (2017B)


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