1 |
commit: 9059463a8b642a8d4a8d5a2a25fb38a49be8c2e6 |
2 |
Author: Sam James <sam <AT> gentoo <DOT> org> |
3 |
AuthorDate: Wed Aug 3 04:18:58 2022 +0000 |
4 |
Commit: Sam James <sam <AT> gentoo <DOT> org> |
5 |
CommitDate: Wed Aug 3 04:35:46 2022 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=9059463a |
7 |
|
8 |
sys-fs/zfs: backport various fixes |
9 |
|
10 |
Mostly build fixes (https://github.com/openzfs/zfs/pull/13684) |
11 |
but also https://github.com/openzfs/zfs/pull/13714. |
12 |
|
13 |
All from upstream zfs-2.1.6-staging branch. |
14 |
|
15 |
Temporarily unkeyworded. |
16 |
|
17 |
Bug: https://bugs.gentoo.org/863212 |
18 |
Bug: https://bugs.gentoo.org/855182 |
19 |
Signed-off-by: Sam James <sam <AT> gentoo.org> |
20 |
|
21 |
sys-fs/zfs/Manifest | 1 + |
22 |
sys-fs/zfs/zfs-2.1.5-r5.ebuild | 334 ++++++++++++++++++++++ |
23 |
sys-libs/compiler-rt/compiler-rt-14.0.6-r1.ebuild | 138 +++++++++ |
24 |
3 files changed, 473 insertions(+) |
25 |
|
26 |
diff --git a/sys-fs/zfs/Manifest b/sys-fs/zfs/Manifest |
27 |
index 8d6ae4d6ba30..7b982f51e740 100644 |
28 |
--- a/sys-fs/zfs/Manifest |
29 |
+++ b/sys-fs/zfs/Manifest |
30 |
@@ -2,5 +2,6 @@ DIST zfs-2.0.7.tar.gz 14550055 BLAKE2B 80f7297f04a21cd8f3f2043d895b0325512ba0cea |
31 |
DIST zfs-2.0.7.tar.gz.asc 836 BLAKE2B 65e7df58c33ccadc4e0ca9dbc1e8c006abbec8442e2da50872a1ab0cbb841fc45152298e8d3b93ee4320ddae6416e3a856caf80d8efb21b19db53dfedbf00e38 SHA512 b901d8e92faa6cfe6010bd54de88c7d18057f434cb07f8a89672d6c446a0a97b23209ee8f02cfd3b2a8f431c68ec977e7dc9f95fe5d385dba0bb6d37338ba682 |
32 |
DIST zfs-2.1.4.tar.gz 34896310 BLAKE2B be303f1181f604770536aa4aa61d5319ec408abbd04964cedadd15b3101a15deba6539bb5d833f4fed357f323d74f622d035305df699b213df41ae45bffdd200 SHA512 c7b57c43fc287b22905067ab022df4133d32e1a5dc335f7baf743b4ef88f64c2bf9d41318c2083230d077dd49e68f7d9e6172266e13d4b1eee29d359860f969e |
33 |
DIST zfs-2.1.4.tar.gz.asc 836 BLAKE2B b311730f72d534c87a782515f35a354bfbefba0513dc0cee5b0b497cf742590f13be6a49ff8a70d7d6503d0ba06b0266e7d290d718337add614812c3d1b0731a SHA512 53880cd5369f468551bab685eb83739ed76aa286886fdd2cbad4270755fe809da730082a91bba61011f59594fac297ce05645ae32c2c73b4a9aa835f2991a1ee |
34 |
+DIST zfs-2.1.5-patches.tar.xz 13324 BLAKE2B bfef8abd298cebd54491272b8c1deacace901d9a1acce67cb927bab6447eafd985352fd09f64336aa9d6611bab0e5c761d7973f0a65c408d77bb735a94c60253 SHA512 d2b009664f8eb4f2a8596693011fde578b6eae123c6169e5dfb70bd920c0f987f5177f7b1be008705a421574a8a9bc930f99823785c69e81573f18b0350cb9bd |
35 |
DIST zfs-2.1.5.tar.gz 34951632 BLAKE2B c6e3efd9c0cda91654767eaad0eaaa05cd9a5daf1cb0384c9c78b30062f5c29142ac37ab9dbdaf96c91456d11c317d782d3524ade293f03fda983e5992b79e49 SHA512 d9ccf1049cefa9167d25f71fbdca70092cd02368b60f09341e6489fb68dc5f89e87b026b0191f4d81181a8851449124d824a1d959d0e2fb29c8a3d624edc4f03 |
36 |
DIST zfs-2.1.5.tar.gz.asc 836 BLAKE2B 4a81c266967540850a2cc824e79555ca9d05b2e17e45fa2723893cbd85b55e3d7d791986d6667b7ee1530e7692c03818f15e8b6798393b54989f90801b775786 SHA512 224b0dcf4982c63a8eff0a39d054537e7d023f7c35e154e4d20490b8daf184c076bc8e4de7d2c5af4059f8a802b747e637aad4479cd8d1330cf5b26da2f19c94 |
37 |
|
38 |
diff --git a/sys-fs/zfs/zfs-2.1.5-r5.ebuild b/sys-fs/zfs/zfs-2.1.5-r5.ebuild |
39 |
new file mode 100644 |
40 |
index 000000000000..c1f790c74a69 |
41 |
--- /dev/null |
42 |
+++ b/sys-fs/zfs/zfs-2.1.5-r5.ebuild |
43 |
@@ -0,0 +1,334 @@ |
44 |
+# Copyright 1999-2022 Gentoo Authors |
45 |
+# Distributed under the terms of the GNU General Public License v2 |
46 |
+ |
47 |
+EAPI=7 |
48 |
+ |
49 |
+DISTUTILS_OPTIONAL=1 |
50 |
+PYTHON_COMPAT=( python3_{8..10} ) |
51 |
+ |
52 |
+inherit autotools bash-completion-r1 dist-kernel-utils distutils-r1 flag-o-matic linux-info pam systemd udev usr-ldscript |
53 |
+ |
54 |
+DESCRIPTION="Userland utilities for ZFS Linux kernel module" |
55 |
+HOMEPAGE="https://github.com/openzfs/zfs" |
56 |
+ |
57 |
+if [[ ${PV} == "9999" ]]; then |
58 |
+ inherit git-r3 linux-mod |
59 |
+ EGIT_REPO_URI="https://github.com/openzfs/zfs.git" |
60 |
+else |
61 |
+ VERIFY_SIG_OPENPGP_KEY_PATH=${BROOT}/usr/share/openpgp-keys/openzfs.asc |
62 |
+ inherit verify-sig |
63 |
+ |
64 |
+ MY_P="${P/_rc/-rc}" |
65 |
+ SRC_URI="https://github.com/openzfs/${PN}/releases/download/${MY_P}/${MY_P}.tar.gz" |
66 |
+ SRC_URI+=" https://dev.gentoo.org/~sam/distfiles/sys-fs/zfs/${P}-patches.tar.xz" |
67 |
+ SRC_URI+=" verify-sig? ( https://github.com/openzfs/${PN}/releases/download/${MY_P}/${MY_P}.tar.gz.asc )" |
68 |
+ S="${WORKDIR}/${P%_rc?}" |
69 |
+ |
70 |
+ # Unkeyworded briefly for testing |
71 |
+ #if [[ ${PV} != *_rc* ]]; then |
72 |
+ # KEYWORDS="~amd64 ~arm64 ~ppc64 ~riscv" |
73 |
+ #fi |
74 |
+fi |
75 |
+ |
76 |
+LICENSE="BSD-2 CDDL MIT" |
77 |
+# just libzfs soname major for now. |
78 |
+# possible candidates: libuutil, libzpool, libnvpair. Those do not provide stable abi, but are considered. |
79 |
+# see libsoversion_check() below as well |
80 |
+SLOT="0/5" |
81 |
+IUSE="custom-cflags debug dist-kernel kernel-builtin minimal nls pam python +rootfs test-suite" |
82 |
+ |
83 |
+DEPEND=" |
84 |
+ net-libs/libtirpc:= |
85 |
+ sys-apps/util-linux |
86 |
+ sys-libs/zlib |
87 |
+ virtual/libudev:= |
88 |
+ dev-libs/openssl:0= |
89 |
+ !minimal? ( ${PYTHON_DEPS} ) |
90 |
+ pam? ( sys-libs/pam ) |
91 |
+ python? ( |
92 |
+ virtual/python-cffi[${PYTHON_USEDEP}] |
93 |
+ ) |
94 |
+" |
95 |
+ |
96 |
+BDEPEND="virtual/awk |
97 |
+ virtual/pkgconfig |
98 |
+ nls? ( sys-devel/gettext ) |
99 |
+ python? ( |
100 |
+ dev-python/setuptools[${PYTHON_USEDEP}] |
101 |
+ || ( |
102 |
+ dev-python/packaging[${PYTHON_USEDEP}] |
103 |
+ dev-python/distlib[${PYTHON_USEDEP}] |
104 |
+ ) |
105 |
+ ) |
106 |
+" |
107 |
+ |
108 |
+if [[ ${PV} != "9999" ]] ; then |
109 |
+ BDEPEND+=" verify-sig? ( sec-keys/openpgp-keys-openzfs )" |
110 |
+fi |
111 |
+ |
112 |
+# awk is used for some scripts, completions, and the Dracut module |
113 |
+RDEPEND="${DEPEND} |
114 |
+ !kernel-builtin? ( ~sys-fs/zfs-kmod-${PV}:= ) |
115 |
+ !prefix? ( virtual/udev ) |
116 |
+ sys-fs/udev-init-scripts |
117 |
+ virtual/awk |
118 |
+ dist-kernel? ( virtual/dist-kernel:= ) |
119 |
+ rootfs? ( |
120 |
+ app-arch/cpio |
121 |
+ app-misc/pax-utils |
122 |
+ !<sys-kernel/genkernel-3.5.1.1 |
123 |
+ ) |
124 |
+ test-suite? ( |
125 |
+ app-shells/ksh |
126 |
+ sys-apps/kmod[tools] |
127 |
+ sys-apps/util-linux |
128 |
+ sys-devel/bc |
129 |
+ sys-block/parted |
130 |
+ sys-fs/lsscsi |
131 |
+ sys-fs/mdadm |
132 |
+ sys-process/procps |
133 |
+ ) |
134 |
+" |
135 |
+ |
136 |
+# PDEPEND in this form is needed to trick portage suggest |
137 |
+# enabling dist-kernel if only 1 package have it set, without suggesting to disable |
138 |
+PDEPEND="dist-kernel? ( ~sys-fs/zfs-kmod-${PV}[dist-kernel] )" |
139 |
+ |
140 |
+REQUIRED_USE=" |
141 |
+ !minimal? ( ${PYTHON_REQUIRED_USE} ) |
142 |
+ python? ( !minimal ) |
143 |
+ test-suite? ( !minimal ) |
144 |
+" |
145 |
+ |
146 |
+RESTRICT="test" |
147 |
+ |
148 |
+PATCHES=( |
149 |
+ # bug #854333 |
150 |
+ "${FILESDIR}"/${PV}-r2-dracut-non-root.patch |
151 |
+ |
152 |
+ "${FILESDIR}"/2.1.5-dracut-zfs-missing.patch |
153 |
+ |
154 |
+ # bug #857228 |
155 |
+ "${FILESDIR}"/${PV}-dracut-mount.patch |
156 |
+ |
157 |
+ # bug #863212, bug #855182 |
158 |
+ "${WORKDIR}"/${P}-patches/ |
159 |
+) |
160 |
+ |
161 |
+pkg_pretend() { |
162 |
+ use rootfs || return 0 |
163 |
+ |
164 |
+ if has_version virtual/dist-kernel && ! use dist-kernel; then |
165 |
+ ewarn "You have virtual/dist-kernel installed, but" |
166 |
+ ewarn "USE=\"dist-kernel\" is not enabled for ${CATEGORY}/${PN}" |
167 |
+ ewarn "It's recommended to globally enable dist-kernel USE flag" |
168 |
+ ewarn "to auto-trigger initrd rebuilds with kernel updates" |
169 |
+ fi |
170 |
+} |
171 |
+ |
172 |
+pkg_setup() { |
173 |
+ if use kernel_linux; then |
174 |
+ linux-info_pkg_setup |
175 |
+ |
176 |
+ if ! linux_config_exists; then |
177 |
+ ewarn "Cannot check the linux kernel configuration." |
178 |
+ else |
179 |
+ if use test-suite; then |
180 |
+ if linux_chkconfig_present BLK_DEV_LOOP; then |
181 |
+ eerror "The ZFS test suite requires loop device support enabled." |
182 |
+ eerror "Please enable it:" |
183 |
+ eerror " CONFIG_BLK_DEV_LOOP=y" |
184 |
+ eerror "in /usr/src/linux/.config or" |
185 |
+ eerror " Device Drivers --->" |
186 |
+ eerror " Block devices --->" |
187 |
+ eerror " [X] Loopback device support" |
188 |
+ fi |
189 |
+ fi |
190 |
+ fi |
191 |
+ fi |
192 |
+} |
193 |
+ |
194 |
+libsoversion_check() { |
195 |
+ local bugurl libzfs_sover |
196 |
+ bugurl="https://bugs.gentoo.org/enter_bug.cgi?form_name=enter_bug&product=Gentoo+Linux&component=Current+packages" |
197 |
+ |
198 |
+ libzfs_sover="$(grep 'libzfs_la_LDFLAGS += -version-info' lib/libzfs/Makefile.am \ |
199 |
+ | grep -Eo '[0-9]+:[0-9]+:[0-9]+')" |
200 |
+ libzfs_sover="${libzfs_sover%%:*}" |
201 |
+ |
202 |
+ if [[ ${libzfs_sover} -ne $(ver_cut 2 ${SLOT}) ]]; then |
203 |
+ echo |
204 |
+ eerror "BUG BUG BUG BUG BUG BUG BUG BUG" |
205 |
+ eerror "ebuild subslot does not match libzfs soversion!" |
206 |
+ eerror "libzfs soversion: ${libzfs_sover}" |
207 |
+ eerror "ebuild value: $(ver_cut 2 ${SLOT})" |
208 |
+ eerror "This is a bug in the ebuild, please use the following URL to report it" |
209 |
+ eerror "${bugurl}&short_desc=${CATEGORY}%2F${P}+update+subslot" |
210 |
+ echo |
211 |
+ # we want to abort for releases, but just print a warning for live ebuild |
212 |
+ # to keep package installable |
213 |
+ [[ ${PV} == "9999" ]] || die |
214 |
+ fi |
215 |
+} |
216 |
+ |
217 |
+src_unpack() { |
218 |
+ if use verify-sig ; then |
219 |
+ # Needed for downloaded patch (which is unsigned, which is fine) |
220 |
+ verify-sig_verify_detached "${DISTDIR}"/${MY_P}.tar.gz{,.asc} |
221 |
+ fi |
222 |
+ |
223 |
+ default |
224 |
+} |
225 |
+ |
226 |
+src_prepare() { |
227 |
+ default |
228 |
+ libsoversion_check |
229 |
+ |
230 |
+ # Run unconditionally (bug #792627) |
231 |
+ eautoreconf |
232 |
+ |
233 |
+ if [[ ${PV} != "9999" ]]; then |
234 |
+ # Set revision number |
235 |
+ sed -i "s/\(Release:\)\(.*\)1/\1\2${PR}-gentoo/" META || die "Could not set Gentoo release" |
236 |
+ fi |
237 |
+ |
238 |
+ if use python; then |
239 |
+ pushd contrib/pyzfs >/dev/null || die |
240 |
+ distutils-r1_src_prepare |
241 |
+ popd >/dev/null || die |
242 |
+ fi |
243 |
+ |
244 |
+ # prevent errors showing up on zfs-mount stop, #647688 |
245 |
+ # openrc will unmount all filesystems anyway. |
246 |
+ sed -i "/^ZFS_UNMOUNT=/ s/yes/no/" "etc/default/zfs.in" || die |
247 |
+} |
248 |
+ |
249 |
+src_configure() { |
250 |
+ use custom-cflags || strip-flags |
251 |
+ use minimal || python_setup |
252 |
+ |
253 |
+ # All the same issue: |
254 |
+ # Segfaults w/ GCC 12 and 'zfs send' |
255 |
+ # bug #856373 |
256 |
+ # https://github.com/openzfs/zfs/issues/13620 |
257 |
+ # https://github.com/openzfs/zfs/issues/13605 |
258 |
+ append-flags -fno-tree-vectorize |
259 |
+ |
260 |
+ local myconf=( |
261 |
+ --bindir="${EPREFIX}/bin" |
262 |
+ --enable-shared |
263 |
+ --enable-sysvinit |
264 |
+ --localstatedir="${EPREFIX}/var" |
265 |
+ --sbindir="${EPREFIX}/sbin" |
266 |
+ --with-config=user |
267 |
+ --with-dracutdir="${EPREFIX}/usr/lib/dracut" |
268 |
+ --with-linux="${KV_DIR}" |
269 |
+ --with-linux-obj="${KV_OUT_DIR}" |
270 |
+ --with-udevdir="$(get_udevdir)" |
271 |
+ --with-pamconfigsdir="${EPREFIX}/unwanted_files" |
272 |
+ --with-pammoduledir="$(getpam_mod_dir)" |
273 |
+ --with-systemdunitdir="$(systemd_get_systemunitdir)" |
274 |
+ --with-systemdpresetdir="$(systemd_get_systempresetdir)" |
275 |
+ --with-vendor=gentoo |
276 |
+ # Building zfs-mount-generator.c on musl breaks as strndupa |
277 |
+ # isn't available. But systemd doesn't support musl anyway, so |
278 |
+ # just disable building it. |
279 |
+ $(use_enable !elibc_musl systemd) |
280 |
+ $(use_enable debug) |
281 |
+ $(use_enable nls) |
282 |
+ $(use_enable pam) |
283 |
+ $(use_enable python pyzfs) |
284 |
+ --disable-static |
285 |
+ $(usex minimal --without-python --with-python="${EPYTHON}") |
286 |
+ ) |
287 |
+ |
288 |
+ econf "${myconf[@]}" |
289 |
+} |
290 |
+ |
291 |
+src_compile() { |
292 |
+ default |
293 |
+ if use python; then |
294 |
+ pushd contrib/pyzfs >/dev/null || die |
295 |
+ distutils-r1_src_compile |
296 |
+ popd >/dev/null || die |
297 |
+ fi |
298 |
+} |
299 |
+ |
300 |
+src_install() { |
301 |
+ default |
302 |
+ |
303 |
+ gen_usr_ldscript -a nvpair uutil zfsbootenv zfs zfs_core zpool |
304 |
+ |
305 |
+ use pam && { rm -rv "${ED}/unwanted_files" || die ; } |
306 |
+ |
307 |
+ use test-suite || { rm -r "${ED}"/usr/share/zfs/{test-runner,zfs-tests,runfiles,*sh} || die ; } |
308 |
+ |
309 |
+ find "${ED}" -name '*.la' -delete || die |
310 |
+ |
311 |
+ dobashcomp contrib/bash_completion.d/zfs |
312 |
+ bashcomp_alias zfs zpool |
313 |
+ |
314 |
+ # strip executable bit from conf.d file |
315 |
+ fperms 0644 /etc/conf.d/zfs |
316 |
+ |
317 |
+ if use python; then |
318 |
+ pushd contrib/pyzfs >/dev/null || die |
319 |
+ distutils-r1_src_install |
320 |
+ popd >/dev/null || die |
321 |
+ fi |
322 |
+ |
323 |
+ # enforce best available python implementation |
324 |
+ use minimal || python_fix_shebang "${ED}/bin" |
325 |
+} |
326 |
+ |
327 |
+pkg_postinst() { |
328 |
+ udev_reload |
329 |
+ |
330 |
+ # we always need userspace utils in sync with zfs-kmod |
331 |
+ # so force initrd update for userspace as well, to avoid |
332 |
+ # situation when zfs-kmod trigger initrd rebuild before |
333 |
+ # userspace component is rebuilt |
334 |
+ # KV_* variables are provided by linux-info.eclass |
335 |
+ if [[ -z ${ROOT} ]] && use dist-kernel; then |
336 |
+ dist-kernel_reinstall_initramfs "${KV_DIR}" "${KV_FULL}" |
337 |
+ fi |
338 |
+ |
339 |
+ if use rootfs; then |
340 |
+ if ! has_version sys-kernel/genkernel && ! has_version sys-kernel/dracut; then |
341 |
+ elog "Root on zfs requires an initramfs to boot" |
342 |
+ elog "The following packages provide one and are tested on a regular basis:" |
343 |
+ elog " sys-kernel/dracut ( preferred, module maintained by zfs developers )" |
344 |
+ elog " sys-kernel/genkernel" |
345 |
+ fi |
346 |
+ fi |
347 |
+ |
348 |
+ if ! use kernel-builtin && [[ ${PV} == "9999" ]]; then |
349 |
+ einfo "Adding ${P} to the module database to ensure that the" |
350 |
+ einfo "kernel modules and userland utilities stay in sync." |
351 |
+ update_moduledb |
352 |
+ fi |
353 |
+ |
354 |
+ if systemd_is_booted || has_version sys-apps/systemd; then |
355 |
+ einfo "Please refer to ${EROOT}/$(systemd_get_systempresetdir)/50-zfs.preset" |
356 |
+ einfo "for default zfs systemd service configuration" |
357 |
+ else |
358 |
+ [[ -e "${EROOT}/etc/runlevels/boot/zfs-import" ]] || \ |
359 |
+ einfo "You should add zfs-import to the boot runlevel." |
360 |
+ [[ -e "${EROOT}/etc/runlevels/boot/zfs-load-key" ]] || \ |
361 |
+ einfo "You should add zfs-load-key to the boot runlevel." |
362 |
+ [[ -e "${EROOT}/etc/runlevels/boot/zfs-mount" ]]|| \ |
363 |
+ einfo "You should add zfs-mount to the boot runlevel." |
364 |
+ [[ -e "${EROOT}/etc/runlevels/default/zfs-share" ]] || \ |
365 |
+ einfo "You should add zfs-share to the default runlevel." |
366 |
+ [[ -e "${EROOT}/etc/runlevels/default/zfs-zed" ]] || \ |
367 |
+ einfo "You should add zfs-zed to the default runlevel." |
368 |
+ fi |
369 |
+} |
370 |
+ |
371 |
+pkg_postrm() { |
372 |
+ udev_reload |
373 |
+ |
374 |
+ if ! use kernel-builtin && [[ ${PV} == "9999" ]]; then |
375 |
+ remove_moduledb |
376 |
+ fi |
377 |
+} |
378 |
|
379 |
diff --git a/sys-libs/compiler-rt/compiler-rt-14.0.6-r1.ebuild b/sys-libs/compiler-rt/compiler-rt-14.0.6-r1.ebuild |
380 |
new file mode 100644 |
381 |
index 000000000000..dfbe222efc20 |
382 |
--- /dev/null |
383 |
+++ b/sys-libs/compiler-rt/compiler-rt-14.0.6-r1.ebuild |
384 |
@@ -0,0 +1,138 @@ |
385 |
+# Copyright 1999-2022 Gentoo Authors |
386 |
+# Distributed under the terms of the GNU General Public License v2 |
387 |
+ |
388 |
+EAPI=8 |
389 |
+ |
390 |
+PYTHON_COMPAT=( python3_{8..10} ) |
391 |
+inherit cmake flag-o-matic llvm llvm.org python-any-r1 toolchain-funcs |
392 |
+ |
393 |
+DESCRIPTION="Compiler runtime library for clang (built-in part)" |
394 |
+HOMEPAGE="https://llvm.org/" |
395 |
+ |
396 |
+LICENSE="Apache-2.0-with-LLVM-exceptions || ( UoI-NCSA MIT )" |
397 |
+SLOT="$(ver_cut 1-3)" |
398 |
+KEYWORDS="~amd64 ~arm ~arm64 ~ppc64 ~riscv ~x86 ~amd64-linux ~ppc-macos ~x64-macos" |
399 |
+IUSE="+abi_x86_32 abi_x86_64 +clang debug test" |
400 |
+RESTRICT="!test? ( test ) !clang? ( test )" |
401 |
+ |
402 |
+CLANG_SLOT=${SLOT%%.*} |
403 |
+# llvm-6 for new lit options |
404 |
+DEPEND=" |
405 |
+ >=sys-devel/llvm-6 |
406 |
+" |
407 |
+BDEPEND=" |
408 |
+ >=dev-util/cmake-3.16 |
409 |
+ clang? ( sys-devel/clang ) |
410 |
+ test? ( |
411 |
+ $(python_gen_any_dep ">=dev-python/lit-9.0.1[\${PYTHON_USEDEP}]") |
412 |
+ =sys-devel/clang-${PV%_*}*:${CLANG_SLOT} |
413 |
+ ) |
414 |
+ !test? ( |
415 |
+ ${PYTHON_DEPS} |
416 |
+ ) |
417 |
+" |
418 |
+ |
419 |
+LLVM_COMPONENTS=( runtimes compiler-rt cmake llvm/cmake ) |
420 |
+LLVM_PATCHSET=${PV}-r2 |
421 |
+llvm.org_set_globals |
422 |
+ |
423 |
+python_check_deps() { |
424 |
+ use test || return 0 |
425 |
+ has_version "dev-python/lit[${PYTHON_USEDEP}]" |
426 |
+} |
427 |
+ |
428 |
+pkg_pretend() { |
429 |
+ if ! use clang && ! tc-is-clang; then |
430 |
+ ewarn "Building using a compiler other than clang may result in broken atomics" |
431 |
+ ewarn "library. Enable USE=clang unless you have a very good reason not to." |
432 |
+ fi |
433 |
+} |
434 |
+ |
435 |
+pkg_setup() { |
436 |
+ # Darwin Prefix builds do not have llvm installed yet, so rely on |
437 |
+ # bootstrap-prefix to set the appropriate path vars to LLVM instead |
438 |
+ # of using llvm_pkg_setup. |
439 |
+ if [[ ${CHOST} != *-darwin* ]] || has_version dev-lang/llvm; then |
440 |
+ llvm_pkg_setup |
441 |
+ fi |
442 |
+ python-any-r1_pkg_setup |
443 |
+} |
444 |
+ |
445 |
+test_compiler() { |
446 |
+ $(tc-getCC) ${CFLAGS} ${LDFLAGS} "${@}" -o /dev/null -x c - \ |
447 |
+ <<<'int main() { return 0; }' &>/dev/null |
448 |
+} |
449 |
+ |
450 |
+src_configure() { |
451 |
+ # LLVM_ENABLE_ASSERTIONS=NO does not guarantee this for us, #614844 |
452 |
+ use debug || local -x CPPFLAGS="${CPPFLAGS} -DNDEBUG" |
453 |
+ |
454 |
+ # pre-set since we need to pass it to cmake |
455 |
+ BUILD_DIR=${WORKDIR}/${P}_build |
456 |
+ |
457 |
+ if use clang; then |
458 |
+ # Only do this conditionally to allow overriding with |
459 |
+ # e.g. CC=clang-13 in case of breakage |
460 |
+ if ! tc-is-clang ; then |
461 |
+ local -x CC=${CHOST}-clang |
462 |
+ local -x CXX=${CHOST}-clang++ |
463 |
+ fi |
464 |
+ strip-unsupported-flags |
465 |
+ fi |
466 |
+ |
467 |
+ local mycmakeargs=( |
468 |
+ -DLLVM_ENABLE_RUNTIMES=compiler-rt |
469 |
+ # this only adds unnecessary req on llvm-lit directory |
470 |
+ -DLLVM_INCLUDE_TESTS=OFF |
471 |
+ |
472 |
+ -DCOMPILER_RT_INSTALL_PATH="${EPREFIX}/usr/lib/clang/${SLOT}" |
473 |
+ -DCOMPILER_RT_INCLUDE_TESTS=$(usex test) |
474 |
+ -DCOMPILER_RT_BUILD_LIBFUZZER=OFF |
475 |
+ -DCOMPILER_RT_BUILD_MEMPROF=OFF |
476 |
+ -DCOMPILER_RT_BUILD_ORC=OFF |
477 |
+ -DCOMPILER_RT_BUILD_PROFILE=OFF |
478 |
+ -DCOMPILER_RT_BUILD_SANITIZERS=OFF |
479 |
+ -DCOMPILER_RT_BUILD_XRAY=OFF |
480 |
+ |
481 |
+ -DPython3_EXECUTABLE="${PYTHON}" |
482 |
+ ) |
483 |
+ |
484 |
+ if use amd64; then |
485 |
+ mycmakeargs+=( |
486 |
+ -DCAN_TARGET_i386=$(usex abi_x86_32) |
487 |
+ -DCAN_TARGET_x86_64=$(usex abi_x86_64) |
488 |
+ ) |
489 |
+ fi |
490 |
+ |
491 |
+ if use prefix && [[ "${CHOST}" == *-darwin* ]] ; then |
492 |
+ mycmakeargs+=( |
493 |
+ # setting -isysroot is disabled with compiler-rt-prefix-paths.patch |
494 |
+ # this allows adding arm64 support using SDK in EPREFIX |
495 |
+ -DDARWIN_macosx_CACHED_SYSROOT="${EPREFIX}/MacOSX.sdk" |
496 |
+ # Set version based on the SDK in EPREFIX. |
497 |
+ # This disables i386 for SDK >= 10.15 |
498 |
+ -DDARWIN_macosx_OVERRIDE_SDK_VERSION="$(realpath ${EPREFIX}/MacOSX.sdk | sed -e 's/.*MacOSX\(.*\)\.sdk/\1/')" |
499 |
+ # Use our libtool instead of looking it up with xcrun |
500 |
+ -DCMAKE_LIBTOOL="${EPREFIX}/usr/bin/${CHOST}-libtool" |
501 |
+ ) |
502 |
+ fi |
503 |
+ |
504 |
+ if use test; then |
505 |
+ mycmakeargs+=( |
506 |
+ -DLLVM_EXTERNAL_LIT="${EPREFIX}/usr/bin/lit" |
507 |
+ -DLLVM_LIT_ARGS="$(get_lit_flags)" |
508 |
+ |
509 |
+ -DCOMPILER_RT_TEST_COMPILER="${EPREFIX}/usr/lib/llvm/${CLANG_SLOT}/bin/clang" |
510 |
+ -DCOMPILER_RT_TEST_CXX_COMPILER="${EPREFIX}/usr/lib/llvm/${CLANG_SLOT}/bin/clang++" |
511 |
+ ) |
512 |
+ fi |
513 |
+ |
514 |
+ cmake_src_configure |
515 |
+} |
516 |
+ |
517 |
+src_test() { |
518 |
+ # respect TMPDIR! |
519 |
+ local -x LIT_PRESERVES_TMP=1 |
520 |
+ |
521 |
+ cmake_build check-builtins |
522 |
+} |