3 changed files with 111 additions and 42 deletions
@ -1,58 +1,76 @@ |
|||||||
#!/bin/zsh |
#!/bin/zsh |
||||||
|
|
||||||
if hash vim 2>/dev/null; then |
# ------------------------- |
||||||
export EDITOR=vim |
# Editor |
||||||
|
# ------------------------- |
||||||
|
if command -v vim >/dev/null 2>&1; then |
||||||
|
export EDITOR=vim |
||||||
else |
else |
||||||
export EDITOR=vi |
export EDITOR=vi |
||||||
fi |
fi |
||||||
|
|
||||||
if hash clang 2>/dev/null; then |
# ------------------------- |
||||||
export CC=$(which clang) |
# C / C++ compiler defaults |
||||||
else |
# ------------------------- |
||||||
export CC=$(which gcc) |
if command -v clang >/dev/null 2>&1; then |
||||||
|
export CC="$(command -v clang)" |
||||||
|
elif command -v gcc >/dev/null 2>&1; then |
||||||
|
export CC="$(command -v gcc)" |
||||||
fi |
fi |
||||||
|
|
||||||
if hash clang++ 2>/dev/null; then |
if command -v clang++ >/dev/null 2>&1; then |
||||||
export CXX=$(which clang++) |
export CXX="$(command -v clang++)" |
||||||
else |
elif command -v g++ >/dev/null 2>&1; then |
||||||
export CXX=$(which g++) |
export CXX="$(command -v g++)" |
||||||
fi |
fi |
||||||
|
|
||||||
export OPENSSL_ROOT_DIR=$(which openssl) |
# ------------------------- |
||||||
|
# History |
||||||
# Add openJDK to path |
# ------------------------- |
||||||
export PATH="/usr/local/opt/openjdk/bin:$PATH" |
# Note: HISTCONTROL is bash-specific, but harmless. |
||||||
|
# ZSH history dedupe should usually be configured with setopt elsewhere. |
||||||
# Ignore duplicates in history to make history less of a hassle to use. |
|
||||||
export HISTCONTROL=ignoredups |
export HISTCONTROL=ignoredups |
||||||
|
|
||||||
# If go is installed, set the $GOPATH to the projects directory created above. |
# ------------------------- |
||||||
if which go > /dev/null; then |
# User paths |
||||||
export GOPATH=$HOME/.go |
# ------------------------- |
||||||
export PATH=${PATH}:`go env GOPATH`/bin |
path=("$HOME/bin" $path) |
||||||
fi |
path=("$HOME/.local/bin" $path) |
||||||
|
|
||||||
if [ -d "$HOME/.rvm" ]; then |
# ------------------------- |
||||||
export PATH="$PATH:$HOME/.rvm/bin" |
# Go |
||||||
|
# ------------------------- |
||||||
|
if command -v go >/dev/null 2>&1; then |
||||||
|
export GOPATH="$HOME/.go" |
||||||
|
path=("$(go env GOPATH)/bin" $path) |
||||||
fi |
fi |
||||||
|
|
||||||
if [ -f "$HOME/.cargo/env" ]; then |
if [[ "$OSTYPE" == "linux-gnu"* ]]; then |
||||||
. "$HOME/.cargo/env" |
# If the Go install guide was followed for Linux, |
||||||
|
# /usr/local/go will contain the go binary. |
||||||
|
[[ -d "/usr/local/go/bin" ]] && path=("/usr/local/go/bin" $path) |
||||||
fi |
fi |
||||||
|
|
||||||
if [[ "$OSTYPE" == "linux-gnu" ]]; then |
# ------------------------- |
||||||
# If the Go install guide was followed for Linux |
# Ruby / RVM |
||||||
# /usr/local/go will contain the go binary. |
# ------------------------- |
||||||
export PATH=$PATH:/usr/local/go/bin |
if [[ -d "$HOME/.rvm/bin" ]]; then |
||||||
|
path=("$HOME/.rvm/bin" $path) |
||||||
fi |
fi |
||||||
|
|
||||||
if [[ "$OSTYPE" == "darwin"* ]]; then |
# ----------------------------- |
||||||
# Enable homebrew openssl support |
# Rust / Cargo - Let rustup win |
||||||
export LIBRARY_PATH=$LIBRARY_PATH:/usr/local/opt/openssl/lib/ |
# ----------------------------- |
||||||
export PATH="/usr/local/opt/llvm/bin:$PATH" |
if [[ -f "$HOME/.cargo/env" ]]; then |
||||||
export PATH="/usr/local/opt/qt/bin:$PATH" |
. "$HOME/.cargo/env" |
||||||
export PATH="/usr/local/opt/tcl-tk/bin:$PATH" |
|
||||||
fi |
fi |
||||||
|
|
||||||
export PATH=$HOME/bin:/usr/local/bin:$PATH |
if [[ -d "$HOME/.cargo/bin" ]]; then |
||||||
|
path=("$HOME/.cargo/bin" $path) |
||||||
|
fi |
||||||
|
# ------------------------- |
||||||
|
# OpenSSL fallback |
||||||
|
# ------------------------- |
||||||
|
if command -v openssl >/dev/null 2>&1; then |
||||||
|
export OPENSSL_BIN="$(command -v openssl)" |
||||||
|
fi |
||||||
|
|||||||
@ -0,0 +1,51 @@ |
|||||||
|
#!/bin/zsh |
||||||
|
|
||||||
|
# ------------------------- |
||||||
|
# macOS-specific setup |
||||||
|
# ------------------------- |
||||||
|
|
||||||
|
# Prefer Apple Silicon Homebrew, fall back to Intel Homebrew. |
||||||
|
if [[ -d "/opt/homebrew" ]]; then |
||||||
|
export HOMEBREW_PREFIX="/opt/homebrew" |
||||||
|
elif [[ -d "/usr/local/Homebrew" || -d "/usr/local/Cellar" ]]; then |
||||||
|
export HOMEBREW_PREFIX="/usr/local" |
||||||
|
fi |
||||||
|
|
||||||
|
if [[ -n "$HOMEBREW_PREFIX" ]]; then |
||||||
|
[[ -d "$HOMEBREW_PREFIX/bin" ]] && path=("$HOMEBREW_PREFIX/bin" $path) |
||||||
|
[[ -d "$HOMEBREW_PREFIX/sbin" ]] && path=("$HOMEBREW_PREFIX/sbin" $path) |
||||||
|
|
||||||
|
# LLVM / clangd / clang-format |
||||||
|
if [[ -d "$HOMEBREW_PREFIX/opt/llvm/bin" ]]; then |
||||||
|
path=("$HOMEBREW_PREFIX/opt/llvm/bin" $path) |
||||||
|
export LDFLAGS="-L$HOMEBREW_PREFIX/opt/llvm/lib ${LDFLAGS:-}" |
||||||
|
export CPPFLAGS="-I$HOMEBREW_PREFIX/opt/llvm/include ${CPPFLAGS:-}" |
||||||
|
fi |
||||||
|
|
||||||
|
# OpenSSL |
||||||
|
if [[ -d "$HOMEBREW_PREFIX/opt/openssl@3" ]]; then |
||||||
|
export OPENSSL_ROOT_DIR="$HOMEBREW_PREFIX/opt/openssl@3" |
||||||
|
export LDFLAGS="-L$OPENSSL_ROOT_DIR/lib ${LDFLAGS:-}" |
||||||
|
export CPPFLAGS="-I$OPENSSL_ROOT_DIR/include ${CPPFLAGS:-}" |
||||||
|
export PKG_CONFIG_PATH="$OPENSSL_ROOT_DIR/lib/pkgconfig:${PKG_CONFIG_PATH:-}" |
||||||
|
elif [[ -d "$HOMEBREW_PREFIX/opt/openssl" ]]; then |
||||||
|
export OPENSSL_ROOT_DIR="$HOMEBREW_PREFIX/opt/openssl" |
||||||
|
export LDFLAGS="-L$OPENSSL_ROOT_DIR/lib ${LDFLAGS:-}" |
||||||
|
export CPPFLAGS="-I$OPENSSL_ROOT_DIR/include ${CPPFLAGS:-}" |
||||||
|
export PKG_CONFIG_PATH="$OPENSSL_ROOT_DIR/lib/pkgconfig:${PKG_CONFIG_PATH:-}" |
||||||
|
fi |
||||||
|
|
||||||
|
# OpenJDK |
||||||
|
[[ -d "$HOMEBREW_PREFIX/opt/openjdk/bin" ]] && path=("$HOMEBREW_PREFIX/opt/openjdk/bin" $path) |
||||||
|
|
||||||
|
# Qt |
||||||
|
[[ -d "$HOMEBREW_PREFIX/opt/qt/bin" ]] && path=("$HOMEBREW_PREFIX/opt/qt/bin" $path) |
||||||
|
|
||||||
|
# Tcl/Tk |
||||||
|
[[ -d "$HOMEBREW_PREFIX/opt/tcl-tk/bin" ]] && path=("$HOMEBREW_PREFIX/opt/tcl-tk/bin" $path) |
||||||
|
fi |
||||||
|
|
||||||
|
# Ghostty CLI |
||||||
|
if [[ -d "/Applications/Ghostty.app/Contents/MacOS" ]]; then |
||||||
|
path=("/Applications/Ghostty.app/Contents/MacOS" $path) |
||||||
|
fi |
||||||
Loading…
Reference in new issue