Update Unix dependencies installation script (#77107)
authorAdeel Mujahid <3840695+am11@users.noreply.github.com>
Tue, 18 Oct 2022 16:22:10 +0000 (19:22 +0300)
committerGitHub <noreply@github.com>
Tue, 18 Oct 2022 16:22:10 +0000 (18:22 +0200)
* Update Unix dependencies installation script

* Add missing libz-dev

* Use zlib1g-dev instead of libz-dev

Co-authored-by: Alexander Köplinger <alex.koeplinger@outlook.com>
* Remove obsolete arguments

Co-authored-by: Alexander Köplinger <alex.koeplinger@outlook.com>
eng/install-native-dependencies.sh
eng/pipelines/common/global-build-job.yml
eng/pipelines/common/templates/runtimes/build-test-job.yml
eng/pipelines/coreclr/templates/build-jit-job.yml
eng/pipelines/coreclr/templates/build-job.yml
eng/pipelines/installer/jobs/build-job.yml
eng/pipelines/libraries/build-job.yml
eng/pipelines/mono/templates/build-job.yml
eng/pipelines/mono/templates/generate-offsets.yml

index bc9b203..a0b0b16 100755 (executable)
@@ -1,49 +1,32 @@
-#!/usr/bin/env bash
+#!/bin/sh
+
+set -e
 
 # This is a simple script primarily used for CI to install necessary dependencies
 #
-# For CI typical usage is
-#
-# ./install-native-dependencies.sh <OS> <arch> azDO
-#
-# For developer use it is not recommended to include the azDO final argument as that
-# makes installation and configuration setting only required for azDO
-#
-# So simple developer usage would currently be
+# Usage:
 #
 # ./install-native-dependencies.sh <OS>
 
-if [ "$1" = "Linux" ]; then
-    sudo apt update
-    if [ "$?" != "0" ]; then
-       exit 1;
-    fi
-    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
-    if [ "$?" != "0" ]; then
-        exit 1;
-    fi
-elif [[ "$1" == "MacCatalyst" || "$1" == "OSX" || "$1" == "tvOS" || "$1" == "iOS" ]]; then
-    engdir=$(dirname "${BASH_SOURCE[0]}")
-
-    echo "Installed xcode version: `xcode-select -p`"
-
-    if [ "$3" = "azDO" ]; then
-        # workaround for old osx images on hosted agents
-        # piped in case we get an agent without these values installed
-        if ! brew_output="$(brew uninstall openssl@1.0.2t 2>&1 >/dev/null)"; then
-            echo "didn't uninstall openssl@1.0.2t"
-        else
-            echo "successfully uninstalled openssl@1.0.2t"
-        fi
-    fi
+os="$(echo "$1" | tr "[:upper:]" "[:lower:]")"
+
+if [ -e /etc/os-release ]; then
+    . /etc/os-release
+fi
+
+if [ "$os" = "linux" ] && { [ "$ID" = "debian" ] || [ "$ID_LIKE" = "debian" ]; }; then
+    apt update
+
+    apt install -y build-essential gettext locales cmake llvm clang lldb liblldb-dev libunwind8-dev libicu-dev liblttng-ust-dev \
+        libssl-dev libkrb5-dev libnuma-dev zlib1g-dev
+
+    localedef -i en_US -c -f UTF-8 -A /usr/share/locale/locale.alias en_US.UTF-8
+elif [ "$os" = "maccatalyst" ] || [ "$os" = "osx" ] || [ "$os" = "macos" ] || [ "$os" = "tvos" ] || [ "$os" = "ios" ]; then
+    echo "Installed xcode version: $(xcode-select -p)"
 
     brew update --preinstall
-    brew bundle --no-upgrade --no-lock --file "${engdir}/Brewfile"
-    if [ "$?" != "0" ]; then
-        exit 1;
-    fi
+    brew bundle --no-upgrade --no-lock --file "$(dirname "$0")/Brewfile"
 else
-    echo "Must pass \"Linux\", \"tvOS\", \"iOS\" or \"OSX\" as first argument."
+    echo "Must pass 'Linux', 'macOS', 'maccatalyst', 'iOS' or 'tvOS' as first argument."
     exit 1
 fi
-
index 171d719..a431f78 100644 (file)
@@ -147,7 +147,7 @@ jobs:
             name: ${{ parameters.platform }}
 
     - ${{ if in(parameters.osGroup, 'OSX', 'iOS', 'tvOS', 'MacCatalyst') }}:
-      - script: $(Build.SourcesDirectory)/eng/install-native-dependencies.sh ${{ parameters.osGroup }} ${{ parameters.archType }} azDO
+      - script: $(Build.SourcesDirectory)/eng/install-native-dependencies.sh ${{ parameters.osGroup }}
         displayName: Install Build Dependencies
 
       - script: |
index 1e8e332..9788d20 100644 (file)
@@ -111,7 +111,7 @@ jobs:
 
     # Install test build dependencies
     - ${{ if eq(parameters.osGroup, 'OSX') }}:
-      - script: $(Build.SourcesDirectory)/eng/install-native-dependencies.sh $(osGroup) ${{ parameters.archType }} azDO
+      - script: $(Build.SourcesDirectory)/eng/install-native-dependencies.sh $(osGroup)
         displayName: Install native dependencies
 
     # Build core/libraries dependencies of test build
index e91e0da..648cc12 100644 (file)
@@ -85,7 +85,7 @@ jobs:
     # and FreeBSD builds use a build agent with dependencies
     # preinstalled, so we only need this step for OSX and Windows.
     - ${{ if eq(parameters.osGroup, 'OSX') }}:
-      - script: $(Build.SourcesDirectory)/eng/install-native-dependencies.sh $(osGroup) ${{ parameters.archType }} azDO
+      - script: $(Build.SourcesDirectory)/eng/install-native-dependencies.sh $(osGroup)
         displayName: Install native dependencies (OSX)
 
     # Install internal tools on official builds
index 12acad0..6fdc663 100644 (file)
@@ -159,7 +159,7 @@ jobs:
     # and FreeBSD builds use a build agent with dependencies
     # preinstalled, so we only need this step for OSX and Windows.
     - ${{ if eq(parameters.osGroup, 'OSX') }}:
-      - script: $(Build.SourcesDirectory)/eng/install-native-dependencies.sh $(osGroup) ${{ parameters.archType }} azDO
+      - script: $(Build.SourcesDirectory)/eng/install-native-dependencies.sh $(osGroup)
         displayName: Install native dependencies
 
     # Install internal tools on official builds
index e894740..00c08f0 100644 (file)
@@ -310,7 +310,7 @@ jobs:
             cleanUnpackFolder: false
 
       - ${{ if in(parameters.osGroup, 'OSX', 'iOS', 'tvOS') }}:
-        - script: $(Build.SourcesDirectory)/eng/install-native-dependencies.sh ${{ parameters.osGroup }} ${{ parameters.archType }} azDO
+        - script: $(Build.SourcesDirectory)/eng/install-native-dependencies.sh ${{ parameters.osGroup }}
           displayName: Install Build Dependencies
 
         - script: |
index 44db3c1..01c7ac9 100644 (file)
@@ -86,7 +86,7 @@ jobs:
           - template: /eng/pipelines/common/restore-internal-tools.yml
 
         - ${{ if in(parameters.osGroup, 'OSX', 'iOS', 'tvOS') }}:
-          - script: $(Build.SourcesDirectory)/eng/install-native-dependencies.sh ${{ parameters.osGroup }} ${{ parameters.archType }} azDO
+          - script: $(Build.SourcesDirectory)/eng/install-native-dependencies.sh ${{ parameters.osGroup }}
             displayName: Install Build Dependencies
 
           - script: |
index 8043230..63d439c 100644 (file)
@@ -122,7 +122,7 @@ jobs:
     # and FreeBSD builds use a build agent with dependencies
     # preinstalled, so we only need this step for OSX and Windows.
     - ${{ if in(parameters.osGroup, 'OSX', 'iOS', 'tvOS') }}:
-      - script: $(Build.SourcesDirectory)/eng/install-native-dependencies.sh $(osGroup) ${{ parameters.archType }} azDO
+      - script: $(Build.SourcesDirectory)/eng/install-native-dependencies.sh $(osGroup)
         displayName: Install native dependencies
 
     - ${{ each monoCrossAOTTargetOS in parameters.monoCrossAOTTargetOS }}:
index 6c84674..7bb8388 100644 (file)
@@ -57,7 +57,7 @@ jobs:
     # and FreeBSD builds use a build agent with dependencies
     # preinstalled, so we only need this step for OSX and Windows.
     - ${{ if in(parameters.osGroup, 'OSX', 'iOS', 'tvOS') }}:
-      - script: $(Build.SourcesDirectory)/eng/install-native-dependencies.sh $(osGroup) ${{ parameters.archType }} azDO
+      - script: $(Build.SourcesDirectory)/eng/install-native-dependencies.sh $(osGroup)
         displayName: Install native dependencies
 
     # Build