sys-devel/llvm: Drop <4

Signed-off-by: Michał Górny <mgorny@gentoo.org>
This commit is contained in:
Michał Górny
2019-03-10 19:24:49 +01:00
parent 25a46c7e43
commit fe01e28de7
7 changed files with 0 additions and 1972 deletions

View File

@@ -1,33 +1,3 @@
DIST cfe-3.4.2.src.tar.gz 10612313 BLAKE2B 6a5d9f20d181b217f3ca72b6585bd953150cc0d207a203feb24aa9cb9b2e341ac6a2e152a1c40baf2d53e5a52c4e4e86a518a329bdda39c08986b3437b04cee8 SHA512 e01fa8e312e9b3b7b3cb572ac21349161aaa50078ecfe7bded273b75db4a0c44acde524f8fdfcbeec54c61eeeb8339e9917d1f205a8fda18e34fe7ccbe89c36d
DIST cfe-3.5.2.src.tar.xz 8268008 BLAKE2B 9444f44e5d2cc8b83832bdb820c79fd9a8d5c9e5b0bc29d1213c10a60e3ef8ba9160c68cabfdbf6ae3eac804cc64b4a539274f5c83baee0059fdfc96dedeeef9 SHA512 2ad9a7daa8e62cdbf47b001aa6b937a06ae7e6396dcd1832797e2d98036522443ccfca9f1253e16d531a99d1edf237fcd2b457c55491ff68ca4534a2396ca52f
DIST cfe-3.6.2.src.tar.xz 8617576 BLAKE2B 02a162d7afa32d25e77618ef890b81f532eba87369611dad332943be5460ff747ede3cb53d2d66398243341ecd1ecee0c5ee2e72ff8ca5ea744d2655946fc934 SHA512 ed837c48f38d8998efd675b56477c8681dcedfcf3f71bba65930f145501289bebb6fe6a6d9de336548f94c381d016b99f10c58e046b885449755d44ac782de03
DIST cfe-3.7.1.src.tar.xz 9110616 BLAKE2B 9df6971afbfc1384c537f384b808f4af6914d3bf32f11017f08bec597e9cc535a96660aafe042a99cd8e450adb5555915392a6098d423993856ea7a1f8e4ee10 SHA512 8e3285a32ad0fd4721fa77c4fb9709f31bb4e4f7cb5245357aaf57b0767b6ef18a30d902b59d1437a6febffb6c2128214f9ce5aa913bb298743221a28c4f9de5
DIST cfe-3.9.1.src.tar.xz 10363080 BLAKE2B 6f6cfe80ea0344342f070d451dabd41b9cf58962ca354f495868821173446f8a08c5a69819f0c5d20b4f49019036fa4a238838b224a1e55d5ac805668fc837d5 SHA512 3f0eea194597e438bbe49ce9ef5fdced81459c21cbdd2653750b2fe02c55a0154d6a33a8cfd02e607b83314a8e35b2c300f944462120ab6de1d4139d85db56b8
DIST clang-tools-extra-3.7.1.src.tar.xz 277476 BLAKE2B 19ed7feb1a558f691af0d0735a3d0f2dc2b80f06cc5ad0ae9dd8dc0545b38d35cd55231d73c0c7c8abe96d045ba4077f5c8c98a454a73a30a00c6a2415bedf46 SHA512 06e2db8af75f1e6ee82da6ee723b5256b9e3f6ba196428f18944ec02d07df26d04329ca8824a083c5f25274ce7e3469aa75e3a29ccfbdb6375524841d65e3ad7
DIST clang-tools-extra-3.9.1.src.tar.xz 456464 BLAKE2B 32cbb7d5282e286e0bf9f8b1e9ecddc5401b78fd088b1302978e0f6cf71fe864ab47eebe81bdea59ccd49122e6d2ef2281b5bd52e97af5eefdbd5d7da9550f5f SHA512 5691fb09f80b519876cdd2e82ad23a20bba32a0bc356e15e6db631b2936763911f15ff55f8bf5f073100b9e4cf217f08fdce90ae98ef0e084274259d3cfe9634
DIST compiler-rt-3.4.src.tar.gz 1858593 BLAKE2B 3e1107b3056b9eaf33ffa0786db144a006f24c0bef2c525e722d2946d0cc70b16aa776a68d1b668671925951efd270b733820085ca310c538892023a780361b0 SHA512 70efffaf12ff7c15befa87ce808489c6f6b6eb421d0ab5d8ecd525239efc8aab850c7ed34b31a993ff5e499657b72598619945cc4461fe3e5359e9a94aaac0c8
DIST compiler-rt-3.5.2.src.tar.xz 1093000 BLAKE2B 633e18ba17f1df077a06089bef5cd495f8b639981330083c300de2e2d31f2033e882fb17286d5c7e13b31b78d24a60e354daacbffebd98d6415b811ad089e0d2 SHA512 319a8a1dbe07eb4f1fcccfe79a1fa445f348fb854a441500e89fa0a128e45716b65d06347f19a63de32e9294cd2331e914ae0d5fe8224f0b2452c39b79ac96ff
DIST compiler-rt-3.6.2.src.tar.xz 1128080 BLAKE2B 934bc3fb139d0a3a82e7824256ebbf524a8298bf5872a89351786585854a09739071fe53f319815b45aca03f1d8ba0d3cc0c2ad8e3cc529fbaf6e180b33cd2c6 SHA512 7dafcc5bd4822475de649d8a84ae51af3c4ed4d0958f76b1b55ba79219638f3e78eb94a1986c6e9ba0e7f1ccf3ec834d546b5ca60e8b08083fea5880ecdf17a3
DIST compiler-rt-3.7.1.src.tar.xz 1181772 BLAKE2B bcc11ee67806bc3b65690a7828f46f9fdc52992f30ce7159045ae21d916de4cb16dd8047913101a56b87c4496872c37e37ce0b54fa72b681a4a369b1f861b070 SHA512 bf434519ea0838264c30de1e1e8681320aa868df0ecc825a45c659077b963a4120c18216946558cbf8aea24a8ac8ec39af2066dab906bc7cabc0894d51d61325
DIST compiler-rt-3.9.1.src.tar.xz 1376372 BLAKE2B 1c7391a429329591d96e474c9ac5b36672a8d50dc621bd21a9e97035811d85293981e98ada1c3284f9d05115a1113086ba3888073fc3b76e09f83614cd7d37ce SHA512 91a4c78a5e8c1cdd2d6bbcb27d2c34f49ea30a952733444ef4f4a7cc7503c880d4b6924595e87745ef6278851178f49f98d38d2068975d4fb6577fb9e9cdcdbe
DIST lldb-3.7.1.src.tar.xz 10650524 BLAKE2B 432e7064f4f48b62b96c80ca184fc2a69ac7e2ee62d14020017c01659aa15299b5f5c47852855b1ff12606d264c1cccf9a31b5818909dd779c8f353df62d12dc SHA512 d2d3e1052026edd6ef9113ff5362acb4a32cef598098b4031c35e389301130ef2e1bda594f30de4d65c9fdc0beaecdd35afcf36676eb540baad34015aca294d1
DIST lldb-3.9.1.src.tar.xz 13750816 BLAKE2B 40bd2797e1e06f600cdd88ba56af8e3c315cd9f2bc2ca12c3172623ae16750f051f9e6d76df354a3fc0c6a4fb802fa842952e1ff1d47a28f5cd218546da89563 SHA512 e2957a1da60284595b21c205b07fa3db5c474bfad1935ab8e1bc832f30af497e9eb709efeb703591ef62e7dd73a28d22fc21398097a232c8a729946d72eb5df7
DIST llvm-3.4-manpages.tar.bz2 33753 BLAKE2B b6a57cc492d133eddad08507521395f8c4cd6c7609b6134e61c330045d68a222bee88f8d0ab7883654db55157b185b59690ca3024957ddaaaa3054fcb9ccf831 SHA512 8e438a9392c9b896ccb2b1460a8f57ffa01633e3a6bba61e2bf2f718d970ff96c17d63b0bc0d4da1162e1d1dc4cb9b2a9e9a14a722e8a5b5d2f205f037ae665d
DIST llvm-3.4-patchset-darwin-leopard.tar.gz 7704 BLAKE2B a46dacae703b19ad2876d3f1f4f59ca12be96e2368d35d2578d4d67e4ea28051e37279e79cd5169f63277ba4d591d2ac8baf3a6f6af6b45e1019c4aa83f1515d SHA512 1f34ef6a20fe09e6de473bd15f9ef30e3d7a16a5a9fdb62d88d1ac22ffc31a2a7814e0a2e677b21dbf0865241786aa2b8b4646737cede1765c8f3c6b5202fccc
DIST llvm-3.4.2-patchset.tar.gz 4612 BLAKE2B e7be0957dac5ceae7e81beef2dbb914554809095fd4857d45809b00ae06f297649f8a5e7baaa1602b711b678120ca18aee1f60413136d0572c8226f7fabae03e SHA512 32c7cf229a6a8917f0fc67efa1fb11994945281f6906395cee7e5c51399c8fb4c06f554a03253c8f9073890a7bc7af151a8adfe887ad62f45f1523e6e358f769
DIST llvm-3.4.2.src.tar.gz 15938155 BLAKE2B 51b2f5e04f448d71fdd757a84c71157de0f9958aace6e8837971e3c62f2b017387b1bc8b310bacfae137b48501d25be8decb4ffa3caa7fcd0083a73c4c65949e SHA512 6c1453f7d9d9110257db3574cc4f6227fed8938705cbb09851ac09a868089b48f1556a1b6e758aff6d97520b08b5605d3ed20411ad9dd22cdc573d62176905f0
DIST llvm-3.5.0-manpages.tar.bz2 35314 BLAKE2B 5368ddc4471d4ebf7e6f2bbd6525293dc8f6300fecf9a303e344b4e5415e5e04e9a9d0fbd636b2a1b554e8a55a69e4306842491ad3cc7c4c227b6ac35f52cc8b SHA512 d99d6096d7f21a81923297584fe5eeb23e0d83d4538fe376615c92fffc8aff3189999f7ab3c537b5aa5d6bc2c22c53eb05717d48c7ab99c42315b8665bac62c3
DIST llvm-3.5.2-patchset.tar.gz 4568 BLAKE2B ab7db30375f497a41e2cd657a628bddf621ccaf48042dbdf29b7bdec0c5b11b2c0dd2d99df72dd9b5acb01b7bb3147f2b91844984be2f842fb115149f61cf0aa SHA512 6df5a61d3e949dbe9840e713eb90e7514760c5ae68e241494d0246925015ac7e9d73671dd0646eb44d2d9232665027783d02c00639f41385615ec541d4e2fa93
DIST llvm-3.5.2.src.tar.xz 11876128 BLAKE2B 05700e6b162beddb246077507147c30cc36f334f4c3142225b038104f674cbb40a3fe145ba82724196ec995235c137fd132e1f98689f77b102c722a84300e069 SHA512 0f6a83cc61a385387e7baf8fb8f0d9f18e3fd00d2d389a3c7e2c3792be7d82ed095506cac52c24e65ae3c1f94456a441d39440feef6125e25ef18447ec9dd406
DIST llvm-3.6.1-manpages.tar.bz2 38338 BLAKE2B d5d385e55c3817e8b25dd33178929d9bcbf59cb8390ecfb44c83c58c3bc1e7c2aae2b0969da4f4f5dbe6b052ab802e00c48f3fb68c6548bc4c8647f5fe4687f9 SHA512 a47aeb0b4632329eaaa1d6c774446fea5822d7692d81533a9a5c5de1c6a3b37fdd6b7c1fc6433339649f4d3a53a753065e73afb30fd84f253ad31d5fb3d48662
DIST llvm-3.6.2-patchset.tar.gz 4562 BLAKE2B 76b7c01e54d5fe154e10478aa6fc8a414458baf3939b71d8a2fe5787c52b7d28bdc07a7eb4b1c00ec4c2da4cdc6df75b49ade528f4451a1e4ee0d31940fab033 SHA512 6018e7d96317e6a46f373259430782a1377193ab64b337d5f6720a4ffe0eb0891e7e9373fb9c20da66e840f07e52f2bccb2a8c51bb55ded0f124748796cce1c8
DIST llvm-3.6.2.src.tar.xz 12802380 BLAKE2B c9ac1c83d99efe5d673a41650b587584b6233420a9d1e02a5cfdc0b7bb99b761ddb3fe48677c8bc0714734af06660a72daf96936057bac19f3e41645404d347b SHA512 42b44ce69cfb96e2dc12dc2246f0de8ff983a99741206e2c46ccf074b3248aaab9c0f22c6baad802de851d06f202f40db9dd62fe38aab4479b3f70026c936b36
DIST llvm-3.7.0-manpages.tar.bz2 38095 BLAKE2B 67be777ceba745fee8a2128de05d2e22b1eeec275afb24376891dcda90dbd2486e58456248934b1cfaf907a80954c7ee537fe0d69bb87db167401f41c404212a SHA512 ea70ac15dbaef3740b31f66aa798338f7f9b82484586582aa62e0364f9d74bf175be2f4f29721df253b8157c1cbc146ab9045c0656c42a6375434e994786b643
DIST llvm-3.7.1-patchset.tar.gz 17234 BLAKE2B 93e3676c9b1a34462435a376e35f0768d57e4db1001d136864f99b569c0235be7f51c21491f9792e7169e221de1e9faeb728928b8963420bbb36234ff28b4eb7 SHA512 030dc7f72d11fcd53307f707d5dde321054feb0f0977601c3e188a37f2be6c14bfd05482d1c1e5f435aaf32ca7c7e3701cf5f1375fbd0cf83cf8afbad7f4f6be
DIST llvm-3.7.1.src.tar.xz 14592544 BLAKE2B f3a197dec9a397be02d2c55d73624352cf1474d935ca6dac466f8f44de0990c3f37b10a598fa2e871dfa27d3506087826dfcd23cb19bbd700cec54141c7d35fb SHA512 ac521debc02f6deba96ef975d6a546b0c5c77299c1dbf5e1b87a7974ff5e7fd715bd7e384b92d9adf572ce47130bdbf6d3c648eb0d7f72f16f976292e4909e90
DIST llvm-3.9.0_rc3-manpages.tar.bz2 80007 BLAKE2B e770497834a5863f5c988d3bae8ef0f7e5551a505d2db9557567976c10fbaa68fb6013f9136db2123e626a99046b47ea5c0d62e1ea830d998015a1f67f67eeb9 SHA512 f96c340021de3f096ec3ad7d51a6af2c7a84974122d1df15729a39d4f9d65452f063a85ab38adb064288dc14220d9cc679b31ee19b48424d3d7cde621ff37597
DIST llvm-3.9.1-patchset.tar.xz 16404 BLAKE2B 9c9d630e6c6a70ba6a026a6ecb7a7d29a567e6b85fc92ce128a8129006ccad44defc07a46351dfa188128a91d419696f6c36a0e184a04f9d1270d5431cbd59f5 SHA512 dcae89ba910b5195bb455924242912f526b6994f0f236571b6364fd594bf9ca03cc74e116a44ae4372e34ce63b21f1351125157e7af7a957aee115f400b54089
DIST llvm-3.9.1.src.tar.xz 18130436 BLAKE2B 90afd2c06e612132bbc84c29fed59abdfdaed41f8a7590e3f60ba5072179317365f15f301f577ba050b78797f682bef8fa85ebad7391fd3e67b46eb02a5df068 SHA512 50cbe8ee911080f586e77861c442348701bd02e2de0c090c54c34f82ac275ecfcd712af0f41e387c33b4a6057778a4258a27554292fe68ab4af3fd9dd6d90683
DIST llvm-4.0.1.src.tar.xz 21065652 BLAKE2B 6327eed2d1feb108440f22d2581d1ff86c10a10c29793538d8d899c7e2dc83d3f7b147d3fd4bcce2bd2bf57c071b08c624aeafe40a3e7a3914506e7751727e6c SHA512 16adc39b34ddb628f81b171119a8e2a0e9138b25011e803ef0b688e2fbea116fc4953d3a1b61b90a98a75e33619f81566b7cb06a9a2ea4d04ac5e0eb303a2d1d
DIST llvm-5.0.1-patchset.tar.bz2 4204 BLAKE2B e7282e84578631d88549bdf34e5a44e0294e47ef1fee29c0cb954d7afd160d4b6a0f39bb3bd53791ea53503a60eaa0ada0a512a63d696ff096dc6f21f4aecdc7 SHA512 395ea2b13008e222c034e2bdd8c2bb033b9c01e61fb89c840f009f6cddb499b317df8b061d29f40968d8f0df5540a2f4a9de31eef1de886796c8c334f37254eb
DIST llvm-5.0.2-manpages.tar.bz2 93977 BLAKE2B 8c5e8899e0df9d6037fb7d5c373de6492ccdc9fd2c26cc7dfbd8fb2b9e68418ca8fdf42cdc303c361e649cc6939bf5229cbad017bdccbd5d791e92752328252f SHA512 568615bce5a75d42e4b6d592557472d366d49a99f8e81be10ae679804f1fe674c7fd0bbdac09af44fc67ee5aa34c4ed2153c2767c536ac8e45dd15c811c92dcb

