oe-init-build-env 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. #!/bin/sh
  2. # OE 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. #
  20. # Normally this is called as '. ./oe-init-build-env builddir'
  21. #
  22. # This works in most shells (not dash), but not all of them pass arg1 when
  23. # being sourced. To workaround the shell limitation use "set arg1" prior
  24. # to sourcing this script.
  25. #
  26. if [ -n "$BASH_SOURCE" ]; then
  27. OEROOT="`dirname $BASH_SOURCE`"
  28. elif [ -n "$ZSH_NAME" ]; then
  29. OEROOT="`dirname $0`"
  30. else
  31. OEROOT="`pwd`"
  32. fi
  33. if [ -n "$BBSERVER" ]; then
  34. unset BBSERVER
  35. fi
  36. THIS_SCRIPT=$OEROOT/oe-init-build-env
  37. if [ -z "$ZSH_NAME" ] && [ "$0" = "$THIS_SCRIPT" ]; then
  38. echo "Error: This script needs to be sourced. Please run as '. $THIS_SCRIPT'"
  39. exit 1
  40. fi
  41. OEROOT=`readlink -f "$OEROOT"`
  42. export OEROOT
  43. . $OEROOT/scripts/oe-buildenv-internal && \
  44. $OEROOT/scripts/oe-setup-builddir && \
  45. [ -n "$BUILDDIR" ] && cd $BUILDDIR
  46. unset OEROOT
  47. unset BBPATH
  48. unset THIS_SCRIPT
  49. # Shutdown any bitbake server if the BBSERVER variable is not set
  50. if [ -z "$BBSERVER" ] && [ -f bitbake.lock ] ; then
  51. grep ":" bitbake.lock > /dev/null && BBSERVER=`cat bitbake.lock` bitbake --status-only
  52. if [ $? = 0 ] ; then
  53. echo "Shutting down bitbake memory resident server with bitbake -m"
  54. BBSERVER=`cat bitbake.lock` bitbake -m
  55. fi
  56. fi