xref: /aosp_15_r20/external/executorch/.ci/docker/common/install_gcc.sh (revision 523fa7a60841cd1ecfb9cc4201f1ca8b03ed023a)
1#!/bin/bash
2# Copyright (c) Meta Platforms, Inc. and affiliates.
3# All rights reserved.
4#
5# This source code is licensed under the BSD-style license found in the
6# LICENSE file in the root directory of this source tree.
7
8set -ex
9
10if [ -n "$GCC_VERSION" ]; then
11
12  apt-get update
13  apt-get install -y g++-"$GCC_VERSION"
14  update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-"$GCC_VERSION" 50
15  update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-"$GCC_VERSION" 50
16  update-alternatives --install /usr/bin/gcov gcov /usr/bin/gcov-"$GCC_VERSION" 50
17
18
19  # Cleanup package manager
20  apt-get autoclean && apt-get clean
21  rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
22
23fi
24