Gentoo Archives: gentoo-commits

From: "Michał Górny" <mgorny@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: sys-devel/llvm/files/, sys-devel/llvm/
Date: Sat, 05 Dec 2015 15:50:18
Message-Id: 1449330595.820607525306cb9f19b9bc1452540b8b1cacb08d.mgorny@gentoo
1 commit: 820607525306cb9f19b9bc1452540b8b1cacb08d
2 Author: Michał Górny <mgorny <AT> gentoo <DOT> org>
3 AuthorDate: Sat Dec 5 15:45:40 2015 +0000
4 Commit: Michał Górny <mgorny <AT> gentoo <DOT> org>
5 CommitDate: Sat Dec 5 15:49:55 2015 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=82060752
7
8 sys-devel/llvm: Update live ebuild, fix Python install
9
10 Update the patches and install procedure for git changes. Switch to
11 python-single-r1 as most of the Python components are now installed
12 by CMake.
13
14 .../llvm/files/clang-3.8-gentoo-install.patch | 14 ---
15 sys-devel/llvm/files/llvm-3.8-llvm-config.patch | 103 +++++++++++++++++++++
16 sys-devel/llvm/llvm-9999.ebuild | 61 +++++-------
17 3 files changed, 125 insertions(+), 53 deletions(-)
18
19 diff --git a/sys-devel/llvm/files/clang-3.8-gentoo-install.patch b/sys-devel/llvm/files/clang-3.8-gentoo-install.patch
20 deleted file mode 100644
21 index 25c4fca..0000000
22 --- a/sys-devel/llvm/files/clang-3.8-gentoo-install.patch
23 +++ /dev/null
24 @@ -1,14 +0,0 @@
25 ----
26 - tools/clang/tools/scan-view/scan-view | 2 +-
27 -
28 -diff --git a/tools/clang/tools/scan-view/bin/scan-view b/tools/clang/tools/scan-view/bin/scan-view
29 -index fb27da6..1f8ddb8 100755
30 ---- a/tools/clang/tools/scan-view/bin/scan-view
31 -+++ b/tools/clang/tools/scan-view/bin/scan-view
32 -@@ -66,2 +66,2 @@ def start_browser(port, options):
33 -- import ScanView
34 -+ from clang import ScanView
35 - try:
36 ---
37 -1.8.4.4
38 -
39
40 diff --git a/sys-devel/llvm/files/llvm-3.8-llvm-config.patch b/sys-devel/llvm/files/llvm-3.8-llvm-config.patch
41 new file mode 100644
42 index 0000000..acc0601
43 --- /dev/null
44 +++ b/sys-devel/llvm/files/llvm-3.8-llvm-config.patch
45 @@ -0,0 +1,103 @@
46 +From cc0ac62d1c03206bc3a1edba4d60f97921b854f5 Mon Sep 17 00:00:00 2001
47 +From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= <mgorny@g.o>
48 +Date: Fri, 4 Dec 2015 20:45:33 +0100
49 +Subject: [PATCH] llvm-config: Clean up exported values, update for shared
50 + linking
51 +
52 +Gentoo-specific fixup for llvm-config, including:
53 +- wiping build-specific CFLAGS, CXXFLAGS,
54 +- updating library suffixes for shared libs,
55 +- wiping --system-libs for shared linking,
56 +- banning --obj-root and --src-root due to no sources installed.
57 +
58 +Thanks to Steven Newbury for the initial patch.
59 +
60 +Bug: https://bugs.gentoo.org/565358
61 +Bug: https://bugs.gentoo.org/501684
62 +---
63 + tools/llvm-config/CMakeLists.txt | 9 +++++++--
64 + tools/llvm-config/llvm-config.cpp | 17 +++++++++++++----
65 + utils/llvm-build/llvmbuild/main.py | 5 ++++-
66 + 3 files changed, 24 insertions(+), 7 deletions(-)
67 +
68 +diff --git a/tools/llvm-config/CMakeLists.txt b/tools/llvm-config/CMakeLists.txt
69 +index 83794bb..21fd845 100644
70 +--- a/tools/llvm-config/CMakeLists.txt
71 ++++ b/tools/llvm-config/CMakeLists.txt
72 +@@ -22,15 +22,20 @@ get_property(COMPILE_FLAGS TARGET llvm-config PROPERTY COMPILE_FLAGS)
73 + set(LLVM_SRC_ROOT ${LLVM_MAIN_SRC_DIR})
74 + set(LLVM_OBJ_ROOT ${LLVM_BINARY_DIR})
75 + set(LLVM_CPPFLAGS "${CMAKE_CPP_FLAGS} ${CMAKE_CPP_FLAGS_${uppercase_CMAKE_BUILD_TYPE}} ${LLVM_DEFINITIONS}")
76 ++# Just use CMAKE_CPP_FLAGS for CFLAGS and CXXFLAGS, otherwise compiler
77 ++# specific flags will be set when we don't know what compiler will be used
78 ++# with external project utilising llvm-config. C++ Standard is required.
79 ++# TODO: figure out if we can remove -std=c++11 and move it to revdeps.
80 + set(LLVM_CFLAGS "${CMAKE_C_FLAGS} ${CMAKE_C_FLAGS_${uppercase_CMAKE_BUILD_TYPE}} ${LLVM_DEFINITIONS}")
81 +-set(LLVM_CXXFLAGS "${CMAKE_CXX_FLAGS} ${CMAKE_CXX_FLAGS_${uppercase_CMAKE_BUILD_TYPE}} ${COMPILE_FLAGS} ${LLVM_DEFINITIONS}")
82 ++set(LLVM_CXXFLAGS "${CMAKE_CPP_FLAGS} -std=c++11 ${CMAKE_CXX_FLAGS_${uppercase_CMAKE_BUILD_TYPE}} ${LLVM_DEFINITIONS}")
83 + set(LLVM_BUILD_SYSTEM cmake)
84 + set(LLVM_HAS_RTTI ${LLVM_CONFIG_HAS_RTTI})
85 +
86 + # Use the C++ link flags, since they should be a superset of C link flags.
87 + set(LLVM_LDFLAGS "${CMAKE_CXX_LINK_FLAGS}")
88 + set(LLVM_BUILDMODE ${CMAKE_BUILD_TYPE})
89 +-set(LLVM_SYSTEM_LIBS ${SYSTEM_LIBS})
90 ++# We don't do static libs, so we don't need to supply any system-libs
91 ++set(LLVM_SYSTEM_LIBS "")
92 + if(BUILD_SHARED_LIBS)
93 + set(LLVM_ENABLE_SHARED ON)
94 + else()
95 +diff --git a/tools/llvm-config/llvm-config.cpp b/tools/llvm-config/llvm-config.cpp
96 +index 80f6279..b16b9a3 100644
97 +--- a/tools/llvm-config/llvm-config.cpp
98 ++++ b/tools/llvm-config/llvm-config.cpp
99 +@@ -497,10 +497,19 @@ int main(int argc, char **argv) {
100 + OS << LLVM_HAS_RTTI << '\n';
101 + } else if (Arg == "--shared-mode") {
102 + PrintSharedMode = true;
103 +- } else if (Arg == "--obj-root") {
104 +- OS << ActivePrefix << '\n';
105 +- } else if (Arg == "--src-root") {
106 +- OS << LLVM_SRC_ROOT << '\n';
107 ++ } else if (Arg == "--obj-root" || Arg == "--src-root") {
108 ++ if (IsInDevelopmentTree) {
109 ++ if (Arg == "--obj-root") {
110 ++ OS << ActivePrefix << '\n';
111 ++ } else {
112 ++ OS << LLVM_SRC_ROOT << '\n';
113 ++ }
114 ++ } else {
115 ++ // sources are not installed
116 ++ llvm::errs() << "llvm-config: sources not installed, "
117 ++ << Arg << " not available\n";
118 ++ exit(1);
119 ++ }
120 + } else {
121 + usage();
122 + }
123 +diff --git a/utils/llvm-build/llvmbuild/main.py b/utils/llvm-build/llvmbuild/main.py
124 +index f2472f6..a29fc83 100644
125 +--- a/utils/llvm-build/llvmbuild/main.py
126 ++++ b/utils/llvm-build/llvmbuild/main.py
127 +@@ -393,6 +393,8 @@ subdirectories = %s
128 + //
129 + //===----------------------------------------------------------------------===//
130 +
131 ++#include "llvm/Config/config.h"
132 ++
133 + """)
134 + f.write('struct AvailableComponent {\n')
135 + f.write(' /// The name of the component.\n')
136 +@@ -413,7 +415,8 @@ subdirectories = %s
137 + if library_name is None:
138 + library_name_as_cstr = 'nullptr'
139 + else:
140 +- library_name_as_cstr = '"lib%s.a"' % library_name
141 ++ library_name_as_cstr = '"lib%s" LTDL_SHLIB_EXT' % library_name
142 ++
143 + if is_installed:
144 + is_installed_as_cstr = 'true'
145 + else:
146 +--
147 +2.6.3
148 +
149
150 diff --git a/sys-devel/llvm/llvm-9999.ebuild b/sys-devel/llvm/llvm-9999.ebuild
151 index ce52542..e65e573 100644
152 --- a/sys-devel/llvm/llvm-9999.ebuild
153 +++ b/sys-devel/llvm/llvm-9999.ebuild
154 @@ -5,10 +5,10 @@
155 EAPI=5
156
157 : ${CMAKE_MAKEFILE_GENERATOR:=ninja}
158 -PYTHON_COMPAT=( python2_7 pypy )
159 +PYTHON_COMPAT=( python2_7 )
160
161 inherit check-reqs cmake-utils eutils flag-o-matic git-r3 multilib \
162 - multilib-minimal python-r1 toolchain-funcs pax-utils
163 + multilib-minimal python-single-r1 toolchain-funcs pax-utils
164
165 DESCRIPTION="Low Level Virtual Machine"
166 HOMEPAGE="http://llvm.org/"
167 @@ -25,12 +25,9 @@ IUSE="clang debug +doc gold libedit +libffi lldb multitarget ncurses ocaml
168 COMMON_DEPEND="
169 sys-libs/zlib:0=
170 clang? (
171 - python? ( ${PYTHON_DEPS} )
172 - static-analyzer? (
173 - dev-lang/perl:*
174 - ${PYTHON_DEPS}
175 - )
176 + static-analyzer? ( dev-lang/perl:* )
177 xml? ( dev-libs/libxml2:2=[${MULTILIB_USEDEP}] )
178 + ${PYTHON_DEPS}
179 )
180 gold? ( >=sys-devel/binutils-2.22:*[cxx] )
181 libedit? ( dev-libs/libedit:0=[${MULTILIB_USEDEP}] )
182 @@ -68,8 +65,7 @@ PDEPEND="clang? ( =sys-devel/clang-${PV}-r100 )"
183 # pypy gives me around 1700 unresolved tests due to open file limit
184 # being exceeded. probably GC does not close them fast enough.
185 REQUIRED_USE="${PYTHON_REQUIRED_USE}
186 - lldb? ( clang xml )
187 - test? ( || ( $(python_gen_useflags 'python*') ) )"
188 + lldb? ( clang xml )"
189
190 pkg_pretend() {
191 # in megs
192 @@ -176,14 +172,12 @@ src_prepare() {
193
194 # Fix llvm-config for shared linking and sane flags
195 # https://bugs.gentoo.org/show_bug.cgi?id=565358
196 - epatch "${FILESDIR}"/llvm-3.7-llvm-config.patch
197 + epatch "${FILESDIR}"/llvm-3.8-llvm-config.patch
198
199 if use clang; then
200 # Automatically select active system GCC's libraries, bugs #406163 and #417913
201 epatch "${FILESDIR}"/clang-3.5-gentoo-runtime-gcc-detection-v3.patch
202
203 - epatch "${FILESDIR}"/clang-3.8-gentoo-install.patch
204 -
205 # Install clang runtime into /usr/lib/clang
206 # https://llvm.org/bugs/show_bug.cgi?id=23792
207 epatch "${FILESDIR}"/cmake/clang-0001-Install-clang-runtime-into-usr-lib-without-suffix-3.8.patch
208 @@ -207,11 +201,11 @@ src_prepare() {
209 -i tools/lldb/scripts/Python/modules/CMakeLists.txt || die
210 fi
211
212 + python_setup
213 +
214 # User patches
215 epatch_user
216
217 - python_setup
218 -
219 # Native libdir is used to hold LLVMgold.so
220 NATIVE_LIBDIR=$(get_libdir)
221 }
222 @@ -458,42 +452,31 @@ multilib_src_install() {
223
224 multilib_src_install_all() {
225 insinto /usr/share/vim/vimfiles
226 - doins -r utils/vim/*/
227 + doins -r utils/vim/*/.
228 # some users may find it useful
229 dodoc utils/vim/vimrc
230
231 if use clang; then
232 pushd tools/clang >/dev/null || die
233
234 - python_inst() {
235 - if use static-analyzer ; then
236 - pushd tools/scan-view/bin >/dev/null || die
237 -
238 - python_doscript scan-view
239 + if use python ; then
240 + pushd bindings/python/clang >/dev/null || die
241
242 - touch __init__.py || die
243 - python_moduleinto clang
244 - python_domodule *.py Resources
245 + python_moduleinto clang
246 + python_domodule *.py
247
248 - popd >/dev/null || die
249 -
250 - # TODO: remove files installed in /usr/share
251 - fi
252 -
253 - if use python ; then
254 - pushd bindings/python/clang >/dev/null || die
255 -
256 - python_moduleinto clang
257 - python_domodule *.py
258 + popd >/dev/null || die
259 + fi
260
261 - popd >/dev/null || die
262 - fi
263 + # AddressSanitizer symbolizer (currently separate)
264 + dobin "${S}"/projects/compiler-rt/lib/asan/scripts/asan_symbolize.py
265
266 - # AddressSanitizer symbolizer (currently separate)
267 - python_doscript "${S}"/projects/compiler-rt/lib/asan/scripts/asan_symbolize.py
268 - }
269 - python_foreach_impl python_inst
270 popd >/dev/null || die
271 +
272 + python_fix_shebang "${ED}"
273 + if use static-analyzer; then
274 + python_optimize "${ED}"usr/share/scan-view
275 + fi
276 fi
277 }