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.0-r4.ebuild (-6 / +93 lines)
Lines 16-27 SRC_URI="http://llvm.org/releases/${PV}/llvm-${PV}.tar.gz Link Here
16
	http://llvm.org/releases/${PV}/${P}.tar.gz"
16
	http://llvm.org/releases/${PV}/${P}.tar.gz"
17
17
18
LICENSE="UoI-NCSA"
18
LICENSE="UoI-NCSA"
19
SLOT="0"
19
SLOT="${PV}"
20
KEYWORDS="~amd64 ~x86 ~amd64-linux ~x86-linux ~ppc-macos"
20
KEYWORDS="~amd64 ~x86 ~amd64-linux ~x86-linux ~ppc-macos"
21
IUSE="debug kernel_FreeBSD multitarget +static-analyzer system-cxx-headers test"
21
IUSE="debug kernel_FreeBSD multitarget +static-analyzer system-cxx-headers test"
22
22
23
DEPEND="static-analyzer? ( dev-lang/perl )"
23
DEPEND="static-analyzer? ( dev-lang/perl )"
24
RDEPEND="~sys-devel/llvm-${PV}[debug=,multitarget=]"
24
RDEPEND="~sys-devel/llvm-${PV}[debug=,multitarget=]
25
	app-admin/eselect-clang"
