diff options
10 files changed, 667 insertions, 36 deletions
diff --git a/sys-devel/clang/clang-9999-r100.ebuild b/sys-devel/clang/clang-9999-r100.ebuild deleted file mode 100644 index eb10ee5738d3..000000000000 --- a/sys-devel/clang/clang-9999-r100.ebuild +++ /dev/null @@ -1,36 +0,0 @@ -# Copyright 1999-2016 Gentoo Foundation -# Distributed under the terms of the GNU General Public License v2 -# $Id$ - -EAPI=5 - -inherit multilib-build - -DESCRIPTION="C language family frontend for LLVM (meta-ebuild)" -HOMEPAGE="http://clang.llvm.org/" -SRC_URI="" - -LICENSE="UoI-NCSA" -SLOT="0/${PV}" -KEYWORDS="" -IUSE="debug multitarget python +static-analyzer" - -RDEPEND="~sys-devel/llvm-${PV}[clang(-),debug=,multitarget?,python?,static-analyzer?,${MULTILIB_USEDEP}]" - -# Please keep this package around since it's quite likely that we'll -# return to separate LLVM & clang ebuilds when the cmake build system -# is complete. - -pkg_postinst() { - if has_version ">=dev-util/ccache-3.1.9-r2" ; then - #add ccache links as clang might get installed after ccache - "${EROOT}"/usr/bin/ccache-config --install-links - fi -} - -pkg_postrm() { - if has_version ">=dev-util/ccache-3.1.9-r2" && [[ -z ${REPLACED_BY_VERSION} ]]; then - # --remove-links would remove all links, --install-links updates them - "${EROOT}"/usr/bin/ccache-config --install-links - fi -} diff --git a/sys-devel/clang/clang-9999.ebuild b/sys-devel/clang/clang-9999.ebuild new file mode 100644 index 000000000000..ad0fcf330b52 --- /dev/null +++ b/sys-devel/clang/clang-9999.ebuild @@ -0,0 +1,265 @@ +# Copyright 1999-2016 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Id$ + +EAPI=6 + +: ${CMAKE_MAKEFILE_GENERATOR:=ninja} +CMAKE_MIN_VERSION=3.4.3 +PYTHON_COMPAT=( python2_7 ) + +inherit check-reqs cmake-utils flag-o-matic git-r3 multilib-minimal \ + python-single-r1 toolchain-funcs pax-utils + +DESCRIPTION="C language family frontend for LLVM" +HOMEPAGE="http://llvm.org/" +SRC_URI="" +EGIT_REPO_URI="http://llvm.org/git/clang.git + https://github.com/llvm-mirror/clang.git" + +LICENSE="UoI-NCSA" +SLOT="0/${PV%.*}" +KEYWORDS="" +IUSE="debug default-compiler-rt default-libcxx +doc multitarget python + +static-analyzer test xml video_cards_radeon elibc_musl kernel_FreeBSD" + +RDEPEND=" + ~sys-devel/llvm-${PV}:=[debug=,multitarget?,video_cards_radeon?,${MULTILIB_USEDEP}] + static-analyzer? ( dev-lang/perl:* ) + xml? ( dev-libs/libxml2:2=[${MULTILIB_USEDEP}] ) + !<sys-devel/llvm-${PV} + ${PYTHON_DEPS}" +# configparser-3.2 breaks the build (3.3 or none at all are fine) +DEPEND="${RDEPEND} + doc? ( dev-python/sphinx ) + xml? ( virtual/pkgconfig ) + !!<dev-python/configparser-3.3.0.2 + ${PYTHON_DEPS}" +PDEPEND=" + default-compiler-rt? ( sys-libs/compiler-rt ) + default-libcxx? ( sys-libs/libcxx )" + +REQUIRED_USE="${PYTHON_REQUIRED_USE}" + +pkg_pretend() { + local build_size=650 + + 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_setup() { + pkg_pretend + + python-single-r1_pkg_setup +} + +src_unpack() { + git-r3_fetch "http://llvm.org/git/clang-tools-extra.git + https://github.com/llvm-mirror/clang-tools-extra.git" + git-r3_fetch + + git-r3_checkout http://llvm.org/git/clang-tools-extra.git \ + "${S}"/tools/clang/tools/extra + git-r3_checkout +} + +src_prepare() { + python_setup + + # fix race condition between sphinx targets + eapply "${FILESDIR}"/9999/0001-cmake-Add-ordering-dep-between-HTML-Sphinx-docs-and-.patch + # automatically select active system GCC's libraries, bugs #406163 and #417913 + # TODO: cross-linux tests broken by this one + eapply "${FILESDIR}"/9999/0002-driver-Support-obtaining-active-toolchain-from-gcc-c.patch + # use cmake checks for rlimits, rather than __has_include_next() + eapply "${FILESDIR}"/9999/0003-driver-Support-checking-for-rlimits-via-cmake-when-b.patch + # adjust llvm-lit search to match LLVM cmake macros + eapply "${FILESDIR}"/9999/0004-cmake-Adjust-llvm-lit-search-to-match-the-one-in-LLV.patch + # support overriding clang runtime install directory + eapply "${FILESDIR}"/9999/0005-cmake-Supporting-overriding-runtime-libdir-via-CLANG.patch + # support overriding LLVMgold.so plugin directory + eapply "${FILESDIR}"/9999/0006-cmake-Add-CLANG_GOLD_LIBDIR_SUFFIX-to-specify-loc-of.patch + # fix stand-alone doc build + eapply "${FILESDIR}"/9999/0007-cmake-Support-stand-alone-Sphinx-doxygen-doc-build.patch + + # User patches + eapply_user + + # 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' + use video_cards_radeon && targets+=';AMDGPU' + fi + + local libdir=$(get_libdir) + local mycmakeargs=( + -DLLVM_LIBDIR_SUFFIX=${libdir#lib} + # install clang runtime straight into /usr/lib + -DCLANG_LIBDIR_SUFFIX="" + # specify host's binutils gold plugin path + -DCLANG_GOLD_LIBDIR_SUFFIX="${NATIVE_LIBDIR#lib}" + + -DBUILD_SHARED_LIBS=ON + -DLLVM_TARGETS_TO_BUILD="${targets}" + # TODO: get them properly conditional + #-DLLVM_BUILD_TESTS=$(usex test) + + -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 "") + + -DCLANG_ENABLE_ARCMT=$(usex static-analyzer) + -DCLANG_ENABLE_STATIC_ANALYZER=$(usex static-analyzer) + ) + + if multilib_is_native_abi; then + mycmakeargs+=( + # TODO: docs don't work out-of-llvm + -DLLVM_BUILD_DOCS=$(usex doc) + -DLLVM_ENABLE_SPHINX=$(usex doc) + -DLLVM_ENABLE_DOXYGEN=OFF + -DCLANG_INSTALL_HTML="${EPREFIX}/usr/share/doc/${PF}/clang" + -DSPHINX_WARNINGS_AS_ERRORS=OFF + ) + else + mycmakeargs+=( + -DLLVM_EXTERNAL_CLANG_TOOLS_EXTRA_BUILD=OFF + ) + fi + + if tc-is-cross-compiler; then + [[ -x "/usr/bin/clang-tblgen" ]] \ + || die "/usr/bin/clang-tblgen not found or usable" + mycmakeargs+=( + -DCMAKE_CROSSCOMPILING=ON + -DCLANG_TABLEGEN=/usr/bin/clang-tblgen + ) + fi + + cmake-utils_src_configure +} + +multilib_src_compile() { + cmake-utils_src_compile +} + +multilib_src_test() { + # respect TMPDIR! + local -x LIT_PRESERVES_TMP=1 + cmake-utils_src_make check-clang +} + +src_install() { + # note: magic applied in multilib_src_install()! + CLANG_VERSION=4.0 + + 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 + ) + + multilib-minimal_src_install + + # 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 + + # apply CHOST and CLANG_VERSION to clang executables + # they're statically linked so we don't have to worry about the lib + 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 +} + +multilib_src_install_all() { + if use python ; then + pushd bindings/python/clang >/dev/null || die + + python_moduleinto clang + python_domodule *.py + + popd >/dev/null || die + fi + + python_fix_shebang "${ED}" + if use static-analyzer; then + python_optimize "${ED}"usr/share/scan-view + fi +} + +pkg_postinst() { + if ! has_version 'sys-libs/libomp'; then + elog "To enable OpenMP support in clang, install sys-libs/libomp." + fi +} diff --git a/sys-devel/clang/files/9999/0001-cmake-Add-ordering-dep-between-HTML-Sphinx-docs-and-.patch b/sys-devel/clang/files/9999/0001-cmake-Add-ordering-dep-between-HTML-Sphinx-docs-and-.patch new file mode 100644 index 000000000000..35fc19da9847 --- /dev/null +++ b/sys-devel/clang/files/9999/0001-cmake-Add-ordering-dep-between-HTML-Sphinx-docs-and-.patch @@ -0,0 +1,27 @@ +From ec16b3f76a26a3a10b0272d012b306963fa93013 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= <mgorny@gentoo.org> +Date: Sun, 21 Aug 2016 23:24:19 +0200 +Subject: [PATCH 1/7] cmake: Add ordering dep between HTML Sphinx docs and + manpages + +--- + docs/CMakeLists.txt | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/docs/CMakeLists.txt b/docs/CMakeLists.txt +index 13b79fdf..bd75b63 100644 +--- a/docs/CMakeLists.txt ++++ b/docs/CMakeLists.txt +@@ -102,6 +102,9 @@ if (LLVM_ENABLE_SPHINX) + endif() + if (${SPHINX_OUTPUT_MAN}) + add_sphinx_target(man clang) ++ if (${SPHINX_OUTPUT_HTML}) ++ add_dependencies(docs-clang-html docs-clang-man) ++ endif() + endif() + endif() + endif() +-- +2.9.3 + diff --git a/sys-devel/clang/files/9999/0002-driver-Support-obtaining-active-toolchain-from-gcc-c.patch b/sys-devel/clang/files/9999/0002-driver-Support-obtaining-active-toolchain-from-gcc-c.patch new file mode 100644 index 000000000000..6128cb938ab0 --- /dev/null +++ b/sys-devel/clang/files/9999/0002-driver-Support-obtaining-active-toolchain-from-gcc-c.patch @@ -0,0 +1,46 @@ +From 67025453e6c2373c8d761f6435e7fa4ddaacd8fa Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= <mgorny@gentoo.org> +Date: Fri, 5 Sep 2014 16:49:35 +0200 +Subject: [PATCH 2/7] driver: Support obtaining active toolchain from + gcc-config on Gentoo + +Author: Richard Yao <ryao@gentoo.org> +Bug: https://bugs.gentoo.org/406163 +Bug: https://bugs.gentoo.org/417913 +--- + lib/Driver/ToolChains.cpp | 19 +++++++++++++++++++ + 1 file changed, 19 insertions(+) + +diff --git a/lib/Driver/ToolChains.cpp b/lib/Driver/ToolChains.cpp +index 68d5214..7689f86 100644 +--- a/lib/Driver/ToolChains.cpp ++++ b/lib/Driver/ToolChains.cpp +@@ -1418,6 +1418,25 @@ void Generic_GCC::GCCInstallationDetector::init( + } + } + ++ for (unsigned k = 0, ke = CandidateTripleAliases.size(); k < ke; ++k) { ++ llvm::ErrorOr<std::unique_ptr<llvm::MemoryBuffer>> 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.9.3 + diff --git a/sys-devel/clang/files/9999/0003-driver-Support-checking-for-rlimits-via-cmake-when-b.patch b/sys-devel/clang/files/9999/0003-driver-Support-checking-for-rlimits-via-cmake-when-b.patch new file mode 100644 index 000000000000..16d63ec7f61c --- /dev/null +++ b/sys-devel/clang/files/9999/0003-driver-Support-checking-for-rlimits-via-cmake-when-b.patch @@ -0,0 +1,84 @@ +From 27b65490c9764d18fa02274bbb4f75dd5a688506 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= <mgorny@gentoo.org> +Date: Sun, 21 Aug 2016 23:30:17 +0200 +Subject: [PATCH 3/7] driver: Support checking for rlimits via cmake (when + bootstrapping) + +Add a cmake check for sys/resource.h and replace the __has_include() +check with its result, in order to make it possible to use rlimits when +building with compilers not supporting __has_include() -- i.e. when +bootstrapping. + +Patch: https://reviews.llvm.org/D23744 +--- + CMakeLists.txt | 3 +++ + include/clang/Config/config.h.cmake | 3 +++ + tools/driver/cc1_main.cpp | 8 +++----- + 3 files changed, 9 insertions(+), 5 deletions(-) + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index e6dde85..aee0d0a 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -177,6 +177,9 @@ if (LIBXML2_FOUND) + set(CLANG_HAVE_LIBXML 1) + endif() + ++include(CheckIncludeFile) ++check_include_file(sys/resource.h CLANG_HAVE_RLIMITS) ++ + set(CLANG_RESOURCE_DIR "" CACHE STRING + "Relative directory from the Clang binary to its resource files.") + +diff --git a/include/clang/Config/config.h.cmake b/include/clang/Config/config.h.cmake +index 9200ed9..9bf9ea5 100644 +--- a/include/clang/Config/config.h.cmake ++++ b/include/clang/Config/config.h.cmake +@@ -35,6 +35,9 @@ + /* Define if we have libxml2 */ + #cmakedefine CLANG_HAVE_LIBXML ${CLANG_HAVE_LIBXML} + ++/* Define if we have sys/resource.h (rlimits) */ ++#cmakedefine CLANG_HAVE_RLIMITS ${CLANG_HAVE_RLIMITS} ++ + /* The LLVM product name and version */ + #define BACKEND_PACKAGE_STRING "${BACKEND_PACKAGE_STRING}" + +diff --git a/tools/driver/cc1_main.cpp b/tools/driver/cc1_main.cpp +index b8cea41..45d44a0 100644 +--- a/tools/driver/cc1_main.cpp ++++ b/tools/driver/cc1_main.cpp +@@ -15,6 +15,7 @@ + + #include "llvm/Option/Arg.h" + #include "clang/CodeGen/ObjectFilePCHContainerOperations.h" ++#include "clang/Config/config.h" + #include "clang/Driver/DriverDiagnostic.h" + #include "clang/Driver/Options.h" + #include "clang/Frontend/CompilerInstance.h" +@@ -37,12 +38,9 @@ + #include "llvm/Support/raw_ostream.h" + #include <cstdio> + +-#ifdef __has_include +-#if __has_include(<sys/resource.h>) +-#define HAVE_RLIMITS ++#ifdef CLANG_HAVE_RLIMITS + #include <sys/resource.h> + #endif +-#endif + + using namespace clang; + using namespace llvm::opt; +@@ -73,7 +71,7 @@ void initializePollyPasses(llvm::PassRegistry &Registry); + } + #endif + +-#ifdef HAVE_RLIMITS ++#ifdef CLANG_HAVE_RLIMITS + // The amount of stack we think is "sufficient". If less than this much is + // available, we may be unable to reach our template instantiation depth + // limit and other similar limits. +-- +2.9.3 + diff --git a/sys-devel/clang/files/9999/0004-cmake-Adjust-llvm-lit-search-to-match-the-one-in-LLV.patch b/sys-devel/clang/files/9999/0004-cmake-Adjust-llvm-lit-search-to-match-the-one-in-LLV.patch new file mode 100644 index 000000000000..bcf409c71b67 --- /dev/null +++ b/sys-devel/clang/files/9999/0004-cmake-Adjust-llvm-lit-search-to-match-the-one-in-LLV.patch @@ -0,0 +1,29 @@ +From d7bc0e05e8064e0c939db6c2fb6d215fd0340708 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= <mgorny@gentoo.org> +Date: Sun, 21 Aug 2016 23:30:39 +0200 +Subject: [PATCH 4/7] cmake: Adjust llvm-lit search to match the one in LLVM + +Adjust the system lit executable search to look for llvm-lit as that is +the name used in AddLLVM.cmake installed by LLVM. + +Patch: https://reviews.llvm.org/D23745 +--- + CMakeLists.txt | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index aee0d0a..e95ab52 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -140,7 +140,7 @@ Please install Python or specify the PYTHON_EXECUTABLE CMake variable.") + endif() + else() + # Seek installed Lit. +- find_program(LLVM_LIT "lit.py" ${LLVM_MAIN_SRC_DIR}/utils/lit ++ find_program(LLVM_LIT "llvm-lit" ${LLVM_MAIN_SRC_DIR}/utils/lit + DOC "Path to lit.py") + endif() + +-- +2.9.3 + diff --git a/sys-devel/clang/files/9999/0005-cmake-Supporting-overriding-runtime-libdir-via-CLANG.patch b/sys-devel/clang/files/9999/0005-cmake-Supporting-overriding-runtime-libdir-via-CLANG.patch new file mode 100644 index 000000000000..da737c19811e --- /dev/null +++ b/sys-devel/clang/files/9999/0005-cmake-Supporting-overriding-runtime-libdir-via-CLANG.patch @@ -0,0 +1,86 @@ +From 8864d8f9da1b30c9539e9dc0388c5d0dccca3a34 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= <mgorny@gentoo.org> +Date: Sun, 21 Aug 2016 23:31:06 +0200 +Subject: [PATCH 5/7] cmake: Supporting overriding runtime libdir via + CLANG_LIBDIR_SUFFIX + +Make it possible to override the value of CLANG_LIBDIR_SUFFIX, and use +it uniformly to control install location of runtimes (i.e. lib/clang), +therefore supporting sharing a common runtime between multiple multilib +variants. + +Previously, CLANG_LIBDIR_SUFFIX was pinned to LLVM_LIBDIR_SUFFIX +and used only to define runtime path in driver code. This patch extends +its use to building and installing the runtime (the former is needed for +tests to work correctly). + +The goal is to support install layout alike "LLVM_LIBDIR_SUFFIX=64 +CLANG_LIBDIR_SUFFIX=''" -- where all shared libraries would be installed +into ABI-specific /usr/lib64, while runtime (that is common between +multilib ABIs) would be installed into /usr/lib. + +Bug: https://llvm.org/bugs/show_bug.cgi?id=23792 +Patch: https://reviews.llvm.org/D23752 +--- + CMakeLists.txt | 5 +++-- + lib/Headers/CMakeLists.txt | 4 ++-- + runtime/CMakeLists.txt | 4 ++-- + 3 files changed, 7 insertions(+), 6 deletions(-) + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index e95ab52..67b85b5 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -235,8 +235,9 @@ endif() + set(CLANG_VENDOR_UTI "org.llvm.clang" CACHE STRING + "Vendor-specific uti.") + +-# The libdir suffix must exactly match whatever LLVM's configuration used. +-set(CLANG_LIBDIR_SUFFIX "${LLVM_LIBDIR_SUFFIX}") ++set(CLANG_LIBDIR_SUFFIX "${LLVM_LIBDIR_SUFFIX}" CACHE ++ STRING "Define suffix of library directory name for clang runtime (32/64)") ++set(CLANG_LIBRARY_OUTPUT_INTDIR ${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/lib${CLANG_LIBDIR_SUFFIX}) + + set(CLANG_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}) + set(CLANG_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}) +diff --git a/lib/Headers/CMakeLists.txt b/lib/Headers/CMakeLists.txt +index 600fece..86a70c5 100644 +--- a/lib/Headers/CMakeLists.txt ++++ b/lib/Headers/CMakeLists.txt +@@ -88,7 +88,7 @@ set(files + xtestintrin.h + ) + +-set(output_dir ${LLVM_LIBRARY_OUTPUT_INTDIR}/clang/${CLANG_VERSION}/include) ++set(output_dir ${CLANG_LIBRARY_OUTPUT_INTDIR}/clang/${CLANG_VERSION}/include) + + # Generate arm_neon.h + clang_tablegen(arm_neon.h -gen-arm-neon +@@ -118,7 +118,7 @@ install( + FILES ${files} ${CMAKE_CURRENT_BINARY_DIR}/arm_neon.h + COMPONENT clang-headers + PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ +- DESTINATION lib${LLVM_LIBDIR_SUFFIX}/clang/${CLANG_VERSION}/include) ++ DESTINATION lib${CLANG_LIBDIR_SUFFIX}/clang/${CLANG_VERSION}/include) + + if (NOT CMAKE_CONFIGURATION_TYPES) # don't add this for IDE's. + add_custom_target(install-clang-headers +diff --git a/runtime/CMakeLists.txt b/runtime/CMakeLists.txt +index 814857f..9348615 100644 +--- a/runtime/CMakeLists.txt ++++ b/runtime/CMakeLists.txt +@@ -71,9 +71,9 @@ if(LLVM_BUILD_EXTERNAL_COMPILER_RT AND EXISTS ${COMPILER_RT_SRC_ROOT}/) + -DCMAKE_MAKE_PROGRAM=${CMAKE_MAKE_PROGRAM} + -DLLVM_CONFIG_PATH=${LLVM_RUNTIME_OUTPUT_INTDIR}/llvm-config + -DLLVM_LIT_ARGS=${LLVM_LIT_ARGS} +- -DCOMPILER_RT_OUTPUT_DIR=${LLVM_LIBRARY_OUTPUT_INTDIR}/clang/${CLANG_VERSION} ++ -DCOMPILER_RT_OUTPUT_DIR=${CLANG_LIBRARY_OUTPUT_INTDIR}/clang/${CLANG_VERSION} + -DCOMPILER_RT_EXEC_OUTPUT_DIR=${LLVM_RUNTIME_OUTPUT_INTDIR} +- -DCOMPILER_RT_INSTALL_PATH:STRING=lib${LLVM_LIBDIR_SUFFIX}/clang/${CLANG_VERSION} ++ -DCOMPILER_RT_INSTALL_PATH:STRING=lib${CLANG_LIBDIR_SUFFIX}/clang/${CLANG_VERSION} + -DCOMPILER_RT_INCLUDE_TESTS=${LLVM_INCLUDE_TESTS} + -DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX} + -DLLVM_LIBDIR_SUFFIX=${LLVM_LIBDIR_SUFFIX} +-- +2.9.3 + diff --git a/sys-devel/clang/files/9999/0006-cmake-Add-CLANG_GOLD_LIBDIR_SUFFIX-to-specify-loc-of.patch b/sys-devel/clang/files/9999/0006-cmake-Add-CLANG_GOLD_LIBDIR_SUFFIX-to-specify-loc-of.patch new file mode 100644 index 000000000000..18adcca8bad0 --- /dev/null +++ b/sys-devel/clang/files/9999/0006-cmake-Add-CLANG_GOLD_LIBDIR_SUFFIX-to-specify-loc-of.patch @@ -0,0 +1,64 @@ +From cf60af04f0ac2836f50d5a042acc89ef76e76a66 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= <mgorny@gentoo.org> +Date: Sun, 21 Aug 2016 23:31:28 +0200 +Subject: [PATCH 6/7] cmake: Add CLANG_GOLD_LIBDIR_SUFFIX to specify loc of + LLVMgold.so + +Add CLANG_GOLD_LIBDIR_SUFFIX that defaults to ${LLVM_LIBDIR_SUFFIX} +and can be overriden if LLVMgold.so is installed elsewhere. The use case +are multilib systems where binutils is 64-bit and clang is 32-bit, +therefore the gold plugin is installed in 64-bit libdir while clang +is not. + +Bug: https://llvm.org/bugs/show_bug.cgi?id=23793 +Patch: https://reviews.llvm.org/D23754 +--- + CMakeLists.txt | 3 +++ + include/clang/Config/config.h.cmake | 3 +++ + lib/Driver/Tools.cpp | 2 +- + 3 files changed, 7 insertions(+), 1 deletion(-) + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 67b85b5..8ed8c10 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -239,6 +239,9 @@ set(CLANG_LIBDIR_SUFFIX "${LLVM_LIBDIR_SUFFIX}" CACHE + STRING "Define suffix of library directory name for clang runtime (32/64)") + set(CLANG_LIBRARY_OUTPUT_INTDIR ${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/lib${CLANG_LIBDIR_SUFFIX}) + ++set(CLANG_GOLD_LIBDIR_SUFFIX "${LLVM_LIBDIR_SUFFIX}" CACHE ++ STRING "Define suffix of library directory name that contains LLVMgold.so (32/64)") ++ + set(CLANG_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}) + set(CLANG_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}) + +diff --git a/include/clang/Config/config.h.cmake b/include/clang/Config/config.h.cmake +index 9bf9ea5..26e0e7e 100644 +--- a/include/clang/Config/config.h.cmake ++++ b/include/clang/Config/config.h.cmake +@@ -20,6 +20,9 @@ + /* Multilib suffix for libdir. */ + #define CLANG_LIBDIR_SUFFIX "${CLANG_LIBDIR_SUFFIX}" + ++/* Multilib suffix for libdir containing LLVMgold.so. */ ++#define CLANG_GOLD_LIBDIR_SUFFIX "${CLANG_GOLD_LIBDIR_SUFFIX}" ++ + /* Relative directory for resource files */ + #define CLANG_RESOURCE_DIR "${CLANG_RESOURCE_DIR}" + +diff --git a/lib/Driver/Tools.cpp b/lib/Driver/Tools.cpp +index a814df3..333a2e9 100644 +--- a/lib/Driver/Tools.cpp ++++ b/lib/Driver/Tools.cpp +@@ -2007,7 +2007,7 @@ static void AddGoldPlugin(const ToolChain &ToolChain, const ArgList &Args, + // forward. + CmdArgs.push_back("-plugin"); + std::string Plugin = +- ToolChain.getDriver().Dir + "/../lib" CLANG_LIBDIR_SUFFIX "/LLVMgold.so"; ++ ToolChain.getDriver().Dir + "/../lib" CLANG_GOLD_LIBDIR_SUFFIX "/LLVMgold.so"; + CmdArgs.push_back(Args.MakeArgString(Plugin)); + + // Try to pass driver level flags relevant to LTO code generation down to +-- +2.9.3 + diff --git a/sys-devel/clang/files/9999/0007-cmake-Support-stand-alone-Sphinx-doxygen-doc-build.patch b/sys-devel/clang/files/9999/0007-cmake-Support-stand-alone-Sphinx-doxygen-doc-build.patch new file mode 100644 index 000000000000..0ecd5bc0e8c1 --- /dev/null +++ b/sys-devel/clang/files/9999/0007-cmake-Support-stand-alone-Sphinx-doxygen-doc-build.patch @@ -0,0 +1,64 @@ +From 8dd12df445c9a35f7b1c0202eb7c74b954b0980d Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= <mgorny@gentoo.org> +Date: Sun, 21 Aug 2016 23:31:55 +0200 +Subject: [PATCH 7/7] cmake: Support stand-alone Sphinx & doxygen doc build + +Copy the necessary options and configuration checks from LLVM to clang, +to support stand-alone documentation builds. + +Patch: https://reviews.llvm.org/D23758 +--- + CMakeLists.txt | 37 +++++++++++++++++++++++++++++++++++++ + 1 file changed, 37 insertions(+) + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 8ed8c10..3f34d8c 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -162,6 +162,43 @@ Please install Python or specify the PYTHON_EXECUTABLE CMake variable.") + endif() + endif() + ++ option (LLVM_BUILD_DOCS "Build the llvm documentation." OFF) ++ option (LLVM_INCLUDE_DOCS "Generate build targets for llvm documentation." ON) ++ option (LLVM_ENABLE_DOXYGEN "Use doxygen to generate llvm API documentation." OFF) ++ option (LLVM_ENABLE_SPHINX "Use Sphinx to generate llvm documentation." OFF) ++ ++ if (LLVM_ENABLE_DOXYGEN) ++ message(STATUS "Doxygen enabled.") ++ find_package(Doxygen REQUIRED) ++ ++ if (DOXYGEN_FOUND) ++ # If we find doxygen and we want to enable doxygen by default create a ++ # global aggregate doxygen target for generating llvm and any/all ++ # subprojects doxygen documentation. ++ if (LLVM_BUILD_DOCS) ++ add_custom_target(doxygen ALL) ++ endif() ++ ++ option(LLVM_DOXYGEN_EXTERNAL_SEARCH "Enable doxygen external search." OFF) ++ if (LLVM_DOXYGEN_EXTERNAL_SEARCH) ++ set(LLVM_DOXYGEN_SEARCHENGINE_URL "" CACHE STRING "URL to use for external search.") ++ set(LLVM_DOXYGEN_SEARCH_MAPPINGS "" CACHE STRING "Doxygen Search Mappings") ++ endif() ++ endif() ++ else() ++ message(STATUS "Doxygen disabled.") ++ endif() ++ ++ if (LLVM_ENABLE_SPHINX) ++ message(STATUS "Sphinx enabled.") ++ find_package(Sphinx REQUIRED) ++ if (LLVM_BUILD_DOCS) ++ add_custom_target(sphinx ALL) ++ endif() ++ else() ++ message(STATUS "Sphinx disabled.") ++ endif() ++ + set( CLANG_BUILT_STANDALONE 1 ) + set(BACKEND_PACKAGE_STRING "LLVM ${LLVM_PACKAGE_VERSION}") + else() +-- +2.9.3 + diff --git a/sys-devel/clang/metadata.xml b/sys-devel/clang/metadata.xml index 28f455942a22..38b8ec4ab6ab 100644 --- a/sys-devel/clang/metadata.xml +++ b/sys-devel/clang/metadata.xml @@ -27,6 +27,8 @@ A simple and hackable code base A single unified parser for C, Objective C, C++, and Objective C++ Conformance with C/C++/ObjC and their variants</longdescription> <use> + <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="multitarget">Build all host targets (default: host only)</flag> <flag name="static-analyzer">Install the Clang static analyzer</flag> </use> |