Skip to content

Commit df627de

Browse files
tecandrewpd0wm
andauthored
fix mac_setup w/ tools+plotjuggler (#23552)
* fix pycurl issue: * use newer curl backend for pip install * update lib paths based on brew prefix * fix cert issue when using pycurl using certifi * make output setup nicer * fix linter * typo * dont need that actually * revert * pipenv in brew * forgot this * make brew available on fresh install * undo * more undo * oops * use sytem curl, but homebrew openssl Co-authored-by: Willem Melching <willem.melching@gmail.com>
1 parent 52266b9 commit df627de

File tree

1 file changed

+27
-13
lines changed

1 file changed

+27
-13
lines changed

tools/mac_setup.sh

+27-13
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,28 @@ set -e
44

55
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )"
66
ROOT="$(cd $DIR/../ && pwd)"
7+
ARCH=$(uname -m)
8+
9+
if [[ $SHELL == "/bin/zsh" ]]; then
10+
RC_FILE="$HOME/.zshrc"
11+
elif [[ $SHELL == "/bin/bash" ]]; then
12+
RC_FILE="$HOME/.bashrc"
13+
fi
714

815
# Install brew if required
916
if [[ $(command -v brew) == "" ]]; then
1017
echo "Installing Hombrew"
1118
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
1219
echo "[ ] installed brew t=$SECONDS"
20+
21+
# make brew available now
22+
if [[ $ARCH == "x86_64" ]]; then
23+
echo 'eval "$(/usr/local/homebrew/bin/brew shellenv)"' >> $RC_FILE
24+
eval "$(/usr/local/homebrew/bin/brew shellenv)"
25+
else
26+
echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> $RC_FILE
27+
eval "$(/opt/homebrew/bin/brew shellenv)"
28+
fi
1329
fi
1430

1531
# TODO: remove protobuf,protobuf-c,swig when casadi can be pip installed
@@ -40,20 +56,18 @@ EOS
4056

4157
echo "[ ] finished brew install t=$SECONDS"
4258

43-
if [[ $SHELL == "/bin/zsh" ]]; then
44-
RC_FILE="$HOME/.zshrc"
45-
elif [[ $SHELL == "/bin/bash" ]]; then
46-
RC_FILE="$HOME/.bash_profile"
47-
fi
59+
BREW_PREFIX=$(brew --prefix)
60+
61+
# archive backend tools for pip dependencies
62+
export LDFLAGS="$LDFLAGS -L${BREW_PREFIX}/opt/zlib/lib"
63+
export LDFLAGS="$LDFLAGS -L${BREW_PREFIX}/opt/bzip2/lib"
64+
export CPPFLAGS="$CPPFLAGS -I${BREW_PREFIX}/opt/zlib/include"
65+
export CPPFLAGS="$CPPFLAGS -I${BREW_PREFIX}/opt/bzip2/include"
4866

49-
export LDFLAGS="$LDFLAGS -L/usr/local/opt/zlib/lib"
50-
export LDFLAGS="$LDFLAGS -L/usr/local/opt/bzip2/lib"
51-
export LDFLAGS="$LDFLAGS -L/usr/local/opt/openssl@1.1/lib"
52-
export CPPFLAGS="$CPPFLAGS -I/usr/local/opt/zlib/include"
53-
export CPPFLAGS="$CPPFLAGS -I/usr/local/opt/bzip2/include"
54-
export CPPFLAGS="$CPPFLAGS -I/usr/local/opt/openssl@1.1/include"
55-
export PATH="$PATH:/usr/local/opt/openssl@1.1/bin"
56-
export PATH="$PATH:/usr/local/bin"
67+
# pycurl curl/openssl backend dependencies
68+
export LDFLAGS="$LDFLAGS -L${BREW_PREFIX}/opt/openssl@3/lib"
69+
export CPPFLAGS="$CPPFLAGS -I${BREW_PREFIX}/opt/openssl@3/include"
70+
export PYCURL_SSL_LIBRARY=openssl
5771

5872
# openpilot environment
5973
if [ -z "$OPENPILOT_ENV" ] && [ -n "$RC_FILE" ] && [ -z "$CI" ]; then

0 commit comments

Comments
 (0)