diff options
Diffstat (limited to 'scripts/oe-find-native-sysroot')
| -rw-r--r-- | scripts/oe-find-native-sysroot | 72 |
1 files changed, 72 insertions, 0 deletions
diff --git a/scripts/oe-find-native-sysroot b/scripts/oe-find-native-sysroot new file mode 100644 index 0000000000..da00a07850 --- /dev/null +++ b/scripts/oe-find-native-sysroot | |||
| @@ -0,0 +1,72 @@ | |||
| 1 | #!/bin/bash | ||
| 2 | # | ||
| 3 | # Find a native sysroot to use - either from an in-tree Poky build or | ||
| 4 | # from a toolchain installation. It then ensures the variable | ||
| 5 | # $OECORE_NATIVE_SYSROOT is set to the sysroot's base directory, and sets | ||
| 6 | # $PSEUDO to the path of the pseudo binary. | ||
| 7 | # | ||
| 8 | # This script is intended to be run within other scripts by source'ing | ||
| 9 | # it, e.g: | ||
| 10 | # | ||
| 11 | # SYSROOT_SETUP_SCRIPT=`which oe-find-native-sysroot` | ||
| 12 | # . $SYSROOT_SETUP_SCRIPT | ||
| 13 | # | ||
| 14 | # This script will terminate execution of your calling program unless | ||
| 15 | # you set a variable $SKIP_STRICT_SYSROOT_CHECK to a non-empty string | ||
| 16 | # beforehand. | ||
| 17 | # | ||
| 18 | # Copyright (c) 2010 Intel Corp. | ||
| 19 | # | ||
| 20 | # This program is free software; you can redistribute it and/or modify | ||
| 21 | # it under the terms of the GNU General Public License version 2 as | ||
| 22 | # published by the Free Software Foundation. | ||
| 23 | # | ||
| 24 | # This program is distributed in the hope that it will be useful, | ||
| 25 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 26 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 27 | # GNU General Public License for more details. | ||
| 28 | # | ||
| 29 | # You should have received a copy of the GNU General Public License along | ||
| 30 | # with this program; if not, write to the Free Software Foundation, Inc., | ||
| 31 | # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. | ||
| 32 | |||
| 33 | if [ -z "$OECORE_NATIVE_SYSROOT" ]; then | ||
| 34 | BITBAKE=`which bitbake` | ||
| 35 | if [ "x$BITBAKE" != "x" ]; then | ||
| 36 | if [ "$UID" = "0" ]; then | ||
| 37 | # Root cannot run bitbake unless sanity checking is disabled | ||
| 38 | if [ ! -d "./conf" ]; then | ||
| 39 | echo "Error: root cannot run bitbake by default, and I cannot find a ./conf directory to be able to disable sanity checking" | ||
| 40 | exit 1 | ||
| 41 | fi | ||
| 42 | touch conf/sanity.conf | ||
| 43 | OECORE_NATIVE_SYSROOT=`bitbake -e | grep ^STAGING_DIR_NATIVE | cut -d '=' -f2 | cut -d '"' -f2` | ||
| 44 | rm -f conf/sanity.conf | ||
| 45 | else | ||
| 46 | OECORE_NATIVE_SYSROOT=`bitbake -e | grep ^STAGING_DIR_NATIVE | cut -d '=' -f2 | cut -d '"' -f2` | ||
| 47 | fi | ||
| 48 | else | ||
| 49 | echo "Error: Unable to locate your native sysroot." | ||
| 50 | echo "Did you forget to source the Poky environment script?" | ||
| 51 | |||
| 52 | if [ -z "$SKIP_STRICT_SYSROOT_CHECK" ]; then | ||
| 53 | exit 1 | ||
| 54 | fi | ||
| 55 | fi | ||
| 56 | fi | ||
| 57 | |||
| 58 | # Set up pseudo command | ||
| 59 | if [ ! -e "$OECORE_NATIVE_SYSROOT/usr/bin/pseudo" ]; then | ||
| 60 | echo "Error: Unable to find pseudo binary in $OECORE_NATIVE_SYSROOT/usr/bin/" | ||
| 61 | |||
| 62 | if [ "x$POKY_DISTRO_VERSION" = "x" ]; then | ||
| 63 | echo "Have you run 'bitbake meta-ide-support'?" | ||
| 64 | else | ||
| 65 | echo "This shouldn't happen - something is wrong with your toolchain installation" | ||
| 66 | fi | ||
| 67 | |||
| 68 | if [ -z "$SKIP_STRICT_SYSROOT_CHECK" ]; then | ||
| 69 | exit 1 | ||
| 70 | fi | ||
| 71 | fi | ||
| 72 | PSEUDO="$OECORE_NATIVE_SYSROOT/usr/bin/pseudo" | ||
