1 |
commit: 5b9ba90d62157a5ef8fe991a87c51c39666f029e |
2 |
Author: Jason Zaman <perfinion <AT> gentoo <DOT> org> |
3 |
AuthorDate: Sat Jun 25 16:24:12 2022 +0000 |
4 |
Commit: Jason Zaman <perfinion <AT> gentoo <DOT> org> |
5 |
CommitDate: Sun Jun 26 02:37:26 2022 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=5b9ba90d |
7 |
|
8 |
dev-cpp/abseil-cpp: Fix build with nvidia cuda11.6 |
9 |
|
10 |
also update EAPI 7 -> 8 |
11 |
|
12 |
Signed-off-by: Jason Zaman <perfinion <AT> gentoo.org> |
13 |
|
14 |
dev-cpp/abseil-cpp/abseil-cpp-20211102.0-r2.ebuild | 73 ++++++++++++++++++++++ |
15 |
...il-cpp-20211102.0-r2-cuda11.6-compile-fix.patch | 24 +++++++ |
16 |
2 files changed, 97 insertions(+) |
17 |
|
18 |
diff --git a/dev-cpp/abseil-cpp/abseil-cpp-20211102.0-r2.ebuild b/dev-cpp/abseil-cpp/abseil-cpp-20211102.0-r2.ebuild |
19 |
new file mode 100644 |
20 |
index 000000000000..a987d852dee3 |
21 |
--- /dev/null |
22 |
+++ b/dev-cpp/abseil-cpp/abseil-cpp-20211102.0-r2.ebuild |
23 |
@@ -0,0 +1,73 @@ |
24 |
+# Copyright 2020-2022 Gentoo Authors |
25 |
+# Distributed under the terms of the GNU General Public License v2 |
26 |
+ |
27 |
+EAPI=8 |
28 |
+ |
29 |
+PYTHON_COMPAT=( python3_{8..10} ) |
30 |
+ |
31 |
+inherit cmake python-any-r1 |
32 |
+ |
33 |
+# yes, it needs SOURCE, not just installed one |
34 |
+# and no, 1.11.0 is not enough |
35 |
+GTEST_COMMIT="1b18723e874b256c1e39378c6774a90701d70f7a" |
36 |
+GTEST_FILE="gtest-${GTEST_COMMIT}.tar.gz" |
37 |
+ |
38 |
+DESCRIPTION="Abseil Common Libraries (C++), LTS Branch" |
39 |
+HOMEPAGE="https://abseil.io" |
40 |
+SRC_URI="https://github.com/abseil/abseil-cpp/archive/${PV}.tar.gz -> ${P}.tar.gz |
41 |
+ test? ( https://github.com/google/googletest/archive/${GTEST_COMMIT}.tar.gz -> ${GTEST_FILE} )" |
42 |
+ |
43 |
+LICENSE=" |
44 |
+ Apache-2.0 |
45 |
+ test? ( BSD ) |
46 |
+" |
47 |
+SLOT="0/${PV%%.*}" |
48 |
+KEYWORDS="~amd64 ~arm ~arm64 ~ppc64 ~riscv ~x86" |
49 |
+IUSE="test" |
50 |
+ |
51 |
+DEPEND="" |
52 |
+RDEPEND="${DEPEND}" |
53 |
+ |
54 |
+BDEPEND=" |
55 |
+ ${PYTHON_DEPS} |
56 |
+ test? ( sys-libs/timezone-data ) |
57 |
+" |
58 |
+ |
59 |
+RESTRICT="!test? ( test )" |
60 |
+ |
61 |
+PATCHES=( |
62 |
+ "${FILESDIR}/${PN}-20211102.0-fix-cuda-nvcc-build.patch" |
63 |
+ "${FILESDIR}/${PN}-20211102.0-r2-cuda11.6-compile-fix.patch" |
64 |
+) |
65 |
+ |
66 |
+src_prepare() { |
67 |
+ cmake_src_prepare |
68 |
+ |
69 |
+ # un-hardcode abseil compiler flags |
70 |
+ sed -i \ |
71 |
+ -e '/"-maes",/d' \ |
72 |
+ -e '/"-msse4.1",/d' \ |
73 |
+ -e '/"-mfpu=neon"/d' \ |
74 |
+ -e '/"-march=armv8-a+crypto"/d' \ |
75 |
+ absl/copts/copts.py || die |
76 |
+ |
77 |
+ # now generate cmake files |
78 |
+ python_fix_shebang absl/copts/generate_copts.py |
79 |
+ absl/copts/generate_copts.py || die |
80 |
+ |
81 |
+ if use test; then |
82 |
+ sed -i 's/-Werror//g' \ |
83 |
+ "${WORKDIR}/googletest-${GTEST_COMMIT}"/googletest/cmake/internal_utils.cmake || die |
84 |
+ fi |
85 |
+} |
86 |
+ |
87 |
+src_configure() { |
88 |
+ local mycmakeargs=( |
89 |
+ -DABSL_ENABLE_INSTALL=TRUE |
90 |
+ -DABSL_LOCAL_GOOGLETEST_DIR="${WORKDIR}/googletest-${GTEST_COMMIT}" |
91 |
+ -DCMAKE_CXX_STANDARD=17 |
92 |
+ -DABSL_PROPAGATE_CXX_STD=TRUE |
93 |
+ $(usex test -DBUILD_TESTING=ON '') #intentional usex |
94 |
+ ) |
95 |
+ cmake_src_configure |
96 |
+} |
97 |
|
98 |
diff --git a/dev-cpp/abseil-cpp/files/abseil-cpp-20211102.0-r2-cuda11.6-compile-fix.patch b/dev-cpp/abseil-cpp/files/abseil-cpp-20211102.0-r2-cuda11.6-compile-fix.patch |
99 |
new file mode 100644 |
100 |
index 000000000000..59efc0f321e3 |
101 |
--- /dev/null |
102 |
+++ b/dev-cpp/abseil-cpp/files/abseil-cpp-20211102.0-r2-cuda11.6-compile-fix.patch |
103 |
@@ -0,0 +1,24 @@ |
104 |
+diff --git a/absl/strings/internal/string_constant.h b/absl/strings/internal/string_constant.h |
105 |
+index a11336b..e1596b1 100644 |
106 |
+--- a/absl/strings/internal/string_constant.h |
107 |
++++ b/absl/strings/internal/string_constant.h |
108 |
+@@ -35,12 +35,18 @@ namespace strings_internal { |
109 |
+ // below. |
110 |
+ template <typename T> |
111 |
+ struct StringConstant { |
112 |
++ private: |
113 |
++ static constexpr bool ValidateConstant(absl::string_view view) { |
114 |
++ return view.empty() || 2 * view[0] != 1; |
115 |
++ } |
116 |
++ |
117 |
++public: |
118 |
+ static constexpr absl::string_view value = T{}(); |
119 |
+ constexpr absl::string_view operator()() const { return value; } |
120 |
+ |
121 |
+ // Check to be sure `view` points to constant data. |
122 |
+ // Otherwise, it can't be constant evaluated. |
123 |
+- static_assert(value.empty() || 2 * value[0] != 1, |
124 |
++ static_assert(ValidateConstant(value), |
125 |
+ "The input string_view must point to constant data."); |
126 |
+ }; |
127 |
+ |