1#!/bin/bash 2## 3## Copyright (c) 2010 The WebM project authors. All Rights Reserved. 4## 5## Use of this source code is governed by a BSD-style license 6## that can be found in the LICENSE file in the root of the source 7## tree. An additional intellectual property rights grant can be found 8## in the file PATENTS. All contributing project authors may 9## be found in the AUTHORS file in the root of the source tree. 10## 11 12 13verbose=0 14set -- $* 15for i; do 16 if [ "$i" == "-o" ]; then 17 on_of=1 18 elif [ "$i" == "-v" ]; then 19 verbose=1 20 elif [ "$on_of" == "1" ]; then 21 outfile=$i 22 on_of=0 23 elif [ -f "$i" ]; then 24 infiles="$infiles $i" 25 elif [ "${i:0:2}" == "-l" ]; then 26 libs="$libs ${i#-l}" 27 elif [ "${i:0:2}" == "-L" ]; then 28 libpaths="${libpaths} ${i#-L}" 29 else 30 args="${args} ${i}" 31 fi 32 shift 33done 34 35# Absolutize library file names 36for f in $libs; do 37 found=0 38 for d in $libpaths; do 39 [ -f "$d/$f" ] && infiles="$infiles $d/$f" && found=1 && break 40 [ -f "$d/lib${f}.so" ] && infiles="$infiles $d/lib${f}.so" && found=1 && break 41 [ -f "$d/lib${f}.a" ] && infiles="$infiles $d/lib${f}.a" && found=1 && break 42 done 43 [ $found -eq 0 ] && infiles="$infiles $f" 44done 45for d in $libpaths; do 46 [ -n "$libsearchpath" ] && libsearchpath="${libsearchpath}," 47 libsearchpath="${libsearchpath}$d" 48done 49 50cmd="armlink $args --userlibpath=$libsearchpath --output=$outfile $infiles" 51[ $verbose -eq 1 ] && echo $cmd 52$cmd 53