git: 782c642c8a10 - main - devel/rubygem-rugged: Unbreak with libgit2 1.8.1

From: Nuno Teixeira <eduardo_at_FreeBSD.org>
Date: Sat, 19 Oct 2024 11:09:34 UTC
The branch main has been updated by eduardo:

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

commit 782c642c8a10cdaeff59df09f00990e76d0392d5
Author:     Nuno Teixeira <eduardo@FreeBSD.org>
AuthorDate: 2024-10-19 11:08:21 +0000
Commit:     Nuno Teixeira <eduardo@FreeBSD.org>
CommitDate: 2024-10-19 11:09:23 +0000

    devel/rubygem-rugged: Unbreak with libgit2 1.8.1
    
    Remove broken libgit2 detection
    
    PR:             280711
---
 .../files/patch-ext_rugged_extconf.rb              | 37 ++++++++++++++++++++++
 1 file changed, 37 insertions(+)

diff --git a/devel/rubygem-rugged/files/patch-ext_rugged_extconf.rb b/devel/rubygem-rugged/files/patch-ext_rugged_extconf.rb
new file mode 100644
index 000000000000..41fd2d2aed76
--- /dev/null
+++ b/devel/rubygem-rugged/files/patch-ext_rugged_extconf.rb
@@ -0,0 +1,37 @@
+# Remove broken libgit2 detection
+
+--- ext/rugged/extconf.rb.orig	2024-10-19 10:29:11 UTC
++++ ext/rugged/extconf.rb
+@@ -65,32 +65,6 @@ if arg_config("--use-system-libraries", !!ENV['RUGGED_
+ 
+ if arg_config("--use-system-libraries", !!ENV['RUGGED_USE_SYSTEM_LIBRARIES'])
+   puts "Building Rugged using system libraries.\n"
+-
+-  dir_config('git2').any? or pkg_config('libgit2')
+-
+-  major = minor = nil
+-
+-  File.readlines(File.join(LIBGIT2_DIR, "include", "git2", "version.h")).each do |line|
+-    if !major && (matches = line.match(/^#define LIBGIT2_VER_MAJOR\s+([0-9]+)$/))
+-      major = matches[1]
+-      next
+-    end
+-
+-    if !minor && (matches = line.match(/^#define LIBGIT2_VER_MINOR\s+([0-9]+)$/))
+-      minor = matches[1]
+-      next
+-    end
+-
+-    break if major && minor
+-  end
+-
+-  try_compile(<<-SRC) or abort "libgit2 version is not compatible, expected ~> #{major}.#{minor}.0"
+-#include <git2/version.h>
+-
+-#if LIBGIT2_VER_MAJOR != #{major} || LIBGIT2_VER_MINOR != #{minor}
+-#error libgit2 version is not compatible
+-#endif
+-  SRC
+ else
+   if !find_executable('cmake')
+     abort "ERROR: CMake is required to build Rugged."