Lines 17-29
SRC_URI="http://llvm.org/releases/${PV}/llvm-${PV}.tgz -> llvm-${PV}-r1.tgz
Link Here
|
17 |
http://llvm.org/releases/${PV}/${P}.tgz" |
17 |
http://llvm.org/releases/${PV}/${P}.tgz" |
18 |
|
18 |
|
19 |
LICENSE="UoI-NCSA" |
19 |
LICENSE="UoI-NCSA" |
20 |
SLOT="0" |
20 |
SLOT="${PV}" |
21 |
KEYWORDS="~amd64 ~x86 ~amd64-linux ~x86-linux ~ppc-macos" |
21 |
KEYWORDS="~amd64 ~x86 ~amd64-linux ~x86-linux ~ppc-macos" |
22 |
IUSE="debug multitarget +static-analyzer system-cxx-headers test" |
22 |
IUSE="debug multitarget +static-analyzer system-cxx-headers test" |
23 |
|
23 |
|
24 |
# Note: for LTO support, clang will depend on binutils with gold plugins, and LLVM built after that - http://llvm.org/docs/GoldPlugin.html |
24 |
# Note: for LTO support, clang will depend on binutils with gold plugins, and LLVM built after that - http://llvm.org/docs/GoldPlugin.html |
25 |
DEPEND="static-analyzer? ( dev-lang/perl )" |
25 |
DEPEND="static-analyzer? ( dev-lang/perl )" |
26 |
RDEPEND="~sys-devel/llvm-${PV}[debug=,multitarget=]" |
26 |
RDEPEND="~sys-devel/llvm-${PV}[debug=,multitarget=] |
|
|
27 |
app-admin/eselect-clang" |
27 |
|
28 |
|
28 |
S="${WORKDIR}/llvm-${PV}" |
29 |
S="${WORKDIR}/llvm-${PV}" |
29 |
|
30 |
|
Lines 68-74
src_prepare() {
Link Here
|
68 |
-i Makefile.config.in || die "Makefile.config sed failed" |
69 |
-i Makefile.config.in || die "Makefile.config sed failed" |
69 |
|
70 |
|
70 |
einfo "Fixing rpath and CFLAGS" |
71 |
einfo "Fixing rpath and CFLAGS" |
71 |
sed -e 's,\$(RPATH) -Wl\,\$(\(ToolDir\|LibDir\)),$(RPATH) -Wl\,'"${EPREFIX}"/usr/$(get_libdir)/llvm, \ |
72 |
sed -e "s@\$(RPATH) -Wl,\$(\(ToolDir\|LibDir\))@\$(RPATH) -Wl,'${EPREFIX}/usr/$(get_libdir)/llvm-${SLOT}'@" \ |
72 |
-e '/OmitFramePointer/s/-fomit-frame-pointer//' \ |
73 |
-e '/OmitFramePointer/s/-fomit-frame-pointer//' \ |
73 |
-i Makefile.rules || die "rpath sed failed" |
74 |
-i Makefile.rules || die "rpath sed failed" |
74 |
} |
75 |
} |
Lines 153-162
src_install() {
Link Here
|
153 |
|
154 |
|
154 |
cd tools/scan-view || die "cd scan-view failed" |
155 |
cd tools/scan-view || die "cd scan-view failed" |
155 |
dobin scan-view |
156 |
dobin scan-view |
|
|
157 |
fi |
158 |
|
159 |
# Register slot for app-admin/eselect-clang |
160 |
local eselect_dir="/usr/share/eselect-clang/slots/${SLOT}" |
161 |
dodir "${eselect_dir}" |
162 |
eselect_dir="${ED}/${eselect_dir}" |
163 |
echo "${CATEGORY}/${PF}" > "${eselect_dir}/ebuild" |
164 |
|
165 |
with_slot_suffix() { |
166 |
local file=$(echo "$1" | sed -e "s/-${SLOT}//") |
167 |
local ext="" |
168 |
if [[ "${file}" =~ \. ]] ; then |
169 |
ext=".${file#*.}" |
170 |
fi |
171 |
local base="${file%%.*}" |
172 |
echo "${base}-${SLOT}${ext}" |
173 |
} |
174 |
|
175 |
make_versioned() { |
176 |
local dir=$1 |
177 |
local candidates=(${ED%/}/${dir}) |
178 |
if [[ ! ${dir##*/} ]] ; then |
179 |
dir=${dir%/} |
180 |
candidates=( "${candidates}"* ) |
181 |
else |
182 |
dir=$(dirname "${dir}") |
183 |
fi |
184 |
|
185 |
pushd ${ED%/}/${dir} >/dev/null || die |
186 |
|
187 |
local candidate |
188 |
for candidate in "${candidates[@]}" ; do |
189 |
if [[ -h "${candidate}" ]] ; then |
190 |
# Add slot suffix to symlink target |
191 |
local target=$(readlink -s "${candidate}") |
192 |
local slotted_target=$(with_slot_suffix "${target}") |
193 |
if [[ -e "${target}" ]] || [[ -e "${slotted_target}" ]] ; then |
194 |
ln -sf "${slotted_target}" "${candidate}" \ |
195 |
|| die "Could not update symlink" |
196 |
fi |
197 |
fi |
198 |
|
199 |
local base_name=$(basename "${candidate}") |
200 |
local slotted_name=$(with_slot_suffix "${base_name}") |
201 |
mv "${candidate}" "${ED}/${dir}/${slotted_name}" \ |
202 |
|| die "Could not rename ${candidate} to ${slotted_name}" |
203 |
echo "/${dir#/}/${base_name}" >> "${eselect_dir}/versioned" |
204 |
done |
205 |
|
206 |
popd >/dev/null || die |
207 |
} |
208 |
|
209 |
# Trailing slash => version the content |
210 |
# No trailing slash => version the directory itself |
211 |
local paths=( |
212 |
/usr/bin/ |
213 |
/usr/$(get_libdir)/llvm |
214 |
/usr/include/ |
215 |
/usr/share/clang |
216 |
/usr/share/man/man1/ |
217 |
) |
218 |
|
219 |
local path |
220 |
for path in "${paths[@]}" ; do |
221 |
make_versioned "${path}" |
222 |
done |
223 |
|
224 |
if use static-analyzer ; then |
225 |
cd "${S}"/tools/clang/tools/scan-view || die "cd scan-view failed" |
226 |
|
156 |
install-scan-view() { |
227 |
install-scan-view() { |
157 |
insinto "$(python_get_sitedir)"/clang |
228 |
insinto "$(python_get_sitedir)"/clang |
158 |
doins Reporter.py Resources ScanView.py startfile.py |
229 |
doins Reporter.py Resources ScanView.py startfile.py |
159 |
touch "${ED}"/"$(python_get_sitedir)"/clang/__init__.py |
230 |
touch "${ED}"/"$(python_get_sitedir)"/clang/__init__.py |
|
|
231 |
make_versioned "$(python_get_sitedir)/clang" |
160 |
} |
232 |
} |
161 |
python_execute_function install-scan-view |
233 |
python_execute_function install-scan-view |
162 |
fi |
234 |
fi |
Lines 186-192
src_install() {
Link Here
|
186 |
} |
258 |
} |
187 |
|
259 |
|
188 |
pkg_postinst() { |
260 |
pkg_postinst() { |
189 |
python_mod_optimize clang |
261 |
python_mod_optimize clang-${SLOT} |
|
|
262 |
|
263 |
if [[ $(eselect ${PN} show) = "(none)" ]] ; then |
264 |
eselect ${PN} set ${SLOT} |
265 |
fi |
266 |
|
190 |
if use system-cxx-headers; then |
267 |
if use system-cxx-headers; then |
191 |
elog "C++ headers search path is hardcoded to the active gcc profile one" |
268 |
elog "C++ headers search path is hardcoded to the active gcc profile one" |
192 |
elog "If you change the active gcc profile, or update gcc to a new version," |
269 |
elog "If you change the active gcc profile, or update gcc to a new version," |
Lines 198-203
pkg_postinst() {
Link Here
|
198 |
fi |
275 |
fi |
199 |
} |
276 |
} |
200 |
|
277 |
|
|
|
278 |
pkg_prerm() { |
279 |
if [[ $(eselect ${PN} show) = ${SLOT} ]] ; then |
280 |
eselect ${PN} clear |
281 |
fi |
282 |
} |
283 |
|
201 |
pkg_postrm() { |
284 |
pkg_postrm() { |
202 |
python_mod_cleanup clang |
285 |
python_mod_cleanup clang-${SLOT} |
|
|
286 |
|
287 |
if [[ -z ${REPLACED_BY_VERSION} ]] ; then |
288 |
eselect ${PN} update |
289 |
fi |
203 |
} |
290 |
} |