commit:     d05a0a16218bf86412d41a673bc9606448efa9fd
Author:     Ionen Wolkens <ionen <AT> gentoo <DOT> org>
AuthorDate: Sat Jan  1 05:20:46 2022 +0000
Commit:     Ionen Wolkens <ionen <AT> gentoo <DOT> org>
CommitDate: Sat Jan  1 08:13:04 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=d05a0a16

dev-cpp/rapidyaml: initial import, version 0.3.0

Originally thought to make c4core a separate package, but upstream's
rather custom cmake files complicate this and it feels more like
a private library (same upstream). It also caused PCSX2 build to
fail due to needing to link with c4core as well if it's not builtin.

May need revisiting if another package ever depends on c4core directly
or want to package the similar test deps (c4fs/c4log).

Signed-off-by: Ionen Wolkens <ionen <AT> gentoo.org>

 dev-cpp/rapidyaml/Manifest                         |  4 ++
 .../rapidyaml/files/rapidyaml-0.3.0-libdir.patch   |  9 +++
 .../files/rapidyaml-0.3.0-no-download.patch        | 23 +++++++
 .../files/rapidyaml-0.3.0-system-gtest.patch       |  8 +++
 .../files/rapidyaml-0.3.0-tests-no-install.patch   | 18 +++++
 dev-cpp/rapidyaml/metadata.xml                     | 12 ++++
 dev-cpp/rapidyaml/rapidyaml-0.3.0.ebuild           | 80 ++++++++++++++++++++++
 7 files changed, 154 insertions(+)

diff --git a/dev-cpp/rapidyaml/Manifest b/dev-cpp/rapidyaml/Manifest
new file mode 100644
index 000000000000..c1afe3db7382
--- /dev/null
+++ b/dev-cpp/rapidyaml/Manifest
@@ -0,0 +1,4 @@
+DIST c4fs-1abba005074022f07d2d9d11ec6a786f2a1f1380.tar.gz 22104 BLAKE2B 
ea9a063de87962d620e98bad573b1eef9a65cffdacdeab241fd91982f3da93ab01b1bfd6fd87eac5def0b8523f6f2ce32e9321385fb07a6f108dcb68630af1f5
 SHA512 
00aa29f818a13301df3506ae2b0bc8b527a6d292eb09ccc69681c2ad92ec270aeb635680543dfe1e761a82206c97f8347337a152728eb49d918284e043d32096
+DIST c4log-b8b86f33fc7539661e302171ee6dcc4a17859e67.tar.gz 11983 BLAKE2B 
8f2f18e85e01ffe76a2705d181260c7f1c0979009c09c6037097c7711d590f576816e39e869b30cad7b8134114eef55edad327e6224b09c6ba34dd389917af22
 SHA512 
a3f8f78ffe38426bab2f79748ecadb07e688d98ac75f907a9898ea93f0e7b1818253846412de24f4f755e0a7099aa886515cdd0b28b8c87786ad656a85bd3f9b
+DIST rapidyaml-0.3.0-src.tgz 696476 BLAKE2B 
30b077e3ddff56f68108a02545efc77ae3684273891f36db61b714a9af414f1f01d147a7132619647796c863ec6ae2f2586c8bfe9e1c2d3c6e7e99d11d41ee8e
 SHA512 
52a469b18c484d8def9239f6f7697f3c3b7760855c7af68a36988cc5a8031e1f5f900819b2af9770722628d0c14fa2cc776d1c07db7a8e85602c4d00aa4199a2
+DIST yaml-test-suite-bcd49a2d4919c1b1ac3b9d6e5ebe6b140b5089e3.tar.gz 54806 
BLAKE2B 
6574bed549759a1f3df7bcaa8051ab5e37ebb6dec878e1935dbf8f5c234f852c9ea037f90cc7bb93306cc5b1cd95f6fa8df885e51131eae50c9187d360110185
 SHA512 
814a654b6b04cf4e9b89ae40ba7daddb8f013da96e929ed618764c55dd23a45d8a97c456f526548cd95d673bcada3650383c3626bbbd0caa3fbdbc4b94496a6f

