commit:     973022fd79030921727e29e7b9405d22253dc535
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Sun May 25 22:40:34 2025 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sun May 25 22:53:07 2025 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=973022fd

dev-libs/yajl: fix compat w/ CMake 4

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

 dev-libs/yajl/files/yajl-2.1.0-cmake-4.patch | 71 ++++++++++++++++++++++++++++
 dev-libs/yajl/yajl-2.1.0-r6.ebuild           | 37 +++++++++++++++
 2 files changed, 108 insertions(+)

diff --git a/dev-libs/yajl/files/yajl-2.1.0-cmake-4.patch 
b/dev-libs/yajl/files/yajl-2.1.0-cmake-4.patch
new file mode 100644
index 000000000000..51ed162d795b
--- /dev/null
+++ b/dev-libs/yajl/files/yajl-2.1.0-cmake-4.patch
@@ -0,0 +1,71 @@
+https://bugs.gentoo.org/951675
+https://github.com/lloyd/yajl/issues/254
+https://github.com/lloyd/yajl/pull/256
+
+From 6fe59ca50dfd65bdb3d1c87a27245b2dd1a072f9 Mon Sep 17 00:00:00 2001
+From: Rudi Heitbaum <[email protected]>
+Date: Fri, 28 Mar 2025 09:31:40 +0000
+Subject: [PATCH] Allow build with CMake 4.0.0
+
+fixes deprecated cmake option and uses cmake 2.8.0 TARGET_FILE
+update cmake supported minimum versions to 2.8.0...3.10
+
+ref:
+- https://cmake.org/cmake/help/latest/policy/CMP0026.html
+
+CMake Error at .../CMakeLists.txt: (GET_TARGET_PROPERTY):
+  The LOCATION property may not be read from target "json_...".  Use the
+  target name directly with add_custom_command, or use the generator
+  expression $<TARGET_FILE>, as appropriate.
+
+Signed-off-by: Rudi Heitbaum <[email protected]>
+---
+ CMakeLists.txt             | 2 +-
+ reformatter/CMakeLists.txt | 4 +---
+ verify/CMakeLists.txt      | 4 +---
+ 3 files changed, 3 insertions(+), 7 deletions(-)
+
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 471eee13..deba3a40 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -12,7 +12,7 @@
+ # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ 
+-CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
++CMAKE_MINIMUM_REQUIRED(VERSION 2.8.0...3.10)
+ 
+ PROJECT(YetAnotherJSONParser C)
+ 
+diff --git a/reformatter/CMakeLists.txt b/reformatter/CMakeLists.txt
+index 52a9bee8..267d02e2 100644
+--- a/reformatter/CMakeLists.txt
++++ b/reformatter/CMakeLists.txt
+@@ -35,9 +35,7 @@ IF (NOT WIN32)
+ ENDIF (NOT WIN32)
+ 
+ # copy the binary into the output directory
+-GET_TARGET_PROPERTY(binPath json_reformat LOCATION)
+-
+ ADD_CUSTOM_COMMAND(TARGET json_reformat POST_BUILD
+-    COMMAND ${CMAKE_COMMAND} -E copy_if_different ${binPath} ${binDir})
++    COMMAND ${CMAKE_COMMAND} -E copy_if_different 
$<TARGET_FILE:json_reformat> ${binDir})
+ 
+ INSTALL(TARGETS json_reformat RUNTIME DESTINATION bin)
+diff --git a/verify/CMakeLists.txt b/verify/CMakeLists.txt
+index 967fca16..2f390082 100644
+--- a/verify/CMakeLists.txt
++++ b/verify/CMakeLists.txt
+@@ -29,9 +29,7 @@ ADD_EXECUTABLE(json_verify ${SRCS})
+ TARGET_LINK_LIBRARIES(json_verify yajl_s)
+ 
+ # copy in the binary
+-GET_TARGET_PROPERTY(binPath json_verify LOCATION)
+-
+ ADD_CUSTOM_COMMAND(TARGET json_verify POST_BUILD
+-    COMMAND ${CMAKE_COMMAND} -E copy_if_different ${binPath} ${binDir})
++    COMMAND ${CMAKE_COMMAND} -E copy_if_different $<TARGET_FILE:json_verify> 
${binDir})
+ 
+ INSTALL(TARGETS json_verify RUNTIME DESTINATION bin)
+

diff --git a/dev-libs/yajl/yajl-2.1.0-r6.ebuild 
b/dev-libs/yajl/yajl-2.1.0-r6.ebuild
new file mode 100644
index 000000000000..6ed557a6512a
--- /dev/null
+++ b/dev-libs/yajl/yajl-2.1.0-r6.ebuild
@@ -0,0 +1,37 @@
+# Copyright 1999-2025 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+inherit cmake-multilib multibuild
+
+DESCRIPTION="Small event-driven (SAX-style) JSON parser"
+HOMEPAGE="https://lloyd.github.io/yajl/";
+SRC_URI="https://github.com/lloyd/yajl/archive/refs/tags/${PV}.tar.gz -> 
${P}-r5.tar.gz"
+
+LICENSE="ISC"
+SLOT="0/2"
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~loong ~ppc ~ppc64 ~riscv ~s390 
~sparc ~x86 ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x64-solaris"
+IUSE=""
+
+PATCHES=(
+       "${FILESDIR}"/${P}-uclibc.patch # git master 5d4bf525
+       "${FILESDIR}"/${P}-pkg-config.patch # downstream
+       "${FILESDIR}"/${P}-memory-leak.patch # Bug 908036
+       "${FILESDIR}"/${PN}-2.1.0-cmake-4.patch # Bug 951675
+)
+
+src_prepare() {
+       cmake_src_prepare
+       multilib_copy_sources
+}
+
+multilib_src_test() {
+       cd "${S}"/test/parsing || die
+       ./run_tests.sh "${BUILD_DIR}"/test/parsing/yajl_test || die
+}
+
+src_install() {
+       cmake-multilib_src_install
+       find "${D}" -name libyajl_s.a -delete || die
+}

Reply via email to