commit:     92b79ee5556f85308377ce5676bbcc8277ed8700
Author:     Azamat H. Hackimov <azamat.hackimov <AT> gmail <DOT> com>
AuthorDate: Tue Jan 14 09:28:35 2025 +0000
Commit:     Joonas Niilola <juippis <AT> gentoo <DOT> org>
CommitDate: Tue Feb 18 06:49:37 2025 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=92b79ee5

dev-libs/re2: add 2024.07.02

Change versioning to upstream naming, switch to cmake build system,
simplify ebuild, remove benchmark dependency.

Signed-off-by: Azamat H. Hackimov <azamat.hackimov <AT> gmail.com>
Closes: https://github.com/gentoo/gentoo/pull/40123
Signed-off-by: Joonas Niilola <juippis <AT> gentoo.org>

 .../files/re2-2024.07.02_optional-benchmark.patch  | 63 ++++++++++++++++++++++
 dev-libs/re2/re2-2024.07.02.ebuild                 | 50 +++++++++++++++++
 2 files changed, 113 insertions(+)

diff --git a/dev-libs/re2/files/re2-2024.07.02_optional-benchmark.patch 
b/dev-libs/re2/files/re2-2024.07.02_optional-benchmark.patch
new file mode 100644
index 000000000000..65edc800705e
--- /dev/null
+++ b/dev-libs/re2/files/re2-2024.07.02_optional-benchmark.patch
@@ -0,0 +1,63 @@
+https://code-review.googlesource.com/c/re2/+/63530
+From: "Azamat H. Hackimov" <[email protected]>
+Date: Tue, 14 Jan 2025 12:08:26 +0300
+Subject: [PATCH] Make benchmark building optional in cmake
+
+Some Linux distributions only requires testing but not benchmarking.
+Make benchmark optional to exclude excessive dependency on building tests.
+
+Change-Id: I1ce8bd1b4f6132efb295f71d43a77ba36ea58dc5
+Signed-off-by: Azamat H. Hackimov <[email protected]>
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -25,6 +25,9 @@ option(RE2_BUILD_FRAMEWORK "build RE2 as a framework" OFF)
+ # so we provide an option similar to BUILD_TESTING, but just for RE2.
+ option(RE2_BUILD_TESTING "enable testing for RE2" OFF)
+ 
++# Enable benchmark building.
++option(RE2_BUILD_BENCHMARK "enable benchmark building for RE2" OFF)
++
+ # The pkg-config Requires: field.
+ set(REQUIRES)
+ 
+@@ -167,8 +170,10 @@ if(RE2_BUILD_TESTING)
+   if(NOT TARGET GTest::gtest)
+     find_package(GTest REQUIRED)
+   endif()
+-  if(NOT TARGET benchmark::benchmark)
+-    find_package(benchmark REQUIRED)
++  if(RE2_BUILD_BENCHMARK)
++    if(NOT TARGET benchmark::benchmark)
++      find_package(benchmark REQUIRED)
++    endif()
+   endif()
+ 
+   set(TESTING_SOURCES
+@@ -227,14 +232,16 @@ if(RE2_BUILD_TESTING)
+     add_test(NAME ${target} COMMAND ${target})
+   endforeach()
+ 
+-  foreach(target ${BENCHMARK_TARGETS})
+-    add_executable(${target} re2/testing/${target}.cc)
+-    if(BUILD_SHARED_LIBS AND WIN32)
+-      target_compile_definitions(${target} PRIVATE -DRE2_CONSUME_TESTING_DLL)
+-    endif()
+-    target_compile_features(${target} PUBLIC cxx_std_14)
+-    target_link_libraries(${target} PUBLIC testing benchmark::benchmark_main 
${EXTRA_TARGET_LINK_LIBRARIES})
+-  endforeach()
++  if(RE2_BUILD_BENCHMARK)
++    foreach(target ${BENCHMARK_TARGETS})
++      add_executable(${target} re2/testing/${target}.cc)
++      if(BUILD_SHARED_LIBS AND WIN32)
++        target_compile_definitions(${target} PRIVATE 
-DRE2_CONSUME_TESTING_DLL)
++      endif()
++      target_compile_features(${target} PUBLIC cxx_std_14)
++      target_link_libraries(${target} PUBLIC testing 
benchmark::benchmark_main ${EXTRA_TARGET_LINK_LIBRARIES})
++    endforeach()
++  endif()
+ endif()
+ 
+ install(TARGETS re2
+-- 
+2.45.2
+

diff --git a/dev-libs/re2/re2-2024.07.02.ebuild 
b/dev-libs/re2/re2-2024.07.02.ebuild
new file mode 100644
index 000000000000..766cb2a878e2
--- /dev/null
+++ b/dev-libs/re2/re2-2024.07.02.ebuild
@@ -0,0 +1,50 @@
+# Copyright 2012-2025 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+inherit cmake-multilib
+
+MY_PV=${PV//./-}
+
+DESCRIPTION="An efficient, principled regular expression library"
+HOMEPAGE="https://github.com/google/re2";
+SRC_URI="https://github.com/google/re2/releases/download/${MY_PV}/${PN}-${MY_PV}.tar.gz";
+S="${WORKDIR}/${PN}-${MY_PV}"
+
+LICENSE="BSD"
+# NOTE: Follow SONAME variable in CMakeLists.txt
+SONAME="11"
+SLOT="0/${SONAME}"
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~loong ~ppc64 ~riscv ~sparc ~x86"
+IUSE="icu test"
+RESTRICT="!test? ( test )"
+
+BDEPEND="
+       virtual/pkgconfig
+       test? (
+               dev-cpp/gtest[${MULTILIB_USEDEP}]
+       )
+"
+RDEPEND="
+       >=dev-cpp/abseil-cpp-20240116.2-r3:=
+       icu? ( dev-libs/icu:0=[${MULTILIB_USEDEP}] )
+"
+DEPEND="${RDEPEND}"
+
+DOCS=( README doc/syntax.txt )
+HTML_DOCS=( doc/syntax.html )
+
+PATCHES=(
+       "${FILESDIR}/re2-2024.07.02_optional-benchmark.patch"
+)
+
+multilib_src_configure() {
+       local mycmakeargs=(
+               -DBUILD_SHARED_LIBS=ON
+               -DRE2_BUILD_BENCHMARK=OFF
+               -DRE2_BUILD_TESTING=$(usex test)
+               -DRE2_USE_ICU=$(usex icu)
+       )
+       cmake_src_configure
+}

Reply via email to