diff --git a/tools/README.md b/tools/README.md index ac2474809e..3188c0fd4a 100644 --- a/tools/README.md +++ b/tools/README.md @@ -22,7 +22,7 @@ git clone --recurse-submodules https://github.com/commaai/openpilot.git 2. Run the setup script: -Ubuntu: +Ubuntu 20.04 LTS: ``` bash openpilot/tools/ubuntu_setup.sh ``` diff --git a/tools/ubuntu_setup.sh b/tools/ubuntu_setup.sh index 28452760f7..c6b8b3dddb 100755 --- a/tools/ubuntu_setup.sh +++ b/tools/ubuntu_setup.sh @@ -2,63 +2,113 @@ OP_ROOT=$(git rev-parse --show-toplevel) -sudo apt-get update && sudo apt-get install -y --no-install-recommends \ +# Install packages present in all supported versions of Ubuntu +function install_ubuntu_common_requirements() { + sudo apt-get update + sudo apt-get install -y --no-install-recommends \ autoconf \ build-essential \ + clang \ + cmake \ + make \ + cppcheck \ + libtool \ + libstdc++-arm-none-eabi-newlib \ + gcc-arm-none-eabi \ bzip2 \ + liblzma-dev \ + libarchive-dev \ + libbz2-dev \ capnproto \ - cppcheck \ libcapnp-dev \ - clang \ - cmake \ curl \ - ffmpeg \ + libcurl4-openssl-dev \ + wget \ git \ git-lfs \ - libavformat-dev libavcodec-dev libavdevice-dev libavutil-dev libswscale-dev libavresample-dev libavfilter-dev \ - libarchive-dev \ - libbz2-dev \ - libcurl4-openssl-dev \ + ffmpeg \ + libavformat-dev \ + libavcodec-dev \ + libavdevice-dev \ + libavutil-dev \ + libavfilter-dev \ libeigen3-dev \ libffi-dev \ libglew-dev \ libgles2-mesa-dev \ libglfw3-dev \ libglib2.0-0 \ - liblzma-dev \ libomp-dev \ libopencv-dev \ libpng16-16 \ libssl-dev \ - libstdc++-arm-none-eabi-newlib \ libsqlite3-dev \ - libtool \ libusb-1.0-0-dev \ libzmq3-dev \ - libsdl-image1.2-dev libsdl-mixer1.2-dev libsdl-ttf2.0-dev libsmpeg-dev \ - libsdl1.2-dev libportmidi-dev libswscale-dev libavformat-dev libavcodec-dev libfreetype6-dev \ + libsdl1.2-dev \ + libsdl-image1.2-dev \ + libsdl-mixer1.2-dev \ + libsdl-ttf2.0-dev \ + libsmpeg-dev \ + libportmidi-dev \ + libfreetype6-dev \ libsystemd-dev \ locales \ + opencl-headers \ ocl-icd-libopencl1 \ ocl-icd-opencl-dev \ - opencl-headers \ python-dev \ python3-pip \ qml-module-qtquick2 \ - qt5-default \ qtmultimedia5-dev \ qtwebengine5-dev \ qtlocation5-dev \ qtpositioning5-dev \ libqt5sql5-sqlite \ libqt5svg5-dev \ - screen \ - sudo \ - vim \ - wget \ - gcc-arm-none-eabi \ libqt5x11extras5-dev \ libreadline-dev +} + +# Install Ubuntu 21.10 packages +function install_ubuntu_latest_requirements() { + install_ubuntu_common_requirements + + sudo apt-get install -y --no-install-recommends \ + qtbase5-dev \ + qtchooser \ + qt5-qmake \ + qtbase5-dev-tools +} + +# Install Ubuntu 20.04 packages +function install_ubuntu_lts_requirements() { + install_ubuntu_common_requirements + + sudo apt-get install -y --no-install-recommends \ + libavresample-dev \ + qt5-default +} + +# Detect OS using /etc/os-release file +if [ -f "/etc/os-release" ]; then + source /etc/os-release + case "$ID $VERSION_ID" in + "ubuntu 21.10") + install_ubuntu_latest_requirements + ;; + "ubuntu 20.04") + install_ubuntu_lts_requirements + ;; + *) + echo "$ID $VERSION_ID is unsupported. This setup script is written for Ubuntu 20.04." + exit 1 + esac +else + echo "No /etc/os-release in the system" + exit 1 +fi + # install pyenv if ! command -v "pyenv" > /dev/null 2>&1; then