commit:     db7f12b0769a1488d5d5af6532b47fe4b6670a44
Author:     Filip Kobierski <fkobi <AT> pm <DOT> me>
AuthorDate: Fri Sep  6 11:19:41 2024 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Wed May 21 10:14:11 2025 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=db7f12b0

dev-libs/cgreen: add 1.6.3 with many improvements

- add no-fortify-source patch
- add USE flags
  - test -- as tests need perl installed
  - xml -- for building a simple, dependency-less xml report generator
  - libxml2 -- for building a xml report generator using libxml2
  + NOTE: the xml and libxml2 flags can coexist
- add filter-lto to avoid ODR violation
- update HOMEPAGE

[sam: Conditionally building tests also means we go from 185->25 targets
when tests are disabled. Nice!]

Closes: https://bugs.gentoo.org/893352
Closes: https://bugs.gentoo.org/915186
Signed-off-by: Filip Kobierski <fkobi <AT> pm.me>
Part-of: https://github.com/gentoo/gentoo/pull/38502
Closes: https://github.com/gentoo/gentoo/pull/38502
Signed-off-by: Sam James <sam <AT> gentoo.org>

 dev-libs/cgreen/Manifest                           |  1 +
 dev-libs/cgreen/cgreen-1.6.3.ebuild                | 40 ++++++++++++++++++++++
 .../files/cgreen-1.6.3_no-fortify-source.patch     | 27 +++++++++++++++
 dev-libs/cgreen/metadata.xml                       |  4 +++
 4 files changed, 72 insertions(+)

diff --git a/dev-libs/cgreen/Manifest b/dev-libs/cgreen/Manifest
index 1ecdc131f83e..9aa7f90c9f7c 100644
--- a/dev-libs/cgreen/Manifest
+++ b/dev-libs/cgreen/Manifest
@@ -1 +1,2 @@
 DIST cgreen-1.3.0.tar.gz 350959 BLAKE2B 
467af04aae61745e1a78e872be9c174a0b21db7a470b48a3d96132f4bc97300b0d51fd4617e4588491a2f032b3ba82e665c7bd49be3d360a33dae0e1323716a5
 SHA512 
3734be08722900b4c6aaa1cd8a7a31ffd876c12742cf81266014158dad0919db46a457fbc742f3d7e9b1fdf75530ee872045962469eeeb6d1fc45fddf2b6d332
+DIST cgreen-1.6.3.tar.gz 461875 BLAKE2B 
94df8754e164d04f40211a8ec1ca1959d6ad9cfd74ec986cb71e38dfec17f0db762d7b879fd86676553cd3134d966f9cb43a4ba035cf22ac080dfd8a28745dbf
 SHA512 
0dbd637e6d2c0511d5e540107b3a4c7c66c3017e1626e19224e2e79f176f07a518be345689fc543f867dd0b412310f3bf10f4560de11239120bc206a1be3a3d8

diff --git a/dev-libs/cgreen/cgreen-1.6.3.ebuild 
b/dev-libs/cgreen/cgreen-1.6.3.ebuild
new file mode 100644
index 000000000000..11ebf1cbc4cf
--- /dev/null
+++ b/dev-libs/cgreen/cgreen-1.6.3.ebuild
@@ -0,0 +1,40 @@
+# Copyright 2020-2024 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+inherit cmake flag-o-matic
+
+DESCRIPTION="Unit test and mocking framework for C and C++"
+HOMEPAGE="
+       https://cgreen-devs.github.io/cgreen/
+       https://github.com/cgreen-devs/cgreen
+"
+SRC_URI="https://github.com/cgreen-devs/cgreen/archive/${PV}.tar.gz -> 
${P}.tar.gz"
+
+LICENSE="ISC"
+SLOT="0"
+KEYWORDS="amd64 ~x86"
+IUSE="libxml2 test xml" # doc flag could be added
+RESTRICT="!test? ( test )"
+
+DEPEND="libxml2? ( dev-libs/libxml2:= )"
+RDEPEND="${DEPEND}"
+BDEPEND="
+       ${DEPEND}
+       test? ( dev-lang/perl )
+"
+
+PATCHES=( "${FILESDIR}"/${PN}-1.6.3_no-fortify-source.patch )
+
+src_configure() {
+       # Makefile is a wrapper for cmake, ignore it
+       filter-lto # fails to compile with LTO because of ODR violation
+       local mycmakeargs=(
+               -DCGREEN_WITH_STATIC_LIBRARY=OFF # upstream default
+               -DCGREEN_WITH_LIBXML2=$(usex libxml2 ON OFF)
+               -DCGREEN_WITH_UNIT_TESTS=$(usex test ON OFF)
+               -DCGREEN_WITH_XML=$(usex xml ON OFF)
+       )
+       cmake_src_configure
+}

diff --git a/dev-libs/cgreen/files/cgreen-1.6.3_no-fortify-source.patch 
b/dev-libs/cgreen/files/cgreen-1.6.3_no-fortify-source.patch
new file mode 100644
index 000000000000..c2be8eb6afbf
--- /dev/null
+++ b/dev-libs/cgreen/files/cgreen-1.6.3_no-fortify-source.patch
@@ -0,0 +1,27 @@
+From 9854dd0f8a955cea4b3a5e2c8956e0a69027aac6 Mon Sep 17 00:00:00 2001
+From: Filip Kobierski <[email protected]>
+Date: Fri, 6 Sep 2024 13:03:12 +0200
+Upstream hardcodes FORTIFY_SOURCE to 2. This patch removes it so it is not 
redefined when we set it.
+This fixes https://bugs.gentoo.org/935525
+---
+ cmake/Modules/DefineCompilerFlags.cmake | 4 ----
+ 1 file changed, 4 deletions(-)
+
+diff --git a/cmake/Modules/DefineCompilerFlags.cmake 
b/cmake/Modules/DefineCompilerFlags.cmake
+index 4d90f36..df45f50 100644
+--- a/cmake/Modules/DefineCompilerFlags.cmake
++++ b/cmake/Modules/DefineCompilerFlags.cmake
+@@ -52,10 +52,6 @@ if (UNIX)
+         endif (WITH_FPIC)
+     endif (NOT CYGWIN)
+ 
+-    check_c_compiler_flag("-D_FORTIFY_SOURCE=2" WITH_FORTIFY_SOURCE)
+-    if (WITH_FORTIFY_SOURCE)
+-      add_definitions(-D_FORTIFY_SOURCE=2)
+-    endif (WITH_FORTIFY_SOURCE)
+ 
+     if (NOT CMAKE_BUILD_TYPE STREQUAL "Debug")
+       add_definitions(-O)
+-- 
+2.44.2
+

diff --git a/dev-libs/cgreen/metadata.xml b/dev-libs/cgreen/metadata.xml
index 096360b6ba9f..4b2a5df44291 100644
--- a/dev-libs/cgreen/metadata.xml
+++ b/dev-libs/cgreen/metadata.xml
@@ -2,6 +2,10 @@
 <!DOCTYPE pkgmetadata SYSTEM "https://www.gentoo.org/dtd/metadata.dtd";>
 <pkgmetadata>
        <!-- maintainer-needed -->
+       <use>
+               <flag name="xml">Add a simple XML report generator without 
external dependencies</flag>
+               <flag name="libxml2">Add an XML report generator which uses 
<pkg>dev-libs/libxml2</pkg> for output formatting</flag>
+       </use>
        <upstream>
                <remote-id type="github">cgreen-devs/cgreen</remote-id>
        </upstream>

Reply via email to