summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJason Zaman <perfinion@gentoo.org>2022-02-06 15:58:10 -0800
committerJason Zaman <perfinion@gentoo.org>2022-02-06 17:56:43 -0800
commita7db6f594b175eebbf00de4ad8af0280198eae72 (patch)
tree1ecc7b833715c45f5afa3fe61f18348c8a927ade /dev-cpp/abseil-cpp
parentdev-util/bazel: bump 4.2.2 (diff)
downloadgentoo-a7db6f594b175eebbf00de4ad8af0280198eae72.tar.gz
gentoo-a7db6f594b175eebbf00de4ad8af0280198eae72.tar.bz2
gentoo-a7db6f594b175eebbf00de4ad8af0280198eae72.zip
dev-cpp/abseil-cpp: Fix build with CUDA nvcc
Minor patch needed for tensorflow to unbundle abseil. Acked by gyakovlev on IRC. Package-Manager: Portage-3.0.30, Repoman-3.0.3 Signed-off-by: Jason Zaman <perfinion@gentoo.org>
Diffstat (limited to 'dev-cpp/abseil-cpp')
-rw-r--r--dev-cpp/abseil-cpp/abseil-cpp-20211102.0-r1.ebuild72
-rw-r--r--dev-cpp/abseil-cpp/files/abseil-cpp-20211102.0-fix-cuda-nvcc-build.patch58
2 files changed, 130 insertions, 0 deletions
diff --git a/dev-cpp/abseil-cpp/abseil-cpp-20211102.0-r1.ebuild b/dev-cpp/abseil-cpp/abseil-cpp-20211102.0-r1.ebuild
new file mode 100644
index 000000000000..9873c85b8ee8
--- /dev/null
+++ b/dev-cpp/abseil-cpp/abseil-cpp-20211102.0-r1.ebuild
@@ -0,0 +1,72 @@
+# Copyright 2020-2022 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+PYTHON_COMPAT=( python3_{7..10} )
+
+inherit cmake python-any-r1
+
+# yes, it needs SOURCE, not just installed one
+# and no, 1.11.0 is not enough
+GTEST_COMMIT="1b18723e874b256c1e39378c6774a90701d70f7a"
+GTEST_FILE="gtest-${GTEST_COMMIT}.tar.gz"
+
+DESCRIPTION="Abseil Common Libraries (C++), LTS Branch"
+HOMEPAGE="https://abseil.io"
+SRC_URI="https://github.com/abseil/abseil-cpp/archive/${PV}.tar.gz -> ${P}.tar.gz
+ test? ( https://github.com/google/googletest/archive/${GTEST_COMMIT}.tar.gz -> ${GTEST_FILE} )"
+
+LICENSE="
+ Apache-2.0
+ test? ( BSD )
+"
+SLOT="0/${PV%%.*}"
+KEYWORDS="~amd64 ~arm64 ~ppc64 ~riscv ~x86"
+IUSE="test"
+
+DEPEND=""
+RDEPEND="${DEPEND}"
+
+BDEPEND="
+ ${PYTHON_DEPS}
+ test? ( sys-libs/timezone-data )
+"
+
+RESTRICT="!test? ( test )"
+
+PATCHES=(
+ "${FILESDIR}/${PN}-20211102.0-fix-cuda-nvcc-build.patch"
+)
+
+src_prepare() {
+ cmake_src_prepare
+
+ # un-hardcode abseil compiler flags
+ sed -i \
+ -e '/"-maes",/d' \
+ -e '/"-msse4.1",/d' \
+ -e '/"-mfpu=neon"/d' \
+ -e '/"-march=armv8-a+crypto"/d' \
+ absl/copts/copts.py || die
+
+ # now generate cmake files
+ python_fix_shebang absl/copts/generate_copts.py
+ absl/copts/generate_copts.py || die
+
+ if use test; then
+ sed -i 's/-Werror//g' \
+ "${WORKDIR}/googletest-${GTEST_COMMIT}"/googletest/cmake/internal_utils.cmake || die
+ fi
+}
+
+src_configure() {
+ local mycmakeargs=(
+ -DABSL_ENABLE_INSTALL=TRUE
+ -DABSL_LOCAL_GOOGLETEST_DIR="${WORKDIR}/googletest-${GTEST_COMMIT}"
+ -DCMAKE_CXX_STANDARD=17
+ -DABSL_PROPAGATE_CXX_STD=TRUE
+ $(usex test -DBUILD_TESTING=ON '') #intentional usex
+ )
+ cmake_src_configure
+}
diff --git a/dev-cpp/abseil-cpp/files/abseil-cpp-20211102.0-fix-cuda-nvcc-build.patch b/dev-cpp/abseil-cpp/files/abseil-cpp-20211102.0-fix-cuda-nvcc-build.patch
new file mode 100644
index 000000000000..45a9fc5406e8
--- /dev/null
+++ b/dev-cpp/abseil-cpp/files/abseil-cpp-20211102.0-fix-cuda-nvcc-build.patch
@@ -0,0 +1,58 @@
+Fixes compile failure with CUDA nvcc
+https://github.com/abseil/abseil-cpp/commit/5202173ca7671ebe241cb4d9447dc4b1f2d3ec10
+https://github.com/tensorflow/tensorflow/commit/e45ca6adf2458d4759e5c40f1f27bbf9505a3c79#diff-b79a9a542260a33fd122a5d1cdb923e08e16cbe321d69c014a9acdde34052b3dR235
+
+From 5202173ca7671ebe241cb4d9447dc4b1f2d3ec10 Mon Sep 17 00:00:00 2001
+From: Abseil Team <absl-team@google.com>
+Date: Tue, 1 Feb 2022 13:52:49 -0800
+Subject: [PATCH] Export of internal Abseil changes
+
+--
+121db1a08321eaa3006726cc32b459cf17880e35 by Derek Mauro <dmauro@google.com>:
+
+Internal change
+
+PiperOrigin-RevId: 425707805
+
+--
+0dec484389bbb75aae0a412146e3564bf833a739 by Derek Mauro <dmauro@google.com>:
+
+macOS CI: Avoid depending on external sites like GitHub by prepopulating
+dependencies and setting --distdir
+
+Our Linux CI does this, but for some reason was never enabled on macOS
+
+PiperOrigin-RevId: 425668638
+GitOrigin-RevId: 121db1a08321eaa3006726cc32b459cf17880e35
+Change-Id: Id51645df90b6a0808dd5b18eb636a10f798e24ea
+---
+ absl/container/internal/inlined_vector.h | 8 ++++----
+ ci/macos_xcode_bazel.sh | 10 +++++++++-
+ 2 files changed, 13 insertions(+), 5 deletions(-)
+
+diff --git a/absl/container/internal/inlined_vector.h b/absl/container/internal/inlined_vector.h
+index cd34a413a..2baf26f3e 100644
+--- a/absl/container/internal/inlined_vector.h
++++ b/absl/container/internal/inlined_vector.h
+@@ -925,8 +925,8 @@ auto Storage<T, N, A>::Swap(Storage* other_storage_ptr) -> void {
+ inlined_ptr->GetSize());
+ }
+ ABSL_INTERNAL_CATCH_ANY {
+- allocated_ptr->SetAllocation(
+- {allocated_storage_view.data, allocated_storage_view.capacity});
++ allocated_ptr->SetAllocation(Allocation<A>{
++ allocated_storage_view.data, allocated_storage_view.capacity});
+ ABSL_INTERNAL_RETHROW;
+ }
+
+@@ -934,8 +934,8 @@ auto Storage<T, N, A>::Swap(Storage* other_storage_ptr) -> void {
+ inlined_ptr->GetInlinedData(),
+ inlined_ptr->GetSize());
+
+- inlined_ptr->SetAllocation(
+- {allocated_storage_view.data, allocated_storage_view.capacity});
++ inlined_ptr->SetAllocation(Allocation<A>{allocated_storage_view.data,
++ allocated_storage_view.capacity});
+ }
+
+ swap(GetSizeAndIsAllocated(), other_storage_ptr->GetSizeAndIsAllocated());