View File

@@ -1,273 +0,0 @@
# Copyright 1999-2018 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
EAPI=5
PYTHON_COMPAT=( python2_7 )
inherit eutils check-reqs flag-o-matic multilib pax-utils prefix \
python-any-r1 toolchain-funcs
DESCRIPTION="Low Level Virtual Machine"
HOMEPAGE="https://llvm.org/"
SRC_URI="https://llvm.org/releases/${PV}/${P}.src.tar.gz
clang? ( https://llvm.org/releases/3.4/compiler-rt-3.4.src.tar.gz
https://llvm.org/releases/${PV}/cfe-${PV}.src.tar.gz )
https://dev.gentoo.org/~mgorny/dist/llvm/${PN}-3.4-manpages.tar.bz2
https://dev.gentoo.org/~mgorny/dist/llvm/${P}-patchset.tar.gz
https://dev.gentoo.org/~grobian/distfiles/${PN}-3.4-patchset-darwin-leopard.tar.gz"
# Additional licenses:
# 1. OpenBSD regex: Henry Spencer's license ('rc' in Gentoo) + BSD.
# 2. ARM backend (disabled): ARM.
# 3. MD5 code: public-domain.
# 4. autoconf (not installed): some undefined M.I.T. license.
# 5. Tests (not installed):
# a. gtest: BSD.
# b. YAML tests: MIT.
LICENSE="UoI-NCSA rc BSD public-domain"
SLOT="0/3.4"
KEYWORDS="~ppc-macos ~x64-macos ~x86-macos"
IUSE="clang +libffi"
COMMON_DEPEND="
sys-libs/zlib:0=
libffi? ( >=virtual/libffi-3.0.13-r1:0= )"
DEPEND="${COMMON_DEPEND}
dev-lang/perl
>=sys-devel/make-3.81
>=sys-devel/flex-2.5.4
>=sys-devel/bison-1.875d
|| ( >=sys-devel/gcc-apple-4.2.1 >=sys-devel/llvm-3.3 )
>=sys-devel/binutils-apple-5.1
libffi? ( virtual/pkgconfig )
${PYTHON_DEPS}"
RDEPEND="${COMMON_DEPEND}
clang? ( !<=sys-devel/clang-${PV}-r99
!>=sys-devel/clang-9999 )"
PDEPEND="clang? ( =sys-devel/clang-${PV}-r100 )"
S=${WORKDIR}/${P}.src
check_space() {
# in megs
# !clang !debug !multitarget -O2 400
# !clang !debug multitarget -O2 550
# clang !debug !multitarget -O2 950
# clang !debug multitarget -O2 1200
# !clang debug multitarget -O2 5G
# clang !debug multitarget -O0 -g 12G
# clang debug multitarget -O2 16G
# clang debug multitarget -O0 -g 14G
local build_size=550
use clang && build_size=1200
if is-flagq '-g?(gdb)?([1-9])'; then
ewarn "The C++ compiler -g option is known to increase the size of the package"
ewarn "considerably. If you run out of space, please consider removing it."
ewarn
(( build_size *= 10 ))
fi
local CHECKREQS_DISK_BUILD=${build_size}M
check-reqs_pkg_pretend
}
pkg_pretend() {
check_space
}
pkg_setup() {
check_space
}
src_unpack() {
default
rm -f "${S}"/tools/clang "${S}"/projects/compiler-rt \
|| die "symlinks removal failed"
if use clang; then
mv "${WORKDIR}"/cfe-${PV}.src "${S}"/tools/clang \
|| die "clang source directory move failed"
mv "${WORKDIR}"/compiler-rt-3.4 "${S}"/projects/compiler-rt \
|| die "compiler-rt source directory move failed"
fi
}
src_prepare() {
epatch "${WORKDIR}/${P}-patchset"/nodoctargz.patch
epatch "${WORKDIR}/${P}-patchset"/gentoo-install.patch
if use clang; then
# Automatically select active system GCC's libraries, bugs #406163 and #417913
epatch "${WORKDIR}/${P}-patchset"/clang/gentoo-runtime-gcc-detection-v3.patch
epatch "${WORKDIR}/${P}-patchset"/clang/gentoo-install.patch
if [[ ${CHOST} != *-darwin8 ]] ; then
# Darwin8/Tiger-only patch
rm "${WORKDIR}"/${PN}-3.4-patchset-darwin-leopard/0006-* || die
fi
if [[ ${CHOST} == *-darwin8 ]] || [[ ${CHOST} == *-darwin9 ]] ; then
EPATCH_SOURCE="${WORKDIR}"/${PN}-3.4-patchset-darwin-leopard \
EPATCH_SUFFIX=patch EPATCH_FORCE=yes epatch
fi
epatch "${WORKDIR}/${P}-patchset"/clang/darwin_build_fix.patch
epatch "${WORKDIR}/${P}-patchset"/clang/darwin_prefix-include-paths.patch
eprefixify tools/clang/lib/Frontend/InitHeaderSearch.cpp
if use prefix ; then
sed -i -e "/^CFLAGS /s@-Werror@-I${EPREFIX}/usr/include@" \
projects/compiler-rt/make/platform/clang_*.mk || die
fi
if [[ ${CHOST} == powerpc*-apple-darwin* ]] ; then
# set ppc as arch for compiler_rt
local arch=${CHOST%%-*}
sed -i -e '/^UniversalArchs/s/:=.*$/:= '${arch/ower/}'/' \
projects/compiler-rt/make/platform/clang_darwin*.mk || die
fi
fi
local sub_files=(
Makefile.config.in
Makefile.rules
tools/llvm-config/llvm-config.cpp
)
use clang && sub_files+=(
tools/clang/lib/Driver/Tools.cpp
tools/clang/tools/scan-build/scan-build
)
# unfortunately ./configure won't listen to --mandir and the-like, so take
# care of this.
# note: we're setting the main libdir intentionally.
# where per-ABI is appropriate, we use $(GENTOO_LIBDIR) make.
einfo "Fixing install dirs"
sed -e "s,@libdir@,$(get_libdir),g" \
-e "s,@PF@,${PF},g" \
-e "s,@EPREFIX@,${EPREFIX},g" \
-i "${sub_files[@]}" \
|| die "install paths sed failed"
if use clang; then
# constantly fails for a long time, likely due to our patches
rm tools/clang/test/Driver/cross-linux.c || die
fi
# User patches
epatch_user
python_setup
}
src_configure() {
# disable timestamps since they confuse ccache
local conf_flags=(
--disable-timestamps
--enable-keep-symbols
--enable-shared
--with-optimize-option=
--enable-optimized
--disable-assertions
--disable-expensive-checks
--disable-terminfo
$(use_enable libffi)
--enable-bindings=none
--enable-targets=host
ac_cv_prog_XML2CONFIG=""
)
if use libffi; then
local CPPFLAGS=${CPPFLAGS}
append-cppflags "$($(tc-getPKG_CONFIG) --cflags libffi)"
fi
# llvm prefers clang over gcc, so we may need to force that
tc-export CC CXX
ECONF_SOURCE=${S} \
econf "${conf_flags[@]}"
}
src_compile() {
LLVM_MAKEARGS=(
VERBOSE=1
REQUIRES_RTTI=1
GENTOO_LIBDIR=$(get_libdir)
)
emake "${LLVM_MAKEARGS[@]}"
pax-mark m Release/bin/llvm-rtdyld
pax-mark m Release/bin/lli
pax-mark m Release/bin/lli-child-target
}
src_install() {
emake "${LLVM_MAKEARGS[@]}" DESTDIR="${D}" install
if ! use clang; then
rm "${WORKDIR}"/${PN}-3.4-manpages/clang.1 || die
else
for tool in clang{,++} ; do
dosym ${tool} /usr/bin/${CHOST}-${tool}
done
fi
doman "${WORKDIR}"/${PN}-3.4-manpages/*.1
# Fix install_names on Darwin. The build system is too complicated
# to just fix this, so we correct it post-install
local lib= f= odylib= ndylib= libpv=${PV}
if [[ ${CHOST} == *-darwin* ]] ; then
eval $(grep PACKAGE_VERSION= configure)
[[ -n ${PACKAGE_VERSION} ]] && libpv=${PACKAGE_VERSION}
libpvminor=${libpv%.[0-9]*}
for lib in lib{EnhancedDisassembly,LLVM-${libpv},LTO,profile_rt,clang}.dylib LLVMHello.dylib BugpointPasses.dylib clang/${libpv}/lib/darwin/libclang_rt.asan_{osx,iossim}_dynamic.dylib; do
# libEnhancedDisassembly is Darwin10 only, so non-fatal
# + omit clang libs if not enabled
[[ -f ${ED}/usr/lib/${lib} ]] || continue
ebegin "fixing install_name of $lib"
install_name_tool \
-id "${EPREFIX}"/usr/lib/${lib} \
"${ED}"/usr/lib/${lib}
eend $?
done
for f in "${ED}"/usr/bin/* "${ED}"/usr/lib/lib*.dylib "${ED}"/usr/lib/clang/${libpv}/lib/darwin/*.dylib ; do
# omit clang libs if not enabled
[[ -f "${f}" ]] || continue
scanmacho -BF'%n#f' "${f}" | tr ',' '\n' | \
while read odylib ; do
ndylib=
case ${odylib} in
*/libclang.dylib)
ndylib="${EPREFIX}"/usr/lib/libclang.dylib
;;
*/libLLVM-${libpv}.dylib)
ndylib="${EPREFIX}"/usr/lib/libLLVM-${libpv}.dylib
;;
*/libLLVM-${libpvminor}.dylib)
ndylib="${EPREFIX}"/usr/lib/libLLVM-${libpvminor}.dylib
;;
*/libLTO.dylib)
ndylib="${EPREFIX}"/usr/lib/libLTO.dylib
;;
esac
if [[ -n ${ndylib} ]] ; then
ebegin "fixing install_name reference to ${odylib} of ${f##*/}"
install_name_tool \
-change "${odylib}" "${ndylib}" \
"${f}"
eend $?
fi
done
done
fi
}

