git: da17cd55f0ad - main - lang/spidermonkey102: Fix build on 12.x

From: Neel Chauhan <nc_at_FreeBSD.org>
Date: Mon, 13 Feb 2023 17:14:47 UTC
The branch main has been updated by nc:

URL: https://cgit.FreeBSD.org/ports/commit/?id=da17cd55f0add82bef10b8863d94ebe97b106d4a

commit da17cd55f0add82bef10b8863d94ebe97b106d4a
Author:     John Hein <jcfyecrayz@liamekaens.com>
AuthorDate: 2023-02-13 17:13:45 +0000
Commit:     Neel Chauhan <nc@FreeBSD.org>
CommitDate: 2023-02-13 17:13:45 +0000

    lang/spidermonkey102: Fix build on 12.x
    
    PR:     269241
---
 lang/spidermonkey102/Makefile                  |  2 --
 lang/spidermonkey102/files/patch-moz.configure | 14 +++++++++++++-
 2 files changed, 13 insertions(+), 3 deletions(-)

diff --git a/lang/spidermonkey102/Makefile b/lang/spidermonkey102/Makefile
index 636f95efde5d..5b46f6f45726 100644
--- a/lang/spidermonkey102/Makefile
+++ b/lang/spidermonkey102/Makefile
@@ -13,8 +13,6 @@ WWW=		https://spidermonkey.dev/
 LICENSE=	MPL20
 LICENSE_FILE=	${WRKSRC}/LICENSE
 
-BROKEN_FreeBSD_12=	ERROR: Cannot find readelf
-
 BUILD_DEPENDS=	${LOCALBASE}/bin/python${PYTHON3_DEFAULT}:lang/python${PYTHON3_DEFAULT:S/.//g} \
 		${RUST_DEFAULT}>=1.35:lang/${RUST_DEFAULT} \
 		autoconf2.13:devel/autoconf2.13 \
diff --git a/lang/spidermonkey102/files/patch-moz.configure b/lang/spidermonkey102/files/patch-moz.configure
index 94ae8c5f0b07..40a6a8adbcc3 100644
--- a/lang/spidermonkey102/files/patch-moz.configure
+++ b/lang/spidermonkey102/files/patch-moz.configure
@@ -1,7 +1,9 @@
 - Fix awk detection
 
+- also look in stderr for readelf --help output (elftoolchain bsd readelf)
+
 Index: moz.configure
---- moz.configure.orig	2022-03-30 19:25:49 UTC
+--- moz.configure.orig	2022-10-10 09:55:56 UTC
 +++ moz.configure
 @@ -708,7 +708,7 @@ add_old_configure_assignment("CLANG_PLUGIN", clang_plu
  
@@ -12,3 +14,13 @@ Index: moz.configure
  
  # Until the AWK variable is not necessary in old-configure
  
+@@ -812,7 +812,8 @@ def validate_readelf(path):
+     # option in the `--help` output, which fortunately, s compatible between
+     # llvm-readelf and readelf.
+     retcode, stdout, stderr = get_cmd_output(path, "--help")
+-    return retcode == 0 and any(l.startswith("  -d ") for l in stdout.splitlines())
++    return retcode == 0 and (any(l.startswith("  -d ") for l in stdout.splitlines()) \
++        or any(l.startswith("  -d ") for l in stderr.splitlines()))
+
+
+ @depends("--enable-compile-environment", target, host)