armlink_adapter.sh 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. #!/bin/sh
  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. verbose=0
  12. set -- $*
  13. for i; do
  14. if [ "$i" = "-o" ]; then
  15. on_of=1
  16. elif [ "$i" = "-v" ]; then
  17. verbose=1
  18. elif [ "$i" = "-g" ]; then
  19. args="${args} --debug"
  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#-l}" != "$i" ]; then
  26. libs="$libs ${i#-l}"
  27. elif [ "${i#-L}" != "$i" ]; then
  28. libpaths="${libpaths} ${i#-L}"
  29. else
  30. args="${args} ${i}"
  31. fi
  32. shift
  33. done
  34. # Absolutize library file names
  35. for f in $libs; do
  36. found=0
  37. for d in $libpaths; do
  38. [ -f "$d/$f" ] && infiles="$infiles $d/$f" && found=1 && break
  39. [ -f "$d/lib${f}.so" ] && infiles="$infiles $d/lib${f}.so" && found=1 && break
  40. [ -f "$d/lib${f}.a" ] && infiles="$infiles $d/lib${f}.a" && found=1 && break
  41. done
  42. [ $found -eq 0 ] && infiles="$infiles $f"
  43. done
  44. for d in $libpaths; do
  45. [ -n "$libsearchpath" ] && libsearchpath="${libsearchpath},"
  46. libsearchpath="${libsearchpath}$d"
  47. done
  48. cmd="armlink $args --userlibpath=$libsearchpath --output=$outfile $infiles"
  49. [ $verbose -eq 1 ] && echo $cmd
  50. $cmd