25
26
26
S=${WORKDIR}/llvm-${PV}.src
27
S=${WORKDIR}/llvm-${PV}.src
27
28
Lines 45-51 src_prepare() { Link Here
45
		-i tools/clang/tools/scan-build/scan-build \
46
		-i tools/clang/tools/scan-build/scan-build \
46
		|| die "scan-build sed failed"
47
		|| die "scan-build sed failed"
47
	# Set correct path for gold plugin
48
	# Set correct path for gold plugin
48
	sed -e "/LLVMgold.so/s#lib/#$(get_libdir)/llvm/#" \
49
	sed -e "/LLVMgold.so/s#lib/#$(get_libdir)/llvm-${SLOT}/#" \
49
		-i  tools/clang/lib/Driver/Tools.cpp \
50
		-i  tools/clang/lib/Driver/Tools.cpp \
50
		|| die "gold plugin path sed failed"
51
		|| die "gold plugin path sed failed"
51
	# Properly detect Gentoo's binutils-apple version (committed in trunk)
52
	# Properly detect Gentoo's binutils-apple version (committed in trunk)
Lines 62-68 src_prepare() { Link Here
62
		-i Makefile.config.in || die "Makefile.config sed failed"
63
		-i Makefile.config.in || die "Makefile.config sed failed"
63
64
64
	einfo "Fixing rpath and CFLAGS"
65
	einfo "Fixing rpath and CFLAGS"
65
	sed -e 's,\$(RPATH) -Wl\,\$(\(ToolDir\|LibDir\)),$(RPATH) -Wl\,'"${EPREFIX}"/usr/$(get_libdir)/llvm, \
66
	sed -e "s@\$(RPATH) -Wl,\$(\(ToolDir\|LibDir\))@\$(RPATH) -Wl,'${EPREFIX}/usr/$(get_libdir)/llvm-${SLOT}'@" \
66
		-e '/OmitFramePointer/s/-fomit-frame-pointer//' \
67
		-e '/OmitFramePointer/s/-fomit-frame-pointer//' \
67
		-i Makefile.rules || die "rpath sed failed"
68
		-i Makefile.rules || die "rpath sed failed"
68
69
Lines 160-169 src_install() { Link Here
160
161
161
		cd tools/scan-view || die "cd scan-view failed"
162
		cd tools/scan-view || die "cd scan-view failed"
162
		dobin scan-view
163
		dobin scan-view
164
	fi
165
166
	# Register slot for app-admin/eselect-clang
167
	local eselect_dir="/usr/share/eselect-clang/slots/${SLOT}"
168
	dodir "${eselect_dir}"
169
	eselect_dir="${ED}/${eselect_dir}"
170
	echo "${CATEGORY}/${PF}" > "${eselect_dir}/ebuild"
171
172
	with_slot_suffix() {
173
		local file=$(echo "$1" | sed -e "s/-${SLOT}//")
174
		local ext=""
175
		if [[ "${file}" =~ \. ]] ; then
176
			ext=".${file#*.}"
177
		fi
178
		local base="${file%%.*}"
179
		echo "${base}-${SLOT}${ext}"
180
	}
181
182
	make_versioned() {
183
		local dir=$1
184
		local candidates=(${ED%/}/${dir})
185
		if [[ ! ${dir##*/} ]] ; then
186
			dir=${dir%/}
187
			candidates=( "${candidates}"* )
188
		else
189
			dir=$(dirname "${dir}")
190
		fi
191
192
		pushd ${ED%/}/${dir} >/dev/null || die
193
194
		local candidate
195
		for candidate in "${candidates[@]}" ; do
196
			if [[ -h "${candidate}" ]] ; then
197
				# Add slot suffix to symlink target
198
				local target=$(readlink -s "${candidate}")
199
				local slotted_target=$(with_slot_suffix "${target}")
200
				if [[ -e "${target}" ]] || [[ -e "${slotted_target}" ]] ; then
201
					ln -sf "${slotted_target}" "${candidate}" \
202
						|| die "Could not update symlink"
203
				fi
204
			fi
205
206
			local base_name=$(basename "${candidate}")
207
			local slotted_name=$(with_slot_suffix "${base_name}")
208
			mv "${candidate}" "${ED}/${dir}/${slotted_name}" \
209
				|| die "Could not rename ${candidate} to ${slotted_name}"
210
			echo "/${dir#/}/${base_name}" >> "${eselect_dir}/versioned"
211
		done
212
213
		popd >/dev/null || die
214
	}
215
216
	# Trailing slash => version the content
217
	# No trailing slash => version the directory itself
218
	local paths=(
219
		/usr/bin/
220
		/usr/$(get_libdir)/llvm
221
		/usr/include/
222
		/usr/share/clang
223
		/usr/share/man/man1/
224
	)
225
226
	local path
227
	for path in "${paths[@]}" ; do
228
		make_versioned "${path}"
229
	done
230
231
	if use static-analyzer ; then
232
		cd "${S}"/tools/clang/tools/scan-view || die "cd scan-view failed"
233
163
		install-scan-view() {
234
		install-scan-view() {
164
			insinto "$(python_get_sitedir)"/clang
235
			insinto "$(python_get_sitedir)"/clang
165
			doins Reporter.py Resources ScanView.py startfile.py
236
			doins Reporter.py Resources ScanView.py startfile.py
166
			touch "${ED}"/"$(python_get_sitedir)"/clang/__init__.py
237
			touch "${ED}"/"$(python_get_sitedir)"/clang/__init__.py
238
			make_versioned "$(python_get_sitedir)/clang"
167
		}
239
		}
168
		python_execute_function install-scan-view
240
		python_execute_function install-scan-view
169
	fi
241
	fi
Lines 196-202 src_install() { Link Here
196
}
268
}
197
269
198
pkg_postinst() {
270
pkg_postinst() {
199
	python_mod_optimize clang
271
	python_mod_optimize clang-${SLOT}
272
273
	if [[ $(eselect ${PN} show) = "(none)" ]] ; then
274
		eselect ${PN} set ${SLOT}
275
	fi
276
200
	if use system-cxx-headers; then
277
	if use system-cxx-headers; then
201
		elog "C++ headers search path is hardcoded to the active gcc profile one"
278
		elog "C++ headers search path is hardcoded to the active gcc profile one"
202
		elog "If you change the active gcc profile, or update gcc to a new version,"
279
		elog "If you change the active gcc profile, or update gcc to a new version,"
Lines 208-213 pkg_postinst() { Link Here
208
	fi
285
	fi
209
}
286
}
210
287
288
pkg_prerm() {
289
	if [[ $(eselect ${PN} show) = ${SLOT} ]] ; then
290
		eselect ${PN} clear
291
	fi
292
}
293
211
pkg_postrm() {
294
pkg_postrm() {
212
	python_mod_cleanup clang
295
	python_mod_cleanup clang-${SLOT}
296
297
	if [[ -z ${REPLACED_BY_VERSION} ]] ; then
298
		eselect ${PN} update
299
	fi
213
}
300
}

Return to bug 471330