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/
Date: Wed, 02 Oct 2019 20:27:43
Message-Id: 1570048054.22a57fe378193e3fff45dac0d668eaeecc3aee9f.mgorny@gentoo
1 commit: 22a57fe378193e3fff45dac0d668eaeecc3aee9f
2 Author: Michał Górny <mgorny <AT> gentoo <DOT> org>
3 AuthorDate: Tue Sep 10 11:52:29 2019 +0000
4 Commit: Michał Górny <mgorny <AT> gentoo <DOT> org>
5 CommitDate: Wed Oct 2 20:27:34 2019 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=22a57fe3
7
8 sys-devel/llvm: Switch 10+ to dylib build
9
10 Build and install the single dylib instead of split shared libs in 10+.
11
12 Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>
13
14 sys-devel/llvm/llvm-10.0.0.9999.ebuild | 182 ++++++++++++++++++++++++++++++++-
15 1 file changed, 180 insertions(+), 2 deletions(-)
16
17 diff --git a/sys-devel/llvm/llvm-10.0.0.9999.ebuild b/sys-devel/llvm/llvm-10.0.0.9999.ebuild
18 index 92a9c5ae1c1..eccfd8a533b 100644
19 --- a/sys-devel/llvm/llvm-10.0.0.9999.ebuild
20 +++ b/sys-devel/llvm/llvm-10.0.0.9999.ebuild
21 @@ -122,6 +122,62 @@ check_live_ebuild() {
22 fi
23 }
24
25 +check_distribution_components() {
26 + if [[ ${CMAKE_MAKEFILE_GENERATOR} == ninja ]]; then
27 + local all_targets=() my_targets=() l
28 + cd "${BUILD_DIR}" || die
29 +
30 + while read -r l; do
31 + if [[ ${l} == install-*-stripped:* ]]; then
32 + l=${l#install-}
33 + l=${l%%-stripped*}
34 +
35 + case ${l} in
36 + # shared libs
37 + LLVM|LLVMgold)
38 + ;;
39 + # TableGen lib + deps
40 + LLVMDemangle|LLVMSupport|LLVMTableGen)
41 + ;;
42 + # static libs
43 + LLVM*)
44 + continue
45 + ;;
46 + # meta-targets
47 + distribution|llvm-libraries)
48 + continue
49 + ;;
50 + esac
51 +
52 + all_targets+=( "${l}" )
53 + fi
54 + done < <(ninja -t targets all)
55 +
56 + while read -r l; do
57 + my_targets+=( "${l}" )
58 + done < <(get_distribution_components $"\n")
59 +
60 + local add=() remove=()
61 + for l in "${all_targets[@]}"; do
62 + if ! has "${l}" "${my_targets[@]}"; then
63 + add+=( "${l}" )
64 + fi
65 + done
66 + for l in "${my_targets[@]}"; do
67 + if ! has "${l}" "${all_targets[@]}"; then
68 + remove+=( "${l}" )
69 + fi
70 + done
71 +
72 + if [[ ${#add[@]} -gt 0 || ${#remove[@]} -gt 0 ]]; then
73 + eqawarn "get_distribution_components() is outdated!"
74 + eqawarn " Add: ${add[*]}"
75 + eqawarn "Remove: ${remove[*]}"
76 + fi
77 + cd - >/dev/null || die
78 + fi
79 +}
80 +
81 src_prepare() {
82 # Fix llvm-config for shared linking and sane flags
83 # https://bugs.gentoo.org/show_bug.cgi?id=565358
84 @@ -149,6 +205,122 @@ is_libcxx_linked() {
85 [[ ${out} == *HAVE_LIBCXX* ]]
86 }
87
88 +get_distribution_components() {
89 + local sep=${1-;}
90 +
91 + local out=(
92 + # shared libs
93 + LLVM
94 + LTO
95 + Remarks
96 +
97 + # tools
98 + llvm-config
99 +
100 + # common stuff
101 + cmake-exports
102 + llvm-headers
103 +
104 + # libraries needed for clang-tblgen
105 + LLVMDemangle
106 + LLVMSupport
107 + LLVMTableGen
108 + )
109 +
110 + if multilib_is_native_abi; then
111 + out+=(
112 + # utilities
113 + llvm-tblgen
114 + FileCheck
115 + llvm-PerfectShuffle
116 + count
117 + not
118 + yaml-bench
119 +
120 + # tools
121 + bugpoint
122 + dsymutil
123 + llc
124 + lli
125 + lli-child-target
126 + llvm-addr2line
127 + llvm-ar
128 + llvm-as
129 + llvm-bcanalyzer
130 + llvm-c-test
131 + llvm-cat
132 + llvm-cfi-verify
133 + llvm-config
134 + llvm-cov
135 + llvm-cvtres
136 + llvm-cxxdump
137 + llvm-cxxfilt
138 + llvm-cxxmap
139 + llvm-diff
140 + llvm-dis
141 + llvm-dlltool
142 + llvm-dwarfdump
143 + llvm-dwp
144 + llvm-elfabi
145 + llvm-exegesis
146 + llvm-extract
147 + llvm-ifs
148 + llvm-jitlink
149 + llvm-lib
150 + llvm-link
151 + llvm-lipo
152 + llvm-lto
153 + llvm-lto2
154 + llvm-mc
155 + llvm-mca
156 + llvm-modextract
157 + llvm-mt
158 + llvm-nm
159 + llvm-objcopy
160 + llvm-objdump
161 + llvm-opt-report
162 + llvm-pdbutil
163 + llvm-profdata
164 + llvm-ranlib
165 + llvm-rc
166 + llvm-readelf
167 + llvm-readobj
168 + llvm-reduce
169 + llvm-rtdyld
170 + llvm-size
171 + llvm-split
172 + llvm-stress
173 + llvm-strings
174 + llvm-strip
175 + llvm-symbolizer
176 + llvm-undname
177 + llvm-xray
178 + obj2yaml
179 + opt
180 + sancov
181 + sanstats
182 + verify-uselistorder
183 + yaml2obj
184 +
185 + # python modules
186 + opt-viewer
187 + )
188 +
189 + use doc && out+=(
190 + docs-dsymutil-man
191 + docs-llvm-dwarfdump-man
192 + docs-llvm-man
193 + docs-llvm-html
194 + )
195 +
196 + use gold && out+=(
197 + LLVMgold
198 + )
199 + fi
200 +
201 + printf "%s${sep}" "${out[@]}"
202 +}
203 +
204 multilib_src_configure() {
205 local ffi_cflags ffi_ldflags
206 if use libffi; then
207 @@ -164,7 +336,11 @@ multilib_src_configure() {
208 -DCMAKE_INSTALL_PREFIX="${EPREFIX}/usr/lib/llvm/${SLOT}"
209 -DLLVM_LIBDIR_SUFFIX=${libdir#lib}
210
211 - -DBUILD_SHARED_LIBS=ON
212 + -DBUILD_SHARED_LIBS=OFF
213 + -DLLVM_BUILD_LLVM_DYLIB=ON
214 + -DLLVM_LINK_LLVM_DYLIB=ON
215 + -DLLVM_DISTRIBUTION_COMPONENTS=$(get_distribution_components)
216 +
217 # cheap hack: LLVM combines both anyway, and the only difference
218 # is that the former list is explicitly verified at cmake time
219 -DLLVM_TARGETS_TO_BUILD=""
220 @@ -256,6 +432,8 @@ multilib_src_configure() {
221 # LLVM_ENABLE_ASSERTIONS=NO does not guarantee this for us, #614844
222 use debug || local -x CPPFLAGS="${CPPFLAGS} -DNDEBUG"
223 cmake-utils_src_configure
224 +
225 + multilib_is_native_abi && check_distribution_components
226 }
227
228 multilib_src_compile() {
229 @@ -295,7 +473,7 @@ src_install() {
230 }
231
232 multilib_src_install() {
233 - cmake-utils_src_install
234 + DESTDIR=${D} cmake-utils_src_make install-distribution
235
236 # move headers to /usr/include for wrapping
237 rm -rf "${ED}"/usr/include || die