17 |
17 |
# 4. ConvertUTF.h: TODO.
|
18 |
18 |
|
19 |
19 |
LICENSE="Apache-2.0-with-LLVM-exceptions UoI-NCSA BSD public-domain rc"
|
20 |
|
SLOT="$(ver_cut 1)"
|
|
20 |
SLOT="${LLVM_MAJOR}/${LLVM_SOABI}"
|
21 |
21 |
KEYWORDS="amd64 arm arm64 ppc ppc64 ~riscv sparc x86 ~amd64-linux ~ppc-macos ~x64-macos"
|
22 |
|
IUSE="+binutils-plugin debug doc exegesis libedit +libffi ncurses test xar xml z3"
|
|
22 |
IUSE="
|
|
23 |
+binutils-plugin debug doc exegesis libedit +libffi ncurses test xar
|
|
24 |
xml z3 zstd
|
|
25 |
"
|
23 |
26 |
RESTRICT="!test? ( test )"
|
24 |
27 |
|
25 |
28 |
RDEPEND="
|
... | ... | |
31 |
34 |
xar? ( app-arch/xar )
|
32 |
35 |
xml? ( dev-libs/libxml2:2=[${MULTILIB_USEDEP}] )
|
33 |
36 |
z3? ( >=sci-mathematics/z3-4.7.1:0=[${MULTILIB_USEDEP}] )
|
|
37 |
zstd? ( app-arch/zstd:=[${MULTILIB_USEDEP}] )
|
34 |
38 |
"
|
35 |
39 |
DEPEND="
|
36 |
40 |
${RDEPEND}
|
... | ... | |
42 |
46 |
>=dev-util/cmake-3.16
|
43 |
47 |
sys-devel/gnuconfig
|
44 |
48 |
kernel_Darwin? (
|
45 |
|
<sys-libs/libcxx-$(ver_cut 1-3).9999
|
|
49 |
<sys-libs/libcxx-${LLVM_VERSION}.9999
|
46 |
50 |
>=sys-devel/binutils-apple-5.1
|
47 |
51 |
)
|
48 |
52 |
doc? ( $(python_gen_any_dep '
|
... | ... | |
50 |
54 |
dev-python/sphinx[${PYTHON_USEDEP}]
|
51 |
55 |
') )
|
52 |
56 |
libffi? ( virtual/pkgconfig )
|
53 |
|
test? (
|
54 |
|
sys-apps/which
|
55 |
|
)
|
56 |
57 |
"
|
57 |
58 |
# There are no file collisions between these versions but having :0
|
58 |
59 |
# installed means llvm-config there will take precedence.
|
... | ... | |
62 |
63 |
"
|
63 |
64 |
PDEPEND="
|
64 |
65 |
sys-devel/llvm-common
|
65 |
|
binutils-plugin? ( >=sys-devel/llvmgold-${SLOT} )
|
|
66 |
sys-devel/llvm-toolchain-symlinks:${LLVM_MAJOR}
|
|
67 |
binutils-plugin? ( >=sys-devel/llvmgold-${LLVM_MAJOR} )
|
66 |
68 |
"
|
67 |
69 |
|
68 |
70 |
LLVM_COMPONENTS=( llvm cmake third-party )
|
69 |
71 |
LLVM_MANPAGES=1
|
70 |
|
LLVM_PATCHSET=${PV}-r4
|
|
72 |
LLVM_PATCHSET=${PV/_/-}-r3
|
71 |
73 |
LLVM_USE_TARGETS=provide
|
72 |
74 |
llvm.org_set_globals
|
73 |
75 |
|
... | ... | |
179 |
181 |
check_uptodate
|
180 |
182 |
|
181 |
183 |
llvm.org_src_prepare
|
182 |
|
|
183 |
|
# remove regressing test
|
184 |
|
# https://github.com/llvm/llvm-project/issues/55761
|
185 |
|
rm test/Other/ChangePrinters/DotCfg/print-changed-dot-cfg.ll || die
|
186 |
184 |
}
|
187 |
185 |
|
188 |
186 |
get_distribution_components() {
|
... | ... | |
216 |
214 |
count
|
217 |
215 |
not
|
218 |
216 |
yaml-bench
|
|
217 |
UnicodeNameMappingGenerator
|
219 |
218 |
|
220 |
219 |
# tools
|
221 |
220 |
bugpoint
|
... | ... | |
237 |
236 |
llvm-cxxdump
|
238 |
237 |
llvm-cxxfilt
|
239 |
238 |
llvm-cxxmap
|
|
239 |
llvm-debuginfod
|
240 |
240 |
llvm-debuginfod-find
|
241 |
241 |
llvm-diff
|
242 |
242 |
llvm-dis
|
243 |
243 |
llvm-dlltool
|
244 |
244 |
llvm-dwarfdump
|
|
245 |
llvm-dwarfutil
|
245 |
246 |
llvm-dwp
|
246 |
247 |
llvm-exegesis
|
247 |
248 |
llvm-extract
|
... | ... | |
274 |
275 |
llvm-readelf
|
275 |
276 |
llvm-readobj
|
276 |
277 |
llvm-reduce
|
|
278 |
llvm-remark-size-diff
|
277 |
279 |
llvm-rtdyld
|
278 |
280 |
llvm-sim
|
279 |
281 |
llvm-size
|
... | ... | |
325 |
327 |
ffi_cflags=$($(tc-getPKG_CONFIG) --cflags-only-I libffi)
|
326 |
328 |
ffi_ldflags=$($(tc-getPKG_CONFIG) --libs-only-L libffi)
|
327 |
329 |
fi
|
|
330 |
|
328 |
331 |
local libdir=$(get_libdir)
|
329 |
332 |
local mycmakeargs=(
|
330 |
333 |
# disable appending VCS revision to the version to improve
|
331 |
334 |
# direct cache hit ratio
|
332 |
335 |
-DLLVM_APPEND_VC_REV=OFF
|
333 |
|
-DCMAKE_INSTALL_PREFIX="${EPREFIX}/usr/lib/llvm/${SLOT}"
|
|
336 |
-DCMAKE_INSTALL_PREFIX="${EPREFIX}/usr/lib/llvm/${LLVM_MAJOR}"
|
334 |
337 |
-DLLVM_LIBDIR_SUFFIX=${libdir#lib}
|
335 |
338 |
|
336 |
339 |
-DBUILD_SHARED_LIBS=OFF
|
... | ... | |
353 |
356 |
-DLLVM_ENABLE_EH=ON
|
354 |
357 |
-DLLVM_ENABLE_RTTI=ON
|
355 |
358 |
-DLLVM_ENABLE_Z3_SOLVER=$(usex z3)
|
|
359 |
-DLLVM_ENABLE_ZSTD=$(usex zstd)
|
356 |
360 |
|
357 |
361 |
-DLLVM_HOST_TRIPLE="${CHOST}"
|
358 |
362 |
|
... | ... | |
394 |
398 |
if llvm_are_manpages_built; then
|
395 |
399 |
build_docs=ON
|
396 |
400 |
mycmakeargs+=(
|
397 |
|
-DCMAKE_INSTALL_MANDIR="${EPREFIX}/usr/lib/llvm/${SLOT}/share/man"
|
|
401 |
-DCMAKE_INSTALL_MANDIR="${EPREFIX}/usr/lib/llvm/${LLVM_MAJOR}/share/man"
|
398 |
402 |
-DLLVM_INSTALL_SPHINX_HTML_DIR="${EPREFIX}/usr/share/doc/${PF}/html"
|
399 |
403 |
-DSPHINX_WARNINGS_AS_ERRORS=OFF
|
400 |
404 |
)
|
... | ... | |
413 |
417 |
fi
|
414 |
418 |
|
415 |
419 |
if tc-is-cross-compiler; then
|
416 |
|
local tblgen="${BROOT}/usr/lib/llvm/${SLOT}/bin/llvm-tblgen"
|
|
420 |
local tblgen="${BROOT}/usr/lib/llvm/${LLVM_MAJOR}/bin/llvm-tblgen"
|
417 |
421 |
[[ -x "${tblgen}" ]] \
|
418 |
422 |
|| die "${tblgen} not found or usable"
|
419 |
423 |
mycmakeargs+=(
|
... | ... | |
440 |
444 |
use debug || local -x CPPFLAGS="${CPPFLAGS} -DNDEBUG"
|
441 |
445 |
cmake_src_configure
|
442 |
446 |
|
443 |
|
grep -q -E "^CMAKE_PROJECT_VERSION_MAJOR(:.*)?=$(ver_cut 1)$" \
|
|
447 |
grep -q -E "^CMAKE_PROJECT_VERSION_MAJOR(:.*)?=${LLVM_MAJOR}$" \
|
444 |
448 |
CMakeCache.txt ||
|
445 |
449 |
die "Incorrect version, did you update _LLVM_MASTER_MAJOR?"
|
446 |
450 |
multilib_is_native_abi && check_distribution_components
|
447 |
451 |
}
|
448 |
452 |
|
449 |
453 |
multilib_src_compile() {
|
450 |
|
cmake_build distribution
|
|
454 |
tc-env_build cmake_build distribution
|
451 |
455 |
|
452 |
456 |
pax-mark m "${BUILD_DIR}"/bin/llvm-rtdyld
|
453 |
457 |
pax-mark m "${BUILD_DIR}"/bin/lli
|
... | ... | |
468 |
472 |
|
469 |
473 |
src_install() {
|
470 |
474 |
local MULTILIB_CHOST_TOOLS=(
|
471 |
|
/usr/lib/llvm/${SLOT}/bin/llvm-config
|
|
475 |
/usr/lib/llvm/${LLVM_MAJOR}/bin/llvm-config
|
472 |
476 |
)
|
473 |
477 |
|
474 |
478 |
local MULTILIB_WRAPPED_HEADERS=(
|
... | ... | |
479 |
483 |
multilib-minimal_src_install
|
480 |
484 |
|
481 |
485 |
# move wrapped headers back
|
482 |
|
mv "${ED}"/usr/include "${ED}"/usr/lib/llvm/${SLOT}/include || die
|
|
486 |
mv "${ED}"/usr/include "${ED}"/usr/lib/llvm/${LLVM_MAJOR}/include || die
|
483 |
487 |
}
|
484 |
488 |
|
485 |
489 |
multilib_src_install() {
|
... | ... | |
487 |
491 |
|
488 |
492 |
# move headers to /usr/include for wrapping
|
489 |
493 |
rm -rf "${ED}"/usr/include || die
|
490 |
|
mv "${ED}"/usr/lib/llvm/${SLOT}/include "${ED}"/usr/include || die
|
|
494 |
mv "${ED}"/usr/lib/llvm/${LLVM_MAJOR}/include "${ED}"/usr/include || die
|
491 |
495 |
|
492 |
|
LLVM_LDPATHS+=( "${EPREFIX}/usr/lib/llvm/${SLOT}/$(get_libdir)" )
|
|
496 |
LLVM_LDPATHS+=( "${EPREFIX}/usr/lib/llvm/${LLVM_MAJOR}/$(get_libdir)" )
|
493 |
497 |
}
|
494 |
498 |
|
495 |
499 |
multilib_src_install_all() {
|
496 |
|
local revord=$(( 9999 - ${SLOT} ))
|
|
500 |
local revord=$(( 9999 - ${LLVM_MAJOR} ))
|
497 |
501 |
newenvd - "60llvm-${revord}" <<-_EOF_
|
498 |
|
PATH="${EPREFIX}/usr/lib/llvm/${SLOT}/bin"
|
|
502 |
PATH="${EPREFIX}/usr/lib/llvm/${LLVM_MAJOR}/bin"
|
499 |
503 |
# we need to duplicate it in ROOTPATH for Portage to respect...
|
500 |
|
ROOTPATH="${EPREFIX}/usr/lib/llvm/${SLOT}/bin"
|
501 |
|
MANPATH="${EPREFIX}/usr/lib/llvm/${SLOT}/share/man"
|
|
504 |
ROOTPATH="${EPREFIX}/usr/lib/llvm/${LLVM_MAJOR}/bin"
|
|
505 |
MANPATH="${EPREFIX}/usr/lib/llvm/${LLVM_MAJOR}/share/man"
|
502 |
506 |
LDPATH="$( IFS=:; echo "${LLVM_LDPATHS[*]}" )"
|
503 |
507 |
_EOF_
|
504 |
508 |
|
505 |
|
docompress "/usr/lib/llvm/${SLOT}/share/man"
|
|
509 |
docompress "/usr/lib/llvm/${LLVM_MAJOR}/share/man"
|
506 |
510 |
llvm_install_manpages
|
507 |
511 |
}
|
508 |
512 |
|
509 |
513 |
pkg_postinst() {
|
510 |
514 |
elog "You can find additional opt-viewer utility scripts in:"
|
511 |
|
elog " ${EROOT}/usr/lib/llvm/${SLOT}/share/opt-viewer"
|
|
515 |
elog " ${EROOT}/usr/lib/llvm/${LLVM_MAJOR}/share/opt-viewer"
|
512 |
516 |
elog "To use these scripts, you will need Python along with the following"
|
513 |
517 |
elog "packages:"
|
514 |
518 |
elog " dev-python/pygments (for opt-viewer)"
|