Home | History | Annotate | Download | only in libopus
      1 #!/bin/bash
      2 
      3 set -e
      4 ASM_CONVERTER="./celt/arm/arm2gnu.pl"
      5 
      6 if [[ ! -x "${ASM_CONVERTER}" ]]; then
      7   echo "This script should be run from external/libopus."
      8   exit
      9 fi
     10 
     11 while read file; do
     12   # This check is required because the ASM conversion script doesn't seem to be
     13   # idempotent.
     14   if [[ ! "${file}" =~ .*_gnu\.s$ ]]; then
     15     gnu_file="${file%.s}_gnu.s"
     16     ${ASM_CONVERTER} "${file}" > "${gnu_file}"
     17     # The ASM conversion script replaces includes with *_gnu.S. So, replace
     18     # occurences of "*-gnu.S" with "*_gnu.s".
     19     sed -i "s/-gnu\.S/_gnu\.s/g" "${gnu_file}"
     20     rm -f "${file}"
     21   fi
     22 done < <(find . -iname '*.s')
     23 
     24 # Generate armopts.s from armopts.s.in
     25 sed \
     26   -e "s/@OPUS_ARM_MAY_HAVE_EDSP@/1/g" \
     27   -e "s/@OPUS_ARM_MAY_HAVE_MEDIA@/1/g" \
     28   -e "s/@OPUS_ARM_MAY_HAVE_NEON@/1/g" \
     29   -e "s/@OPUS_ARM_MAY_HAVE_NEON_INTR@/1/g" \
     30 	celt/arm/armopts.s.in > celt/arm/armopts.s.temp
     31 ${ASM_CONVERTER} "celt/arm/armopts.s.temp" > "celt/arm/armopts_gnu.s"
     32 rm "celt/arm/armopts.s.temp"
     33 echo "Converted all ASM files and generated armopts.s successfully."
     34