View File

@@ -1,276 +0,0 @@
# Copyright 1999-2017 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
EAPI=5
PYTHON_COMPAT=( python2_7 )
inherit eutils check-reqs flag-o-matic multilib pax-utils prefix \
python-any-r1 toolchain-funcs
DESCRIPTION="Low Level Virtual Machine"
HOMEPAGE="https://llvm.org/"
SRC_URI="https://llvm.org/releases/${PV}/${P}.src.tar.xz
clang? ( https://llvm.org/releases/${PV}/compiler-rt-${PV}.src.tar.xz
https://llvm.org/releases/${PV}/cfe-${PV}.src.tar.xz )
https://dev.gentoo.org/~voyageur/distfiles/${PN}-3.5.0-manpages.tar.bz2
https://dev.gentoo.org/~mgorny/dist/llvm/${P}-patchset.tar.gz"
# Additional licenses:
# 1. OpenBSD regex: Henry Spencer's license ('rc' in Gentoo) + BSD.
# 2. ARM backend: LLVM Software Grant by ARM.
# 3. MD5 code: public-domain.
# 4. autoconf (not installed): some undefined M.I.T. license.
# 5. Tests (not installed):
# a. gtest: BSD.
# b. YAML tests: MIT.
LICENSE="UoI-NCSA rc BSD public-domain"
SLOT="0/3.5"
KEYWORDS="~ppc-macos ~x64-macos ~x86-macos"
IUSE="clang +libffi"
COMMON_DEPEND="
sys-libs/zlib:0=
libffi? ( >=virtual/libffi-3.0.13-r1:0= )"
# configparser-3.2 breaks the build (3.3 or none at all are fine)
DEPEND="${COMMON_DEPEND}
app-arch/xz-utils
dev-lang/perl
>=sys-devel/make-3.81
>=sys-devel/flex-2.5.4
>=sys-devel/bison-1.875d
|| ( >=sys-devel/gcc-apple-4.2.1 >=sys-devel/llvm-3.3 )
>=sys-devel/binutils-apple-5.1
libffi? ( virtual/pkgconfig )
!!<dev-python/configparser-3.3.0.2
${PYTHON_DEPS}"
RDEPEND="${COMMON_DEPEND}
clang? ( !<=sys-devel/clang-${PV}-r99
!>=sys-devel/clang-9999 )"
PDEPEND="clang? ( =sys-devel/clang-${PV}-r100 )"
S=${WORKDIR}/${P}.src
check_space() {
# in megs
# !clang !debug !multitarget -O2 400
# !clang !debug multitarget -O2 550
# clang !debug !multitarget -O2 950
# clang !debug multitarget -O2 1200
# !clang debug multitarget -O2 5G
# clang !debug multitarget -O0 -g 12G
# clang debug multitarget -O2 16G
# clang debug multitarget -O0 -g 14G
local build_size=550
use clang && build_size=1200
if is-flagq '-g?(gdb)?([1-9])'; then
ewarn "The C++ compiler -g option is known to increase the size of the package"
ewarn "considerably. If you run out of space, please consider removing it."
ewarn
(( build_size *= 10 ))
fi
local CHECKREQS_DISK_BUILD=${build_size}M
check-reqs_pkg_pretend
if [[ ${MERGE_TYPE} != binary ]]; then
echo 'int main() {return 0;}' > "${T}"/test.cxx || die
ebegin "Trying to build a C++11 test program"
if ! $(tc-getCXX) -std=c++11 -o /dev/null "${T}"/test.cxx; then
eerror "LLVM-${PV} requires C++11-capable C++ compiler. Your current compiler"
eerror "does not seem to support -std=c++11 option. Please upgrade your compiler"
eerror "to gcc-4.7 or an equivalent version supporting C++11."
die "Currently active compiler does not support -std=c++11"
fi
eend ${?}
fi
}
pkg_pretend() {
check_space
}
pkg_setup() {
check_space
}
src_unpack() {
default
rm -f "${S}"/tools/clang "${S}"/projects/compiler-rt \
|| die "symlinks removal failed"
if use clang; then
mv "${WORKDIR}"/cfe-${PV}.src "${S}"/tools/clang \
|| die "clang source directory move failed"
mv "${WORKDIR}"/compiler-rt-${PV}.src "${S}"/projects/compiler-rt \
|| die "compiler-rt source directory move failed"
fi
}
src_prepare() {
epatch "${WORKDIR}/${P}-patchset"/nodoctargz.patch
epatch "${WORKDIR}/${P}-patchset"/gcc-4.9.patch
epatch "${WORKDIR}/${P}-patchset"/gentoo-install.patch
epatch "${WORKDIR}/${P}-patchset"/gcc-5.1.patch
if use clang; then
# Automatically select active system GCC's libraries, bugs #406163 and #417913
epatch "${WORKDIR}/${P}-patchset"/clang/gentoo-runtime-gcc-detection-v3.patch
epatch "${WORKDIR}/${P}-patchset"/clang/gentoo-install.patch
epatch "${WORKDIR}/${P}-patchset"/clang/darwin_prefix-include-paths.patch
eprefixify tools/clang/lib/Frontend/InitHeaderSearch.cpp
fi
if use prefix && use clang; then
sed -i -e "/^CFLAGS /s@-Werror@-I${EPREFIX}/usr/include@" \
projects/compiler-rt/make/platform/clang_*.mk || die
fi
# disable use of SDK on OSX, bug #568758
sed -i -e 's/xcrun/false/' utils/lit/lit/util.py || die
local sub_files=(
Makefile.config.in
Makefile.rules
tools/llvm-config/llvm-config.cpp
)
use clang && sub_files+=(
tools/clang/lib/Driver/Tools.cpp
tools/clang/tools/scan-build/scan-build
)
# unfortunately ./configure won't listen to --mandir and the-like, so take
# care of this.
# note: we're setting the main libdir intentionally.
# where per-ABI is appropriate, we use $(GENTOO_LIBDIR) make.
einfo "Fixing install dirs"
sed -e "s,@libdir@,$(get_libdir),g" \
-e "s,@PF@,${PF},g" \
-e "s,@EPREFIX@,${EPREFIX},g" \
-i "${sub_files[@]}" \
|| die "install paths sed failed"
if use clang; then
# constantly fails for a long time, likely due to our patches
rm tools/clang/test/Driver/cross-linux.c || die
fi
# User patches
epatch_user
python_setup
}
src_configure() {
# disable timestamps since they confuse ccache
local conf_flags=(
--disable-timestamps
--enable-keep-symbols
--enable-shared
--with-optimize-option=
--enable-optimized
--disable-assertions
--disable-expensive-checks
--disable-libedit
--disable-terminfo
$(use_enable libffi)
--enable-bindings=none
--enable-targets=host
ac_cv_prog_XML2CONFIG=""
)
if use libffi; then
local CPPFLAGS=${CPPFLAGS}
append-cppflags "$($(tc-getPKG_CONFIG) --cflags libffi)"
fi
# llvm prefers clang over gcc, so we may need to force that
tc-export CC CXX
ECONF_SOURCE=${S} \
econf "${conf_flags[@]}"
}
src_compile() {
LLVM_MAKEARGS=(
VERBOSE=1
REQUIRES_RTTI=1
GENTOO_LIBDIR=$(get_libdir)
)
emake "${LLVM_MAKEARGS[@]}"
pax-mark m Release/bin/llvm-rtdyld
pax-mark m Release/bin/lli
pax-mark m Release/bin/lli-child-target
}
src_install() {
emake "${LLVM_MAKEARGS[@]}" DESTDIR="${D}" install
if ! use clang; then
rm "${WORKDIR}"/${PN}-3.5.0-manpages/clang.1 || die
else
for tool in clang{,++} ; do
dosym ${tool} /usr/bin/${CHOST}-${tool}
done
fi
doman "${WORKDIR}"/${PN}-3.5.0-manpages/*.1
# Fix install_names on Darwin. The build system is too complicated
# to just fix this, so we correct it post-install
local lib= f= odylib= ndylib= libpv=${PV}
if [[ ${CHOST} == *-darwin* ]] ; then
eval $(grep PACKAGE_VERSION= configure)
[[ -n ${PACKAGE_VERSION} ]] && libpv=${PACKAGE_VERSION}
libpvminor=${libpv%.[0-9]*}
for lib in lib{EnhancedDisassembly,LLVM-${libpv},LTO,profile_rt,clang}.dylib LLVMHello.dylib clang/${libpv}/lib/darwin/libclang_rt.asan_{osx,iossim}_dynamic.dylib; do
# libEnhancedDisassembly is Darwin10 only, so non-fatal
# + omit clang libs if not enabled
[[ -f ${ED}/usr/lib/${lib} ]] || continue
ebegin "fixing install_name of $lib"
install_name_tool \
-id "${EPREFIX}"/usr/lib/${lib} \
"${ED}"/usr/lib/${lib}
eend $?
done
for f in "${ED}"/usr/bin/* "${ED}"/usr/lib/lib*.dylib "${ED}"/usr/lib/clang/${libpv}/lib/darwin/*.dylib ; do
# omit clang libs if not enabled
[[ -f "${f}" ]] || continue
scanmacho -BF'%n#f' "${f}" | tr ',' '\n' | \
while read odylib ; do
ndylib=
case ${odylib} in
*/libclang.dylib)
ndylib="${EPREFIX}"/usr/lib/libclang.dylib
;;
*/libLLVM-${libpv}.dylib)
ndylib="${EPREFIX}"/usr/lib/libLLVM-${libpv}.dylib
;;
*/libLLVM-${libpvminor}.dylib)
ndylib="${EPREFIX}"/usr/lib/libLLVM-${libpvminor}.dylib
;;
*/libLTO.dylib)
ndylib="${EPREFIX}"/usr/lib/libLTO.dylib
;;
esac
if [[ -n ${ndylib} ]] ; then
ebegin "fixing install_name reference to ${odylib} of ${f##*/}"
install_name_tool \
-change "${odylib}" "${ndylib}" \
"${f}"
eend $?
fi
done
done
fi
}

