From c467d2c00f93131c0127ef294fe53ef319bba837 Mon Sep 17 00:00:00 2001 From: Andy Pfister Date: Sun, 3 Dec 2023 16:45:03 +0100 Subject: [PATCH] Add `/opt/homebrew` to search path on Apple Silicon This is default directory for Homebrew on Apple Silicon. Intel Mac installs into `/usr/local`, which is in our default path. Co-authored-by: Caleb Land --- CHANGELOG.md | 1 + ext/tiny_tds/extconf.rb | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 394e1b3f..7350886c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ * Fix segfault when asking if client was dead after closing it. Fixes #519. * Mark `alloc` function as undefined on `TinyTds::Result`. Fixes #515. * Fix Gem installation on Windows by adding default freetds msys path. Fixes #522 +* Search for `freetds` in `/opt/homebrew` when installing on Apple Silicon. Fixes #484, #492 and #508. ## 2.1.5 diff --git a/ext/tiny_tds/extconf.rb b/ext/tiny_tds/extconf.rb index 9b7db299..431034ed 100644 --- a/ext/tiny_tds/extconf.rb +++ b/ext/tiny_tds/extconf.rb @@ -35,6 +35,13 @@ def do_help /usr/local ) +# Homebrew on Apple Silicon installs into /opt/hombrew +# https://docs.brew.sh/Installation +# On Intel Macs, it is /usr/local, so no changes necessary to DIRS +if RbConfig::CONFIG['host_os'] =~ /darwin/i && RbConfig::CONFIG['host_cpu'] == 'arm64' + DIRS.unshift("/opt/homebrew") +end + if ENV["RI_DEVKIT"] && ENV["MINGW_PREFIX"] # RubyInstaller Support DIRS.unshift(File.join(ENV["RI_DEVKIT"], ENV["MINGW_PREFIX"])) end