Guillaume Martres | eb2fbea | 2013-08-14 18:56:48 -0700 | [diff] [blame] | 1 | #!/bin/sh |
John Koleszar | 0ea50ce | 2010-05-18 11:58:33 -0400 | [diff] [blame] | 2 | ## |
John Koleszar | c2140b8 | 2010-09-09 08:16:39 -0400 | [diff] [blame] | 3 | ## Copyright (c) 2010 The WebM project authors. All Rights Reserved. |
John Koleszar | 0ea50ce | 2010-05-18 11:58:33 -0400 | [diff] [blame] | 4 | ## |
John Koleszar | 94c52e4 | 2010-06-18 12:39:21 -0400 | [diff] [blame] | 5 | ## Use of this source code is governed by a BSD-style license |
John Koleszar | 09202d8 | 2010-06-04 16:19:40 -0400 | [diff] [blame] | 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 |
John Koleszar | 94c52e4 | 2010-06-18 12:39:21 -0400 | [diff] [blame] | 8 | ## in the file PATENTS. All contributing project authors may |
John Koleszar | 09202d8 | 2010-06-04 16:19:40 -0400 | [diff] [blame] | 9 | ## be found in the AUTHORS file in the root of the source tree. |
John Koleszar | 0ea50ce | 2010-05-18 11:58:33 -0400 | [diff] [blame] | 10 | ## |
| 11 | |
| 12 | |
| 13 | verbose=0 |
| 14 | set -- $* |
| 15 | for i; do |
Guillaume Martres | eb2fbea | 2013-08-14 18:56:48 -0700 | [diff] [blame] | 16 | if [ "$i" = "-o" ]; then |
John Koleszar | 0ea50ce | 2010-05-18 11:58:33 -0400 | [diff] [blame] | 17 | on_of=1 |
Guillaume Martres | eb2fbea | 2013-08-14 18:56:48 -0700 | [diff] [blame] | 18 | elif [ "$i" = "-v" ]; then |
John Koleszar | 0ea50ce | 2010-05-18 11:58:33 -0400 | [diff] [blame] | 19 | verbose=1 |
Guillaume Martres | eb2fbea | 2013-08-14 18:56:48 -0700 | [diff] [blame] | 20 | elif [ "$i" = "-g" ]; then |
Attila Nagy | 0905af3 | 2011-02-04 10:21:43 +0200 | [diff] [blame] | 21 | args="${args} --debug" |
Guillaume Martres | eb2fbea | 2013-08-14 18:56:48 -0700 | [diff] [blame] | 22 | elif [ "$on_of" = "1" ]; then |
John Koleszar | 0ea50ce | 2010-05-18 11:58:33 -0400 | [diff] [blame] | 23 | outfile=$i |
Attila Nagy | 0905af3 | 2011-02-04 10:21:43 +0200 | [diff] [blame] | 24 | on_of=0 |
John Koleszar | 0ea50ce | 2010-05-18 11:58:33 -0400 | [diff] [blame] | 25 | elif [ -f "$i" ]; then |
| 26 | infiles="$infiles $i" |
Guillaume Martres | eb2fbea | 2013-08-14 18:56:48 -0700 | [diff] [blame] | 27 | elif [ "${i#-l}" != "$i" ]; then |
John Koleszar | 0ea50ce | 2010-05-18 11:58:33 -0400 | [diff] [blame] | 28 | libs="$libs ${i#-l}" |
Guillaume Martres | eb2fbea | 2013-08-14 18:56:48 -0700 | [diff] [blame] | 29 | elif [ "${i#-L}" != "$i" ]; then |
Attila Nagy | 0905af3 | 2011-02-04 10:21:43 +0200 | [diff] [blame] | 30 | libpaths="${libpaths} ${i#-L}" |
John Koleszar | 0ea50ce | 2010-05-18 11:58:33 -0400 | [diff] [blame] | 31 | else |
| 32 | args="${args} ${i}" |
| 33 | fi |
| 34 | shift |
| 35 | done |
| 36 | |
| 37 | # Absolutize library file names |
| 38 | for f in $libs; do |
| 39 | found=0 |
| 40 | for d in $libpaths; do |
| 41 | [ -f "$d/$f" ] && infiles="$infiles $d/$f" && found=1 && break |
| 42 | [ -f "$d/lib${f}.so" ] && infiles="$infiles $d/lib${f}.so" && found=1 && break |
| 43 | [ -f "$d/lib${f}.a" ] && infiles="$infiles $d/lib${f}.a" && found=1 && break |
| 44 | done |
| 45 | [ $found -eq 0 ] && infiles="$infiles $f" |
| 46 | done |
| 47 | for d in $libpaths; do |
| 48 | [ -n "$libsearchpath" ] && libsearchpath="${libsearchpath}," |
| 49 | libsearchpath="${libsearchpath}$d" |
| 50 | done |
| 51 | |
| 52 | cmd="armlink $args --userlibpath=$libsearchpath --output=$outfile $infiles" |
| 53 | [ $verbose -eq 1 ] && echo $cmd |
| 54 | $cmd |