git: fc1c752e8b1c - main - lang/ruby31: Add upstream patch to fix bug of mkmf library

From: Yasuhiro Kimura <yasu_at_FreeBSD.org>
Date: Sat, 11 Feb 2023 05:59:20 UTC
The branch main has been updated by yasu:

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

commit fc1c752e8b1cfb6162b9243f275efbe33ec04757
Author:     Yasuhiro Kimura <yasu@FreeBSD.org>
AuthorDate: 2023-01-28 05:35:34 +0000
Commit:     Yasuhiro Kimura <yasu@FreeBSD.org>
CommitDate: 2023-02-11 05:59:02 +0000

    lang/ruby31: Add upstream patch to fix bug of mkmf library
    
    There is bug in mkmf library of Ruby 3.1 that it fails to detect
    pkg-config command if it isn't installed in environment that Ruby is
    built, and it causes build error of some ports when default version of
    Ruby is 3.1. So add upstream patch to fix it.
    
    Reference:      https://bugs.ruby-lang.org/issues/19189
    PR:             269197
    Approved by:    maintainer timeout
    MFH:            2023Q1
---
 Mk/Uses/ruby.mk                         |  2 +-
 lang/ruby31/files/patch-mkmf-pkg-config | 25 +++++++++++++++++++++++++
 2 files changed, 26 insertions(+), 1 deletion(-)

diff --git a/Mk/Uses/ruby.mk b/Mk/Uses/ruby.mk
index da2e4ea30a4e..46b76fd7e423 100644
--- a/Mk/Uses/ruby.mk
+++ b/Mk/Uses/ruby.mk
@@ -162,7 +162,7 @@ RUBY_PORTREVISION=	0
 # Ruby 3.1
 #
 RUBY_DISTVERSION=	3.1.3
-RUBY_PORTREVISION=	0
+RUBY_PORTREVISION=	1
 
 .      elif ${RUBY_VER} == 3.2
 #
diff --git a/lang/ruby31/files/patch-mkmf-pkg-config b/lang/ruby31/files/patch-mkmf-pkg-config
new file mode 100644
index 000000000000..f966b82eadb1
--- /dev/null
+++ b/lang/ruby31/files/patch-mkmf-pkg-config
@@ -0,0 +1,25 @@
+From 613fca01486e47dee9364a2fd86b5f5e77fe23c8 Mon Sep 17 00:00:00 2001
+From: Nobuyoshi Nakada <nobu@ruby-lang.org>
+Date: Wed, 7 Dec 2022 22:14:44 +0900
+Subject: [PATCH] [Bug #19189] Fallback to the default "pkg-config"
+
+---
+ lib/mkmf.rb | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git lib/mkmf.rb lib/mkmf.rb
+index e94733c635..0fbc1cc2e5 100644
+--- lib/mkmf.rb
++++ lib/mkmf.rb
+@@ -1866,7 +1866,7 @@ def pkg_config(pkg, *options)
+     if pkgconfig = with_config("#{pkg}-config") and find_executable0(pkgconfig)
+       # if and only if package specific config command is given
+     elsif ($PKGCONFIG ||=
+-           (pkgconfig = with_config("pkg-config", RbConfig::CONFIG["PKG_CONFIG"])) &&
++           (pkgconfig = with_config("pkg-config") {config_string("PKG_CONFIG") || "pkg-config"}) &&
+            find_executable0(pkgconfig) && pkgconfig) and
+         xsystem([*envs, $PKGCONFIG, "--exists", pkg])
+       # default to pkg-config command
+-- 
+2.39.1
+