1#!/bin/bash 2# 3# Copyright (C) 2016 The Android Open Source Project 4# 5# Licensed under the Apache License, Version 2.0 (the "License"); 6# you may not use this file except in compliance with the License. 7# You may obtain a copy of the License at 8# 9# http://www.apache.org/licenses/LICENSE-2.0 10# 11# Unless required by applicable law or agreed to in writing, software 12# distributed under the License is distributed on an "AS IS" BASIS, 13# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14# See the License for the specific language governing permissions and 15# limitations under the License. 16# 17 18set -e 19ASM_CONVERTER="./libopus/celt/arm/arm2gnu.pl" 20 21if [[ ! -x "${ASM_CONVERTER}" ]]; then 22 echo "Please make sure you have checked out libopus." 23 exit 24fi 25 26while read file; do 27 # This check is required because the ASM conversion script doesn't seem to be 28 # idempotent. 29 if [[ ! "${file}" =~ .*_gnu\.s$ ]]; then 30 gnu_file="${file%.s}_gnu.s" 31 ${ASM_CONVERTER} "${file}" > "${gnu_file}" 32 # The ASM conversion script replaces includes with *_gnu.S. So, replace 33 # occurences of "*-gnu.S" with "*_gnu.s". 34 perl -pi -e "s/-gnu\.S/_gnu\.s/g" "${gnu_file}" 35 rm -f "${file}" 36 fi 37done < <(find . -iname '*.s') 38 39# Generate armopts.s from armopts.s.in 40sed \ 41 -e "s/@OPUS_ARM_MAY_HAVE_EDSP@/1/g" \ 42 -e "s/@OPUS_ARM_MAY_HAVE_MEDIA@/1/g" \ 43 -e "s/@OPUS_ARM_MAY_HAVE_NEON@/1/g" \ 44 libopus/celt/arm/armopts.s.in > libopus/celt/arm/armopts.s.temp 45${ASM_CONVERTER} "libopus/celt/arm/armopts.s.temp" > "libopus/celt/arm/armopts_gnu.s" 46rm "libopus/celt/arm/armopts.s.temp" 47echo "Converted all ASM files and generated armopts.s successfully." 48