Subject: bug#57023: [PATCH] Take last libgccjit.dylib or .so from homebrew

From: "James N. V. Cash" <[email-masked]>
Date: Sat, 06 Aug 2022 19:22:43 -0400

Tags: patch

This patch fixes a bug where building with native-compilation with the
latest libgccjit from homebrew fails, because an extra copy of the dylib showing up
in the output of brew ls results in a malformed CFLAG.

James Cash

>From b5ec156fb396ca4567e900c64ab6faeae1702400 Mon Sep 17 00:00:00 2001
From: "James N. V. Cash" <[email-masked]>
Date: Sat, 6 Aug 2022 18:18:42 -0400
Subject: [PATCH] Take last libgccjit.dylib or .so from homebrew

Homebrew now shows multiple dylibs, under "<version-number>/" and
"current/". One is a symlink to the other, so it doesn't matter which
we choose, but otherwise the linker flag gets malformed (ends up as
"-L/whatever/12/libgccjit.dylib\n/whatever/current/")
---
 configure.ac | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/configure.ac b/configure.ac
index 1a264275bd..f55ffaa339 100644
--- a/configure.ac
+++ b/configure.ac
@@ -4241,7 +4241,8 @@ AC_DEFUN
           MAC_CFLAGS="-I$(dirname $($BREW ls -v libgccjit | \
                                                 grep libgccjit.h))"
           MAC_LIBS="-L$(dirname $($BREW ls -v libgccjit| \
-                                            grep -E 'libgccjit\.(so|dylib)$'))"
+                                            grep -E 'libgccjit\.(so|dylib)$'| \
+                                            tail -n 1))"
         fi
       fi
 
-- 
2.32.1 (Apple Git-133)