From: grey Subject: Re: portable: configure.ac: honor HOMEBREW_PREFIX env variable To: Lucas Cc: gameoftrees@openbsd.org Date: Sun, 11 Sep 2022 00:07:16 +0000 It appears as if this diff was merged for 0.75 portable. Preliminarily, it appears as if it broke the MacPorts checks for bison. FWIW, /usr/local is a default path in MacOS, /opt/local is what MacPorts uses. I'm attempting to undo the damage at the moment. I had previously replied to Lucas off list. No one has responded via IRC yet. Thanks On Mon, Sep 5, 2022 at 1:37 PM Lucas wrote: > > Hello list, > > I happen to own a Mac M1 for $DAYJOB. I tried to build got in there with > no success, as configure uses some hardcoded paths in /usr/local that > correspond to Homebrew packages. Somewhere along the path, Homebrew > changed the default installation path from /usr/local to /opt/homebrew. > Instead of trying to guess, given that Homebrew does recommend running > `brew shellenv` in your shell rc file, check and use for the existence > of HOMEBREW_PREFIX in the environment, and default to /usr/local if it's > not the case. With this, I'm able to build and run got in my Mac M1. > > -Lucas > > > diff --git a/configure.ac b/configure.ac > index 554ab266..7a742348 100644 > --- a/configure.ac > +++ b/configure.ac > @@ -228,16 +228,17 @@ AM_CONDITIONAL([HOST_NETBSD], [test "$PLATFORM" = "netbsd"]) > AM_CONDITIONAL([HOST_DRAGONFLYBSD], [test "$PLATFORM" = "dragonflybsd"]) > > if test x"$PLATFORM" = "xdarwin"; then > - if ! test -x "/usr/local/opt/bison/bin/bison"; then > + : ${HOMEBREW_PREFIX:=/usr/local} > + if ! test -x "$HOMEBREW_PREFIX/opt/bison/bin/bison"; then > AC_MSG_ERROR("GNU Bison not found") > fi > > # Override YACC here to point to the GNU version of bison. > - export YACC="/usr/local/opt/bison/bin/bison -y" > - export LDFLAGS="-L/usr/local/opt/ncurses/lib -L/usr/local/opt/openssl@3/lib $LDFLAGS" > - export CPPFLAGS="-I/usr/local/opt/ncurses/include -I/usr/local/opt/openssl@3/include $CPPFLAGS" > - export PKG_CONFIG_PATH="/usr/local/opt/ncurses/lib/pkgconfig" > - export PKG_CONFIG_PATH="$PKG_CONFIG_PATH:/usr/local/opt/openssl@3/lib/pkgconfig" > + export YACC="$HOMEBREW_PREFIX/opt/bison/bin/bison -y" > + export LDFLAGS="-L$HOMEBREW_PREFIX/opt/ncurses/lib -L$HOMEBREW_PREFIX/opt/openssl@3/lib $LDFLAGS" > + export CPPFLAGS="-I$HOMEBREW_PREFIX/opt/ncurses/include -I$HOMEBREW_PREFIX/opt/openssl@3/include $CPPFLAGS" > + export PKG_CONFIG_PATH="$HOMEBREW_PREFIX/opt/ncurses/lib/pkgconfig" > + export PKG_CONFIG_PATH="$PKG_CONFIG_PATH:$HOMEBREW_PREFIX/opt/openssl@3/lib/pkgconfig" > fi > > # Landlock detection. >