@@ -, +, @@ --- sys-devel/llvm/Manifest | 17 + .../clang-3.4-darwin_prefix-include-paths.patch | 18 + .../llvm/files/clang-3.5-gentoo-install.patch | 57 +++ ...clang-3.5-gentoo-runtime-gcc-detection-v3.patch | 42 ++ sys-devel/llvm/files/llvm-3.2-nodoctargz.patch | 45 ++ sys-devel/llvm/files/llvm-3.5-gcc-4.9.patch | 43 ++ sys-devel/llvm/files/llvm-3.5-gentoo-install.patch | 83 ++++ .../llvm/files/llvm-3.5-musl-compiler-rt.patch | 58 +++ sys-devel/llvm/files/llvm-3.5-musl-fixes.patch | 77 +++ sys-devel/llvm/files/llvm-3.5-musl-support.patch | 124 +++++ .../files/llvm-3.5.0-fix_LLVMExports_cmake.patch | 39 ++ sys-devel/llvm/llvm-3.5.0-r99.ebuild | 530 +++++++++++++++++++++ sys-devel/llvm/metadata.xml | 28 ++ 13 files changed, 1161 insertions(+) create mode 100644 sys-devel/llvm/Manifest create mode 100644 sys-devel/llvm/files/clang-3.4-darwin_prefix-include-paths.patch create mode 100644 sys-devel/llvm/files/clang-3.5-gentoo-install.patch create mode 100644 sys-devel/llvm/files/clang-3.5-gentoo-runtime-gcc-detection-v3.patch create mode 100644 sys-devel/llvm/files/llvm-3.2-nodoctargz.patch create mode 100644 sys-devel/llvm/files/llvm-3.5-gcc-4.9.patch create mode 100644 sys-devel/llvm/files/llvm-3.5-gentoo-install.patch create mode 100644 sys-devel/llvm/files/llvm-3.5-musl-compiler-rt.patch create mode 100644 sys-devel/llvm/files/llvm-3.5-musl-fixes.patch create mode 100644 sys-devel/llvm/files/llvm-3.5-musl-support.patch create mode 100644 sys-devel/llvm/files/llvm-3.5.0-fix_LLVMExports_cmake.patch create mode 100644 sys-devel/llvm/llvm-3.5.0-r99.ebuild create mode 100644 sys-devel/llvm/metadata.xml --- a/sys-devel/llvm/Manifest +++ a/sys-devel/llvm/Manifest @@ -0,0 +1,17 @@ +AUX clang-3.4-darwin_prefix-include-paths.patch 710 SHA256 f76311dfc5fa734a3a72fa516f695486595963824d5b6891fd1454d71c27fa0b SHA512 e130d7392b82ffc40ec96c0ee45d53cf032c761e00a7a2382af1f826e2a892b12069a7f5407307e1828fb741e522b8e10728d593d839e1b5648ccf9460feff0e WHIRLPOOL d2b24e224cb90be9615994d64af92b139325b2630cc43851370b8989d0eb7ee8f43ad421e3036041a30ec1fb30c1e3ddaf09d54f461484963a2bd8ea2fba24c6 +AUX clang-3.5-gentoo-install.patch 2166 SHA256 e359a219f2d0d2b88094bbb5ab91fd50d9662686f77e85b7ccfb8d1c4a6fd39d SHA512 07e5b3d4131a7d58577bcb99a82c585258c98a38e71b7e8dda058b467a558471e1ddeec5c9f5492f5d17e280cd4b09e49338e0926dd2534583bc8a2772bce26d WHIRLPOOL 5582b2015b4d3e845a45bfda08c156683df11685170f253f79ccf016f2e771b016d213417d83068f01a41bd8e0148474711cd6f9b7187e758322e9ebb9c390dd +AUX clang-3.5-gentoo-runtime-gcc-detection-v3.patch 1694 SHA256 24691db819d08f87f0144a67900ae6797c0df4d180b55acc5c377d890ac2e72e SHA512 a34f694560ef0c7366ad0dc243a479afc74b6122d624b8681538da69c70d0d1869245a89c61d49add890c5f76134281470f5e75a59e6fc9ac963230fc56fe8e6 WHIRLPOOL 4f4af09e08c7d5af89558e77d0a2a4542f77ae505e9020ca6e48e20ef71c4db6016ed0211b2a303b756994f62949c91c216cc2f81b16ff65c71414d354977c8f +AUX llvm-3.2-nodoctargz.patch 1761 SHA256 e17494aef638d2fe3fb0b669516ffcc9e560161903e1e165de0eecba684c8c1b SHA512 d12a8996d8a1160f7bad4ce3b3a9ddfb2d29d91fc160876c145f9241927b0cf4413f3b29bc2bf291f0421f61a512de8057e8f3d0029a8a09ba3f1d93582723b5 WHIRLPOOL be273271db8293829a63120cfc917711c99d8893cae6f95af2583def735131f629ee67b5a1515df007477f34abeaf5f2729d689eefdc61eb3aae6b1959971507 +AUX llvm-3.5-gcc-4.9.patch 1722 SHA256 c73f64311ff67534b581729b3ef0fecf452b86961c3b668ac2e6b50f1eff0bd2 SHA512 5ad0a742fca3eb9e08a183af9f90370baf85528bba6f3083d19592fe2a704950ca8c6bf9e930f9834255de3fc5832c49a06c9ca29a66e45928d9047abd9ad8ac WHIRLPOOL dac24fcb47d8b094ffa6b4403dbd7604901dd0f5ef6665a882380109584e4de815b2f277e05d44c05e1a3d22a7003075b2b2649f3f614f299b38bc6d594400ae +AUX llvm-3.5-gentoo-install.patch 3204 SHA256 0c97173613505ea92f0aa79d4e04e797f1917fdc33b34daee05752bb52336d53 SHA512 f60b04f1fc7798f7869f3d80e4c163086c398e01b81220d60ccff42be5899fa036d5ab95257933e89e4c5efd04267a09015917c6a617b86b82d7ab4f5d0de221 WHIRLPOOL 81ce5835b9eb1fe1b162f35d6e37762cc8d613e67c5791f078ecd0e354a87eb92e52452bd6e9a7f70953dabea99d197786e87ed64dc802223149b8e97d6de265 +AUX llvm-3.5-musl-compiler-rt.patch 2404 SHA256 992e7be032cac68d05f686ad06bd8d8266f3f176e275322988871f05d69b5213 SHA512 406c7311d2341c8d635999b5276c1e69b0a0b77b15f55cead49239f513c1a5b06dd5023b552d1e4ede544841b6a7543bdd764ba3775dd792309732fc2a9cb056 WHIRLPOOL 5b2dbf6ff8cf39d698feba11e3b994c66623c50bdb5a30beb8e95bff2dd10e1580eb954041baba64784ba1d5b22d88f457f67b83dbef1b418f45214a4e78e88a +AUX llvm-3.5-musl-fixes.patch 3465 SHA256 e7ea600500b948bcf5d3eaad0664039b1cdfb27ece878f176b038a97c86183e5 SHA512 b5c5c6e25d7c15d5a014537e8b77d1f648bd3abb56aa1b1342849235e7887468d0b46031ac00115ee8c1786a1ad4695dee9d43c9d38dbfca8577faeee5db156f WHIRLPOOL f7ede3ed9e8d06aa76eb12c3e23a35629be9d4676aa21017758b25cbf97d1e03534763e2a0008d2b549672b10c326925da5040319f70c0c8d139add8c4eb7661 +AUX llvm-3.5-musl-support.patch 5228 SHA256 3d967be662643016a9e250bd48e70b7e633a73a4293c3328bd53f19007dcf111 SHA512 3b4bfd485ca49a2494c36d10fc6bd57fb437eff2852833af54e178c9f7ac9238eb5061baa5739fb340407326c3a3aa6adeedb3c8e190d6f94dbcc4aa78824ad1 WHIRLPOOL 9838d31b5c8de0cbcf3581dbbf1090654e4111e300ed30b787d67c3f00b8b92b60b97375f6ea1b58d894973b89d3d992a2bd08e232656a56a36f9b435b512cc2 +AUX llvm-3.5.0-fix_LLVMExports_cmake.patch 1563 SHA256 924303a7fa7ee46276eb2984e3e2d9304873df1d63c0d878371cf98b4094aef0 SHA512 8e8c3ae2c8e2bac0d78a7f572ccfae9cfc30e52ffbfa953596c075cf6adc4e5881d2b80cad4d87bbf1de837d88352334bb51a331adc8d8db74354945c036637e WHIRLPOOL b525bbf3a7ade5906e9e35315af1ccb50c4392e1d104c516927a3ab9b627bc3d0fcf41bd0b77093f6743131f801d37d53d1065371e5c86eb4e7d538eb969b3a8 +DIST cfe-3.5.0.src.tar.xz 8233432 SHA256 fc80992e004b06f6c7afb612de1cdaa9ac9d25811c55f94fcf7331d9b81cdb8b SHA512 b26a5e2cd81c150607c23b22fafc0d9c7f12b83b45e476b8e75bf5e99d42be7c98ffeac7349df664f01b00900864a01429860b298e48961861377a4b2daf3e49 WHIRLPOOL 5dd8b6fe97933b74f1668b1d753c16cd3bcd05ccf72aac1283aa449caf93f5ba88ae79e7668f7e79b554e1421549a87af21c86cf92657c1b4d77744165718ce7 +DIST clang-tools-extra-3.5.0.src.tar.xz 216256 SHA256 2981beb378afb5aa5c50ed017720a42a33e77e902c7086ad2d412ef4fa931f69 SHA512 5ff2cc5d143b78fbe6645486f02e50f738a92aaf6b8e85cfc6f91e659684686b12e61fc8f00b814b4372c5ed2c2b1be5eca61ea696fbe074b815877b799534ee WHIRLPOOL 10b5afc550fa6a8c33739fbf9268e934732b2892842d398152676e66ab90aed3c6e1bae02bc1b8aa0a9a917b6b450f60950317a9eda3f9e377971cbe00164b11 +DIST compiler-rt-3.5.0.src.tar.xz 1088352 SHA256 a4b3e655832bf8d9a357ea2c771db347237460e131988cbb96cda40ff39a8136 SHA512 862cce2d6b398bd1a8399496a547e6ab976a31f676528beebfbea5fd7dc54aa72e1c25deefa12f6167096521eba74090565b0168806451da02ddac04e922fc48 WHIRLPOOL 248acf997d70d7904aa79bf83e0c02ba4e5f8c2812c03f44a8e1e31b845a654f250c09ec6a123f9245d0db8713e8cc5a4087b9ce785af4f5eb7e55d9dbd362a2 +DIST llvm-3.5.0-manpages.tar.bz2 35314 SHA256 724e752a60016dce8cc536658906d3646c600e977374e0ea692a5d0fe2d4a021 SHA512 d99d6096d7f21a81923297584fe5eeb23e0d83d4538fe376615c92fffc8aff3189999f7ab3c537b5aa5d6bc2c22c53eb05717d48c7ab99c42315b8665bac62c3 WHIRLPOOL 68ced06ee6678c5333c662eb1cc0da744c5a184b12dd059c1b77ec200b1d3cc231f270b9d9b6e177d728776894277b3f9061338aa55620c90474eb97915b7819 +DIST llvm-3.5.0.src.tar.xz 11735940 SHA256 28e199f368ef0a4666708f31c7991ad3bcc3a578342b0306526dd35f07595c03 SHA512 b4d0f325dbdb0a8f10e5fd031954ef4b1971d8f99f4e4b53834801a2b74a7acde3f77c655c8355b407424b363edfb10f71d85fc370356dc52af5c636a1bba197 WHIRLPOOL 561520823468b61c63df8e13f876b7ac586eb1e52c256e9a36370e5d46e8cef3937655c36fbb51eebd3680fab67412e7c777479477fc728e7a8f35420e573ef1 +EBUILD llvm-3.5.0-r99.ebuild 15143 SHA256 94a1674bde07e026e0ca1e9f982f5f753f425b949183f4c5355d1af6a2388028 SHA512 ccb3ab314aab5d9af0d64ba5331d5390cd7d60b91e4ac50bee350d0d5885b712eb2b3e08c3df249c012fec7b410b7e32203948fddb444a4bbced86a655c705e3 WHIRLPOOL 308ec5e0ae0c874d2a43f7c571b5fb65a2566a36a3dcca4657304643b5d8fb6614ea5745383da819dbca5798b3dcbfcd49ca27de29a69cf216a6c0f15a5b1fab +MISC metadata.xml 2787 SHA256 22dc7b91c98fb4258271cc9cd4bd99f214b30f258bbdfea83dc37ac74df8d498 SHA512 4fca0d2551a889e7800c688077adf405697d05730bf66621ac53fdefeeeaddb7a8d868973edc9a6fe48e9a07734f1d43fd88229bae693fe181a7dbb95eeb9481 WHIRLPOOL 6284033d40bef02510f924ec1e6a9d3e1072bf26945fdedde0ddaf1d6d35c3d30971cdefa583a8e4d9db3da67bee04145ace15ded4cee63f534588b66633c76b --- a/sys-devel/llvm/files/clang-3.4-darwin_prefix-include-paths.patch +++ a/sys-devel/llvm/files/clang-3.4-darwin_prefix-include-paths.patch @@ -0,0 +1,18 @@ +--- tools/clang/lib/Frontend/InitHeaderSearch.cpp ++++ tools/clang/lib/Frontend/InitHeaderSearch.cpp +@@ -233,6 +233,7 @@ + case llvm::Triple::Bitrig: + break; + default: ++ AddPath("@GENTOO_PORTAGE_EPREFIX@/usr/include", System, false); + // FIXME: temporary hack: hard-coded paths. + AddPath("/usr/local/include", System, false); + break; +@@ -505,6 +506,7 @@ + // Add the default framework include paths on Darwin. + if (HSOpts.UseStandardSystemIncludes) { + if (triple.isOSDarwin()) { ++ AddPath("@GENTOO_PORTAGE_EPREFIX@/Frameworks", System, true); + AddPath("/System/Library/Frameworks", System, true); + AddPath("/Library/Frameworks", System, true); + } --- a/sys-devel/llvm/files/clang-3.5-gentoo-install.patch +++ a/sys-devel/llvm/files/clang-3.5-gentoo-install.patch @@ -0,0 +1,57 @@ +--- + tools/clang/lib/Driver/Tools.cpp | 2 +- + tools/clang/tools/scan-build/scan-build | 4 ++-- + tools/clang/tools/scan-view/scan-view | 2 +- + 3 files changed, 4 insertions(+), 4 deletions(-) + +diff --git a/tools/clang/lib/Driver/Tools.cpp b/tools/clang/lib/Driver/Tools.cpp +index 187ed38..55bcd99 100644 +--- a/tools/clang/lib/Driver/Tools.cpp ++++ b/tools/clang/lib/Driver/Tools.cpp +@@ -1404,7 +1404,7 @@ static void AddGoldPlugin(const ToolChain &ToolChain, const ArgList &Args, + // as gold requires -plugin to come before any -plugin-opt that -Wl might + // forward. + CmdArgs.push_back("-plugin"); +- std::string Plugin = ToolChain.getDriver().Dir + "/../lib/LLVMgold.so"; ++ std::string Plugin = ToolChain.getDriver().Dir + "/../@libdir@/LLVMgold.so"; + CmdArgs.push_back(Args.MakeArgString(Plugin)); + + // Try to pass driver level flags relevant to LTO code generation down to +diff --git a/tools/clang/tools/scan-build/scan-build b/tools/clang/tools/scan-build/scan-build +index 0f119f6..58f78d9 100755 +--- a/tools/clang/tools/scan-build/scan-build ++++ b/tools/clang/tools/scan-build/scan-build +@@ -419,7 +419,7 @@ + + my $Dir = shift; + +- my $JS = Cwd::realpath("$RealBin/sorttable.js"); ++ my $JS = Cwd::realpath("@EPREFIX@/usr/share/llvm/sorttable.js"); + + DieDiag("Cannot find 'sorttable.js'.\n") + if (! -r $JS); +@@ -429,7 +429,7 @@ + DieDiag("Could not copy 'sorttable.js' to '$Dir'.\n") + if (! -r "$Dir/sorttable.js"); + +- my $CSS = Cwd::realpath("$RealBin/scanview.css"); ++ my $CSS = Cwd::realpath("@EPREFIX@/usr/share/llvm/scanview.css"); + + DieDiag("Cannot find 'scanview.css'.\n") + if (! -r $CSS); +diff --git a/tools/clang/tools/scan-view/scan-view b/tools/clang/tools/scan-view/scan-view +index fb27da6..1f8ddb8 100755 +--- a/tools/clang/tools/scan-view/scan-view ++++ b/tools/clang/tools/scan-view/scan-view +@@ -54,7 +54,7 @@ def start_browser(port, options): + webbrowser.open(url) + + def run(port, options, root): +- import ScanView ++ from clang import ScanView + try: + print 'Starting scan-view at: http://%s:%d'%(options.host, + port) +-- +1.8.4.4 + --- a/sys-devel/llvm/files/clang-3.5-gentoo-runtime-gcc-detection-v3.patch +++ a/sys-devel/llvm/files/clang-3.5-gentoo-runtime-gcc-detection-v3.patch @@ -0,0 +1,42 @@ +From 916572e1243633ddf913c8f32771a3a7f70fd853 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= +Date: Fri, 5 Sep 2014 16:49:35 +0200 +Subject: [PATCH] Support obtaining active toolchain from gcc-config. + +--- + tools/clang/lib/Driver/ToolChains.cpp | 19 +++++++++++++++++++ + 1 file changed, 19 insertions(+) + +diff --git a/tools/clang/lib/Driver/ToolChains.cpp b/tools/clang/lib/Driver/ToolChains.cpp +index b46f69d..2d4374d 100644 +--- a/tools/clang/lib/Driver/ToolChains.cpp ++++ b/tools/clang/lib/Driver/ToolChains.cpp +@@ -1253,6 +1253,25 @@ Generic_GCC::GCCInstallationDetector::init( + Prefixes.push_back("/usr"); + } + ++ for (unsigned k = 0, ke = CandidateTripleAliases.size(); k < ke; ++k) { ++ llvm::ErrorOr> File = ++ llvm::MemoryBuffer::getFile(D.SysRoot + "/etc/env.d/gcc/config-" + CandidateTripleAliases[k].str()); ++ if (File) ++ { ++ const std::string VersionText = File.get()->getBuffer().rsplit('-').second.substr(0,5).str(); ++ const std::string GentooPath = D.SysRoot + "/usr/lib/gcc/" + CandidateTripleAliases[k].str() + "/" + VersionText; ++ if (llvm::sys::fs::exists(GentooPath + "/crtbegin.o")) ++ { ++ Version = GCCVersion::Parse(VersionText); ++ GCCInstallPath = GentooPath; ++ GCCParentLibPath = GCCInstallPath + "/../../.."; ++ GCCTriple.setTriple(CandidateTripleAliases[k]); ++ IsValid = true; ++ return; ++ } ++ } ++ } ++ + // Loop over the various components which exist and select the best GCC + // installation available. GCC installs are ranked by version number. + Version = GCCVersion::Parse("0.0.0"); +-- +2.1.0 + --- a/sys-devel/llvm/files/llvm-3.2-nodoctargz.patch +++ a/sys-devel/llvm/files/llvm-3.2-nodoctargz.patch @@ -0,0 +1,45 @@ +--- docs/Makefile.orig 2012-04-30 17:00:01.000000000 +0200 @@ -0,0 +1,43 @@ +commit 080fb498017d17af2e4d7563608c7d8a848f20da +Author: Sanjoy Das +Date: Thu Jun 19 15:38:02 2014 -0700 + + Fix the --enable-shared build. + + Currently a build configured with ./configure --enable-shared breaks + with an undefined "llvm::cl::parser::getOption(unsigned int) const" symbol when linking opt. This + body for this symbol gets emitted into Pass.o (along with the destructor + for PassNameParser), but gets linked into libLLVM-3.5svn.so with local + visibility, causing the link error. + + This fix uses the existing EXTERN_TEMPLATE machinery to force a globally + visible definition for the functions in parser into + Pass.o. + +diff --git a/include/llvm/IR/LegacyPassNameParser.h b/include/llvm/IR/LegacyPassNameParser.h +index e2e4912..a07e3fd 100644 +--- a/include/llvm/IR/LegacyPassNameParser.h ++++ b/include/llvm/IR/LegacyPassNameParser.h +@@ -95,6 +95,8 @@ private: + } + }; + ++EXTERN_TEMPLATE_INSTANTIATION(class cl::parser); ++ + ///===----------------------------------------------------------------------===// + /// FilteredPassNameParser class - Make use of the pass registration + /// mechanism to automatically add a command line argument to opt for +diff --git a/lib/IR/Pass.cpp b/lib/IR/Pass.cpp +index 91d86ae..00ce223 100644 +--- a/lib/IR/Pass.cpp ++++ b/lib/IR/Pass.cpp +@@ -234,6 +234,8 @@ PassNameParser::~PassNameParser() { + // attempting to remove the registration listener is an error. + } + ++TEMPLATE_INSTANTIATION(class cl::parser); ++ + //===----------------------------------------------------------------------===// + // AnalysisUsage Class Implementation + // --- a/sys-devel/llvm/files/llvm-3.5-gentoo-install.patch +++ a/sys-devel/llvm/files/llvm-3.5-gentoo-install.patch @@ -0,0 +1,83 @@ +From b8846d389ff5e2b768a114f752cf39788accba26 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= +Date: Mon, 19 Aug 2013 13:22:46 +0200 +Subject: [PATCH] gentoo install fixes + +--- + Makefile.config.in | 6 +++--- + Makefile.rules | 6 +++--- + tools/llvm-config/BuildVariables.inc.in | 2 ++ + tools/llvm-config/Makefile | 4 ++++ + tools/llvm-config/llvm-config.cpp | 5 +++-- + utils/FileCheck/Makefile | 2 +- + 7 files changed, 17 insertions(+), 10 deletions(-) + +diff --git a/Makefile.config.in b/Makefile.config.in +index dcca45f..e75ae2e 100644 +--- a/Makefile.config.in ++++ b/Makefile.config.in +@@ -95,10 +95,10 @@ PROJ_internal_prefix := $(prefix) + endif + + PROJ_bindir := $(PROJ_prefix)/bin +-PROJ_libdir := $(PROJ_prefix)/lib ++PROJ_libdir := $(PROJ_prefix)/$(GENTOO_LIBDIR) + PROJ_datadir := $(PROJ_prefix)/share +-PROJ_docsdir := $(PROJ_prefix)/docs/llvm +-PROJ_etcdir := $(PROJ_prefix)/etc/llvm ++PROJ_docsdir := $(PROJ_prefix)/share/doc/@PF@ ++PROJ_etcdir := @EPREFIX@/etc/llvm + PROJ_includedir := $(PROJ_prefix)/include + PROJ_infodir := $(PROJ_prefix)/info + PROJ_mandir := $(PROJ_prefix)/share/man +diff --git a/Makefile.rules b/Makefile.rules +index e53598b..217f754 100644 +--- a/Makefile.rules ++++ b/Makefile.rules +@@ -275,7 +275,7 @@ ifeq ($(ENABLE_OPTIMIZED),1) + BuildMode := Release + # Don't use -fomit-frame-pointer on Darwin or FreeBSD. + ifneq ($(HOST_OS), $(filter $(HOST_OS), Cygwin Darwin DragonFly FreeBSD GNU/kFreeBSD)) +- OmitFramePointer := -fomit-frame-pointer ++ OmitFramePointer := + endif + + CXX.Flags += $(OPTIMIZE_OPTION) $(OmitFramePointer) +diff --git a/tools/llvm-config/BuildVariables.inc.in b/tools/llvm-config/BuildVariables.inc.in +index fe87afb..fd9f2c6 100644 +--- a/tools/llvm-config/BuildVariables.inc.in ++++ b/tools/llvm-config/BuildVariables.inc.in +@@ -25,3 +25,4 @@ + #define LLVM_BUILDMODE "@LLVM_BUILDMODE@" + #define LLVM_TARGETS_BUILT "@LLVM_TARGETS_BUILT@" + #define LLVM_SYSTEM_LIBS "@LLVM_SYSTEM_LIBS@" ++#define LLVM_LIBDIR "@LLVM_LIBDIR@" +diff --git a/tools/llvm-config/Makefile b/tools/llvm-config/Makefile +index b20b6bf..fc56781 100644 +--- a/tools/llvm-config/Makefile ++++ b/tools/llvm-config/Makefile +@@ -55,6 +55,8 @@ $(ObjDir)/BuildVariables.inc: $(BUILDVARIABLES_SRCPATH) Makefile $(ObjDir)/.dir + >> temp.sed + $(Verb) $(ECHO) 's/@LLVM_TARGETS_BUILT@/$(subst /,\/,$(TARGETS_TO_BUILD))/' \ + >> temp.sed ++ $(Verb) $(ECHO) 's/@LLVM_LIBDIR@/$(subst /,\/,$(GENTOO_LIBDIR))/' \ ++ >> temp.sed + $(Verb) $(SED) -f temp.sed < $< > $@ + $(Verb) $(RM) temp.sed + +diff --git a/tools/llvm-config/llvm-config.cpp b/tools/llvm-config/llvm-config.cpp +index 3924e2e..f439c60 100644 +--- a/tools/llvm-config/llvm-config.cpp ++++ b/tools/llvm-config/llvm-config.cpp +@@ -250,7 +250,7 @@ int main(int argc, char **argv) { + ActivePrefix = CurrentExecPrefix; + ActiveIncludeDir = ActivePrefix + "/include"; + ActiveBinDir = ActivePrefix + "/bin"; +- ActiveLibDir = ActivePrefix + "/lib"; ++ ActiveLibDir = ActivePrefix + "/" LLVM_LIBDIR; + ActiveIncludeOption = "-I" + ActiveIncludeDir; + } + +-- +1.8.4.2 + --- a/sys-devel/llvm/files/llvm-3.5-musl-compiler-rt.patch +++ a/sys-devel/llvm/files/llvm-3.5-musl-compiler-rt.patch @@ -0,0 +1,58 @@ +diff -ur a/llvm-3.5.0.src/projects/compiler-rt/lib/Makefile.mk b/llvm-3.5.0.src/projects/compiler-rt/lib/Makefile.mk +--- a/llvm-3.5.0.src/projects/compiler-rt/lib/Makefile.mk 2014-02-14 10:20:33.000000000 -0100 @@ -0,0 +1,77 @@ +llvm-musl.patch from alpine linux + +diff -ru llvm-3.5.0.src.orig/include/llvm/Target/TargetLibraryInfo.h llvm-3.5.0.src/include/llvm/Target/TargetLibraryInfo.h +--- llvm-3.5.0.src.orig/include/llvm/Target/TargetLibraryInfo.h 2014-11-13 12:51:53.341455401 +0000 @@ -0,0 +1,124 @@ +adapted from llvm-alpine-linux.patch from Alpine + +diff -ru llvm-3.5.0.src.orig/include/llvm/ADT/Triple.h llvm-3.5.0.src/include/llvm/ADT/Triple.h +--- llvm-3.5.0.src.orig/include/llvm/ADT/Triple.h 2014-07-18 17:28:19.000000000 -0300 @@ -0,0 +1,39 @@ +Index: cmake/modules/Makefile +=================================================================== +--- cmake/modules/Makefile (revision 217451) @@ -0,0 +1,530 @@ +# Copyright 1999-2015 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/sys-devel/llvm/llvm-3.5.0.ebuild,v 1.11 2015/01/01 20:53:32 maekke Exp $ + +EAPI=5 + +PYTHON_COMPAT=( python2_7 pypy ) + +inherit eutils flag-o-matic multibuild multilib \ + multilib-minimal python-r1 toolchain-funcs pax-utils check-reqs prefix + +DESCRIPTION="Low Level Virtual Machine" +HOMEPAGE="http://llvm.org/" +SRC_URI="http://llvm.org/releases/${PV}/${P}.src.tar.xz + clang? ( http://llvm.org/releases/${PV}/compiler-rt-${PV}.src.tar.xz + http://llvm.org/releases/${PV}/cfe-${PV}.src.tar.xz + http://llvm.org/releases/${PV}/clang-tools-extra-${PV}.src.tar.xz ) + !doc? ( http://dev.gentoo.org/~voyageur/distfiles/${P}-manpages.tar.bz2 )" + +LICENSE="UoI-NCSA" +SLOT="0/3.5" +KEYWORDS="amd64 arm ppc x86" +IUSE="clang debug doc gold libedit +libffi multitarget ncurses ocaml python + +static-analyzer test xml video_cards_radeon + kernel_Darwin kernel_FreeBSD" + +COMMON_DEPEND=" + sys-libs/zlib:0= + clang? ( + python? ( ${PYTHON_DEPS} ) + static-analyzer? ( + dev-lang/perl:* + ${PYTHON_DEPS} + ) + xml? ( dev-libs/libxml2:2= ) + ) + 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:5=[${MULTILIB_USEDEP}] ) + ocaml? ( dev-lang/ocaml: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-3.0 >=sys-devel/gcc-apple-4.2.1 + ( >=sys-freebsd/freebsd-lib-9.1-r10 sys-libs/libcxx ) + ) + || ( >=sys-devel/binutils-2.18 >=sys-devel/binutils-apple-3.2.3 ) + clang? ( xml? ( virtual/pkgconfig ) ) + doc? ( dev-python/sphinx ) + libffi? ( virtual/pkgconfig ) + !! "${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_setup() { + pkg_pretend +} + +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" + mv "${WORKDIR}"/clang-tools-extra-${PV}.src "${S}"/tools/clang/tools/extra \ + || die "clang-tools-extra source directory move failed" + fi +} + +src_prepare() { + epatch "${FILESDIR}"/${PN}-3.2-nodoctargz.patch + epatch "${FILESDIR}"/${PN}-3.5-gcc-4.9.patch + epatch "${FILESDIR}"/${PN}-3.5-gentoo-install.patch + + epatch "${FILESDIR}"/${PN}-3.5-musl-fixes.patch + epatch "${FILESDIR}"/${PN}-3.5-musl-support.patch + epatch "${FILESDIR}"/${PN}-3.5-musl-compiler-rt.patch + + epatch "${FILESDIR}"/${P}-fix_LLVMExports_cmake.patch + + if use clang; then + # Automatically select active system GCC's libraries, bugs #406163 and #417913 + epatch "${FILESDIR}"/clang-3.5-gentoo-runtime-gcc-detection-v3.patch + + epatch "${FILESDIR}"/clang-3.5-gentoo-install.patch + epatch "${FILESDIR}"/clang-3.4-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 + + 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 +} + +multilib_src_configure() { + # disable timestamps since they confuse ccache + local conf_flags=( + --disable-timestamps + --enable-keep-symbols + --enable-shared + --with-optimize-option= + $(tc-is-static-only && echo --disable-shared) + $(use_enable !debug optimized) + $(use_enable debug assertions) + $(use_enable debug expensive-checks) + $(use_enable libedit) + $(use_enable ncurses terminfo) + $(use_enable libffi) + ) + + # well, it's used only by clang executable c-index-test + if multilib_is_native_abi && use clang && use xml; then + conf_flags+=( XML2CONFIG="$(tc-getPKG_CONFIG) libxml-2.0" ) + else + conf_flags+=( ac_cv_prog_XML2CONFIG="" ) + fi + + local targets bindings + if use multitarget; then + targets='all' + else + targets='host,cpp' + use video_cards_radeon && targets+=',r600' + fi + conf_flags+=( --enable-targets=${targets} ) + + if multilib_is_native_abi; then + use gold && conf_flags+=( --with-binutils-include="${EPREFIX}"/usr/include/ ) + # extra commas don't hurt + use ocaml && bindings+=',ocaml' + fi + + [[ ${bindings} ]] || bindings='none' + conf_flags+=( --enable-bindings=${bindings} ) + + if use libffi; then + local CPPFLAGS=${CPPFLAGS} + append-cppflags "$(pkg-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[@]}" +} + +set_makeargs() { + MAKEARGS=( + VERBOSE=1 + REQUIRES_RTTI=1 + GENTOO_LIBDIR=$(get_libdir) + ) + + # for tests, we want it all! otherwise, we may use a little filtering... + # adding ONLY_TOOLS also disables unittest building... + if [[ ${EBUILD_PHASE_FUNC} != src_test ]]; then + local tools=( llvm-config ) + use clang && tools+=( clang ) + + if multilib_is_native_abi; then + tools+=( + opt llvm-as llvm-dis llc llvm-ar llvm-nm llvm-link lli + llvm-extract llvm-mc llvm-bcanalyzer llvm-diff macho-dump + llvm-objdump llvm-readobj llvm-rtdyld llvm-dwarfdump llvm-cov + llvm-size llvm-stress llvm-mcmarkup llvm-profdata + llvm-symbolizer obj2yaml yaml2obj lto bugpoint + ) + + # the build system runs explicitly specified tools in parallel, + # so we need to split it into two runs + if [[ ${1} != -1 ]]; then + # those require lto + tools+=( llvm-lto ) + use gold && tools+=( gold ) + + # those require clang :) + # we need to explicitly specify all its tools + # since we're passing BUILD_CLANG_ONLY + use clang && tools+=( + clang/tools/{clang-check,clang-format,extra} + ) + fi + fi + + MAKEARGS+=( + # filter tools + disable unittests implicitly + ONLY_TOOLS="${tools[*]}" + + # this disables unittests & docs from clang + BUILD_CLANG_ONLY=YES + ) + fi +} + +multilib_src_compile() { + local MAKEARGS + set_makeargs -1 + emake "${MAKEARGS[@]}" + + if multilib_is_native_abi; then + set_makeargs + emake -C tools "${MAKEARGS[@]}" + + if use doc; then + emake -C "${S}"/docs -f Makefile.sphinx man + use clang && emake -C "${S}"/tools/clang/docs/tools \ + BUILD_FOR_WEBSITE=1 DST_MAN_DIR="${T}"/ man + emake -C "${S}"/docs -f Makefile.sphinx html + fi + fi + + if use debug; then + pax-mark m Debug+Asserts+Checks/bin/llvm-rtdyld + pax-mark m Debug+Asserts+Checks/bin/lli + pax-mark m Debug+Asserts+Checks/bin/lli-child-target + else + pax-mark m Release/bin/llvm-rtdyld + pax-mark m Release/bin/lli + pax-mark m Release/bin/lli-child-target + fi +} + +multilib_src_test() { + local MAKEARGS + set_makeargs + + # build the remaining tools & unittests + emake "${MAKEARGS[@]}" + + pax-mark m unittests/ExecutionEngine/JIT/Release/JITTests + pax-mark m unittests/ExecutionEngine/MCJIT/Release/MCJITTests + pax-mark m unittests/Support/Release/SupportTests + + # respect TMPDIR! + local -x LIT_PRESERVES_TMP=1 + emake "${MAKEARGS[@]}" check + use clang && emake "${MAKEARGS[@]}" -C tools/clang test +} + +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 below + MULTILIB_CHOST_TOOLS+=( + /usr/bin/clang + /usr/bin/clang++ + /usr/bin/clang-${PV} + /usr/bin/clang++-${PV} + ) + + MULTILIB_WRAPPED_HEADERS+=( + /usr/include/clang/Config/config.h + ) + fi + + multilib-minimal_src_install + + # Remove unnecessary headers on FreeBSD, bug #417171 + use kernel_FreeBSD && use clang && rm "${ED}"usr/lib/clang/${PV}/include/{std,float,iso,limits,tgmath,varargs}*.h +} + +multilib_src_install() { + local MAKEARGS + set_makeargs + + local root=${D}/_${ABI} + + emake "${MAKEARGS[@]}" DESTDIR="${root}" install + multibuild_merge_root "${root}" "${D}" + + if ! multilib_is_native_abi; then + # Backwards compat, will be happily removed someday. + dosym "${CHOST}"-llvm-config /usr/bin/llvm-config.${ABI} + else + # Install docs. + if use doc; then + doman "${S}"/docs/_build/man/*.1 + use clang && doman "${T}"/clang.1 + dohtml -r "${S}"/docs/_build/html/ + else + if ! use clang; then + rm "${WORKDIR}"/${P}-manpages/clang.1 || die + fi + doman "${WORKDIR}"/${P}-manpages/*.1 + fi + + # 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 PV 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++ ) + local i + + # append ${PV} and symlink back + # TODO: use alternatives.eclass? does that make any sense? + # maybe with USE=-clang on :0 and USE=clang on older + for i in "${clang_tools[@]}"; do + mv "${ED%/}/usr/bin/${i}"{,-${PV}} || die + dosym "${i}"-${PV} /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}-${PV}" || die + cat > "${T}"/wrapper.tmp <<-_EOF_ + #!${EPREFIX}/bin/sh + exec "${i}-${PV}" $(get_abi_CFLAGS) "\${@}" + _EOF_ + newbin "${T}"/wrapper.tmp "${i}-${PV}" + done + fi + fi + + # 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} + for lib in lib{EnhancedDisassembly,LLVM-${libpv},LTO,profile_rt,clang}.dylib LLVMHello.dylib clang/${libpv}/lib/darwin/libclang_rt.asan_osx_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 ${ED}/usr/lib/${lib} ]] || 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 + ;; + */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 +} + +multilib_src_install_all() { + insinto /usr/share/vim/vimfiles/syntax + doins utils/vim/*.vim + + if use clang; then + cd tools/clang || die + + if use static-analyzer ; then + dobin tools/scan-build/ccc-analyzer + dosym ccc-analyzer /usr/bin/c++-analyzer + dobin tools/scan-build/scan-build + + insinto /usr/share/${PN} + doins tools/scan-build/scanview.css + doins tools/scan-build/sorttable.js + fi + + python_inst() { + 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 __init__.py Reporter.py Resources ScanView.py startfile.py + + popd >/dev/null || die + fi + + if use python ; then + pushd bindings/python/clang >/dev/null || die + + python_moduleinto clang + python_domodule __init__.py cindex.py enumerations.py + + popd >/dev/null || die + fi + + # AddressSanitizer symbolizer (currently separate) + python_doscript "${S}"/projects/compiler-rt/lib/asan/scripts/asan_symbolize.py + } + python_foreach_impl python_inst + fi +} --- a/sys-devel/llvm/metadata.xml +++ a/sys-devel/llvm/metadata.xml @@ -0,0 +1,28 @@ + + + + + voyageur@gentoo.org + Bernard Cafarelli + + + mgorny@gentoo.org + Michał Górny + + Low Level Virtual Machine (LLVM) is: + 1. A compilation strategy designed to enable effective program optimization across the entire lifetime of a program. LLVM supports effective optimization at compile time, link-time (particularly interprocedural), run-time and offline (i.e., after software is installed), while remaining transparent to developers and maintaining compatibility with existing build scripts. + 2. A virtual instruction set - LLVM is a low-level object code representation that uses simple RISC-like instructions, but provides rich, language-independent, type information and dataflow (SSA) information about operands. This combination enables sophisticated transformations on object code, while remaining light-weight enough to be attached to the executable. This combination is key to allowing link-time, run-time, and offline transformations. + 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. + + Build the clang C/C++ compiler + Enable cmake support (experimental) + Build and install the HTML documentation and regenerate the man pages + Build the gold linker plugin + Build LLVM with sys-devel/llvm-gcc + Build all host targets (default: host only) + Support querying terminal properties using ncurses' terminfo + Install the Clang static analyzer (requires USE=clang) + Enable support for dev-libs/udis86 disassembler library + + --