travis_osx_steps.sh 1.71 KB
Newer Older
1
#!/bin/bash
2
# Wheel build, install, run test steps on OSX
3
4
set -e

5
if [ "$PLAT" == "arm64" ] || [ "$PLAT" == "universal2" ]; then
Andrew Murray's avatar
Andrew Murray committed
6
  if [[ "$(xcrun -show-sdk-version | cut -d '.' -f 1)" -lt 11 ]]; then
Andrew Murray's avatar
Andrew Murray committed
7
8
    latestXcode=$(ls /Applications | grep Xcode[_0-9\.]*\.app | sort -V | tail -n 1)
    if ([ "$GITHUB_WORKFLOW" != "" ] || [ "$PIPELINE_WORKSPACE" != "" ]) && [ $latestXcode ]; then
Isuru Fernando's avatar
Isuru Fernando committed
9
      sudo xcode-select -switch /Applications/$latestXcode
10
    fi
Andrew Murray's avatar
Andrew Murray committed
11
    if [[ "$(xcrun -show-sdk-version | cut -d '.' -f 1)" -lt 11 ]]; then
12
13
14
15
16
      echo "Need SDK>=11 for arm64 builds. Please run xcode-select to select a newer SDK"
      exit 1
    fi
  fi
  export SDKROOT=${SDKROOT:-$(xcrun -show-sdk-path)}
17
18
fi

19
# Get needed utilities
20
MULTIBUILD_DIR=$(dirname "${BASH_SOURCE[0]}")
21
MB_PYTHON_VERSION=${MB_PYTHON_VERSION:-$TRAVIS_PYTHON_VERSION}
22
23
24

ENV_VARS_PATH=${ENV_VARS_PATH:-env_vars.sh}

25
# These load common_utils.sh
Matthew Brett's avatar
Matthew Brett committed
26
source $MULTIBUILD_DIR/osx_utils.sh
27
28
MB_PYTHON_OSX_VER=${MB_PYTHON_OSX_VER:-$(macpython_sdk_for_version $MB_PYTHON_VERSION)}

29
if [ -r "$ENV_VARS_PATH" ]; then source "$ENV_VARS_PATH"; fi
30
source $MULTIBUILD_DIR/configure_build.sh
31
source $MULTIBUILD_DIR/library_builders.sh
32

33
34
# NB - config.sh sourced at end of this function.
# config.sh can override any function defined here.
35
36
37
38

function before_install {
    export CC=clang
    export CXX=clang++
39

40
    get_macpython_environment $MB_PYTHON_VERSION venv
41
42
43
44
    source venv/bin/activate
    pip install --upgrade pip wheel
}

45
# build_wheel function defined in common_utils (via osx_utils)
46
# install_run function defined in common_utils
47
48

# Local configuration may define custom pre-build, source patching.
49
# It can also overwrite the functions above.
50
51
CONFIG_PATH=${CONFIG_PATH:-config.sh}
source "$CONFIG_PATH"