oe-buildenv-internal 3.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. #!/bin/sh
  2. # OE-Core Build Environment Setup Script
  3. #
  4. # Copyright (C) 2006-2011 Linux Foundation
  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 the
  14. # 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, write to the Free Software
  18. # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  19. # It is assumed OEROOT is already defined when this is called
  20. if [ -z "$OEROOT" ]; then
  21. echo >&2 "Error: OEROOT is not defined!"
  22. return 1
  23. fi
  24. if [ ! -z "$OECORE_SDK_VERSION" ]; then
  25. echo >&2 "Error: The OE SDK/ADT was detected as already being present in this shell environment. Please use a clean shell when sourcing this environment script."
  26. return 1
  27. fi
  28. if [ "x$BDIR" = "x" ]; then
  29. if [ "x$1" = "x" ]; then
  30. BDIR="build"
  31. else
  32. BDIR="$1"
  33. if [ "$BDIR" = "/" ]; then
  34. echo >&2 "Error: / is not supported as a build directory."
  35. return 1
  36. fi
  37. # Remove any possible trailing slashes. This is used to work around
  38. # buggy readlink in Ubuntu 10.04 that doesn't ignore trailing slashes
  39. # and hence "readlink -f new_dir_to_be_created/" returns empty.
  40. BDIR=`echo $BDIR | sed -re 's|/+$||'`
  41. BDIR=`readlink -f "$BDIR"`
  42. if [ -z "$BDIR" ]; then
  43. PARENTDIR=`dirname "$1"`
  44. echo >&2 "Error: the directory $PARENTDIR does not exist?"
  45. return 1
  46. fi
  47. fi
  48. if [ "x$2" != "x" ]; then
  49. BITBAKEDIR="$2"
  50. fi
  51. fi
  52. if expr "$BDIR" : '/.*' > /dev/null ; then
  53. BUILDDIR="$BDIR"
  54. else
  55. BUILDDIR="`pwd`/$BDIR"
  56. fi
  57. unset BDIR
  58. if [ "x$BITBAKEDIR" = "x" ]; then
  59. BITBAKEDIR="$OEROOT/bitbake$BBEXTRA/"
  60. fi
  61. BITBAKEDIR=`readlink -f "$BITBAKEDIR"`
  62. BUILDDIR=`readlink -f "$BUILDDIR"`
  63. if ! (test -d "$BITBAKEDIR"); then
  64. echo >&2 "Error: The bitbake directory ($BITBAKEDIR) does not exist! Please ensure a copy of bitbake exists at this location"
  65. return 1
  66. fi
  67. # Make sure our paths are at the beginning of $PATH
  68. NEWPATHS="${OEROOT}/scripts:$BITBAKEDIR/bin:"
  69. PATH=$NEWPATHS$(echo $PATH | sed -e "s|:$NEWPATHS|:|g" -e "s|^$NEWPATHS||")
  70. unset BITBAKEDIR NEWPATHS
  71. # Used by the runqemu script
  72. export BUILDDIR
  73. export PATH
  74. export BB_ENV_EXTRAWHITE="MACHINE DISTRO TCMODE TCLIBC HTTP_PROXY http_proxy \
  75. HTTPS_PROXY https_proxy FTP_PROXY ftp_proxy FTPS_PROXY ftps_proxy ALL_PROXY \
  76. all_proxy NO_PROXY no_proxy SSH_AGENT_PID SSH_AUTH_SOCK BB_SRCREV_POLICY \
  77. SDKMACHINE BB_NUMBER_THREADS BB_NO_NETWORK PARALLEL_MAKE GIT_PROXY_COMMAND \
  78. SOCKS5_PASSWD SOCKS5_USER SCREENDIR STAMPS_DIR"