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/llvm/llvm-2.9-r2.ebuild (-7 / +91 lines)
Lines 10-16 HOMEPAGE="http://llvm.org/" Link Here
10
SRC_URI="http://llvm.org/releases/${PV}/${P}.tgz"
10
SRC_URI="http://llvm.org/releases/${PV}/${P}.tgz"
11
11
12
LICENSE="UoI-NCSA"
12
LICENSE="UoI-NCSA"
13
SLOT="0"
13
SLOT="${PV}"
14
KEYWORDS="amd64 ~ppc x86 ~x86-fbsd ~amd64-linux ~x86-linux ~ppc-macos"
14
KEYWORDS="amd64 ~ppc x86 ~x86-fbsd ~amd64-linux ~x86-linux ~ppc-macos"
15
IUSE="debug +libffi llvm-gcc multitarget ocaml test udis86 vim-syntax"
15
IUSE="debug +libffi llvm-gcc multitarget ocaml test udis86 vim-syntax"
16
16
Lines 25-30 DEPEND="dev-lang/perl Link Here
25
	ocaml? ( dev-lang/ocaml )
25
	ocaml? ( dev-lang/ocaml )
26
	udis86? ( dev-libs/udis86[pic(+)] )"
26
	udis86? ( dev-libs/udis86[pic(+)] )"
27
RDEPEND="dev-lang/perl
27
RDEPEND="dev-lang/perl
28
	app-admin/eselect-llvm
28
	libffi? ( virtual/libffi )
29
	libffi? ( virtual/libffi )
29
	vim-syntax? ( || ( app-editors/vim app-editors/gvim ) )"
30
	vim-syntax? ( || ( app-editors/vim app-editors/gvim ) )"
30
31
Lines 76-82 src_prepare() { Link Here
76
		-i tools/llvm-config/llvm-config.in.in || die "llvm-config sed failed"
77
		-i tools/llvm-config/llvm-config.in.in || die "llvm-config sed failed"
77
78
78
	einfo "Fixing rpath and CFLAGS"
79
	einfo "Fixing rpath and CFLAGS"
79
	sed -e 's,\$(RPATH) -Wl\,\$(\(ToolDir\|LibDir\)),$(RPATH) -Wl\,'"${EPREFIX}"/usr/$(get_libdir)/${PN}, \
80
	sed -e "s@\$(RPATH) -Wl,\$(\(ToolDir\|LibDir\))@\$(RPATH) -Wl,'${EPREFIX}/usr/$(get_libdir)/${PN}-${SLOT}'@" \
80
		-e '/OmitFramePointer/s/-fomit-frame-pointer//' \
81
		-e '/OmitFramePointer/s/-fomit-frame-pointer//' \
81
		-i Makefile.rules || die "rpath sed failed"
82
		-i Makefile.rules || die "rpath sed failed"
82
83
Lines 167-193 src_install() { Link Here
167
		doins utils/vim/*.vim
168
		doins utils/vim/*.vim
168
	fi
169
	fi
169
170
171
	# Register slot for app-admin/eselect-llvm
172
	local eselect_dir="/usr/share/eselect-llvm/slots/${SLOT}"
173
	dodir "${eselect_dir}"
174
	eselect_dir="${ED}/${eselect_dir}"
175
	echo "${CATEGORY}/${PF}" > "${eselect_dir}/ebuild"
176
177
	with_slot_suffix() {
178
		local file=$(echo "$1" | sed -e "s/-${SLOT}//")
179
		local ext=""
180
		if [[ "${file}" =~ \. ]] ; then
181
			ext=".${file#*.}"
182
		fi
183
		local base="${file%%.*}"
184
		echo "${base}-${SLOT}${ext}"
185
	}
186
187
	make_versioned() {
188
		local dir=$1
189
		local candidates=(${ED%/}/${dir})
190
		if [[ ! ${dir##*/} ]] ; then
191
			dir=${dir%/}
192
			candidates=( "${candidates}"* )
193
		else
194
			dir=$(dirname "${dir}")
195
		fi
196
197
		pushd ${ED%/}/${dir} >/dev/null || die
198
199
		local candidate
200
		for candidate in "${candidates[@]}" ; do
201
			if [[ -h "${candidate}" ]] ; then
202
				# Add slot suffix to symlink target
203
				local target=$(readlink -s "${candidate}")
204
				local slotted_target=$(with_slot_suffix "${target}")
205
				if [[ -e "${target}" ]] || [[ -e "${slotted_target}" ]] ; then
