|
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 |
| 11 | +os="$(echo "$1" | tr "[:upper:]" "[:lower:]")" |
| 12 | + |
| 13 | +if [ -e /etc/os-release ]; then |
| 14 | + . /etc/os-release |
| 15 | +fi |
| 16 | + |
| 17 | +if [ "$os" = "linux" ] && { [ "$ID" = "debian" ] || [ "$ID_LIKE" = "debian" ]; }; then |
| 18 | + apt update |
| 19 | + |
| 20 | + apt install -y build-essential gettext locales cmake llvm clang lldb liblldb-dev libunwind8-dev libicu-dev liblttng-ust-dev \ |
| 21 | + libssl-dev libkrb5-dev libnuma-dev zlib1g-dev |
| 22 | + |
| 23 | + localedef -i en_US -c -f UTF-8 -A /usr/share/locale/locale.alias en_US.UTF-8 |
| 24 | +elif [ "$os" = "maccatalyst" ] || [ "$os" = "osx" ] || [ "$os" = "macos" ] || [ "$os" = "tvos" ] || [ "$os" = "ios" ]; then |
| 25 | + echo "Installed xcode version: $(xcode-select -p)" |
39 | 26 |
|
40 | 27 | brew update --preinstall |
41 | | - brew bundle --no-upgrade --no-lock --file "${engdir}/Brewfile" |
42 | | - if [ "$?" != "0" ]; then |
43 | | - exit 1; |
44 | | - fi |
| 28 | + brew bundle --no-upgrade --no-lock --file "$(dirname "$0")/Brewfile" |
45 | 29 | else |
46 | | - echo "Must pass \"Linux\", \"tvOS\", \"iOS\" or \"OSX\" as first argument." |
| 30 | + echo "Must pass 'Linux', 'macOS', 'maccatalyst', 'iOS' or 'tvOS' as first argument." |
47 | 31 | exit 1 |
48 | 32 | fi |
49 | | - |
0 commit comments