commit:     820607525306cb9f19b9bc1452540b8b1cacb08d
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Sat Dec  5 15:45:40 2015 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Sat Dec  5 15:49:55 2015 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=82060752

sys-devel/llvm: Update live ebuild, fix Python install

Update the patches and install procedure for git changes. Switch to
python-single-r1 as most of the Python components are now installed
by CMake.

 .../llvm/files/clang-3.8-gentoo-install.patch      |  14 ---
 sys-devel/llvm/files/llvm-3.8-llvm-config.patch    | 103 +++++++++++++++++++++
 sys-devel/llvm/llvm-9999.ebuild                    |  61 +++++-------
 3 files changed, 125 insertions(+), 53 deletions(-)

diff --git a/sys-devel/llvm/files/clang-3.8-gentoo-install.patch 
b/sys-devel/llvm/files/clang-3.8-gentoo-install.patch
deleted file mode 100644
index 25c4fca..0000000
--- a/sys-devel/llvm/files/clang-3.8-gentoo-install.patch
+++ /dev/null
@@ -1,14 +0,0 @@
----
- tools/clang/tools/scan-view/scan-view   | 2 +-
-
-diff --git a/tools/clang/tools/scan-view/bin/scan-view 
b/tools/clang/tools/scan-view/bin/scan-view
-index fb27da6..1f8ddb8 100755
---- a/tools/clang/tools/scan-view/bin/scan-view
-+++ b/tools/clang/tools/scan-view/bin/scan-view
-@@ -66,2 +66,2 @@ def start_browser(port, options):
--    import ScanView
-+    from clang import ScanView
-     try:
--- 
-1.8.4.4
-

diff --git a/sys-devel/llvm/files/llvm-3.8-llvm-config.patch 
b/sys-devel/llvm/files/llvm-3.8-llvm-config.patch
new file mode 100644
index 0000000..acc0601
--- /dev/null
+++ b/sys-devel/llvm/files/llvm-3.8-llvm-config.patch
@@ -0,0 +1,103 @@
+From cc0ac62d1c03206bc3a1edba4d60f97921b854f5 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= <[email protected]>
+Date: Fri, 4 Dec 2015 20:45:33 +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   |  9 +++++++--
+ tools/llvm-config/llvm-config.cpp  | 17 +++++++++++++----
+ utils/llvm-build/llvmbuild/main.py |  5 ++++-
+ 3 files changed, 24 insertions(+), 7 deletions(-)
+
+diff --git a/tools/llvm-config/CMakeLists.txt 
b/tools/llvm-config/CMakeLists.txt
+index 83794bb..21fd845 100644
+--- a/tools/llvm-config/CMakeLists.txt
++++ b/tools/llvm-config/CMakeLists.txt
+@@ -22,15 +22,20 @@ 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}")
++# 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_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}")
++set(LLVM_CXXFLAGS "${CMAKE_CPP_FLAGS} -std=c++11 
${CMAKE_CXX_FLAGS_${uppercase_CMAKE_BUILD_TYPE}} ${LLVM_DEFINITIONS}")
+ set(LLVM_BUILD_SYSTEM cmake)
+ set(LLVM_HAS_RTTI ${LLVM_CONFIG_HAS_RTTI})
+ 
+ # 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 "")
+ if(BUILD_SHARED_LIBS)
+   set(LLVM_ENABLE_SHARED ON)
+ else()
+diff --git a/tools/llvm-config/llvm-config.cpp 
b/tools/llvm-config/llvm-config.cpp
+index 80f6279..b16b9a3 100644
+--- a/tools/llvm-config/llvm-config.cpp
++++ b/tools/llvm-config/llvm-config.cpp
+@@ -497,10 +497,19 @@ int main(int argc, char **argv) {
+         OS << LLVM_HAS_RTTI << '\n';
+       } else if (Arg == "--shared-mode") {
+         PrintSharedMode = true;
+-      } 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();
+       }
+diff --git a/utils/llvm-build/llvmbuild/main.py 
b/utils/llvm-build/llvmbuild/main.py
+index f2472f6..a29fc83 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,8 @@ subdirectories = %s
+             if library_name is None:
+                 library_name_as_cstr = 'nullptr'
+             else:
+-                library_name_as_cstr = '"lib%s.a"' % library_name
++                library_name_as_cstr = '"lib%s" LTDL_SHLIB_EXT' % library_name
++
+             if is_installed:
+                 is_installed_as_cstr = 'true'
+             else:
+-- 
+2.6.3
+

