bitbake 3.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. #!/bin/sh
  2. export BBFETCH2=True
  3. export BB_ENV_EXTRAWHITE="PSEUDO_BUILD PSEUDO_DISABLED $BB_ENV_EXTRAWHITE"
  4. NO_BUILD_OPTS="--version -h --help -p --parse-only -s --show-versions -e --environment -g --graphviz"
  5. needpseudo="1"
  6. for opt in $@; do
  7. for key in $NO_BUILD_OPTS; do
  8. if [ $opt = $key ]
  9. then
  10. needpseudo="0"
  11. break
  12. fi
  13. done
  14. [ $needpseudo = "0" ] && break
  15. done
  16. # Make sure we're not using python v3.x. This check can't go into
  17. # sanity.bbclass because bitbake's source code doesn't even pass
  18. # parsing stage when used with python v3, so we catch it here so we
  19. # can offer a meaningful error message.
  20. py_v3_check=`/usr/bin/env python --version 2>&1 | grep "Python 3"`
  21. if [ "$py_v3_check" != "" ]; then
  22. echo "Bitbake is not compatible with python v3"
  23. echo "Please set up python v2 as your default python interpreter"
  24. exit 1
  25. fi
  26. # Similarly, we now have code that doesn't parse correctly with older
  27. # versions of Python, and rather than fixing that and be eternally
  28. # vigilant for any other new feature use, just check the version here.
  29. py_v26_check=`python -c 'import sys; print sys.version_info >= (2,6,0)'`
  30. if [ "$py_v26_check" != "True" ]; then
  31. echo "BitBake requires Python 2.6 or later"
  32. exit 1
  33. fi
  34. needtar="1"
  35. TARVERSION=`tar --version | head -n 1 | cut -d ' ' -f 4`
  36. float_test() {
  37. echo | awk 'END { exit ( !( '"$1"')); }'
  38. }
  39. # Tar version 1.24 and onwards handle symlinks in sstate packages correctly
  40. # but earlier versions do not
  41. float_test "$TARVERSION > 1.23" && needtar="0"
  42. buildpseudo="1"
  43. if [ $needpseudo = "1" ] && [ -e "$BUILDDIR/pseudodone" ]; then
  44. PSEUDOBINDIR=`cat $BUILDDIR/pseudodone`
  45. if [ -e "$PSEUDOBINDIR/pseudo" -a -e "$PSEUDOBINDIR/tar" -a "$needtar" = "1" ]; then
  46. buildpseudo="0"
  47. fi
  48. if [ -e "$PSEUDOBINDIR/pseudo" -a $needtar = "0" ]; then
  49. buildpseudo="0"
  50. fi
  51. fi
  52. if [ $needpseudo = "0" ]; then
  53. buildpseudo="0"
  54. fi
  55. OLDPATH=$PATH
  56. export PATH=`echo $PATH | sed s#[^:]*/scripts:##`
  57. if [ $buildpseudo = "1" ]; then
  58. echo "Pseudo is not present but is required, building this first before the main build"
  59. export PSEUDO_BUILD=1
  60. TARTARGET="tar-replacement-native"
  61. if [ $needtar = "0" ]; then
  62. TARTARGET=""
  63. fi
  64. bitbake pseudo-native $TARTARGET -c populate_sysroot
  65. ret=$?
  66. if [ "$ret" != "0" ]; then
  67. exit 1
  68. fi
  69. PSEUDOBINDIR=`bitbake -e | grep STAGING_BINDIR_NATIVE=\" | cut -d '=' -f2 | cut -d '"' -f2`
  70. ret=$?
  71. if [ "$ret" != "0" ]; then
  72. exit 1
  73. fi
  74. echo $PSEUDOBINDIR > $BUILDDIR/pseudodone
  75. # This needs to exist in case pseudo has to log somewhere
  76. mkdir -p $PSEUDOBINDIR/../../var/pseudo
  77. fi
  78. BITBAKE=`which bitbake`
  79. export PATH=$OLDPATH
  80. if [ $needpseudo = "1" ]; then
  81. export PSEUDO_BUILD=2
  82. PSEUDOBINDIR=`cat $BUILDDIR/pseudodone`
  83. PSEUDO_BINDIR=$PSEUDOBINDIR PSEUDO_LIBDIR=$PSEUDOBINDIR/../lib/pseudo/lib PSEUDO_PREFIX=$PSEUDOBINDIR/../../ PSEUDO_DISABLED=1 $PSEUDOBINDIR/pseudo $BITBAKE $@
  84. else
  85. export PSEUDO_BUILD=0
  86. $BITBAKE $@
  87. fi
  88. ret=$?
  89. exit $ret