armlink_adapter.sh 1.55 KB
Newer Older
John Koleszar's avatar
John Koleszar committed
1
2
#!/bin/bash
##
3
##  Copyright (c) 2010 The WebM project authors. All Rights Reserved.
John Koleszar's avatar
John Koleszar committed
4
##
5
##  Use of this source code is governed by a BSD-style license
6
7
##  that can be found in the LICENSE file in the root of the source
##  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.
John Koleszar's avatar
John Koleszar committed
10
11
12
13
14
15
16
17
18
19
##


verbose=0
set -- $*
for i; do
    if [ "$i" == "-o" ]; then
        on_of=1
    elif [ "$i" == "-v" ]; then
        verbose=1
20
21
    elif [ "$i" == "-g" ]; then
        args="${args} --debug"
John Koleszar's avatar
John Koleszar committed
22
23
    elif [ "$on_of" == "1" ]; then
        outfile=$i
24
        on_of=0
John Koleszar's avatar
John Koleszar committed
25
26
27
28
29
    elif [ -f "$i" ]; then
        infiles="$infiles $i"
    elif [ "${i:0:2}" == "-l" ]; then
        libs="$libs ${i#-l}"
    elif [ "${i:0:2}" == "-L" ]; then
30
        libpaths="${libpaths} ${i#-L}"
John Koleszar's avatar
John Koleszar committed
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
    else
        args="${args} ${i}"
    fi
    shift
done

# Absolutize library file names
for f in $libs; do
    found=0
    for d in $libpaths; do
        [ -f "$d/$f" ] && infiles="$infiles $d/$f" && found=1 && break
        [ -f "$d/lib${f}.so" ] && infiles="$infiles $d/lib${f}.so" && found=1 && break
        [ -f "$d/lib${f}.a" ] && infiles="$infiles $d/lib${f}.a" && found=1 && break
    done
    [ $found -eq 0 ] && infiles="$infiles $f"
done
for d in $libpaths; do
    [ -n "$libsearchpath" ] && libsearchpath="${libsearchpath},"
    libsearchpath="${libsearchpath}$d"
done

cmd="armlink $args --userlibpath=$libsearchpath --output=$outfile $infiles"
[ $verbose -eq 1 ] && echo $cmd
$cmd