From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) by finch.gentoo.org (Postfix) with ESMTP id 44D931384B4 for ; Wed, 2 Dec 2015 19:55:55 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id AB0C7E08EF; Wed, 2 Dec 2015 19:55:54 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 36F30E08EF for ; Wed, 2 Dec 2015 19:55:54 +0000 (UTC) Received: from oystercatcher.gentoo.org (unknown [IPv6:2a01:4f8:202:4333:225:90ff:fed9:fc84]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 0CB8E340894 for ; Wed, 2 Dec 2015 19:55:53 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id C58AF99E for ; Wed, 2 Dec 2015 19:55:51 +0000 (UTC) From: "Michał Górny" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Michał Górny" Message-ID: <1449086148.8eff1b80294e92ebc2f0273980ccabdc615f85f3.mgorny@gentoo> Subject: [gentoo-commits] repo/gentoo:master commit in: sys-devel/llvm/, sys-devel/llvm/files/ X-VCS-Repository: repo/gentoo X-VCS-Files: sys-devel/llvm/files/llvm-3.7-llvm-config.patch sys-devel/llvm/llvm-3.7.0-r3.ebuild sys-devel/llvm/llvm-9999.ebuild X-VCS-Directories: sys-devel/llvm/files/ sys-devel/llvm/ X-VCS-Committer: mgorny X-VCS-Committer-Name: Michał Górny X-VCS-Revision: 8eff1b80294e92ebc2f0273980ccabdc615f85f3 X-VCS-Branch: master Date: Wed, 2 Dec 2015 19:55:51 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Archives-Salt: a0bfca4d-460e-47db-aa97-d32fc57d1e69 X-Archives-Hash: 0f2dc0024bf1d53756de988602d086da commit: 8eff1b80294e92ebc2f0273980ccabdc615f85f3 Author: Michał Górny gentoo org> AuthorDate: Wed Dec 2 19:27:50 2015 +0000 Commit: Michał Górny gentoo org> CommitDate: Wed Dec 2 19:55:48 2015 +0000 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=8eff1b80 sys-devel/llvm: Fix bogus flags and paths in llvm-config, #565358 Fix llvm-config to avoid bogus results. In particular: 1. Limit --cflags and --cxxflags to package-specific flags. Do not output the whole flag-string used during the build. This fixes libclc build issues when LLVM build flags were not tolerated by clang. 2. Fix library names and paths to use shared library suffix rather than static library suffix, especially that we do not install static libraries. 3. Wipe out --system-libs since they should not be required for dynamic linking. 4. Ban --obj-root and --src-root when running outside source tree, since we are not installing any sources and therefore their results would always be bogus. Based on patch provided by Steven Newbury. Fixes: https://bugs.gentoo.org/565358 sys-devel/llvm/files/llvm-3.7-llvm-config.patch | 113 +++++++++++++++++++++ .../{llvm-9999.ebuild => llvm-3.7.0-r3.ebuild} | 104 +++++++++++-------- sys-devel/llvm/llvm-9999.ebuild | 4 + 3 files changed, 181 insertions(+), 40 deletions(-) diff --git a/sys-devel/llvm/files/llvm-3.7-llvm-config.patch b/sys-devel/llvm/files/llvm-3.7-llvm-config.patch new file mode 100644 index 0000000..932c92b --- /dev/null +++ b/sys-devel/llvm/files/llvm-3.7-llvm-config.patch @@ -0,0 +1,113 @@ +From 8a51e9673859eb3fb819f0d1dad5e2a60d1a3c0a Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= +Date: Wed, 2 Dec 2015 16:04:56 +0100 +Subject: [PATCH] llvm-config: Clean up exported values, update for shared + linking + +Gentoo-specific fixup for llvm-config, including: +- wiping build-specific CFLAGS, CXXFLAGS, +- updating library suffixes for shared libs, +- wiping --system-libs for shared linking, +- banning --obj-root and --src-root due to no sources installed. + +Thanks to Steven Newbury for the initial patch. + +Bug: https://bugs.gentoo.org/565358 +Bug: https://bugs.gentoo.org/501684 +--- + tools/llvm-config/CMakeLists.txt | 11 ++++++++--- + tools/llvm-config/llvm-config.cpp | 22 ++++++++++++++++------ + utils/llvm-build/llvmbuild/main.py | 4 +++- + 4 files changed, 27 insertions(+), 10 deletions(-) + +diff --git a/tools/llvm-config/CMakeLists.txt b/tools/llvm-config/CMakeLists.txt +index edbd8c9..9a801bd 100644 +--- a/tools/llvm-config/CMakeLists.txt ++++ b/tools/llvm-config/CMakeLists.txt +@@ -22,12 +22,17 @@ get_property(COMPILE_FLAGS TARGET llvm-config PROPERTY COMPILE_FLAGS) + set(LLVM_SRC_ROOT ${LLVM_MAIN_SRC_DIR}) + set(LLVM_OBJ_ROOT ${LLVM_BINARY_DIR}) + set(LLVM_CPPFLAGS "${CMAKE_CPP_FLAGS} ${CMAKE_CPP_FLAGS_${uppercase_CMAKE_BUILD_TYPE}} ${LLVM_DEFINITIONS}") +-set(LLVM_CFLAGS "${CMAKE_C_FLAGS} ${CMAKE_C_FLAGS_${uppercase_CMAKE_BUILD_TYPE}} ${LLVM_DEFINITIONS}") +-set(LLVM_CXXFLAGS "${CMAKE_CXX_FLAGS} ${CMAKE_CXX_FLAGS_${uppercase_CMAKE_BUILD_TYPE}} ${COMPILE_FLAGS} ${LLVM_DEFINITIONS}") ++# Just use CMAKE_CPP_FLAGS for CFLAGS and CXXFLAGS, otherwise compiler ++# specific flags will be set when we don't know what compiler will be used ++# with external project utilising llvm-config. C++ Standard is required. ++# TODO: figure out if we can remove -std=c++11 and move it to revdeps. ++set(LLVM_CFLAGS "${CMAKE_CPP_FLAGS} ${CMAKE_C_FLAGS_${uppercase_CMAKE_BUILD_TYPE}} ${LLVM_DEFINITIONS}") ++set(LLVM_CXXFLAGS "${CMAKE_CPP_FLAGS} -std=c++11 ${CMAKE_CXX_FLAGS_${uppercase_CMAKE_BUILD_TYPE}} ${LLVM_DEFINITIONS}") + # Use the C++ link flags, since they should be a superset of C link flags. + set(LLVM_LDFLAGS "${CMAKE_CXX_LINK_FLAGS}") + set(LLVM_BUILDMODE ${CMAKE_BUILD_TYPE}) +-set(LLVM_SYSTEM_LIBS ${SYSTEM_LIBS}) ++# We don't do static libs, so we don't need to supply any system-libs ++set(LLVM_SYSTEM_LIBS "") + string(REPLACE ";" " " LLVM_TARGETS_BUILT "${LLVM_TARGETS_TO_BUILD}") + configure_file(${BUILDVARIABLES_SRCPATH} ${BUILDVARIABLES_OBJPATH} @ONLY) + +diff --git a/tools/llvm-config/llvm-config.cpp b/tools/llvm-config/llvm-config.cpp +index 879b9ab..d2c43fa 100644 +--- a/tools/llvm-config/llvm-config.cpp ++++ b/tools/llvm-config/llvm-config.cpp +@@ -323,10 +323,19 @@ int main(int argc, char **argv) { + #else + OS << "ON\n"; + #endif +- } else if (Arg == "--obj-root") { +- OS << ActivePrefix << '\n'; +- } else if (Arg == "--src-root") { +- OS << LLVM_SRC_ROOT << '\n'; ++ } else if (Arg == "--obj-root" || Arg == "--src-root") { ++ if (IsInDevelopmentTree) { ++ if (Arg == "--obj-root") { ++ OS << ActivePrefix << '\n'; ++ } else { ++ OS << LLVM_SRC_ROOT << '\n'; ++ } ++ } else { ++ // sources are not installed ++ llvm::errs() << "llvm-config: sources not installed, " ++ << Arg << " not available\n"; ++ exit(1); ++ } + } else { + usage(); + } +@@ -360,8 +369,9 @@ int main(int argc, char **argv) { + OS << ActiveLibDir << '/' << Lib; + } else if (PrintLibs) { + // If this is a typical library name, include it using -l. +- if (Lib.startswith("lib") && Lib.endswith(".a")) { +- OS << "-l" << Lib.slice(3, Lib.size()-2); ++ if (Lib.startswith("lib") && Lib.endswith(LTDL_SHLIB_EXT)) { ++ // sizeof counts trailing NUL ++ OS << "-l" << Lib.slice(3, Lib.size()-sizeof(LTDL_SHLIB_EXT)+1); + continue; + } + +diff --git a/utils/llvm-build/llvmbuild/main.py b/utils/llvm-build/llvmbuild/main.py +index 353741f..4ba5e91 100644 +--- a/utils/llvm-build/llvmbuild/main.py ++++ b/utils/llvm-build/llvmbuild/main.py +@@ -393,6 +393,8 @@ subdirectories = %s + // + //===----------------------------------------------------------------------===// + ++#include "llvm/Config/config.h" ++ + """) + f.write('struct AvailableComponent {\n') + f.write(' /// The name of the component.\n') +@@ -413,7 +415,7 @@ subdirectories = %s + if library_name is None: + library_name_as_cstr = '0' + else: +- library_name_as_cstr = '"lib%s.a"' % library_name ++ library_name_as_cstr = '"lib%s" LTDL_SHLIB_EXT' % library_name + f.write(' { "%s", %s, %d, { %s } },\n' % ( + name, library_name_as_cstr, is_installed, + ', '.join('"%s"' % dep + +-- +2.6.3 + diff --git a/sys-devel/llvm/llvm-9999.ebuild b/sys-devel/llvm/llvm-3.7.0-r3.ebuild similarity index 82% copy from sys-devel/llvm/llvm-9999.ebuild copy to sys-devel/llvm/llvm-3.7.0-r3.ebuild index a413692..4fe4d69 100644 --- a/sys-devel/llvm/llvm-9999.ebuild +++ b/sys-devel/llvm/llvm-3.7.0-r3.ebuild @@ -7,19 +7,22 @@ EAPI=5 : ${CMAKE_MAKEFILE_GENERATOR:=ninja} PYTHON_COMPAT=( python2_7 pypy ) -inherit check-reqs cmake-utils eutils flag-o-matic git-r3 multilib \ +inherit check-reqs cmake-utils eutils flag-o-matic multilib \ multilib-minimal python-r1 toolchain-funcs pax-utils DESCRIPTION="Low Level Virtual Machine" HOMEPAGE="http://llvm.org/" -SRC_URI="" -EGIT_REPO_URI="http://llvm.org/git/llvm.git - https://github.com/llvm-mirror/llvm.git" +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 ) + lldb? ( http://llvm.org/releases/${PV}/lldb-${PV}.src.tar.xz ) + !doc? ( http://dev.gentoo.org/~voyageur/distfiles/${P}-manpages.tar.bz2 )" LICENSE="UoI-NCSA" SLOT="0/${PV}" -KEYWORDS="" -IUSE="clang debug +doc gold libedit +libffi lldb multitarget ncurses ocaml +KEYWORDS="~amd64 ~arm ~arm64 ~ppc ~ppc64 ~sparc ~x86 ~amd64-fbsd ~x86-fbsd ~x64-freebsd ~amd64-linux ~arm-linux ~x86-linux ~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=" @@ -39,7 +42,8 @@ COMMON_DEPEND=" ocaml? ( >=dev-lang/ocaml-4.00.0:0= dev-ml/findlib - dev-ml/ocaml-ctypes )" + 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 @@ -71,6 +75,8 @@ REQUIRED_USE="${PYTHON_REQUIRED_USE} lldb? ( clang xml ) test? ( || ( $(python_gen_useflags 'python*') ) )" +S=${WORKDIR}/${P/_}.src + pkg_pretend() { # in megs # !clang !debug !multitarget -O2 400 @@ -124,40 +130,30 @@ pkg_setup() { } src_unpack() { - if use clang; then - git-r3_fetch "http://llvm.org/git/compiler-rt.git - https://github.com/llvm-mirror/compiler-rt.git" - git-r3_fetch "http://llvm.org/git/clang.git - https://github.com/llvm-mirror/clang.git" - git-r3_fetch "http://llvm.org/git/clang-tools-extra.git - https://github.com/llvm-mirror/clang-tools-extra.git" - fi - if use lldb; then - git-r3_fetch "http://llvm.org/git/lldb.git - https://github.com/llvm-mirror/lldb.git" - fi - git-r3_fetch + default if use clang; then - git-r3_checkout http://llvm.org/git/compiler-rt.git \ - "${S}"/projects/compiler-rt - git-r3_checkout http://llvm.org/git/clang.git \ - "${S}"/tools/clang - git-r3_checkout http://llvm.org/git/clang-tools-extra.git \ - "${S}"/tools/clang/tools/extra + 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 - git-r3_checkout http://llvm.org/git/lldb.git \ - "${S}"/tools/lldb + mv "${WORKDIR}"/lldb-${PV/_}.src "${S}"/tools/lldb \ + || die "lldb source directory move failed" fi - git-r3_checkout } src_prepare() { # 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 - epatch "${FILESDIR}"/cmake/${PN}-3.7.0-ocaml-multilib.patch + epatch "${FILESDIR}"/cmake/${P}-ocaml-multilib.patch + # Do not build/install ocaml docs with USE=-doc, bug #562008 + epatch "${FILESDIR}"/cmake/${P}-ocaml-build_doc.patch # Make it possible to override Sphinx HTML install dirs # https://llvm.org/bugs/show_bug.cgi?id=23780 @@ -171,20 +167,28 @@ src_prepare() { # https://llvm.org/bugs/show_bug.cgi?id=18341 epatch "${FILESDIR}"/cmake/0004-cmake-Do-not-install-libgtest.patch - # Allow custom cmake build types (like 'Gentoo') - epatch "${FILESDIR}"/cmake/${PN}-3.8-allow_custom_cmake_build_types.patch + # Fix llvm-config for shared linking and sane flags + # https://bugs.gentoo.org/show_bug.cgi?id=565358 + epatch "${FILESDIR}"/llvm-3.7-llvm-config.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.8-gentoo-install.patch + epatch "${FILESDIR}"/clang-3.6-gentoo-install.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 - epatch "${FILESDIR}"/cmake/clang-0001-Install-clang-runtime-into-usr-lib-without-suffix-3.8.patch + epatch "${FILESDIR}"/cmake/clang-0001-Install-clang-runtime-into-usr-lib-without-suffix.patch epatch "${FILESDIR}"/cmake/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 + epatch "${FILESDIR}"/cmake/${P}-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 @@ -201,6 +205,15 @@ src_prepare() { # 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 + epatch "${FILESDIR}"/${PN}-3.7-lldb_python.patch + sed -e "s/GENTOO_LIBDIR/$(get_libdir)/" \ + -i tools/lldb/scripts/Python/finishSwigPythonLLDB.py || die + + # Fix build with ncurses[tinfo], #560474 + # http://llvm.org/viewvc/llvm-project?view=revision&revision=247842 + epatch "${FILESDIR}"/cmake/${P}-lldb_tinfo.patch fi # User patches @@ -382,7 +395,7 @@ src_install() { if use clang; then # note: magic applied in multilib_src_install()! - CLANG_VERSION=3.8 + CLANG_VERSION=${PV%.*} MULTILIB_CHOST_TOOLS+=( /usr/bin/clang @@ -405,8 +418,8 @@ multilib_src_install() { cmake-utils_src_install if multilib_is_native_abi; then - # Install docs. - #use doc && dohtml -r "${S}"/docs/_build/html/ + # Install man pages. + use doc || doman "${WORKDIR}"/${P}-manpages/*.1 # Symlink the gold plugin. if use gold; then @@ -461,9 +474,22 @@ multilib_src_install_all() { 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 + python_inst() { if use static-analyzer ; then - pushd tools/scan-view/bin >/dev/null || die + pushd tools/scan-view >/dev/null || die python_doscript scan-view @@ -472,8 +498,6 @@ multilib_src_install_all() { python_domodule *.py Resources popd >/dev/null || die - - # TODO: remove files installed in /usr/share fi if use python ; then diff --git a/sys-devel/llvm/llvm-9999.ebuild b/sys-devel/llvm/llvm-9999.ebuild index a413692..ce52542 100644 --- a/sys-devel/llvm/llvm-9999.ebuild +++ b/sys-devel/llvm/llvm-9999.ebuild @@ -174,6 +174,10 @@ src_prepare() { # Allow custom cmake build types (like 'Gentoo') epatch "${FILESDIR}"/cmake/${PN}-3.8-allow_custom_cmake_build_types.patch + # Fix llvm-config for shared linking and sane flags + # https://bugs.gentoo.org/show_bug.cgi?id=565358 + epatch "${FILESDIR}"/llvm-3.7-llvm-config.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