View File

@@ -1,280 +0,0 @@
# Copyright 1999-2017 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
EAPI=5
PYTHON_COMPAT=( python2_7 )
inherit eutils check-reqs flag-o-matic multilib pax-utils prefix \
python-any-r1 toolchain-funcs
DESCRIPTION="Low Level Virtual Machine"
HOMEPAGE="https://llvm.org/"
SRC_URI="https://llvm.org/releases/${PV}/${P}.src.tar.xz
clang? ( https://llvm.org/releases/${PV}/compiler-rt-${PV}.src.tar.xz
https://llvm.org/releases/${PV}/cfe-${PV}.src.tar.xz )
https://dev.gentoo.org/~voyageur/distfiles/${PN}-3.6.1-manpages.tar.bz2
https://dev.gentoo.org/~mgorny/dist/llvm/${P}-patchset.tar.gz"
# Additional licenses:
# 1. OpenBSD regex: Henry Spencer's license ('rc' in Gentoo) + BSD.
# 2. ARM backend: LLVM Software Grant by ARM.
# 3. MD5 code: public-domain.
# 4. autoconf (not installed): some undefined M.I.T. license.
# 5. Tests (not installed):
# a. gtest: BSD.
# b. YAML tests: MIT.
LICENSE="UoI-NCSA rc BSD public-domain"
SLOT="0/3.6"
KEYWORDS="~ppc-macos ~x64-macos ~x86-macos"
IUSE="clang +libffi"
COMMON_DEPEND="
sys-libs/zlib:0=
libffi? ( >=virtual/libffi-3.0.13-r1:0= )"
# configparser-3.2 breaks the build (3.3 or none at all are fine)
DEPEND="${COMMON_DEPEND}
app-arch/xz-utils
dev-lang/perl
>=sys-devel/make-3.81
>=sys-devel/flex-2.5.4
>=sys-devel/bison-1.875d
|| ( >=sys-devel/gcc-apple-4.2.1 >=sys-devel/llvm-3.3 )
>=sys-devel/binutils-apple-5.1
libffi? ( virtual/pkgconfig )
!!<dev-python/configparser-3.3.0.2
${PYTHON_DEPS}"
RDEPEND="${COMMON_DEPEND}
clang? ( !<=sys-devel/clang-${PV}-r99
!>=sys-devel/clang-9999 )"
PDEPEND="clang? ( =sys-devel/clang-${PV}-r100 )"
S=${WORKDIR}/${P}.src
check_space() {
# in megs
# !clang !debug !multitarget -O2 400
# !clang !debug multitarget -O2 550
# clang !debug !multitarget -O2 950
# clang !debug multitarget -O2 1200
# !clang debug multitarget -O2 5G
# clang !debug multitarget -O0 -g 12G
# clang debug multitarget -O2 16G
# clang debug multitarget -O0 -g 14G
local build_size=550
use clang && build_size=1200
if is-flagq '-g?(gdb)?([1-9])'; then
ewarn "The C++ compiler -g option is known to increase the size of the package"
ewarn "considerably. If you run out of space, please consider removing it."
ewarn
(( build_size *= 10 ))
fi
local CHECKREQS_DISK_BUILD=${build_size}M
check-reqs_pkg_pretend
if [[ ${MERGE_TYPE} != binary ]]; then
echo 'int main() {return 0;}' > "${T}"/test.cxx || die
ebegin "Trying to build a C++11 test program"
if ! $(tc-getCXX) -std=c++11 -o /dev/null "${T}"/test.cxx; then
eerror "LLVM-${PV} requires C++11-capable C++ compiler. Your current compiler"
eerror "does not seem to support -std=c++11 option. Please upgrade your compiler"
eerror "to gcc-4.7 or an equivalent version supporting C++11."
die "Currently active compiler does not support -std=c++11"
fi
eend ${?}
fi
}
pkg_pretend() {
check_space
}
pkg_setup() {
check_space
}
src_unpack() {
default
rm -f "${S}"/tools/clang "${S}"/projects/compiler-rt \
|| die "symlinks removal failed"
if use clang; then
mv "${WORKDIR}"/cfe-${PV/_}.src "${S}"/tools/clang \
|| die "clang source directory move failed"
mv "${WORKDIR}"/compiler-rt-${PV/_}.src "${S}"/projects/compiler-rt \
|| die "compiler-rt source directory move failed"
fi
}
src_prepare() {
epatch "${WORKDIR}/${P}-patchset"/nodoctargz.patch
epatch "${WORKDIR}/${P}-patchset"/gcc-4.9.patch
epatch "${WORKDIR}/${P}-patchset"/gentoo-install.patch
if use clang; then
# Automatically select active system GCC's libraries, bugs #406163 and #417913
epatch "${WORKDIR}/${P}-patchset"/clang/gentoo-runtime-gcc-detection-v3.patch
epatch "${WORKDIR}/${P}-patchset"/clang/gentoo-install.patch
epatch "${WORKDIR}/${P}-patchset"/clang/darwin_prefix-include-paths.patch
eprefixify tools/clang/lib/Frontend/InitHeaderSearch.cpp
# Fix build fails with using gcc-4.9 on Gentoo/FreeBSD, bug #548444
epatch "${WORKDIR}/${P}-patchset"/clang/fbsd-gcc49.patch
fi
if use prefix && use clang; then
sed -i -e "/^CFLAGS /s@-Werror@-I${EPREFIX}/usr/include@" \
projects/compiler-rt/make/platform/clang_*.mk || die
fi
# disable use of SDK on OSX, bug #568758
sed -i -e 's/xcrun/false/' utils/lit/lit/util.py || die
local sub_files=(
Makefile.config.in
Makefile.rules
tools/llvm-config/llvm-config.cpp
)
use clang && sub_files+=(
tools/clang/lib/Driver/Tools.cpp
tools/clang/tools/scan-build/scan-build
)
# unfortunately ./configure won't listen to --mandir and the-like, so take
# care of this.
# note: we're setting the main libdir intentionally.
# where per-ABI is appropriate, we use $(GENTOO_LIBDIR) make.
einfo "Fixing install dirs"
sed -e "s,@libdir@,$(get_libdir),g" \
-e "s,@PF@,${PF},g" \
-e "s,@EPREFIX@,${EPREFIX},g" \
-i "${sub_files[@]}" \
|| die "install paths sed failed"
if use clang; then
# constantly fails for a long time, likely due to our patches
rm tools/clang/test/Driver/cross-linux.c || die
fi
# User patches
epatch_user
python_setup
}
src_configure() {
# disable timestamps since they confuse ccache
local conf_flags=(
--disable-timestamps
--enable-keep-symbols
--enable-shared
--with-optimize-option=
--enable-optimized
--disable-assertions
--disable-expensive-checks
--disable-libedit
--disable-terminfo
$(use_enable libffi)
--enable-bindings=none
--enable-targets=host
ac_cv_prog_XML2CONFIG=""
)
if use libffi; then
local CPPFLAGS=${CPPFLAGS}
append-cppflags "$($(tc-getPKG_CONFIG) --cflags libffi)"
fi
# Enable large file support, bug #550708
append-lfs-flags
# llvm prefers clang over gcc, so we may need to force that
tc-export CC CXX
ECONF_SOURCE=${S} \
econf "${conf_flags[@]}"
}
src_compile() {
LLVM_MAKEARGS=(
VERBOSE=1
REQUIRES_RTTI=1
GENTOO_LIBDIR=$(get_libdir)
)
emake "${LLVM_MAKEARGS[@]}"
pax-mark m Release/bin/llvm-rtdyld
pax-mark m Release/bin/lli
pax-mark m Release/bin/lli-child-target
}
src_install() {
emake "${LLVM_MAKEARGS[@]}" DESTDIR="${D}" install
if ! use clang; then
rm "${WORKDIR}"/${PN}-3.6.1-manpages/clang.1 || die
else
for tool in clang{,++} ; do
dosym ${tool} /usr/bin/${CHOST}-${tool}
done
fi
doman "${WORKDIR}"/${PN}-3.6.1-manpages/*.1
# Fix install_names on Darwin. The build system is too complicated
# to just fix this, so we correct it post-install
local lib= f= odylib= ndylib= libpv=${PV}
if [[ ${CHOST} == *-darwin* ]] ; then
eval $(grep PACKAGE_VERSION= configure)
[[ -n ${PACKAGE_VERSION} ]] && libpv=${PACKAGE_VERSION}
libpvminor=${libpv%.[0-9]*}
for lib in lib{EnhancedDisassembly,LLVM-${libpv},LTO,profile_rt,clang}.dylib LLVMHello.dylib clang/${libpv}/lib/darwin/libclang_rt.asan_{osx,iossim}_dynamic.dylib; do
# libEnhancedDisassembly is Darwin10 only, so non-fatal
# + omit clang libs if not enabled
[[ -f ${ED}/usr/lib/${lib} ]] || continue
ebegin "fixing install_name of $lib"
install_name_tool \
-id "${EPREFIX}"/usr/lib/${lib} \
"${ED}"/usr/lib/${lib}
eend $?
done
for f in "${ED}"/usr/bin/* "${ED}"/usr/lib/lib*.dylib "${ED}"/usr/lib/clang/${libpv}/lib/darwin/*.dylib ; do
# omit clang libs if not enabled
[[ -f "${f}" ]] || continue
scanmacho -BF'%n#f' "${f}" | tr ',' '\n' | \
while read odylib ; do
ndylib=
case ${odylib} in
*/libclang.dylib)
ndylib="${EPREFIX}"/usr/lib/libclang.dylib
;;
*/libLLVM-${libpv}.dylib)
ndylib="${EPREFIX}"/usr/lib/libLLVM-${libpv}.dylib
;;
*/libLLVM-${libpvminor}.dylib)
ndylib="${EPREFIX}"/usr/lib/libLLVM-${libpvminor}.dylib
;;
*/libLTO.dylib)
ndylib="${EPREFIX}"/usr/lib/libLTO.dylib
;;
esac
if [[ -n ${ndylib} ]] ; then
ebegin "fixing install_name reference to ${odylib} of ${f##*/}"
install_name_tool \
-change "${odylib}" "${ndylib}" \
"${f}"
eend $?
fi
done
done
fi
}