diff --git a/dev-cpp/rapidyaml/files/rapidyaml-0.3.0-libdir.patch 
b/dev-cpp/rapidyaml/files/rapidyaml-0.3.0-libdir.patch
new file mode 100644
index 000000000000..a10fbc49585e
--- /dev/null
+++ b/dev-cpp/rapidyaml/files/rapidyaml-0.3.0-libdir.patch
@@ -0,0 +1,9 @@
+--- a/ext/c4core/cmake/c4Project.cmake
++++ b/ext/c4core/cmake/c4Project.cmake
+@@ -2643,4 +2643,4 @@
+     set(_RUNTIME_INSTALL_DIR   bin/)
+-    set(_ARCHIVE_INSTALL_DIR   lib/)
+-    set(_LIBRARY_INSTALL_DIR   lib/) # TODO on Windows, ARCHIVE and LIBRARY 
dirs must be different to prevent name clashes
++    set(_ARCHIVE_INSTALL_DIR   lib/ CACHE STRING "")
++    set(_LIBRARY_INSTALL_DIR   lib/ CACHE STRING "")
+     set(_INCLUDE_INSTALL_DIR   include/)

diff --git a/dev-cpp/rapidyaml/files/rapidyaml-0.3.0-no-download.patch 
b/dev-cpp/rapidyaml/files/rapidyaml-0.3.0-no-download.patch
new file mode 100644
index 000000000000..97c4926cd9d2
--- /dev/null
+++ b/dev-cpp/rapidyaml/files/rapidyaml-0.3.0-no-download.patch
@@ -0,0 +1,23 @@
+--- a/ext/testbm.cmake
++++ b/ext/testbm.cmake
+@@ -1,4 +1,2 @@
+ # these are used both for testing and benchmarking
+-c4_require_subproject(c4fs REMOTE
+-    GIT_REPOSITORY https://github.com/biojppm/c4fs
+-    GIT_TAG master)
++c4_require_subproject(c4fs SUBDIRECTORY ext/c4fs)
+--- a/test/CMakeLists.txt
++++ b/test/CMakeLists.txt
+@@ -103,10 +103,5 @@
+ 
+-    c4_require_subproject(c4log REMOTE
+-        GIT_REPOSITORY https://github.com/biojppm/c4log
+-        GIT_TAG master)
++    c4_require_subproject(c4log SUBDIRECTORY ../ext/c4log)
+ 
+-    set(tsdir ${ed}/yaml-test-suite)
+-    c4_download_remote_proj(yaml-test-suite tsdir
+-        GIT_REPOSITORY https://github.com/yaml/yaml-test-suite
+-        GIT_TAG bcd49a2d4919c1b1ac3b9d6e5ebe6b140b5089e3)
++    set(tsdir ${CMAKE_SOURCE_DIR}/ext/yaml-test-suite)
+     set(suite_dir ${tsdir}/src)

diff --git a/dev-cpp/rapidyaml/files/rapidyaml-0.3.0-system-gtest.patch 
b/dev-cpp/rapidyaml/files/rapidyaml-0.3.0-system-gtest.patch
new file mode 100644
index 000000000000..0e404f09d781
--- /dev/null
+++ b/dev-cpp/rapidyaml/files/rapidyaml-0.3.0-system-gtest.patch
@@ -0,0 +1,8 @@
+--- a/ext/c4core/cmake/c4Project.cmake
++++ b/ext/c4core/cmake/c4Project.cmake
+@@ -2762,2 +2762,5 @@
+         if(NOT TARGET gtest)
++            find_package(GTest REQUIRED)
++        endif()
++        if(FALSE)
+             c4_import_remote_proj(gtest ${CMAKE_CURRENT_BINARY_DIR}/ext/gtest

diff --git a/dev-cpp/rapidyaml/files/rapidyaml-0.3.0-tests-no-install.patch 
b/dev-cpp/rapidyaml/files/rapidyaml-0.3.0-tests-no-install.patch
new file mode 100644
index 000000000000..97aeb72ee1a5
--- /dev/null
+++ b/dev-cpp/rapidyaml/files/rapidyaml-0.3.0-tests-no-install.patch
@@ -0,0 +1,18 @@
+--- a/ext/c4fs/CMakeLists.txt
++++ b/ext/c4fs/CMakeLists.txt
+@@ -18,6 +18,4 @@
+ )
+ 
+-c4_install_target(c4fs)
+-c4_install_exports()
+ 
+ c4_add_dev_targets()
+--- a/ext/c4log/CMakeLists.txt
++++ b/ext/c4log/CMakeLists.txt
+@@ -21,6 +21,4 @@
+     )
+ 
+-c4_install_target(c4log)
+-c4_install_exports()
+ 
+ c4_add_dev_targets()

