common 948 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. #!/bin/bash
  2. function execute() {
  3. echo "$@"
  4. "$@" || exit $?
  5. }
  6. function download() {
  7. URL="$1"
  8. TO="$2"
  9. if [ -e "$TO" ]; then
  10. echo "found $TO"
  11. else
  12. execute wget "$URL" -O "$TO"
  13. fi
  14. }
  15. ME="`readlink -f $0`"
  16. BASEDIR="`dirname "$ME"`"
  17. DOWNLOAD_DIR="$BASEDIR/download"
  18. mkdir -p "$DOWNLOAD_DIR"
  19. if [ ! -e "$DOWNLOAD_DIR" ]; then
  20. echo "Couldn't create $DOWNLOAD_DIR"
  21. fi
  22. # 2x configuration
  23. PREFIX="/opt/open2x" # note: do not change this, it's hardcoded in some of the toolchain applications
  24. COMPILER_PREFIX="$PREFIX/gcc-4.1.1-glibc-2.3.6"
  25. TARGET=arm-open2x-linux
  26. BUILD="`$BASEDIR/config.guess`"
  27. PATH="$COMPILER_PREFIX/$TARGET/bin:$PATH:$COMPILER_PREFIX/bin"
  28. export PATH
  29. PKG_CONFIG_PATH="$PREFIX/lib/pkg-config:$PKG_CONFIG_PATH"
  30. export PKG_CONFIG_PATH
  31. # can we write to $PREFIX
  32. mkdir -p "$PREFIX"
  33. TESTFILE="$PREFIX/icanwrite"
  34. if ! touch "$TESTFILE"; then
  35. echo "Please make sure '$PREFIX' exists and is writable"
  36. exit 1
  37. fi
  38. rm -f "$TESTFILE"