View File

@@ -1,559 +0,0 @@
# Copyright 1999-2018 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
EAPI=6
: ${CMAKE_MAKEFILE_GENERATOR:=ninja}
PYTHON_COMPAT=( python2_7 )
inherit check-reqs cmake-utils eutils flag-o-matic multilib \
multilib-minimal python-single-r1 toolchain-funcs pax-utils prefix
DESCRIPTION="Low Level Virtual Machine"
HOMEPAGE="https://llvm.org/"
SRC_URI="https://llvm.org/releases/${PV}/${P}.src.tar.xz
clang? ( https://llvm.org/releases/${PV}/compiler-rt-${PV}.src.tar.xz
https://llvm.org/releases/${PV}/cfe-${PV}.src.tar.xz
https://llvm.org/releases/${PV}/clang-tools-extra-${PV}.src.tar.xz )
lldb? ( https://llvm.org/releases/${PV}/lldb-${PV}.src.tar.xz )
!doc? ( https://dev.gentoo.org/~voyageur/distfiles/${PN}-3.7.0-manpages.tar.bz2 )
https://dev.gentoo.org/~mgorny/dist/llvm/${P}-patchset.tar.gz"
# Additional licenses:
# 1. OpenBSD regex: Henry Spencer's license ('rc' in Gentoo) + BSD.
# 2. ARM backend: LLVM Software Grant by ARM.
# 3. MD5 code: public-domain.
# 4. autoconf (not used): some undefined M.I.T. license.
# 5. Tests (not installed):
# a. gtest: BSD.
# b. YAML tests: MIT.
LICENSE="UoI-NCSA rc BSD public-domain
arm? ( LLVM-Grant )
multitarget? ( LLVM-Grant )"
SLOT="0/${PV}"
KEYWORDS="~arm ~ppc-macos ~x64-macos ~x86-macos"
IUSE="clang debug doc gold libedit +libffi lldb multitarget ncurses ocaml
python +static-analyzer test xml video_cards_radeon
kernel_Darwin"
COMMON_DEPEND="
sys-libs/zlib:0=
clang? (
python? ( ${PYTHON_DEPS} )
static-analyzer? (
dev-lang/perl:*
${PYTHON_DEPS}
)
xml? ( dev-libs/libxml2:2=[${MULTILIB_USEDEP}] )
)
gold? ( >=sys-devel/binutils-2.22:*[cxx] )
libedit? ( dev-libs/libedit:0=[${MULTILIB_USEDEP}] )
libffi? ( >=virtual/libffi-3.0.13-r1:0=[${MULTILIB_USEDEP}] )
ncurses? ( >=sys-libs/ncurses-5.9-r3:0=[${MULTILIB_USEDEP}] )
ocaml? (
>=dev-lang/ocaml-4.00.0:0=
dev-ml/findlib
dev-ml/ocaml-ctypes
!!<=sys-devel/llvm-3.7.0-r1[ocaml] )"
# configparser-3.2 breaks the build (3.3 or none at all are fine)
DEPEND="${COMMON_DEPEND}
dev-lang/perl
>=sys-devel/make-3.81
>=sys-devel/flex-2.5.4
>=sys-devel/bison-1.875d
|| ( >=sys-devel/gcc-3.0 >=sys-devel/llvm-3.5
( >=sys-freebsd/freebsd-lib-9.1-r10 sys-libs/libcxx )
)
|| ( >=sys-devel/binutils-2.18 >=sys-devel/binutils-apple-5.1 )
clang? ( xml? ( virtual/pkgconfig ) )
doc? ( dev-python/sphinx )
gold? ( sys-libs/binutils-libs )
libffi? ( virtual/pkgconfig )
lldb? ( dev-lang/swig )
!!<dev-python/configparser-3.3.0.2
ocaml? ( test? ( dev-ml/ounit ) )
${PYTHON_DEPS}"
RDEPEND="${COMMON_DEPEND}
clang? ( !<=sys-devel/clang-${PV}-r99 )"
PDEPEND="clang? ( =sys-devel/clang-${PV}-r100 )
kernel_Darwin? ( =sys-libs/libcxx-${PV}* )"
# pypy gives me around 1700 unresolved tests due to open file limit
# being exceeded. probably GC does not close them fast enough.
REQUIRED_USE="${PYTHON_REQUIRED_USE}
lldb? ( clang xml )"
S=${WORKDIR}/${P/_}.src
check_space() {
# in megs
# !clang !debug !multitarget -O2 400
# !clang !debug multitarget -O2 550
# clang !debug !multitarget -O2 950
# clang !debug multitarget -O2 1200
# !clang debug multitarget -O2 5G
# clang !debug multitarget -O0 -g 12G
# clang debug multitarget -O2 16G
# clang debug multitarget -O0 -g 14G
local build_size=550
use clang && build_size=1200
if use debug; then
ewarn "USE=debug is known to increase the size of package considerably"
ewarn "and cause the tests to fail."
ewarn
(( build_size *= 14 ))
elif is-flagq '-g?(gdb)?([1-9])'; then
ewarn "The C++ compiler -g option is known to increase the size of the package"
ewarn "considerably. If you run out of space, please consider removing it."
ewarn
(( build_size *= 10 ))
fi
# Multiply by number of ABIs :).
local abis=( $(multilib_get_enabled_abis) )
(( build_size *= ${#abis[@]} ))
local CHECKREQS_DISK_BUILD=${build_size}M
check-reqs_pkg_pretend
}
pkg_pretend() {
check_space
}
pkg_setup() {
check_space
}
src_unpack() {
default
if use clang; then
mv "${WORKDIR}"/cfe-${PV/_}.src "${S}"/tools/clang \
|| die "clang source directory move failed"
mv "${WORKDIR}"/compiler-rt-${PV/_}.src "${S}"/projects/compiler-rt \
|| die "compiler-rt source directory move failed"
mv "${WORKDIR}"/clang-tools-extra-${PV/_}.src "${S}"/tools/clang/tools/extra \
|| die "clang-tools-extra source directory move failed"
fi
if use lldb; then
mv "${WORKDIR}"/lldb-${PV/_}.src "${S}"/tools/lldb \
|| die "lldb source directory move failed"
fi
}
src_prepare() {
python_setup
# Make ocaml warnings non-fatal, bug #537308
sed -e "/RUN/s/-warn-error A//" -i test/Bindings/OCaml/*ml || die
# Fix libdir for ocaml bindings install, bug #559134
eapply "${WORKDIR}/${P}-patchset"/0001-cmake-Install-OCaml-modules-into-correct-package-loc.patch
# Do not build/install ocaml docs with USE=-doc, bug #562008
eapply "${WORKDIR}/${P}-patchset"/0002-cmake-Make-OCaml-docs-dependent-on-LLVM_BUILD_DOCS.patch
# Make it possible to override Sphinx HTML install dirs
# https://llvm.org/bugs/show_bug.cgi?id=23780
eapply "${WORKDIR}/${P}-patchset"/0003-cmake-Support-overriding-Sphinx-HTML-doc-install-dir.patch
# Prevent race conditions with parallel Sphinx runs
# https://llvm.org/bugs/show_bug.cgi?id=23781
eapply "${WORKDIR}/${P}-patchset"/0004-cmake-Add-an-ordering-dep-between-HTML-man-Sphinx-ta.patch
# Prevent installing libgtest
# https://llvm.org/bugs/show_bug.cgi?id=18341
eapply "${WORKDIR}/${P}-patchset"/0005-cmake-Do-not-install-libgtest.patch
# Fix llvm-config for shared linking, sane flags and return values
# in order:
# - backported r247159 that adds --build-system (needed for later code)
# - backported r252532 that adds better shared linking support
# - our fixes
# - backported r260343 that fixes cross-compilation
# combination of backported upstream r252532 with our patch
# https://bugs.gentoo.org/show_bug.cgi?id=565358
eapply "${WORKDIR}/${P}-patchset"/llvm-config-0.patch
eapply "${WORKDIR}/${P}-patchset"/llvm-config-1.patch
eapply "${WORKDIR}/${P}-patchset"/llvm-config-2.patch
eapply "${WORKDIR}/${P}-patchset"/llvm-config-3.patch
# Fix msan with newer kernels, #569894
eapply "${WORKDIR}/${P}-patchset"/msan-fix.patch
# disable use of SDK on OSX, bug #568758
sed -i -e 's/xcrun/false/' utils/lit/lit/util.py || die
if use clang; then
# Automatically select active system GCC's libraries, bugs #406163 and #417913
eapply "${WORKDIR}/${P}-patchset"/clang/gentoo-runtime-gcc-detection-v3.patch
# Support gcc4.9 search paths
# https://github.com/llvm-mirror/clang/commit/af4db76e059c1a3
eapply "${WORKDIR}/${P}-patchset"/clang/gcc4.9-search-path.patch
eapply "${WORKDIR}/${P}-patchset"/clang/gentoo-install.patch
eapply "${WORKDIR}/${P}-patchset"/clang/darwin_prefix-include-paths.patch
eprefixify tools/clang/lib/Frontend/InitHeaderSearch.cpp
# Fix -isystem support in ccc-analyzer
eapply "${WORKDIR}/${P}-patchset"/clang/ccc-analyzer-isystem.patch
sed -i -e "s^@EPREFIX@^${EPREFIX}^" \
tools/clang/tools/scan-build/scan-build || die
# Install clang runtime into /usr/lib/clang
# https://llvm.org/bugs/show_bug.cgi?id=23792
eapply "${WORKDIR}/${P}-patchset"/clang/0001-Install-clang-runtime-into-usr-lib-without-suffix.patch
eapply "${WORKDIR}/${P}-patchset"/compiler-rt/0001-cmake-Install-compiler-rt-into-usr-lib-without-suffi.patch
# Do not force -march flags on arm platforms
# https://bugs.gentoo.org/show_bug.cgi?id=562706
eapply "${WORKDIR}/${P}-patchset"/compiler-rt/arm_march_flags.patch
# Make it possible to override CLANG_LIBDIR_SUFFIX
# (that is used only to find LLVMgold.so)
# https://llvm.org/bugs/show_bug.cgi?id=23793
eapply "${WORKDIR}/${P}-patchset"/clang/0002-cmake-Make-CLANG_LIBDIR_SUFFIX-overridable.patch
# Fix git-clang-format shebang, bug #562688
python_fix_shebang tools/clang/tools/clang-format/git-clang-format
pushd projects/compiler-rt >/dev/null || die
# Fix msan with newer kernels, compiler-rt part, #569894
eapply "${WORKDIR}/${P}-patchset"/compiler-rt/msan-fix.patch
# Fix WX sections, bug #421527
find lib/builtins -type f -name '*.S' -exec sed \
-e '$a\\n#if defined(__linux__) && defined(__ELF__)\n.section .note.GNU-stack,"",%progbits\n#endif' \
-i {} + || die
popd >/dev/null || die
fi
if use lldb; then
# Do not install dummy readline.so module from
# https://llvm.org/bugs/show_bug.cgi?id=18841
sed -e 's/add_subdirectory(readline)/#&/' \
-i tools/lldb/scripts/Python/modules/CMakeLists.txt || die
# Fix Python paths, bugs #562436 and #562438
eapply "${WORKDIR}/${P}-patchset"/lldb/python.patch
sed -e "s/GENTOO_LIBDIR/$(get_libdir)/" \
-i tools/lldb/scripts/Python/finishSwigPythonLLDB.py || die
# Fix build with ncurses[tinfo], #560474
# https://llvm.org/viewvc/llvm-project?view=revision&revision=247842
eapply "${WORKDIR}/${P}-patchset"/lldb/tinfo.patch
fi
# User patches + QA
cmake-utils_src_prepare
# Native libdir is used to hold LLVMgold.so
NATIVE_LIBDIR=$(get_libdir)
}
multilib_src_configure() {
local targets
if use multitarget; then
targets=all
else
targets='host;BPF;CppBackend'
use video_cards_radeon && targets+=';AMDGPU'
fi
local ffi_cflags ffi_ldflags
if use libffi; then
ffi_cflags=$($(tc-getPKG_CONFIG) --cflags-only-I libffi)
ffi_ldflags=$($(tc-getPKG_CONFIG) --libs-only-L libffi)
fi
local libdir=$(get_libdir)
local mycmakeargs=(
-DLLVM_LIBDIR_SUFFIX=${libdir#lib}
-DBUILD_SHARED_LIBS=ON
-DLLVM_ENABLE_TIMESTAMPS=OFF
-DLLVM_TARGETS_TO_BUILD="${targets}"
-DLLVM_BUILD_TESTS=$(usex test)
-DLLVM_ENABLE_FFI=$(usex libffi)
-DLLVM_ENABLE_TERMINFO=$(usex ncurses)
-DLLVM_ENABLE_ASSERTIONS=$(usex debug)
-DLLVM_ENABLE_EH=ON
-DLLVM_ENABLE_RTTI=ON
-DWITH_POLLY=OFF # TODO
-DLLVM_HOST_TRIPLE="${CHOST}"
-DFFI_INCLUDE_DIR="${ffi_cflags#-I}"
-DFFI_LIBRARY_DIR="${ffi_ldflags#-L}"
-DHAVE_HISTEDIT_H=$(usex libedit)
)
if use clang; then
mycmakeargs+=(
-DCMAKE_DISABLE_FIND_PACKAGE_LibXml2=$(usex !xml)
# libgomp support fails to find headers without explicit -I
# furthermore, it provides only syntax checking
-DCLANG_DEFAULT_OPENMP_RUNTIME=libomp
)
fi
if use lldb; then
mycmakeargs+=(
-DLLDB_DISABLE_LIBEDIT=$(usex !libedit)
-DLLDB_DISABLE_CURSES=$(usex !ncurses)
-DLLDB_ENABLE_TERMINFO=$(usex ncurses)
)
fi
if ! multilib_is_native_abi || ! use ocaml; then
mycmakeargs+=(
-DOCAMLFIND=NO
)
fi
# Note: go bindings have no CMake rules at the moment
# but let's kill the check in case they are introduced
# if ! multilib_is_native_abi || ! use go; then
mycmakeargs+=(
-DGO_EXECUTABLE=GO_EXECUTABLE-NOTFOUND
)
# fi
if multilib_is_native_abi; then
mycmakeargs+=(
-DLLVM_BUILD_DOCS=$(usex doc)
-DLLVM_ENABLE_SPHINX=$(usex doc)
-DLLVM_ENABLE_DOXYGEN=OFF
-DLLVM_INSTALL_HTML="${EPREFIX}/usr/share/doc/${PF}/html"
-DSPHINX_WARNINGS_AS_ERRORS=OFF
-DLLVM_INSTALL_UTILS=ON
)
if use clang; then
mycmakeargs+=(
-DCLANG_INSTALL_HTML="${EPREFIX}/usr/share/doc/${PF}/clang"
)
fi
if use gold; then
mycmakeargs+=(
-DLLVM_BINUTILS_INCDIR="${EPREFIX}"/usr/include
)
fi
if use lldb; then
mycmakeargs+=(
-DLLDB_DISABLE_PYTHON=$(usex !python)
)
fi
else
if use clang; then
mycmakeargs+=(
# disable compiler-rt on non-native ABI because:
# 1. it fails to configure because of -m32
# 2. it is shared between ABIs so no point building
# it multiple times
-DLLVM_EXTERNAL_COMPILER_RT_BUILD=OFF
-DLLVM_EXTERNAL_CLANG_TOOLS_EXTRA_BUILD=OFF
)
fi
if use lldb; then
mycmakeargs+=(
# only run swig on native abi
-DLLDB_DISABLE_PYTHON=ON
)
fi
fi
if use clang; then
mycmakeargs+=(
-DCLANG_ENABLE_ARCMT=$(usex static-analyzer)
-DCLANG_ENABLE_STATIC_ANALYZER=$(usex static-analyzer)
-DCLANG_LIBDIR_SUFFIX="${NATIVE_LIBDIR#lib}"
)
# -- not needed when compiler-rt is built with host compiler --
# cmake passes host C*FLAGS to compiler-rt build
# which is performed using clang, so we need to filter out
# some flags clang does not support
# (if you know some more flags that don't work, let us know)
#filter-flags -msahf -frecord-gcc-switches
fi
cmake-utils_src_configure
}
multilib_src_compile() {
cmake-utils_src_compile
# TODO: not sure why this target is not correctly called
multilib_is_native_abi && use doc && use ocaml && cmake-utils_src_make docs/ocaml_doc
pax-mark m "${BUILD_DIR}"/bin/llvm-rtdyld
pax-mark m "${BUILD_DIR}"/bin/lli
pax-mark m "${BUILD_DIR}"/bin/lli-child-target
if use test; then
pax-mark m "${BUILD_DIR}"/unittests/ExecutionEngine/Orc/OrcJITTests
pax-mark m "${BUILD_DIR}"/unittests/ExecutionEngine/MCJIT/MCJITTests
pax-mark m "${BUILD_DIR}"/unittests/Support/SupportTests
fi
}
multilib_src_test() {
# respect TMPDIR!
local -x LIT_PRESERVES_TMP=1
local test_targets=( check )
# clang tests won't work on non-native ABI because we skip compiler-rt
multilib_is_native_abi && use clang && test_targets+=( check-clang )
cmake-utils_src_make "${test_targets[@]}"
}
src_install() {
local MULTILIB_CHOST_TOOLS=(
/usr/bin/llvm-config
)
local MULTILIB_WRAPPED_HEADERS=(
/usr/include/llvm/Config/config.h
/usr/include/llvm/Config/llvm-config.h
)
if use clang; then
# note: magic applied in multilib_src_install()!
CLANG_VERSION=${PV%.*}
MULTILIB_CHOST_TOOLS+=(
/usr/bin/clang
/usr/bin/clang++
/usr/bin/clang-cl
/usr/bin/clang-${CLANG_VERSION}
/usr/bin/clang++-${CLANG_VERSION}
/usr/bin/clang-cl-${CLANG_VERSION}
)
MULTILIB_WRAPPED_HEADERS+=(
/usr/include/clang/Config/config.h
)
fi
multilib-minimal_src_install
}
multilib_src_install() {
cmake-utils_src_install
if multilib_is_native_abi; then
# Install man pages.
use doc || doman "${WORKDIR}"/${PN}-3.7.0-manpages/*.1
# Symlink the gold plugin.
if use gold; then
dodir "/usr/${CHOST}/binutils-bin/lib/bfd-plugins"
dosym "../../../../$(get_libdir)/LLVMgold.so" \
"/usr/${CHOST}/binutils-bin/lib/bfd-plugins/LLVMgold.so"
fi
fi
# apply CHOST and CLANG_VERSION to clang executables
# they're statically linked so we don't have to worry about the lib
if use clang; then
local clang_tools=( clang clang++ clang-cl )
local i
# cmake gives us:
# - clang-X.Y
# - clang -> clang-X.Y
# - clang++, clang-cl -> clang
# we want to have:
# - clang-X.Y
# - clang++-X.Y, clang-cl-X.Y -> clang-X.Y
# - clang, clang++, clang-cl -> clang*-X.Y
# so we need to fix the two tools
for i in "${clang_tools[@]:1}"; do
rm "${ED%/}/usr/bin/${i}" || die
dosym "clang-${CLANG_VERSION}" "/usr/bin/${i}-${CLANG_VERSION}"
dosym "${i}-${CLANG_VERSION}" "/usr/bin/${i}"
done
# now prepend ${CHOST} and let the multilib-build.eclass symlink it
if ! multilib_is_native_abi; then
# non-native? let's replace it with a simple wrapper
for i in "${clang_tools[@]}"; do
rm "${ED%/}/usr/bin/${i}-${CLANG_VERSION}" || die
cat > "${T}"/wrapper.tmp <<-_EOF_
#!${EPREFIX}/bin/sh
exec "${i}-${CLANG_VERSION}" $(get_abi_CFLAGS) "\${@}"
_EOF_
newbin "${T}"/wrapper.tmp "${i}-${CLANG_VERSION}"
done
fi
fi
}
multilib_src_install_all() {
insinto /usr/share/vim/vimfiles
doins -r utils/vim/*/.
# some users may find it useful
dodoc utils/vim/vimrc
if use clang; then
pushd tools/clang >/dev/null || die
if use static-analyzer ; then
pushd tools/scan-build >/dev/null || die
dobin ccc-analyzer scan-build
dosym ccc-analyzer /usr/bin/c++-analyzer
doman scan-build.1
insinto /usr/share/llvm
doins scanview.css sorttable.js
popd >/dev/null || die
fi
if use static-analyzer ; then
pushd tools/scan-view >/dev/null || die
python_doscript scan-view
touch __init__.py || die
python_moduleinto clang
python_domodule *.py Resources
popd >/dev/null || die
fi
if use python ; then
pushd bindings/python/clang >/dev/null || die
python_moduleinto clang
python_domodule *.py
popd >/dev/null || die
fi
# AddressSanitizer symbolizer (currently separate)
dobin "${S}"/projects/compiler-rt/lib/asan/scripts/asan_symbolize.py
popd >/dev/null || die
python_fix_shebang "${ED}"
if use lldb && use python; then
python_optimize
fi
fi
}

View File

@@ -1,547 +0,0 @@
# Copyright 1999-2018 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
EAPI=6
: ${CMAKE_MAKEFILE_GENERATOR:=ninja}
PYTHON_COMPAT=( python2_7 )
inherit check-reqs cmake-utils eutils flag-o-matic multilib \
multilib-minimal python-single-r1 toolchain-funcs pax-utils prefix
DESCRIPTION="Low Level Virtual Machine"
HOMEPAGE="https://llvm.org/"
SRC_URI="https://llvm.org/releases/${PV}/${P}.src.tar.xz
clang? ( https://llvm.org/releases/${PV}/compiler-rt-${PV}.src.tar.xz
https://llvm.org/releases/${PV}/cfe-${PV}.src.tar.xz
https://llvm.org/releases/${PV}/clang-tools-extra-${PV}.src.tar.xz )
lldb? ( https://llvm.org/releases/${PV}/lldb-${PV}.src.tar.xz )
!doc? ( https://dev.gentoo.org/~mgorny/dist/llvm/${PN}-3.9.0_rc3-manpages.tar.bz2 )
https://dev.gentoo.org/~mgorny/dist/llvm/${P}-patchset.tar.xz"
# Keep in sync with CMakeLists.txt
ALL_LLVM_TARGETS=( AArch64 AMDGPU ARM BPF Hexagon Mips MSP430
NVPTX PowerPC Sparc SystemZ X86 XCore )
ALL_LLVM_TARGETS=( "${ALL_LLVM_TARGETS[@]/#/llvm_targets_}" )
# Additional licenses:
# 1. OpenBSD regex: Henry Spencer's license ('rc' in Gentoo) + BSD.
# 2. ARM backend: LLVM Software Grant by ARM.
# 3. MD5 code: public-domain.
# 4. Tests (not installed):
# a. gtest: BSD.
# b. YAML tests: MIT.
LICENSE="UoI-NCSA rc BSD public-domain
llvm_targets_ARM? ( LLVM-Grant )"
SLOT="0/${PV}"
KEYWORDS="~ppc-macos ~x64-macos ~x86-macos"
IUSE="clang debug default-compiler-rt default-libcxx doc gold libedit +libffi
lldb multitarget ncurses ocaml python +sanitize +static-analyzer test xml
elibc_musl kernel_Darwin kernel_FreeBSD ${ALL_LLVM_TARGETS[*]}"
COMMON_DEPEND="
sys-libs/zlib:0=
clang? (
python? ( ${PYTHON_DEPS} )
static-analyzer? (
dev-lang/perl:*
${PYTHON_DEPS}
)
xml? ( dev-libs/libxml2:2=[${MULTILIB_USEDEP}] )
)
gold? ( >=sys-devel/binutils-2.22:*[cxx] )
libedit? ( dev-libs/libedit:0=[${MULTILIB_USEDEP}] )
libffi? ( >=virtual/libffi-3.0.13-r1:0=[${MULTILIB_USEDEP}] )
lldb? ( dev-python/six[${PYTHON_USEDEP}] )
ncurses? ( >=sys-libs/ncurses-5.9-r3:0=[${MULTILIB_USEDEP}] )
ocaml? (
>=dev-lang/ocaml-4.00.0:0=
dev-ml/ocaml-ctypes:=
!!<=sys-devel/llvm-3.7.0-r1[ocaml] )"
# configparser-3.2 breaks the build (3.3 or none at all are fine)
DEPEND="${COMMON_DEPEND}
dev-lang/perl
>=sys-devel/make-3.81
>=sys-devel/flex-2.5.4
>=sys-devel/bison-1.875d
|| ( >=sys-devel/gcc-3.0 >=sys-devel/llvm-3.5
( >=sys-freebsd/freebsd-lib-9.1-r10 sys-libs/libcxx )
)
|| ( >=sys-devel/binutils-2.18 >=sys-devel/binutils-apple-5.1 )
kernel_Darwin? ( <sys-libs/libcxx-${PV%_rc*}.9999 )
clang? ( xml? ( virtual/pkgconfig ) )
doc? ( dev-python/sphinx )
gold? ( sys-libs/binutils-libs )
libffi? ( virtual/pkgconfig )
lldb? ( dev-lang/swig )
!!<dev-python/configparser-3.3.0.2
ocaml? ( dev-ml/findlib
test? ( dev-ml/ounit ) )
${PYTHON_DEPS}"
RDEPEND="${COMMON_DEPEND}
clang? ( !<=sys-devel/clang-${PV}-r99 )"
PDEPEND="
clang? (
=sys-devel/clang-${PV}-r100
~sys-devel/clang-runtime-${PV}
)
default-libcxx? ( sys-libs/libcxx )
kernel_Darwin? ( =sys-libs/libcxx-${PV%.*}* )"
# pypy gives me around 1700 unresolved tests due to open file limit
# being exceeded. probably GC does not close them fast enough.
REQUIRED_USE="${PYTHON_REQUIRED_USE}
lldb? ( clang xml )
|| ( ${ALL_LLVM_TARGETS[*]} )
multitarget? ( ${ALL_LLVM_TARGETS[*]} )"
S=${WORKDIR}/${P/_}.src
check_space() {
# in megs
# !clang !debug !multitarget -O2 400
# !clang !debug multitarget -O2 550
# clang !debug !multitarget -O2 950
# clang !debug multitarget -O2 1200
# !clang debug multitarget -O2 5G
# clang !debug multitarget -O0 -g 12G
# clang debug multitarget -O2 16G
# clang debug multitarget -O0 -g 14G
local build_size=550
use clang && build_size=1200
if use debug; then
ewarn "USE=debug is known to increase the size of package considerably"
ewarn "and cause the tests to fail."
ewarn
(( build_size *= 14 ))
elif is-flagq '-g?(gdb)?([1-9])'; then
ewarn "The C++ compiler -g option is known to increase the size of the package"
ewarn "considerably. If you run out of space, please consider removing it."
ewarn
(( build_size *= 10 ))
fi
# Multiply by number of ABIs :).
local abis=( $(multilib_get_enabled_abis) )
(( build_size *= ${#abis[@]} ))
local CHECKREQS_DISK_BUILD=${build_size}M
check-reqs_pkg_pretend
}
pkg_pretend() {
check_space
}
pkg_setup() {
check_space
}
src_unpack() {
default
if use clang; then
mv "${WORKDIR}"/cfe-${PV/_}.src "${S}"/tools/clang \
|| die "clang source directory move failed"
mv "${WORKDIR}"/compiler-rt-${PV/_}.src "${S}"/projects/compiler-rt \
|| die "compiler-rt source directory move failed"
mv "${WORKDIR}"/clang-tools-extra-${PV/_}.src "${S}"/tools/clang/tools/extra \
|| die "clang-tools-extra source directory move failed"
fi
if use lldb; then
mv "${WORKDIR}"/lldb-${PV/_}.src "${S}"/tools/lldb \
|| die "lldb source directory move failed"
fi
}
src_prepare() {
python_setup
# Fix libdir for ocaml bindings install, bug #559134
eapply "${WORKDIR}/${P}-patchset"/0001-cmake-Install-OCaml-modules-into-correct-package-loc.patch
# Do not build/install ocaml docs with USE=-doc, bug #562008
eapply "${WORKDIR}/${P}-patchset"/0002-cmake-Make-OCaml-docs-dependent-on-LLVM_BUILD_DOCS.patch
# Make it possible to override Sphinx HTML install dirs
# https://llvm.org/bugs/show_bug.cgi?id=23780
eapply "${WORKDIR}/${P}-patchset"/0003-cmake-Support-overriding-Sphinx-HTML-doc-install-dir.patch
# Prevent race conditions with parallel Sphinx runs
# https://llvm.org/bugs/show_bug.cgi?id=23781
eapply "${WORKDIR}/${P}-patchset"/0004-cmake-Use-separate-doctrees-to-prevent-races-between.patch
# Allow custom cmake build types (like 'Gentoo')
eapply "${WORKDIR}/${P}-patchset"/0006-cmake-Remove-the-CMAKE_BUILD_TYPE-assertion.patch
# Fix llvm-config for shared linking and sane flags
# https://bugs.gentoo.org/show_bug.cgi?id=565358
eapply "${WORKDIR}/${P}-patchset"/llvm-config-r1.patch
# Restore SOVERSIONs for shared libraries
# https://bugs.gentoo.org/show_bug.cgi?id=578392
eapply "${WORKDIR}/${P}-patchset"/0008-cmake-Reintroduce-ldconfig-compatible-SOVERSIONs-on-.patch
# Revert commit breaking AMDGPU
# https://bugs.gentoo.org/show_bug.cgi?id=603858
eapply "${WORKDIR}/${P}-patchset"/0009-Revert-AMDGPU-Fix-an-interaction-between-WQM-and-pol.patch
# support building llvm against musl-libc
use elibc_musl && eapply "${WORKDIR}/${P}-patchset"/musl-fixes.patch
# disable use of SDK on OSX, bug #568758
sed -i -e 's/xcrun/false/' utils/lit/lit/util.py || die
# Workaround, can be compiled with gcc on Gentoo/FreeBSD, bug #578064
use kernel_FreeBSD && tc-is-gcc && append-cppflags "-D_GLIBCXX_USE_C99"
if use clang; then
# Automatically select active system GCC's libraries, bugs #406163 and #417913
eapply "${WORKDIR}/${P}-patchset"/clang/gcc-config.patch
eapply "${WORKDIR}/${P}-patchset"/clang/darwin_prefix-include-paths.patch
eprefixify tools/clang/lib/Frontend/InitHeaderSearch.cpp
eapply "${WORKDIR}/${P}-patchset"/compiler-rt/darwin-default-sysroot.patch
pushd "${S}"/tools/clang >/dev/null || die
# be able to specify default values for -stdlib and -rtlib at build time
eapply "${WORKDIR}/${P}-patchset"/clang/default-libs.patch
popd >/dev/null || die
sed -i -e "s^@EPREFIX@^${EPREFIX}^" \
tools/clang/tools/scan-build/bin/scan-build || die
# Install clang runtime into /usr/lib/clang
# https://llvm.org/bugs/show_bug.cgi?id=23792
eapply "${WORKDIR}/${P}-patchset"/clang/0001-Install-clang-runtime-into-usr-lib-without-suffix.patch
eapply "${WORKDIR}/${P}-patchset"/compiler-rt/0001-cmake-Install-compiler-rt-into-usr-lib-without-suffi.patch
# Make it possible to override CLANG_LIBDIR_SUFFIX
# (that is used only to find LLVMgold.so)
# https://llvm.org/bugs/show_bug.cgi?id=23793
eapply "${WORKDIR}/${P}-patchset"/clang/0002-cmake-Make-CLANG_LIBDIR_SUFFIX-overridable.patch
# Fix git-clang-format shebang, bug #562688
python_fix_shebang tools/clang/tools/clang-format/git-clang-format
pushd projects/compiler-rt >/dev/null || die
# Fix WX sections, bug #421527
find lib/builtins -type f -name '*.S' -exec sed \
-e '$a\\n#if defined(__linux__) && defined(__ELF__)\n.section .note.GNU-stack,"",%progbits\n#endif' \
-i {} + || die
popd >/dev/null || die
fi
if use lldb; then
# Do not install dummy readline.so module from
# https://llvm.org/bugs/show_bug.cgi?id=18841
sed -e 's/add_subdirectory(readline)/#&/' \
-i tools/lldb/scripts/Python/modules/CMakeLists.txt || die
# Do not install bundled six module
eapply "${WORKDIR}/${P}-patchset"/lldb/six.patch
fi
# User patches + QA
cmake-utils_src_prepare
# Native libdir is used to hold LLVMgold.so
NATIVE_LIBDIR=$(get_libdir)
}
multilib_src_configure() {
local ffi_cflags ffi_ldflags
if use libffi; then
ffi_cflags=$($(tc-getPKG_CONFIG) --cflags-only-I libffi)
ffi_ldflags=$($(tc-getPKG_CONFIG) --libs-only-L libffi)
fi
local libdir=$(get_libdir)
local mycmakeargs=(
-DLLVM_LIBDIR_SUFFIX=${libdir#lib}
-DBUILD_SHARED_LIBS=ON
-DLLVM_TARGETS_TO_BUILD="${LLVM_TARGETS// /;}"
-DLLVM_BUILD_TESTS=$(usex test)
-DLLVM_ENABLE_FFI=$(usex libffi)
-DLLVM_ENABLE_TERMINFO=$(usex ncurses)
-DLLVM_ENABLE_ASSERTIONS=$(usex debug)
-DLLVM_ENABLE_EH=ON
-DLLVM_ENABLE_RTTI=ON
-DWITH_POLLY=OFF # TODO
-DLLVM_HOST_TRIPLE="${CHOST}"
-DFFI_INCLUDE_DIR="${ffi_cflags#-I}"
-DFFI_LIBRARY_DIR="${ffi_ldflags#-L}"
-DHAVE_HISTEDIT_H=$(usex libedit)
)
if use clang; then
mycmakeargs+=(
-DCMAKE_DISABLE_FIND_PACKAGE_LibXml2=$(usex !xml)
# libgomp support fails to find headers without explicit -I
# furthermore, it provides only syntax checking
-DCLANG_DEFAULT_OPENMP_RUNTIME=libomp
# override default stdlib and rtlib
-DCLANG_DEFAULT_CXX_STDLIB=$(usex default-libcxx libc++ "")
-DCLANG_DEFAULT_RTLIB=$(usex default-compiler-rt compiler-rt "")
# compiler-rt's test cases depend on sanitizer
-DCOMPILER_RT_BUILD_SANITIZERS=$(usex sanitize)
-DCOMPILER_RT_INCLUDE_TESTS=$(usex sanitize)
)
fi
if use lldb; then
mycmakeargs+=(
-DLLDB_DISABLE_LIBEDIT=$(usex !libedit)
-DLLDB_DISABLE_CURSES=$(usex !ncurses)
-DLLDB_ENABLE_TERMINFO=$(usex ncurses)
)
fi
if ! multilib_is_native_abi || ! use ocaml; then
mycmakeargs+=(
-DOCAMLFIND=NO
)
fi
# Note: go bindings have no CMake rules at the moment
# but let's kill the check in case they are introduced
# if ! multilib_is_native_abi || ! use go; then
mycmakeargs+=(
-DGO_EXECUTABLE=GO_EXECUTABLE-NOTFOUND
)
# fi
if multilib_is_native_abi; then
mycmakeargs+=(
-DLLVM_BUILD_DOCS=$(usex doc)
-DLLVM_ENABLE_SPHINX=$(usex doc)
-DLLVM_ENABLE_DOXYGEN=OFF
-DLLVM_INSTALL_HTML="${EPREFIX}/usr/share/doc/${PF}/html"
-DSPHINX_WARNINGS_AS_ERRORS=OFF
-DLLVM_INSTALL_UTILS=ON
)
if use clang; then
mycmakeargs+=(
-DCLANG_INSTALL_HTML="${EPREFIX}/usr/share/doc/${PF}/clang"
)
fi
if use gold; then
mycmakeargs+=(
-DLLVM_BINUTILS_INCDIR="${EPREFIX}"/usr/include
)
fi
if use lldb; then
mycmakeargs+=(
-DLLDB_DISABLE_PYTHON=$(usex !python)
)
fi
else
if use clang; then
mycmakeargs+=(
# disable compiler-rt on non-native ABI because:
# 1. it fails to configure because of -m32
# 2. it is shared between ABIs so no point building
# it multiple times
-DLLVM_EXTERNAL_COMPILER_RT_BUILD=OFF
-DLLVM_EXTERNAL_CLANG_TOOLS_EXTRA_BUILD=OFF
)
fi
if use lldb; then
mycmakeargs+=(
# only run swig on native abi
-DLLDB_DISABLE_PYTHON=ON
)
fi
fi
if use clang; then
mycmakeargs+=(
-DCLANG_ENABLE_ARCMT=$(usex static-analyzer)
-DCLANG_ENABLE_STATIC_ANALYZER=$(usex static-analyzer)
-DCLANG_LIBDIR_SUFFIX="${NATIVE_LIBDIR#lib}"
)
# -- not needed when compiler-rt is built with host compiler --
# cmake passes host C*FLAGS to compiler-rt build
# which is performed using clang, so we need to filter out
# some flags clang does not support
# (if you know some more flags that don't work, let us know)
#filter-flags -msahf -frecord-gcc-switches
fi
if tc-is-cross-compiler; then
[[ -x "/usr/bin/llvm-tblgen" ]] \
|| die "/usr/bin/llvm-tblgen not found or usable"
mycmakeargs+=(
-DCMAKE_CROSSCOMPILING=ON
-DLLVM_TABLEGEN=/usr/bin/llvm-tblgen
)
if use clang; then
[[ -x "/usr/bin/clang-tblgen" ]] \
|| die "/usr/bin/clang-tblgen not found or usable"
mycmakeargs+=(
-DCLANG_TABLEGEN=/usr/bin/clang-tblgen
)
fi
fi
cmake-utils_src_configure
}
multilib_src_compile() {
cmake-utils_src_compile
# TODO: not sure why this target is not correctly called
multilib_is_native_abi && use doc && use ocaml && cmake-utils_src_make docs/ocaml_doc
pax-mark m "${BUILD_DIR}"/bin/llvm-rtdyld
pax-mark m "${BUILD_DIR}"/bin/lli
pax-mark m "${BUILD_DIR}"/bin/lli-child-target
if use test; then
pax-mark m "${BUILD_DIR}"/unittests/ExecutionEngine/Orc/OrcJITTests
pax-mark m "${BUILD_DIR}"/unittests/ExecutionEngine/MCJIT/MCJITTests
pax-mark m "${BUILD_DIR}"/unittests/Support/SupportTests
fi
# provide a symlink for tests
if [[ $(get_libdir) != lib ]]; then
ln -s "../$(get_libdir)/clang" lib/clang || die
fi
}
multilib_src_test() {
# respect TMPDIR!
local -x LIT_PRESERVES_TMP=1
local test_targets=( check )
# clang tests won't work on non-native ABI because we skip compiler-rt
multilib_is_native_abi && use clang && test_targets+=( check-clang )
cmake-utils_src_make "${test_targets[@]}"
}
src_install() {
local MULTILIB_CHOST_TOOLS=(
/usr/bin/llvm-config
)
local MULTILIB_WRAPPED_HEADERS=(
/usr/include/llvm/Config/config.h
/usr/include/llvm/Config/llvm-config.h
)
if use clang; then
MULTILIB_WRAPPED_HEADERS+=(
/usr/include/clang/Config/config.h
)
fi
multilib-minimal_src_install
if use clang; then
# Apply CHOST and version suffix to clang tools
local clang_version=${PV%.*}
local clang_tools=( clang clang++ clang-cl clang-cpp )
local abi i
# cmake gives us:
# - clang-X.Y
# - clang -> clang-X.Y
# - clang++, clang-cl, clang-cpp -> clang
# we want to have:
# - clang-X.Y
# - clang++-X.Y, clang-cl-X.Y, clang-cpp-X.Y -> clang-X.Y
# - clang, clang++, clang-cl, clang-cpp -> clang*-X.Y
# also in CHOST variant
for i in "${clang_tools[@]:1}"; do
rm -f "${ED%/}/usr/bin/${i}" || die
dosym "clang-${clang_version}" "/usr/bin/${i}-${clang_version}"
dosym "${i}-${clang_version}" "/usr/bin/${i}"
done
# now create target symlinks for all supported ABIs
for abi in $(get_all_abis); do
local abi_chost=$(get_abi_CHOST "${abi}")
for i in "${clang_tools[@]}"; do
dosym "${i}-${clang_version}" \
"/usr/bin/${abi_chost}-${i}-${clang_version}"
dosym "${abi_chost}-${i}-${clang_version}" \
"/usr/bin/${abi_chost}-${i}"
done
done
fi
# Remove unnecessary headers on FreeBSD, bug #417171
if use kernel_FreeBSD && use clang; then
rm "${ED}"usr/lib/clang/${PV}/include/{std,float,iso,limits,tgmath,varargs}*.h || die
fi
}
multilib_src_install() {
cmake-utils_src_install
if multilib_is_native_abi; then
# Symlink the gold plugin.
if use gold; then
dodir "/usr/${CHOST}/binutils-bin/lib/bfd-plugins"
dosym "../../../../$(get_libdir)/LLVMgold.so" \
"/usr/${CHOST}/binutils-bin/lib/bfd-plugins/LLVMgold.so"
fi
fi
}
multilib_src_install_all() {
insinto /usr/share/vim/vimfiles
doins -r utils/vim/*/.
# some users may find it useful
dodoc utils/vim/vimrc
# Install man pages from the prebuilt package
if ! use doc; then
if ! use clang; then
rm "${WORKDIR}"/${PN}-3.9.0_rc3-manpages/{clang,extraclangtools,scan-build}.1 || die
fi
doman "${WORKDIR}"/${PN}-3.9.0_rc3-manpages/*.1
fi
if use clang; then
pushd tools/clang >/dev/null || die
if use python ; then
pushd bindings/python/clang >/dev/null || die
python_moduleinto clang
python_domodule *.py
popd >/dev/null || die
fi
# AddressSanitizer symbolizer (currently separate)
dobin "${S}"/projects/compiler-rt/lib/asan/scripts/asan_symbolize.py
popd >/dev/null || die
python_fix_shebang "${ED}"
if use static-analyzer; then
python_optimize "${ED}"usr/share/scan-view
fi
fi
}

View File

@@ -10,18 +10,11 @@
3. A compiler infrastructure - LLVM is also a collection of source code that implements the language and compilation strategy. The primary components of the LLVM infrastructure are a GCC-based C and C++ front-end, a link-time optimization framework with a growing set of global and interprocedural analyses and transformations, static back-ends for many popular (and some obscure) architectures, a back-end which emits portable C code, and a Just-In-Time compilers for several architectures.
4. LLVM does not imply things that you would expect from a high-level virtual machine. It does not require garbage collection or run-time code generation (In fact, LLVM makes a great static compiler!). Note that optional LLVM components can be used to build high-level virtual machines and other systems that need these services.</longdescription>
<use>
<flag name="clang">Build the clang C/C++ compiler</flag>
<flag name="default-compiler-rt">Use compiler-rt instead of libgcc as the default rtlib for clang</flag>
<flag name="default-libcxx">Use libc++ instead of libstdc++ as the default stdlib for clang</flag>
<flag name="doc">Build and install the HTML documentation and regenerate the man pages</flag>
<flag name="exegesis">Enable performance counter support for llvm-exegesis tool
that can be used to measure host machine instruction characteristics</flag>
<flag name="gold">Build the gold linker plugin</flag>
<flag name="lldb">Build the lldb debugger</flag>
<flag name="multitarget">Build all host targets (default: host only)</flag>
<flag name="ncurses">Support querying terminal properties using ncurses' terminfo</flag>
<flag name="sanitize">Build compiler-rt's sanitizers</flag>
<flag name="static-analyzer">Install the Clang static analyzer (requires USE=clang)</flag>
<flag name="xar">Support dumping LLVM bitcode sections in Mach-O files
(uses <pkg>app-arch/xar</pkg>)</flag>
</use>