CMake
-----
-CoreCLR has a dependency on CMake for the build. You can download it from [CMake downloads](http://www.cmake.org/download/).
-
-Alternatively, you can install CMake from [Homebrew](http://brew.sh/).
+CoreCLR has a dependency on CMake for the build. You can install it with [Homebrew](https://brew.sh/).
```sh
brew install cmake
ICU
---
-ICU (International Components for Unicode) is also required to build and run. It can be obtained via [Homebrew](http://brew.sh/).
+ICU (International Components for Unicode) is also required to build and run. It can be obtained via [Homebrew](https://brew.sh/).
```sh
brew install icu4c
-brew link --force icu4c
```
Build the Runtime and System.Private.CoreLib
- cmake 3.15.5 or newer
- autoconf
- automake
+- icu4c
- libtool
+- openssl 1.1
- pkg-config
- python3
-- icu4c
The lines to install all the packages above using Homebrew.
```
-brew install cmake autoconf automake libtool pkg-config python3 icu4c
-brew link --force icu4c
-```
-
-OpenSSL
--------
-
-To build the libraries on macOS, you must install and configure links for OpenSSL 1.1.
-
-```sh
-brew install openssl
-
-# You might need to "link" pkg-config:
-brew link pkg-config
-
-# We need to make the runtime libraries discoverable, as well as make
-# pkg-config be able to find the headers and current ABI version.
-#
-# Ensure the paths we will need exist
-mkdir -p /usr/local/lib/pkgconfig
-
-# The rest of these instructions assume a default Homebrew path of
-# `/usr/local/opt/<module>`, with `brew --prefix` returning `/usr/local`
-# and `brew --prefix openssl` returning `/usr/local/opt/openssl@1.1`.
-# In this case, `brew info openssl` shows:
-# `openssl@1.1: stable 1.1.1d (bottled) [keg-only]`.
-
-# Runtime dependencies
-ln -s /usr/local/opt/openssl\@1.1/lib/libcrypto.1.1.dylib /usr/local/lib/
-ln -s /usr/local/opt/openssl\@1.1/lib/libssl.1.1.dylib /usr/local/lib/
-
-# Compile-time dependencies (for pkg-config)
-ln -s /usr/local/opt/openssl\@1.1/lib/pkgconfig/libcrypto.pc /usr/local/lib/pkgconfig/
-ln -s /usr/local/opt/openssl\@1.1/lib/pkgconfig/libssl.pc /usr/local/lib/pkgconfig/
-ln -s /usr/local/opt/openssl\@1.1/lib/pkgconfig/openssl.pc /usr/local/lib/pkgconfig/
+brew install cmake autoconf automake icu4c libtool openssl@1.1 pkg-config python3
```
if [ "$?" != "0" ]; then
exit 1;
fi
- brew install icu4c openssl autoconf automake libtool pkg-config python3
+ brew install autoconf automake icu4c libtool openssl@1.1 pkg-config python3
if [ "$?" != "0" ]; then
exit 1;
fi
- brew link --force icu4c
if [ "$?" != "0" ]; then
exit 1;
fi
if [ "$?" != "0" ]; then
exit 1;
fi
- brew install openssl autoconf automake libtool pkg-config python3
+ brew install autoconf automake libtool openssl@1.1 pkg-config python3
if [ "$?" != "0" ]; then
exit 1;
fi
if [ "$?" != "0" ]; then
exit 1;
fi
- brew install openssl autoconf automake libtool pkg-config python3
+ brew install autoconf automake libtool openssl@1.1 pkg-config python3
if [ "$?" != "0" ]; then
exit 1;
fi
echo "Please install CMake 3.14.2 or newer from http://www.cmake.org/download/ or https://apt.kitware.com and ensure it is on your path."; exit 1;
fi
+ if [[ "$__HostOS" == "OSX" ]]; then
+ # Check presence of pkg-config on the path
+ command -v pkg-config 2>/dev/null || { echo >&2 "Please install pkg-config before running this script, see https://github.com/dotnet/runtime/blob/master/docs/workflow/requirements/macos-requirements.md"; exit 1; }
+
+ if ! pkg-config openssl ; then
+ # We export the proper PKG_CONFIG_PATH where openssl was installed by Homebrew
+ # It's important to _export_ it since build-commons.sh is sourced by other scripts such as build-native.sh
+ export PKG_CONFIG_PATH=/usr/local/opt/openssl/lib/pkgconfig
+ # We try again with the PKG_CONFIG_PATH in place, if pkg-config still can't find OpenSSL, exit with an error, cmake won't find OpenSSL either
+ pkg-config openssl || { echo >&2 "Please install openssl before running this script, see https://github.com/dotnet/runtime/blob/master/docs/workflow/requirements/macos-requirements.md"; exit 1; }
+ fi
+ fi
+
if [[ "$__UseNinja" == 1 ]]; then
command -v ninja 2>/dev/null || command -v ninja-build 2>/dev/null || { echo "Unable to locate ninja!"; exit 1; }
fi
variables: ${{ parameters.variables }}
steps:
- - ${{ if eq(parameters.osGroup, 'OSX') }}:
- - script: |
- $(setScriptToEchoAndFailOnNonZero)
- brew install pkgconfig icu4c openssl autoconf automake libtool pkg-config python3
- brew link --force icu4c
- ln -s /usr/local/opt/openssl/lib/pkgconfig/libcrypto.pc /usr/local/lib/pkgconfig/
- ln -s /usr/local/opt/openssl/lib/pkgconfig/libssl.pc /usr/local/lib/pkgconfig/
- ln -s /usr/local/opt/openssl/lib/pkgconfig/openssl.pc /usr/local/lib/pkgconfig/
- displayName: Install Build Dependencies
-
- template: /eng/pipelines/common/clone-checkout-bundle-step.yml
- - ${{ if in(parameters.osGroup, 'OSX', 'iOS','tvOS') }}:
+ - ${{ if in(parameters.osGroup, 'OSX', 'iOS', 'tvOS') }}:
+ - script: sh $(Build.SourcesDirectory)/eng/install-native-dependencies.sh ${{ parameters.osGroup }}
+ displayName: Install Build Dependencies
+
- script: |
du -sh $(Build.SourcesDirectory)/*
df -h
displayName: 'Libraries artifacts (AllConfigurations)'
cleanUnpackFolder: false
- - ${{ if in(parameters.osGroup, 'OSX', 'iOS','tvOS') }}:
+ - ${{ if in(parameters.osGroup, 'OSX', 'iOS', 'tvOS') }}:
+ - script: sh $(Build.SourcesDirectory)/eng/install-native-dependencies.sh ${{ parameters.osGroup }}
+ displayName: Install Build Dependencies
+
- script: |
du -sh $(Build.SourcesDirectory)/*
df -h
- ${{ parameters.variables }}
steps:
- - ${{ if eq(parameters.osGroup, 'OSX') }}:
- - script: |
- brew install pkgconfig icu4c openssl
- brew link --force icu4c
- ln -s /usr/local/opt/openssl/lib/pkgconfig/libcrypto.pc /usr/local/lib/pkgconfig/
- ln -s /usr/local/opt/openssl/lib/pkgconfig/libssl.pc /usr/local/lib/pkgconfig/
- ln -s /usr/local/opt/openssl/lib/pkgconfig/openssl.pc /usr/local/lib/pkgconfig/
- displayName: Install Build Dependencies
-
- ${{ if eq(parameters.isOfficialBuild, true) }}:
- template: /eng/pipelines/common/restore-internal-tools.yml
- - ${{ if in(parameters.osGroup, 'OSX', 'iOS','tvOS') }}:
+ - ${{ if in(parameters.osGroup, 'OSX', 'iOS', 'tvOS') }}:
+ - script: sh $(Build.SourcesDirectory)/eng/install-native-dependencies.sh ${{ parameters.osGroup }}
+ displayName: Install Build Dependencies
+
- script: |
du -sh $(Build.SourcesDirectory)/*
df -h
endif()
if(NOT OPENSSL_FOUND)
- message(FATAL_ERROR "!!! Cannot find libssl and System.Security.Cryptography.Native cannot build without it. Try installing libssl-dev (or the appropriate package for your platform) !!!. See the requirements document for your specific operating system: https://github.com/dotnet/runtime/tree/master/docs/workflow/requirements.")
+ message(FATAL_ERROR "!!! Cannot find libssl and System.Security.Cryptography.Native cannot build without it. Try installing libssl-dev (on Linux, but this may vary by distro) or openssl (on macOS) !!!. See the requirements document for your specific operating system: https://github.com/dotnet/runtime/tree/master/docs/workflow/requirements.")
endif(NOT OPENSSL_FOUND)
include_directories(${OPENSSL_INCLUDE_DIR})