diff --git a/sys-devel/llvm/llvm-9999.ebuild b/sys-devel/llvm/llvm-9999.ebuild
index ce52542..e65e573 100644
--- a/sys-devel/llvm/llvm-9999.ebuild
+++ b/sys-devel/llvm/llvm-9999.ebuild
@@ -5,10 +5,10 @@
 EAPI=5
 
 : ${CMAKE_MAKEFILE_GENERATOR:=ninja}
-PYTHON_COMPAT=( python2_7 pypy )
+PYTHON_COMPAT=( python2_7 )
 
 inherit check-reqs cmake-utils eutils flag-o-matic git-r3 multilib \
-       multilib-minimal python-r1 toolchain-funcs pax-utils
+       multilib-minimal python-single-r1 toolchain-funcs pax-utils
 
 DESCRIPTION="Low Level Virtual Machine"
 HOMEPAGE="http://llvm.org/";
@@ -25,12 +25,9 @@ IUSE="clang debug +doc gold libedit +libffi lldb multitarget 
ncurses ocaml
 COMMON_DEPEND="
        sys-libs/zlib:0=
        clang? (
-               python? ( ${PYTHON_DEPS} )
-               static-analyzer? (
-                       dev-lang/perl:*
-                       ${PYTHON_DEPS}
-               )
+               static-analyzer? ( dev-lang/perl:* )
                xml? ( dev-libs/libxml2:2=[${MULTILIB_USEDEP}] )
+               ${PYTHON_DEPS}
        )
        gold? ( >=sys-devel/binutils-2.22:*[cxx] )
        libedit? ( dev-libs/libedit:0=[${MULTILIB_USEDEP}] )
@@ -68,8 +65,7 @@ PDEPEND="clang? ( =sys-devel/clang-${PV}-r100 )"
 # 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 )
-       test? ( || ( $(python_gen_useflags 'python*') ) )"
+       lldb? ( clang xml )"
 
 pkg_pretend() {
        # in megs
@@ -176,14 +172,12 @@ src_prepare() {
 
        # 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
+       epatch "${FILESDIR}"/llvm-3.8-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
-
                # 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
@@ -207,11 +201,11 @@ src_prepare() {
                        -i tools/lldb/scripts/Python/modules/CMakeLists.txt || 
die
        fi
 
+       python_setup
+
        # User patches
        epatch_user
 
-       python_setup
-
        # Native libdir is used to hold LLVMgold.so
        NATIVE_LIBDIR=$(get_libdir)
 }
@@ -458,42 +452,31 @@ multilib_src_install() {
 
 multilib_src_install_all() {
        insinto /usr/share/vim/vimfiles
-       doins -r utils/vim/*/
+       doins -r utils/vim/*/.
        # some users may find it useful
        dodoc utils/vim/vimrc
 
        if use clang; then
                pushd tools/clang >/dev/null || die
 
-               python_inst() {
-                       if use static-analyzer ; then
-                               pushd tools/scan-view/bin >/dev/null || die
-
-                               python_doscript scan-view
+               if use python ; then
+                       pushd bindings/python/clang >/dev/null || die
 
-                               touch __init__.py || die
-                               python_moduleinto clang
-                               python_domodule *.py Resources
+                       python_moduleinto clang
+                       python_domodule *.py
 
-                               popd >/dev/null || die
-
-                               # TODO: remove files installed in /usr/share
-                       fi
-
-                       if use python ; then
-                               pushd bindings/python/clang >/dev/null || die
-
-                               python_moduleinto clang
-                               python_domodule *.py
+                       popd >/dev/null || die
+               fi
 
-                               popd >/dev/null || die
-                       fi
+               # AddressSanitizer symbolizer (currently separate)
+               dobin 
"${S}"/projects/compiler-rt/lib/asan/scripts/asan_symbolize.py
 
-                       # AddressSanitizer symbolizer (currently separate)
-                       python_doscript 
"${S}"/projects/compiler-rt/lib/asan/scripts/asan_symbolize.py
-               }
-               python_foreach_impl python_inst
                popd >/dev/null || die
+
+               python_fix_shebang "${ED}"
+               if use static-analyzer; then
+                       python_optimize "${ED}"usr/share/scan-view
+               fi
        fi
 }
 

Reply via email to