annotate .shell.d/99.openssl.sh @ 524:24f7a481d284

shell: cache openssl prefix from homebrew Turns out homebrew costs about 800ms to figure this out, experimentally. :(
author Augie Fackler <raf@durin42.com>
date Mon, 14 Nov 2022 10:40:29 -0500
parents 5e6b1240684c
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
442
5e6b1240684c shell.d: add script to set some environment variables for openssl
Augie Fackler <raf@durin42.com>
parents:
diff changeset
1 if hash brew 2>/dev/null ; then
524
24f7a481d284 shell: cache openssl prefix from homebrew
Augie Fackler <raf@durin42.com>
parents: 442
diff changeset
2 BREW_SSL_PREFIX_CACHE_FILE="${XDG_CACHE_HOME:-$HOME/.cache}/durin42-zsh/brew-openssl-prefix"
24f7a481d284 shell: cache openssl prefix from homebrew
Augie Fackler <raf@durin42.com>
parents: 442
diff changeset
3 if [ -e "$BREW_SSL_PREFIX_CACHE_FILE" ] ; then
24f7a481d284 shell: cache openssl prefix from homebrew
Augie Fackler <raf@durin42.com>
parents: 442
diff changeset
4 BREW_OPENSSL_PREFIX="$(cat $BREW_SSL_PREFIX_CACHE_FILE)"
24f7a481d284 shell: cache openssl prefix from homebrew
Augie Fackler <raf@durin42.com>
parents: 442
diff changeset
5 fi
24f7a481d284 shell: cache openssl prefix from homebrew
Augie Fackler <raf@durin42.com>
parents: 442
diff changeset
6 if [ -z "$BREW_OPENSSL_PREFIX" -o ! -d "$BREW_OPENSSL_PREFIX" ] ; then
24f7a481d284 shell: cache openssl prefix from homebrew
Augie Fackler <raf@durin42.com>
parents: 442
diff changeset
7 BREW_OPENSSL_PREFIX="$(brew --prefix openssl)"
24f7a481d284 shell: cache openssl prefix from homebrew
Augie Fackler <raf@durin42.com>
parents: 442
diff changeset
8 mkdir -p "$(dirname $BREW_SSL_PREFIX_CACHE_FILE)"
24f7a481d284 shell: cache openssl prefix from homebrew
Augie Fackler <raf@durin42.com>
parents: 442
diff changeset
9 echo "$BREW_OPENSSL_PREFIX" > "$BREW_SSL_PREFIX_CACHE_FILE"
24f7a481d284 shell: cache openssl prefix from homebrew
Augie Fackler <raf@durin42.com>
parents: 442
diff changeset
10 fi
24f7a481d284 shell: cache openssl prefix from homebrew
Augie Fackler <raf@durin42.com>
parents: 442
diff changeset
11 export OPENSSL_INCLUDE_DIR="${BREW_OPENSSL_PREFIX}/include"
24f7a481d284 shell: cache openssl prefix from homebrew
Augie Fackler <raf@durin42.com>
parents: 442
diff changeset
12 export OPENSSL_LIB_DIR="${BREW_OPENSSL_PREFIX}/lib"
24f7a481d284 shell: cache openssl prefix from homebrew
Augie Fackler <raf@durin42.com>
parents: 442
diff changeset
13 export DEP_OPENSSL_INCLUDE="${BREW_OPENSSL_PREFIX}/include"
442
5e6b1240684c shell.d: add script to set some environment variables for openssl
Augie Fackler <raf@durin42.com>
parents:
diff changeset
14 fi