isar-buildenv-internal 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. #!/bin/sh
  2. # Isar-Core Build Environment Setup Script
  3. #
  4. # Copyright (C) 2006-2011 Linux Foundation
  5. # Copyright (C) 2016 ilbers GmbH
  6. #
  7. # This program is free software; you can redistribute it and/or modify
  8. # it under the terms of the GNU General Public License as published by
  9. # the Free Software Foundation; either version 2 of the License, or
  10. # (at your option) any later version.
  11. #
  12. # This program is distributed in the hope that it will be useful,
  13. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. # GNU General Public License for more details.
  16. #
  17. # You should have received a copy of the GNU General Public License
  18. # along with this program; if not, write to the Free Software
  19. # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  20. # It is assumed ISARROOT is already defined when this is called
  21. if [ -z "$ISARROOT" ]; then
  22. echo >&2 "Error: ISARROOT is not defined!"
  23. return 1
  24. fi
  25. if [ -z "$BDIR" ]; then
  26. if [ -z "$1" ]; then
  27. BDIR="build"
  28. else
  29. BDIR="$1"
  30. if [ "$BDIR" = "/" ]; then
  31. echo >&2 "Error: / is not supported as a build directory."
  32. return 1
  33. fi
  34. # Remove any possible trailing slashes. This is used to work around
  35. # buggy readlink in Ubuntu 10.04 that doesn't ignore trailing slashes
  36. # and hence "readlink -f new_dir_to_be_created/" returns empty.
  37. BDIR=$(echo $BDIR | sed -re 's|/+$||')
  38. BDIR=$(readlink -f "$BDIR")
  39. if [ -z "$BDIR" ]; then
  40. PARENTDIR=$(dirname "$1")
  41. echo >&2 "Error: the directory $PARENTDIR does not exist?"
  42. return 1
  43. fi
  44. fi
  45. if [ -n "$2" ]; then
  46. BITBAKEDIR="$2"
  47. fi
  48. fi
  49. if [ "${BDIR#/}" != "$BDIR" ]; then
  50. BUILDDIR="$BDIR"
  51. else
  52. BUILDDIR="$(pwd)/$BDIR"
  53. fi
  54. unset BDIR
  55. export BUILDDIR
  56. PATH=$ISARROOT/bitbake/bin:$ISARROOT/scripts:$PATH
  57. export PATH
  58. BBPATH="${BASEDIR}/meta-zynq/"
  59. export BBPATH
  60. BB_ENV_EXTRAWHITE="BASEDIR BUILDDIR"
  61. export BB_ENV_EXTRAWHITE