Gentoo Archives: gentoo-commits

From: Sergei Trofimovich <slyfox@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: dev-util/include-what-you-use/
Date: Sat, 29 Jul 2017 17:34:50
Message-Id: 1501349681.c3759ec007c6cda0a7c1100247d455f33a2a1314.slyfox@gentoo
1 commit: c3759ec007c6cda0a7c1100247d455f33a2a1314
2 Author: Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
3 AuthorDate: Sat Jul 29 17:34:08 2017 +0000
4 Commit: Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
5 CommitDate: Sat Jul 29 17:34:41 2017 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=c3759ec0
7
8 dev-util/include-what-you-use: worjaround <stddef.h> lookup failure, bug #625972
9
10 libclangDriver treats path to include files as stable relative
11 to clang binary: when we run /usr/lib64/llvm/4/bin/clang it resolves
12 <stddef.h> the following way:
13 "/usr/lib64/llvm/4/bin/" + "../../../../lib/clang/4.0.1/include/stddef.h"
14
15 Unfortunately when someone reuses clang driver to build a new tool
16 heared lookup breaks if final tool resides in "/usr/bin":
17 "/usr/bin/" + "../../../../lib/clang/4.0.1/include/stddef.h"
18 causing file open failures in case of include-what-you-use:
19 /usr/include/wchar.h:39:11: fatal error: 'stdarg.h' file not found
20 # include <stdarg.h>
21 ^~~~~~~~~~
22
23 The workaround is to install executable to the same directory as clang itself.
24
25 Reported-by: MichaƂ Bartoszkiewicz
26 Bug: https://bugs.gentoo.org/625972
27 Package-Manager: Portage-2.3.6, Repoman-2.3.3
28
29 .../include-what-you-use-4.0-r1.ebuild | 56 ++++++++++++++++++++++
30 1 file changed, 56 insertions(+)
31
32 diff --git a/dev-util/include-what-you-use/include-what-you-use-4.0-r1.ebuild b/dev-util/include-what-you-use/include-what-you-use-4.0-r1.ebuild
33 new file mode 100644
34 index 00000000000..4876be74098
35 --- /dev/null
36 +++ b/dev-util/include-what-you-use/include-what-you-use-4.0-r1.ebuild
37 @@ -0,0 +1,56 @@
38 +# Copyright 1999-2017 Gentoo Foundation
39 +# Distributed under the terms of the GNU General Public License v2
40 +
41 +EAPI=6
42 +
43 +PYTHON_COMPAT=( python2_7 python3_{4,5,6} )
44 +
45 +inherit cmake-utils flag-o-matic llvm python-single-r1
46 +
47 +DESCRIPTION="Find unused include directives in C/C++ programs"
48 +HOMEPAGE="https://include-what-you-use.org/"
49 +SRC_URI="https://github.com/${PN}/${PN}/archive/clang_${PV}.tar.gz -> ${P}.src.tar.gz"
50 +
51 +LICENSE="GPL-2"
52 +SLOT="0"
53 +KEYWORDS="~amd64 ~x86"
54 +
55 +RDEPEND="sys-devel/llvm:4
56 + sys-devel/clang:4
57 + ${PYTHON_DEPS}
58 +"
59 +DEPEND="${RDEPEND}"
60 +
61 +REQUIRED_USE=${PYTHON_REQUIRED_USE}
62 +
63 +S=${WORKDIR}/${PN}-clang_${PV}
64 +
65 +pkg_setup() {
66 + llvm_pkg_setup
67 + python-single-r1_pkg_setup
68 +}
69 +
70 +src_prepare() {
71 + python_fix_shebang .
72 + default
73 +}
74 +
75 +src_configure() {
76 + local mycmakeargs=(
77 + -DIWYU_LLVM_INCLUDE_PATH=$(llvm-config --includedir)
78 + -DIWYU_LLVM_LIB_PATH=$(llvm-config --libdir)
79 +
80 + # Note [llvm install path]
81 + # Unfortunately all binaries using clang driver
82 + # have to reside at the same path depth as
83 + # 'clang' binary itself. See bug #625972
84 + # Thus as a hack we install it to the same directory
85 + # as llvm/clang itself.
86 + -DCMAKE_INSTALL_PREFIX="$(get_llvm_prefix)"
87 + )
88 + cmake-utils_src_configure
89 +}
90 +
91 +src_test() {
92 + "${EPYTHON}" run_iwyu_tests.py
93 +}