configure 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. #!/usr/bin/env bash
  2. set -e
  3. interactive_pkgs=libsdl2-dev
  4. y=''
  5. while getopts t OPT; do
  6. case "$OPT" in
  7. t)
  8. interactive_pkgs=''
  9. y='-y'
  10. ;;
  11. esac
  12. done
  13. shift $(($OPTIND - 1))
  14. (
  15. set -e
  16. # Shallow clonning saves a considerable ammount of time, specially because of the linux kernel.
  17. # However, git submodules are buggy as usual, and this is the best way i've found to get it done:
  18. # https://stackoverflow.com/questions/2144406/git-shallow-submodules/47374702#47374702
  19. # In particular:
  20. # - `shallow = true` on the submodule has no effect for the non default educational branches of our submodules
  21. # - QEMU's submodules point to commits that are neither under branches nor tags, and so `--shallow-submodules` fails
  22. git submodule update --depth 1 --jobs 4 --init
  23. cd qemu
  24. git submodule update --init
  25. ) &
  26. wait $! || git submodule update --init
  27. pkgs="\
  28. automake \
  29. build-essential \
  30. coreutils \
  31. "
  32. # GEM5
  33. pkgs="$pkgs \
  34. g++-6 \
  35. gcc-6 \
  36. gcc-aarch64-linux-gnu \
  37. gcc-arm-linux-gnueabi \
  38. libgoogle-perftools-dev \
  39. protobuf-compiler \
  40. "
  41. command -v apt-get >/dev/null 2>&1 || {
  42. cat <<EOF
  43. apt-get not found. You're on your own for installing dependencies.
  44. On Ubuntu they are:
  45. $pkgs
  46. EOF
  47. exit 0
  48. }
  49. # Without this started failing in kernel 4.15 with:
  50. # Makefile:932: *** "Cannot generate ORC metadata for CONFIG_UNWINDER_ORC=y, please install libelf-dev, libelf-devel or elfutils-libelf-devel". Stop.
  51. pkgs="$pkgs libelf-dev"
  52. sudo apt-get update $y
  53. # Building SDL for QEMU in Buildroot was rejected upstream because it adds many dependencies:
  54. # https://patchwork.ozlabs.org/patch/770684/
  55. # We are just using the host SDL for now, if it causes too much problems we might remove it.
  56. # libsdl2-dev needs to be installed separatedly from sudo apt-get build-dep qemu
  57. # because Ubuntu 16.04's QEMU uses SDL 1.
  58. sudo apt-get install $y \
  59. $pkgs \
  60. $interactive_pkgs \
  61. ;
  62. sudo apt-get build-dep $y qemu