-
Notifications
You must be signed in to change notification settings - Fork 448
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update MacOS runner to Ventura, add MacOS Sonoma (M1) runner (#4393)
* Use M1 Github runner. * Update ci-test and remove elements which have no effect. * Add a cache. * Fun with GPTs. * Cleanup.
- Loading branch information
Showing
3 changed files
with
107 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,63 @@ | ||
#! /bin/bash | ||
|
||
# Script for building P4C on MacOS. | ||
# Script to install P4C dependencies on MacOS. | ||
|
||
set -e # Exit on error. | ||
set -x # Make command execution verbose | ||
|
||
# Install some custom requirements on OS X using brew | ||
BREW=/usr/local/bin/brew | ||
if [[ ! -x $BREW ]]; then | ||
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" | ||
# Installation helper. | ||
brew_install() { | ||
echo "\nInstalling $1" | ||
if brew list $1 &>/dev/null; then | ||
echo "${1} is already installed" | ||
else | ||
brew install $1 && echo "$1 is installed" | ||
fi | ||
} | ||
|
||
# Check if brew shellenv command is already in zprofile. | ||
if ! grep -q 'brew shellenv' ~/.zprofile; then | ||
# Set up Homebrew differently for arm64. | ||
if [[ $(uname -m) == 'arm64' ]]; then | ||
(echo; echo 'eval "$(/opt/homebrew/bin/brew shellenv)"') >> ~/.zprofile | ||
eval "$(/opt/homebrew/bin/brew shellenv)" | ||
else | ||
(echo; echo 'eval "$(/usr/local/bin/brew shellenv)"') >> ~/.zprofile | ||
eval "$(/usr/local/bin/brew shellenv)" | ||
fi | ||
fi | ||
# Source zprofile. | ||
source ~/.zprofile | ||
|
||
BOOST_LIB="boost@1.76" | ||
|
||
$BREW install autoconf automake bdw-gc ccache cmake \ | ||
libtool openssl pkg-config python coreutils | ||
# Check if Homebrew is already installed. | ||
if ! which brew > /dev/null 2>&1; then | ||
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" | ||
fi | ||
HOMEBREW_PREFIX=$(brew --prefix) | ||
|
||
|
||
BOOST_LIB="boost@1.84" | ||
REQUIRED_PACKAGES=( | ||
autoconf automake bdw-gc ccache cmake libtool | ||
openssl pkg-config coreutils bison grep | ||
${BOOST_LIB} | ||
) | ||
for package in "${REQUIRED_PACKAGES[@]}"; do | ||
brew_install ${package} | ||
done | ||
|
||
# Check if linking is needed. | ||
if ! brew ls --linked --formula ${BOOST_LIB} > /dev/null 2>&1; then | ||
brew link ${BOOST_LIB} | ||
fi | ||
|
||
# We need to link boost. | ||
$BREW install ${BOOST_LIB} | ||
$BREW link ${BOOST_LIB} | ||
# Prefer Homebrew's bison and grep over the macOS-provided version | ||
$BREW install bison | ||
echo 'export PATH="/usr/local/opt/bison/bin:$PATH"' >> ~/.bash_profile | ||
$BREW install grep | ||
echo 'export PATH="/usr/local/opt/grep/libexec/gnubin:$PATH"' >> ~/.bash_profile | ||
# Check if PATH modification is needed. | ||
if ! grep -q "$(brew --prefix bison)/bin" ~/.bash_profile; then | ||
echo 'export PATH="$(brew --prefix bison)/bin:$PATH"' >> ~/.bash_profile | ||
fi | ||
if ! grep -q "$HOMEBREW_PREFIX/opt/grep/libexec/gnubin" ~/.bash_profile; then | ||
echo 'export PATH="$HOMEBREW_PREFIX/opt/grep/libexec/gnubin:$PATH"' >> ~/.bash_profile | ||
fi | ||
source ~/.bash_profile | ||
|
||
|
||
# install pip and required pip packages | ||
# curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py | ||
# python get-pip.py --user | ||
# use scapy 2.4.5, which is the version on which ptf depends | ||
pip3 install --user scapy==2.4.5 ply==3.8 | ||
# Install required pip packages | ||
pip3 install --user -r requirements.txt |