206
					ln -sf "${slotted_target}" "${candidate}" \
207
						|| die "Could not update symlink"
208
				fi
209
			fi
210
211
			local base_name=$(basename "${candidate}")
212
			local slotted_name=$(with_slot_suffix "${base_name}")
213
			mv "${candidate}" "${ED}/${dir}/${slotted_name}" \
214
				|| die "Could not rename ${candidate} to ${slotted_name}"
215
			echo "/${dir#/}/${base_name}" >> "${eselect_dir}/versioned"
216
		done
217
218
		popd >/dev/null || die
219
	}
220
221
	# Trailing slash => version the content
222
	# No trailing slash => version the directory itself
223
	local paths=(
224
		/usr/bin/
225
		/usr/$(get_libdir)/
226
		/usr/include/
227
		/usr/share/man/man1/
228
	)
229
	use vim-syntax && paths+=( /usr/share/vim/vimfiles/syntax/ )
230
231
	local path
232
	for path in "${paths[@]}" ; do
233
		make_versioned "${path}"
234
	done
235
170
	# Fix install_names on Darwin.  The build system is too complicated
236
	# Fix install_names on Darwin.  The build system is too complicated
171
	# to just fix this, so we correct it post-install
237
	# to just fix this, so we correct it post-install
172
	local lib= f= odylib=
238
	local lib= f= odylib=
173
	if [[ ${CHOST} == *-darwin* ]] ; then
239
	if [[ ${CHOST} == *-darwin* ]] ; then
174
		for lib in lib{EnhancedDisassembly,LLVM-${PV},LTO}.dylib {BugpointPasses,LLVMHello,profile_rt}.dylib ; do
240
		for lib in lib{EnhancedDisassembly,LLVM-${PV},LTO}.dylib {BugpointPasses,LLVMHello,profile_rt}.dylib ; do
175
			# libEnhancedDisassembly is Darwin10 only, so non-fatal
241
			# libEnhancedDisassembly is Darwin10 only, so non-fatal
176
			[[ -f ${ED}/usr/lib/${PN}/${lib} ]] || continue
242
			[[ -f ${ED}/usr/lib/${PN}-${SLOT}/${lib} ]] || continue
177
			ebegin "fixing install_name of $lib"
243
			ebegin "fixing install_name of $lib"
178
			install_name_tool \
244
			install_name_tool \
179
				-id "${EPREFIX}"/usr/lib/${PN}/${lib} \
245
				-id "${EPREFIX}"/usr/lib/${PN}-${SLOT}/${lib} \
180
				"${ED}"/usr/lib/${PN}/${lib}
246
				"${ED}"/usr/lib/${PN}-${SLOT}/${lib}
181
			eend $?
247
			eend $?
182
		done
248
		done
183
		for f in "${ED}"/usr/bin/* "${ED}"/usr/lib/${PN}/libLTO.dylib ; do
249
		for f in "${ED}"/usr/bin/* "${ED}"/usr/lib/${PN}-${SLOT}/libLTO.dylib ; do
184
			odylib=$(scanmacho -BF'%n#f' "${f}" | tr ',' '\n' | grep libLLVM-${PV}.dylib)
250
			odylib=$(scanmacho -BF'%n#f' "${f}" | tr ',' '\n' | grep libLLVM-${PV}.dylib)
185
			ebegin "fixing install_name reference to ${odylib} of ${f##*/}"
251
			ebegin "fixing install_name reference to ${odylib} of ${f##*/}"
186
			install_name_tool \
252
			install_name_tool \
187
				-change "${odylib}" \
253
				-change "${odylib}" \
188
					"${EPREFIX}"/usr/lib/${PN}/libLLVM-${PV}.dylib \
254
					"${EPREFIX}"/usr/lib/${PN}-${SLOT}/libLLVM-${PV}.dylib \
189
				"${f}"
255
				"${f}"
190
			eend $?
256
			eend $?
191
		done
257
		done
192
	fi
258
	fi
193
}
259
}
260
261
pkg_postinst() {
262
	if [[ $(eselect ${PN} show) = "(none)" ]] ; then
263
		eselect ${PN} set ${SLOT}
264
	fi
265
}
266
267
pkg_prerm() {
268
	if [[ $(eselect ${PN} show) = ${SLOT} ]] ; then
269
		eselect ${PN} clear
270
	fi
271
}
272
273
pkg_postrm() {
274
	if [[ -z ${REPLACED_BY_VERSION} ]] ; then
275
		eselect ${PN} update
276
	fi
277
}

Return to bug 471330