oe-run-native 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. #!/bin/sh
  2. #
  3. # Copyright (c) 2016, Intel Corporation.
  4. # All Rights Reserved
  5. #
  6. # This program is free software; you can redistribute it and/or modify
  7. # it under the terms of the GNU General Public License as published by
  8. # the Free Software Foundation; either version 2 of the License, or
  9. # (at your option) any later version.
  10. #
  11. # This program is distributed in the hope that it will be useful,
  12. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
  14. # the GNU General Public License for more details.
  15. #
  16. # You should have received a copy of the GNU General Public License
  17. # along with this program; if not, see <http://www.gnu.org/licenses/>
  18. #
  19. #
  20. # This script is for running tools from native oe sysroot
  21. #
  22. if [ $# -lt 1 -o "$1" = '--help' -o "$1" = '-h' ] ; then
  23. echo "Usage: $0 <native tool> [parameters]"
  24. exit 1
  25. fi
  26. SYSROOT_SETUP_SCRIPT=`which oe-find-native-sysroot 2> /dev/null`
  27. if [ -z "$SYSROOT_SETUP_SCRIPT" ]; then
  28. echo "Error: Unable to find oe-find-native-sysroot script"
  29. exit 1
  30. fi
  31. . $SYSROOT_SETUP_SCRIPT
  32. OLDPATH=$PATH
  33. # look for a tool only in native sysroot
  34. PATH=$OECORE_NATIVE_SYSROOT/usr/bin:$OECORE_NATIVE_SYSROOT/bin:$OECORE_NATIVE_SYSROOT/usr/sbin:$OECORE_NATIVE_SYSROOT/sbin
  35. tool=`/usr/bin/which $1 2>/dev/null`
  36. if [ -n "$tool" ] ; then
  37. # add old path to allow usage of host tools
  38. PATH=$PATH:$OLD_PATH $@
  39. else
  40. echo "Error: Unable to find '$1' in native sysroot"
  41. exit 1
  42. fi