diff --git a/dev-cpp/rapidyaml/metadata.xml b/dev-cpp/rapidyaml/metadata.xml
new file mode 100644
index 000000000000..0955cf954630
--- /dev/null
+++ b/dev-cpp/rapidyaml/metadata.xml
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "https://www.gentoo.org/dtd/metadata.dtd";>
+<pkgmetadata>
+       <maintainer type="person">
+               <email>io...@gentoo.org</email>
+               <name>Ionen Wolkens</name>
+       </maintainer>
+       <upstream>
+               <remote-id type="github">biojppm/rapidyaml</remote-id>
+               <remote-id type="pypi">rapidyaml</remote-id>
+       </upstream>
+</pkgmetadata>

diff --git a/dev-cpp/rapidyaml/rapidyaml-0.3.0.ebuild 
b/dev-cpp/rapidyaml/rapidyaml-0.3.0.ebuild
new file mode 100644
index 000000000000..a31baebfcc2c
--- /dev/null
+++ b/dev-cpp/rapidyaml/rapidyaml-0.3.0.ebuild
@@ -0,0 +1,80 @@
+# Copyright 2022 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+inherit cmake
+
+C4FS_COMMIT="1abba005074022f07d2d9d11ec6a786f2a1f1380"
+C4LOG_COMMIT="b8b86f33fc7539661e302171ee6dcc4a17859e67"
+YAMLTS_COMMIT="bcd49a2d4919c1b1ac3b9d6e5ebe6b140b5089e3"
+C4FS_P="c4fs-${C4FS_COMMIT}"
+C4LOG_P="c4log-${C4LOG_COMMIT}"
+YAMLTS_P="yaml-test-suite-${YAMLTS_COMMIT}"
+
+DESCRIPTION="Library to parse and emit YAML, and do it fast"
+HOMEPAGE="https://github.com/biojppm/rapidyaml/";
+SRC_URI="
+       
https://github.com/biojppm/rapidyaml/releases/download/v${PV}/${P}-src.tgz
+       test? (
+               https://github.com/biojppm/c4fs/archive/${C4FS_COMMIT}.tar.gz 
-> ${C4FS_P}.tar.gz
+               https://github.com/biojppm/c4log/archive/${C4LOG_COMMIT}.tar.gz 
-> ${C4LOG_P}.tar.gz
+               
https://github.com/yaml/yaml-test-suite/archive/${YAMLTS_COMMIT}.tar.gz -> 
${YAMLTS_P}.tar.gz
+       )"
+S="${WORKDIR}/${P}-src"
+
+LICENSE="MIT Boost-1.0 BSD"
+SLOT="0/${PV}"
+KEYWORDS="~amd64 ~x86"
+IUSE="debug test"
+RESTRICT="!test? ( test )"
+
+DEPEND="test? ( dev-cpp/gtest )"
+
+PATCHES=(
+       "${FILESDIR}"/${P}-libdir.patch
+       "${FILESDIR}"/${P}-no-download.patch
+       "${FILESDIR}"/${P}-system-gtest.patch
+)
+
+DOCS=( README.md ROADMAP.md changelog )
+
+src_prepare() {
+       if use test; then
+               mv ../${C4FS_P} ext/c4fs &&
+                       rmdir ext/c4fs/ext/c4core &&
+                       ln -s ../../c4core ext/c4fs/ext || die
+
+               mv ../${C4LOG_P} ext/c4log &&
+                       rmdir ext/c4log/ext/c4core &&
+                       ln -s ../../c4core ext/c4log/ext || die
+
+               mv ../${YAMLTS_P} ext/yaml-test-suite || die
+
+               PATCHES+=( "${FILESDIR}"/${P}-tests-no-install.patch )
+       fi
+
+       cmake_src_prepare
+}
+
+src_configure() {
+       local mycmakeargs=(
+               -DRYML_BUILD_API=no # TODO if a consumer needs it
+               -DRYML_BUILD_TESTS=$(usex test)
+               -DRYML_DBG=$(usex debug)
+               -D_{ARCHIVE,LIBRARY}_INSTALL_DIR=$(get_libdir)
+       )
+
+       cmake_src_configure
+}
+
+src_test() {
+       cmake_build test
+}
+
+src_install() {
+       cmake_src_install
+
+       # remove shared private library that is statically linked
+       rm "${ED}"/usr/$(get_libdir)/libc4core.so* || die
+}

Reply via email to