Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 471330 | Differences between
and this patch

Collapse All | Expand All

(-)a/sys-devel/clang/clang-3.2.ebuild (-7 / +104 lines)
Lines 1-6 Link Here
1
# Copyright 1999-2013 Gentoo Foundation
1
# Copyright 1999-2013 Gentoo Foundation
2
# Distributed under the terms of the GNU General Public License v2
2
# Distributed under the terms of the GNU General Public License v2
3
# $Header: /var/cvsroot/gentoo-x86/sys-devel/clang/clang-3.2.ebuild,v 1.6 2013/05/24 21:27:58 aballier Exp $
3
# $Header: /var/cvsroot/gentoo-x86/sys-devel/clang/clang-3.2.ebuild,v 1.5 2013/02/04 08:50:49 mgorny Exp $
4
4
5
EAPI=5
5
EAPI=5
6
6
Lines 16-28 SRC_URI="http://llvm.org/releases/${PV}/llvm-${PV}.src.tar.gz Link Here
16
	http://llvm.org/releases/${PV}/${P}.src.tar.gz"
16
	http://llvm.org/releases/${PV}/${P}.src.tar.gz"
17
17
18
LICENSE="UoI-NCSA"
18
LICENSE="UoI-NCSA"
19
SLOT="0"
19
SLOT="${PV}"
20
KEYWORDS="~amd64 ~arm ~x86 ~amd64-fbsd ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos"
20
KEYWORDS="~amd64 ~arm ~x86 ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos"
21
IUSE="debug kernel_FreeBSD multitarget python +static-analyzer test"
21
IUSE="debug kernel_FreeBSD multitarget python +static-analyzer test"
22
22
23
DEPEND="static-analyzer? ( dev-lang/perl )
23
DEPEND="static-analyzer? ( dev-lang/perl )
24
	${PYTHON_DEPS}"
24
	${PYTHON_DEPS}"
25
RDEPEND="~sys-devel/llvm-${PV}[debug=,multitarget=]
25
RDEPEND="~sys-devel/llvm-${PV}[debug=,multitarget=]
26
	app-admin/eselect-clang
26
	${PYTHON_DEPS}"
27
	${PYTHON_DEPS}"
