commit:     cfad6d83e575e0ecd778b8068f2d8fed9eb94f08
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Wed Oct 16 04:27:12 2024 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Wed Oct 16 04:27:12 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=cfad6d83

net-libs/nghttp2: fix build w/ cares-1.34.1

While we bumped to cares-1.34.2 already in 
33e2e04cdb2faac45b5bbc99015f8d608404f16c
which changes/works around this, we should fix it in nghttp2 anyway because:
a) it's the right thing to do (cares may change it again in future);
b) it makes it easier than trying to express a dep of "<1.34.1 or >1.34.1"
which looks a bit gross.

Bug: https://bugs.gentoo.org/941453
Signed-off-by: Sam James <sam <AT> gentoo.org>

 net-libs/nghttp2/files/nghttp2-1.63.0-cares.patch | 38 +++++++++++++++++++++++
 net-libs/nghttp2/nghttp2-1.63.0.ebuild            |  4 +++
 2 files changed, 42 insertions(+)

diff --git a/net-libs/nghttp2/files/nghttp2-1.63.0-cares.patch 
b/net-libs/nghttp2/files/nghttp2-1.63.0-cares.patch
new file mode 100644
index 000000000000..ed5286673211
--- /dev/null
+++ b/net-libs/nghttp2/files/nghttp2-1.63.0-cares.patch
@@ -0,0 +1,38 @@
+https://bugs.gentoo.org/941453
+https://github.com/nghttp2/nghttp2/issues/2253
+https://github.com/nghttp2/nghttp2/pull/2256
+https://github.com/nghttp2/nghttp2/commit/1ee4636528b1a8ea6769496750dda05f12104fa8
+
+From 1ee4636528b1a8ea6769496750dda05f12104fa8 Mon Sep 17 00:00:00 2001
+From: Tatsuhiro Tsujikawa <tatsuhir...@gmail.com>
+Date: Tue, 15 Oct 2024 19:25:12 +0900
+Subject: [PATCH] cmake: Fix c-ares v1.34.0 version detection failure
+
+--- a/cmake/FindLibcares.cmake
++++ b/cmake/FindLibcares.cmake
+@@ -17,12 +17,18 @@ find_library(LIBCARES_LIBRARY
+ )
+ 
+ if(LIBCARES_INCLUDE_DIR)
+-  set(_version_regex "^#define[ \t]+ARES_VERSION_STR[ \t]+\"([^\"]+)\".*")
+-  file(STRINGS "${LIBCARES_INCLUDE_DIR}/ares_version.h"
+-    LIBCARES_VERSION REGEX "${_version_regex}")
+-  string(REGEX REPLACE "${_version_regex}" "\\1"
+-    LIBCARES_VERSION "${LIBCARES_VERSION}")
+-  unset(_version_regex)
++  file(READ "${LIBCARES_INCLUDE_DIR}/ares_version.h" _ares_version_h)
++  string(REGEX REPLACE ".*#define[ \t]+ARES_VERSION_MAJOR[ \t]+([0-9]+).*" 
"\\1"
++    _ares_version_major ${_ares_version_h})
++  string(REGEX REPLACE ".*#define[ \t]+ARES_VERSION_MINOR[ \t]+([0-9]+).*" 
"\\1"
++    _ares_version_minor ${_ares_version_h})
++  string(REGEX REPLACE ".*#define[ \t]+ARES_VERSION_PATCH[ \t]+([0-9]+).*" 
"\\1"
++    _ares_version_patch ${_ares_version_h})
++  set(LIBCARES_VERSION 
"${_ares_version_major}.${_ares_version_minor}.${_ares_version_patch}")
++  unset(_ares_version_patch)
++  unset(_ares_version_minor)
++  unset(_ares_version_major)
++  unset(_ares_version_h)
+ endif()
+ 
+ include(FindPackageHandleStandardArgs)
+

diff --git a/net-libs/nghttp2/nghttp2-1.63.0.ebuild 
b/net-libs/nghttp2/nghttp2-1.63.0.ebuild
index 040b77645d76..54c2599e4f59 100644
--- a/net-libs/nghttp2/nghttp2-1.63.0.ebuild
+++ b/net-libs/nghttp2/nghttp2-1.63.0.ebuild
@@ -34,6 +34,10 @@ RDEPEND="
 DEPEND="${RDEPEND}"
 BDEPEND="virtual/pkgconfig"
 
+PATCHES=(
+       "${FILESDIR}"/${P}-cares.patch
+)
+
 multilib_src_configure() {
        #TODO: enable HTTP3
        #requires quictls/openssl, libngtcp2, libngtcp2_crypto_quictls, 
libnghttp3

Reply via email to