|
1 | | -#!/usr/bin/env bash |
| 1 | +#!/bin/sh |
| 2 | + |
| 3 | +set -e |
2 | 4 |
|
3 | 5 | # This is a simple script primarily used for CI to install necessary dependencies |
4 | 6 | # |
5 | | -# For CI typical usage is |
6 | | -# |
7 | | -# ./install-native-dependencies.sh <OS> <arch> azDO |
8 | | -# |
9 | | -# For developer use it is not recommended to include the azDO final argument as that |
10 | | -# makes installation and configuration setting only required for azDO |
11 | | -# |
12 | | -# So simple developer usage would currently be |
| 7 | +# Usage: |
13 | 8 | # |
14 | 9 | # ./install-native-dependencies.sh <OS> |
15 | 10 |
|
16 | | -if [ "$1" = "Linux" ]; then |
17 | | - sudo apt update |
18 | | - if [ "$?" != "0" ]; then |
19 | | - exit 1; |
20 | | - fi |
21 | | - sudo apt install cmake llvm-3.9 clang-3.9 lldb-3.9 liblldb-3.9-dev libunwind8 libunwind8-dev gettext libicu-dev liblttng-ust-dev libcurl4-openssl-dev libssl-dev libkrb5-dev libnuma-dev build-essential |
22 | | - if [ "$?" != "0" ]; then |
23 | | - exit 1; |
24 | | - fi |
25 | | -elif [[ "$1" == "MacCatalyst" || "$1" == "OSX" || "$1" == "tvOS" || "$1" == "iOS" ]]; then |
26 | | - engdir=$(dirname "${BASH_SOURCE[0]}") |
27 | | - |
28 | | - echo "Installed xcode version: `xcode-select -p`" |
29 | | - |
30 | | - if [ "$3" = "azDO" ]; then |
31 | | - # workaround for old osx images on hosted agents |
32 | | - # piped in case we get an agent without these values installed |
33 | | - if ! brew_output="$(brew uninstall openssl@1.0.2t 2>&1 >/dev/null)"; then |
34 | | - echo "didn't uninstall openssl@1.0.2t" |
35 | | - else |
36 | | - echo "successfully uninstalled openssl@1.0.2t" |
37 | | - fi |
38 | | - fi |
39 | | - |
40 | | - export HOMEBREW_NO_INSTALL_CLEANUP=1 |
41 | | - export HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK=1 |
42 | | - # Skip brew update for now, see https://github.com/actions/setup-python/issues/577 |
43 | | - # brew update --preinstall |
44 | | - brew bundle --no-upgrade --no-lock --file "${engdir}/Brewfile" |
45 | | - if [ "$?" != "0" ]; then |
46 | | - exit 1; |
47 | | - fi |
48 | | -else |
49 | | - echo "Must pass \"Linux\", \"tvOS\", \"iOS\" or \"OSX\" as first argument." |
50 | | - exit 1 |
| 11 | +os="$(echo "$1" | tr "[:upper:]" "[:lower:]")" |
| 12 | + |
| 13 | +if [ -z "$os" ]; then |
| 14 | + . "$(dirname "$0")"/native/init-os-and-arch.sh |
| 15 | + os="$(echo "$os" | tr "[:upper:]" "[:lower:]")" |
51 | 16 | fi |
52 | 17 |
|
| 18 | +case "$os" in |
| 19 | + linux) |
| 20 | + if [ -e /etc/os-release ]; then |
| 21 | + . /etc/os-release |
| 22 | + fi |
| 23 | + |
| 24 | + if [ "$ID" != "debian" ] && [ "$ID_LIKE" != "debian" ]; then |
| 25 | + echo "Unsupported distro. distro: $ID" |
| 26 | + exit 1 |
| 27 | + fi |
| 28 | + |
| 29 | + apt update |
| 30 | + |
| 31 | + apt install -y build-essential gettext locales cmake llvm clang lldb liblldb-dev libunwind8-dev libicu-dev liblttng-ust-dev \ |
| 32 | + libssl-dev libkrb5-dev libnuma-dev zlib1g-dev |
| 33 | + |
| 34 | + localedef -i en_US -c -f UTF-8 -A /usr/share/locale/locale.alias en_US.UTF-8 |
| 35 | + ;; |
| 36 | + |
| 37 | + osx|mac*|ios*|tvos*) |
| 38 | + echo "Installed xcode version: $(xcode-select -p)" |
| 39 | + |
| 40 | + export HOMEBREW_NO_INSTALL_CLEANUP=1 |
| 41 | + export HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK=1 |
| 42 | + # Skip brew update for now, see https://github.com/actions/setup-python/issues/577 |
| 43 | + # brew update --preinstall |
| 44 | + brew bundle --no-upgrade --no-lock --file "$(dirname "$0")/Brewfile" |
| 45 | + ;; |
| 46 | + |
| 47 | + *) |
| 48 | + echo "Unsupported platform. OS: $os" |
| 49 | + exit 1 |
| 50 | + ;; |
| 51 | +esac |
0 commit comments