shithub: orca

Download patch

ref: 002a7b949d5719b640d70aa62ed642bffa51b2c8
parent: 2004b2cb37c69280fcfa128a0083de4c8c1e8ca4
author: cancel <cancel@cancel.fm>
date: Fri Dec 14 00:47:38 EST 2018

Add dynamic homebrew prefix on mac

--- a/tool
+++ b/tool
@@ -240,13 +240,21 @@
       out_exe=orca
       case $os in
         mac)
+          local brew_prefix=
+          if ! brew_prefix=$(printenv HOMEBREW_PREFIX); then
+             brew_prefix=/usr/local/
+          fi
+          local ncurses_dir="$brew_prefix/opt/ncurses"
+          if ! [[ -d "$ncurses_dir" ]]; then
+            echo "Error: ncurses directory not found at $ncurses_dir" >&2
+            echo "Install with: brew install ncurses" >&2
+            exit 1
+          fi
           # prefer homebrew version of ncurses if installed. Will give us
           # better terminfo, so we can use A_DIM in Terminal.app, etc.
-          if [[ -d /usr/local/opt/ncurses ]]; then
-            add libraries -L/usr/local/opt/ncurses/lib
-            add cc_flags -I/usr/local/opt/ncurses/include
-          fi
-          # todo mach time stuff for mac
+          add libraries "-L$ncurses_dir/lib"
+          add cc_flags "-I$ncurses_dir/include"
+          # todo mach time stuff for mac?
         ;;
         *)
           # librt and high-res posix timers on Linux