commit:     28d0fbda2fdecaddf99a2201214c7ba19926fdb8
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Wed Dec 29 00:12:25 2021 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Wed Dec 29 00:15:40 2021 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=28d0fbda

dev-cpp/cpp-hocon: fix build with glibc-2.34, conditionally build tests

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

 dev-cpp/cpp-hocon/cpp-hocon-0.3.0-r1.ebuild        | 40 +++++++++++++++++
 .../files/cpp-hocon-0.3.0-use-system-catch.patch   | 51 ++++++++++++++++++++++
 2 files changed, 91 insertions(+)

diff --git a/dev-cpp/cpp-hocon/cpp-hocon-0.3.0-r1.ebuild 
b/dev-cpp/cpp-hocon/cpp-hocon-0.3.0-r1.ebuild
new file mode 100644
index 000000000000..d1dccdfe8426
--- /dev/null
+++ b/dev-cpp/cpp-hocon/cpp-hocon-0.3.0-r1.ebuild
@@ -0,0 +1,40 @@
+# Copyright 1999-2021 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+inherit cmake prefix
+
+DESCRIPTION="Provides C++ support for the HOCON configuration file format"
+HOMEPAGE="https://github.com/puppetlabs/cpp-hocon";
+SRC_URI="https://github.com/puppetlabs/${PN}/archive/${PV}.tar.gz -> 
${P}.tar.gz"
+
+LICENSE="Apache-2.0"
+SLOT="0/${PV}"
+KEYWORDS="~amd64 ~arm ~ppc64 ~x86"
+IUSE="debug test"
+RESTRICT="!test? ( test )"
+
+RDEPEND="
+       >=dev-libs/boost-1.54:=[nls]
+       >=dev-libs/leatherman-0.9.3:=
+"
+DEPEND="${DEPEND}
+       test? ( dev-cpp/catch:1 )"
+
+#PATCHES=( "${FILESDIR}"/${PN}-0.2.1-cmake.patch )
+PATCHES=( "${FILESDIR}"/${PN}-0.3.0-use-system-catch.patch )
+
+src_prepare() {
+       cmake_src_prepare
+
+       eprefixify lib/tests/CMakeLists.txt
+}
+
+src_configure() {
+       local mycmakeargs=(
+               -DBUILD_TESTING=$(usex test)
+       )
+
+       cmake_src_configure
+}

diff --git a/dev-cpp/cpp-hocon/files/cpp-hocon-0.3.0-use-system-catch.patch 
b/dev-cpp/cpp-hocon/files/cpp-hocon-0.3.0-use-system-catch.patch
new file mode 100644
index 000000000000..0964e3e7bc7a
--- /dev/null
+++ b/dev-cpp/cpp-hocon/files/cpp-hocon-0.3.0-use-system-catch.patch
@@ -0,0 +1,51 @@
+https://bugs.gentoo.org/823419
+
+Wanted to make this "proper" but Catch2 lacks a pkgconfig file (or a CMake one)
+and it's easier to just do this for now.
+
+Based on patch version of sed commands from upstream bug
+(https://github.com/puppetlabs/cpp-hocon/issues/132) and
+Fedora 
(https://src.fedoraproject.org/rpms/cpp-hocon/blob/rawhide/f/cpp-hocon.spec#_76).
+
+Makes tests conditional too.
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -16,12 +16,16 @@ if (NOT CMAKE_BUILD_TYPE)
+     set(CMAKE_BUILD_TYPE "Release" CACHE STRING "Choose the type of build, 
options are: None Debug Release RelWithDebInfo MinSizeRel." FORCE)
+ endif()
+ 
+-enable_testing()
+-
+ # Leatherman setup
+-set(LEATHERMAN_COMPONENTS locale catch nowide util)
++set(LEATHERMAN_COMPONENTS locale nowide util)
+ find_package(Leatherman REQUIRED COMPONENTS ${LEATHERMAN_COMPONENTS})
+ 
++option(BUILD_TESTING "Build test suite (needs Catch)" ON)
++
++if(BUILD_TESTING)
++    enable_testing()
++endif()
++
+ ## Before we find any packages, we want to pull in the common leatherman 
options, as they can affect commonly-used packages.
+ include(options)
+ ## Pull in common cflags setting from leatherman. Don't override 
CMAKE_CXX_FLAGS at the project root to avoid impacting 3rd party code.
+--- a/lib/CMakeLists.txt
++++ b/lib/CMakeLists.txt
+@@ -91,4 +91,6 @@ symbol_exports(lib${PROJECT_NAME} 
"${CMAKE_CURRENT_LIST_DIR}/inc/hocon/export.h"
+ leatherman_install(lib${PROJECT_NAME})
+ install(DIRECTORY inc/hocon DESTINATION include)
+ 
+-add_subdirectory(tests)
++if (BUILD_TESTING)
++    add_subdirectory(tests)
++endif()
+--- a/lib/tests/CMakeLists.txt
++++ b/lib/tests/CMakeLists.txt
+@@ -1,5 +1,5 @@
+ # Setup compiling the test executable. C++ compile flags are inherited from 
the parent directory.
+-include_directories(${LEATHERMAN_CATCH_INCLUDE})
++include_directories(@GENTOO_PORTAGE_EPREFIX@/usr/include/catch)
+ 
+ set(TEST_CASES
+     concatenation_test.cc

Reply via email to