-
Notifications
You must be signed in to change notification settings - Fork 88
/
travis_osx_steps.sh
52 lines (42 loc) · 1.82 KB
/
travis_osx_steps.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#!/bin/bash
# Wheel build, install, run test steps on OSX
set -e
if [ "$PLAT" == "arm64" ] || [ "$PLAT" == "universal2" ]; then
if [[ "$(xcrun --sdk macosx --show-sdk-version | cut -d '.' -f 1)" -lt 11 ]]; then
latestXcode=$(ls /Applications | grep Xcode[_0-9\.]*\.app | sort -V | tail -n 1)
if ([ "$GITHUB_WORKFLOW" != "" ] || [ "$PIPELINE_WORKSPACE" != "" ]) && [ $latestXcode ]; then
sudo xcode-select -switch /Applications/$latestXcode
fi
if [[ "$(xcrun --sdk macosx --show-sdk-version | cut -d '.' -f 1)" -lt 11 ]]; then
echo "Need SDK>=11 for arm64 builds. Please run xcode-select to select a newer SDK"
exit 1
fi
fi
export SDKROOT=${SDKROOT:-$(xcrun --sdk macosx --show-sdk-path)}
fi
# Get needed utilities
MULTIBUILD_DIR=$(dirname "${BASH_SOURCE[0]}")
MB_PYTHON_VERSION=${MB_PYTHON_VERSION:-$TRAVIS_PYTHON_VERSION}
ENV_VARS_PATH=${ENV_VARS_PATH:-env_vars.sh}
# These load common_utils.sh
source $MULTIBUILD_DIR/osx_utils.sh
MB_PYTHON_OSX_VER=${MB_PYTHON_OSX_VER:-$(macpython_sdk_for_version $MB_PYTHON_VERSION)}
if [ -r "$ENV_VARS_PATH" ]; then source "$ENV_VARS_PATH"; fi
source $MULTIBUILD_DIR/configure_build.sh
source $MULTIBUILD_DIR/library_builders.sh
# NB - config.sh sourced at end of this function.
# config.sh can override any function defined here.
function before_install {
export CC=clang
export CXX=clang++
get_macpython_environment $MB_PYTHON_VERSION venv
source venv/bin/activate
# Tomli for pyproject.toml parsing, to get dependencies.
pip install --upgrade pip wheel tomli
}
# build_wheel function defined in common_utils (via osx_utils)
# install_run function defined in common_utils
# Local configuration may define custom pre-build, source patching.
# It can also overwrite the functions above.
CONFIG_PATH=${CONFIG_PATH:-config.sh}
source "$CONFIG_PATH"