27
28
28
S=${WORKDIR}/llvm-${PV}.src
29
S=${WORKDIR}/llvm-${PV}.src
Lines 53-59 src_prepare() { Link Here
53
		-i tools/clang/tools/scan-build/scan-build \
54
		-i tools/clang/tools/scan-build/scan-build \
54
		|| die "scan-build sed failed"
55
		|| die "scan-build sed failed"
55
	# Set correct path for gold plugin
56
	# Set correct path for gold plugin
56
	sed -e "/LLVMgold.so/s#lib/#$(get_libdir)/llvm/#" \
57
	sed -e "/LLVMgold.so/s#lib/#$(get_libdir)/llvm-${SLOT}/#" \
57
		-i  tools/clang/lib/Driver/Tools.cpp \
58
		-i  tools/clang/lib/Driver/Tools.cpp \
58
		|| die "gold plugin path sed failed"
59
		|| die "gold plugin path sed failed"
59
60
Lines 65-71 src_prepare() { Link Here
65
		-i Makefile.config.in || die "Makefile.config sed failed"
66
		-i Makefile.config.in || die "Makefile.config sed failed"
66
67
67
	einfo "Fixing rpath and CFLAGS"
68
	einfo "Fixing rpath and CFLAGS"
68
	sed -e 's,\$(RPATH) -Wl\,\$(\(ToolDir\|LibDir\)),$(RPATH) -Wl\,'"${EPREFIX}"/usr/$(get_libdir)/llvm, \
69
	sed -e "s@\$(RPATH) -Wl,\$(\(ToolDir\|LibDir\))@\$(RPATH) -Wl,'${EPREFIX}/usr/$(get_libdir)/llvm-${SLOT}'@" \
69
		-e '/OmitFramePointer/s/-fomit-frame-pointer//' \
70
		-e '/OmitFramePointer/s/-fomit-frame-pointer//' \
70
		-i Makefile.rules || die "rpath sed failed"
71
		-i Makefile.rules || die "rpath sed failed"
71
72
Lines 147-157 src_install() { Link Here
147
		doins tools/scan-build/sorttable.js
148
		doins tools/scan-build/sorttable.js
148
	fi
149
	fi
149
150
151
	# Register slot for app-admin/eselect-clang
152
	local eselect_dir="/usr/share/eselect-clang/slots/${SLOT}"
153
	dodir "${eselect_dir}"
154
	eselect_dir="${ED}/${eselect_dir}"
155
	echo "${CATEGORY}/${PF}" > "${eselect_dir}/ebuild"
156
157
	with_slot_suffix() {
158
		local file=$(echo "$1" | sed -e "s/-${SLOT}//")
159
		local ext=""
160
		if [[ "${file}" =~ \. ]] ; then
161
			ext=".${file#*.}"
162
		fi
163
		local base="${file%%.*}"
164
		echo "${base}-${SLOT}${ext}"
165
	}
166
167
	make_versioned() {
168
		local dir=$1
169
		local candidates=(${ED%/}/${dir})
170
		if [[ ! ${dir##*/} ]] ; then
171
			dir=${dir%/}
172
			candidates=( "${candidates}"* )
173
		else
174
			dir=$(dirname "${dir}")
175
		fi
176
177
		pushd ${ED%/}/${dir} >/dev/null || die
178
179
		local candidate
180
		for candidate in "${candidates[@]}" ; do
181
			if [[ -h "${candidate}" ]] ; then
182
				# Add slot suffix to symlink target
183
				local target=$(readlink -s "${candidate}")
184
				local slotted_target=$(with_slot_suffix "${target}")
185
				if [[ -e "${target}" ]] || [[ -e "${slotted_target}" ]] ; then
186
					ln -sf "${slotted_target}" "${candidate}" \
187
						|| die "Could not update symlink"
188
				fi
189
			fi
190
191
			local base_name=$(basename "${candidate}")
192
			local slotted_name=$(with_slot_suffix "${base_name}")
193
			mv "${candidate}" "${ED}/${dir}/${slotted_name}" \
194
				|| die "Could not rename ${candidate} to ${slotted_name}"
195
			echo "/${dir#/}/${base_name}" >> "${eselect_dir}/versioned"
196
		done
197
198
		popd >/dev/null || die
199
	}
200
201
	# Trailing slash => version the content
202
	# No trailing slash => version the directory itself
203
	local paths=(
204
		/usr/bin/
205
		/usr/$(get_libdir)/llvm
206
		/usr/include/
207
		/usr/share/clang
208
		/usr/share/man/man1/
209
	)
210
211
	local path
212
	for path in "${paths[@]}" ; do
213
		make_versioned "${path}"
214
	done
215
216
	python_doscript_versioned() {
217
		local path="$1"
218
		local file=$(basename "${path}")
219
220
		python_newscript "${path}" $(with_slot_suffix "${file}")
221
222
		local scriptroot=${python_scriptroot:-${DESTTREE%/}/bin}
223
		echo "${scriptroot%/}/${file}" >> "${eselect_dir}/versioned"
224
	}
225
150
	python_inst() {
226
	python_inst() {
151
		if use static-analyzer ; then
227
		if use static-analyzer ; then
152
			pushd tools/scan-view >/dev/null || die
228
			pushd tools/scan-view >/dev/null || die
153
229
154
			python_doscript scan-view
230
			python_doscript_versioned scan-view
155
231
156
			touch __init__.py || die
232
			touch __init__.py || die
157
			python_moduleinto clang
233
			python_moduleinto clang
Lines 169-176 src_install() { Link Here
169
			popd >/dev/null || die
245
			popd >/dev/null || die
170
		fi
246
		fi
171
247
248
		use static-analyzer || use python && \
249
			make_versioned "$(python_get_sitedir)/clang"
250
172
		# AddressSanitizer symbolizer (currently separate)
251
		# AddressSanitizer symbolizer (currently separate)
173
		python_doscript "${S}"/projects/compiler-rt/lib/asan/scripts/asan_symbolize.py
252
		python_doscript_versioned "${S}"/projects/compiler-rt/lib/asan/scripts/asan_symbolize.py
174
	}
253
	}
175
	python_foreach_impl python_inst
254
	python_foreach_impl python_inst
176
255
Lines 200-202 src_install() { Link Here
200
	# Remove unnecessary headers on FreeBSD, bug #417171
279
	# Remove unnecessary headers on FreeBSD, bug #417171
201
	use kernel_FreeBSD && rm "${ED}"usr/$(get_libdir)/clang/${PV}/include/{arm_neon,std,float,iso,limits,tgmath,varargs}*.h
280
	use kernel_FreeBSD && rm "${ED}"usr/$(get_libdir)/clang/${PV}/include/{arm_neon,std,float,iso,limits,tgmath,varargs}*.h
202
}
281
}
282
283
pkg_postinst() {
284
	if [[ $(eselect ${PN} show) = "(none)" ]] ; then
285
		eselect ${PN} set ${SLOT}
286
	fi
287
}
288
289
pkg_prerm() {
290
	if [[ $(eselect ${PN} show) = ${SLOT} ]] ; then
291
		eselect ${PN} clear
292
	fi
293
}
294
295
pkg_postrm() {
296
	if [[ -z ${REPLACED_BY_VERSION} ]] ; then
297
		eselect ${PN} update
298
	fi
299
}

Return to bug 471330