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-9999.ebuild (-7 / +91 lines)
Lines 16-22 SRC_URI="" Link Here
16
ESVN_REPO_URI="http://llvm.org/svn/llvm-project/llvm/trunk"
16
ESVN_REPO_URI="http://llvm.org/svn/llvm-project/llvm/trunk"
17
17
18
LICENSE="UoI-NCSA"
18
LICENSE="UoI-NCSA"
19
SLOT="0"
19
SLOT="${PV}"
20
KEYWORDS=""
20
KEYWORDS=""
21
IUSE="debug doc gold +libffi multitarget ocaml test udis86 vim-syntax video_cards_radeon"
21
IUSE="debug doc gold +libffi multitarget ocaml test udis86 vim-syntax video_cards_radeon"
22
22
Lines 34-39 DEPEND="dev-lang/perl Link Here
34
	udis86? ( dev-libs/udis86[pic(+)] )
34
	udis86? ( dev-libs/udis86[pic(+)] )
35
	${PYTHON_DEPS}"
35
	${PYTHON_DEPS}"
36
RDEPEND="dev-lang/perl
36
RDEPEND="dev-lang/perl
37
	app-admin/eselect-llvm
37
	libffi? ( virtual/libffi )
38
	libffi? ( virtual/libffi )
38
	vim-syntax? ( || ( app-editors/vim app-editors/gvim ) )"
39
	vim-syntax? ( || ( app-editors/vim app-editors/gvim ) )"
39
40
Lines 86-92 src_prepare() { Link Here
86
		-i tools/llvm-config/llvm-config.cpp || die "llvm-config sed failed"
87
		-i tools/llvm-config/llvm-config.cpp || die "llvm-config sed failed"
87
88
88
	einfo "Fixing rpath and CFLAGS"
89
	einfo "Fixing rpath and CFLAGS"
89
	sed -e 's,\$(RPATH) -Wl\,\$(\(ToolDir\|LibDir\)),$(RPATH) -Wl\,'"${EPREFIX}"/usr/$(get_libdir)/${PN}, \
90
	sed -e "s@\$(RPATH) -Wl,'\$\$ORIGIN/../lib'@\$(RPATH) -Wl,'${EPREFIX}/usr/$(get_libdir)/${PN}-${SLOT}'@" \
90
		-e '/OmitFramePointer/s/-fomit-frame-pointer//' \
91
		-e '/OmitFramePointer/s/-fomit-frame-pointer//' \
91
		-i Makefile.rules || die "rpath sed failed"
92
		-i Makefile.rules || die "rpath sed failed"
92
	if use gold; then
93
	if use gold; then
Lines 175-180 src_install() { Link Here
175
		doins utils/vim/*.vim
176
		doins utils/vim/*.vim
176
	fi
177
	fi
177
178
179
	# Register slot for app-admin/eselect-llvm
180
	local eselect_dir="/usr/share/eselect-llvm/slots/${SLOT}"
181
	dodir "${eselect_dir}"
182
	eselect_dir="${ED}/${eselect_dir}"
183
	echo "${CATEGORY}/${PF}" > "${eselect_dir}/ebuild"
184
185
	with_slot_suffix() {
186
		local file=$(echo "$1" | sed -e "s/-${SLOT}//")
187
		local ext=""
188
		if [[ "${file}" =~ \. ]] ; then
189
			ext=".${file#*.}"
190
		fi
191
		local base="${file%%.*}"
192
		echo "${base}-${SLOT}${ext}"
193
	}
194
195
	make_versioned() {
196
		local dir=$1
197
		local candidates=(${ED%/}/${dir})
198
		if [[ ! ${dir##*/} ]] ; then
199
			dir=${dir%/}
200
			candidates=( "${candidates}"* )
201
		else
202
			dir=$(dirname "${dir}")
203
		fi
204
205
		pushd ${ED%/}/${dir} >/dev/null || die
206
207
		local candidate
208
		for candidate in "${candidates[@]}" ; do
209
			if [[ -h "${candidate}" ]] ; then
210
				# Add slot suffix to symlink target
211
				local target=$(readlink -s "${candidate}")
212
				local slotted_target=$(with_slot_suffix "${target}")
213
				if [[ -e "${target}" ]] || [[ -e "${slotted_target}" ]] ; then
214
					ln -sf "${slotted_target}" "${candidate}" \
215
						|| die "Could not update symlink"
216
				fi
217
			fi
218
219
			local base_name=$(basename "${candidate}")
220
			local slotted_name=$(with_slot_suffix "${base_name}")
221
			mv "${candidate}" "${ED}/${dir}/${slotted_name}" \
222
				|| die "Could not rename ${candidate} to ${slotted_name}"
223
			echo "/${dir#/}/${base_name}" >> "${eselect_dir}/versioned"
224
		done
225
226
		popd >/dev/null || die
227
	}
228
229
	# Trailing slash => version the content
230
	# No trailing slash => version the directory itself
231
	local paths=(
232
		/usr/bin/
233
		/usr/$(get_libdir)/
234
		/usr/include/
235
		/usr/share/man/man1/
236
	)
237
	use vim-syntax && paths+=( /usr/share/vim/vimfiles/syntax/ )
238
239
	local path
240
	for path in "${paths[@]}" ; do
241
		make_versioned "${path}"
242
	done
243
178
	# Fix install_names on Darwin.  The build system is too complicated
244
	# Fix install_names on Darwin.  The build system is too complicated
179
	# to just fix this, so we correct it post-install
245
	# to just fix this, so we correct it post-install
180
	local lib= f= odylib= libpv=${PV}
246
	local lib= f= odylib= libpv=${PV}
Lines 183-203 src_install() { Link Here
183
		[[ -n ${PACKAGE_VERSION} ]] && libpv=${PACKAGE_VERSION}
249
		[[ -n ${PACKAGE_VERSION} ]] && libpv=${PACKAGE_VERSION}
184
		for lib in lib{EnhancedDisassembly,LLVM-${libpv},LTO,profile_rt}.dylib {BugpointPasses,LLVMHello}.dylib ; do
250
		for lib in lib{EnhancedDisassembly,LLVM-${libpv},LTO,profile_rt}.dylib {BugpointPasses,LLVMHello}.dylib ; do
185
			# libEnhancedDisassembly is Darwin10 only, so non-fatal
251
			# libEnhancedDisassembly is Darwin10 only, so non-fatal
186
			[[ -f ${ED}/usr/lib/${PN}/${lib} ]] || continue
252
			[[ -f ${ED}/usr/lib/${PN}-${SLOT}/${lib} ]] || continue
187
			ebegin "fixing install_name of $lib"
253
			ebegin "fixing install_name of $lib"
188
			install_name_tool \
254
			install_name_tool \
189
				-id "${EPREFIX}"/usr/lib/${PN}/${lib} \
255
				-id "${EPREFIX}"/usr/lib/${PN}-${SLOT}/${lib} \
190
				"${ED}"/usr/lib/${PN}/${lib}
256
				"${ED}"/usr/lib/${PN}-${SLOT}/${lib}
191
			eend $?
257
			eend $?
192
		done
258
		done
193
		for f in "${ED}"/usr/bin/* "${ED}"/usr/lib/${PN}/libLTO.dylib ; do
259
		for f in "${ED}"/usr/bin/* "${ED}"/usr/lib/${PN}-${SLOT}/libLTO.dylib ; do
194
			odylib=$(scanmacho -BF'%n#f' "${f}" | tr ',' '\n' | grep libLLVM-${libpv}.dylib)
260
			odylib=$(scanmacho -BF'%n#f' "${f}" | tr ',' '\n' | grep libLLVM-${libpv}.dylib)
195
			ebegin "fixing install_name reference to ${odylib} of ${f##*/}"
261
			ebegin "fixing install_name reference to ${odylib} of ${f##*/}"
196
			install_name_tool \
262
			install_name_tool \
197
				-change "${odylib}" \
263
				-change "${odylib}" \
198
					"${EPREFIX}"/usr/lib/${PN}/libLLVM-${libpv}.dylib \
264
					"${EPREFIX}"/usr/lib/${PN}-${SLOT}/libLLVM-${libpv}.dylib \
199
				"${f}"
265
				"${f}"
200
			eend $?
266
			eend $?
201
		done
267
		done
202
	fi
268
	fi
203
}
269
}
270
271
pkg_postinst() {
272
	if [[ $(eselect ${PN} show) = "(none)" ]] ; then
273
		eselect ${PN} set ${SLOT}
274
	fi
275
}
276
277
pkg_prerm() {
278
	if [[ $(eselect ${PN} show) = ${SLOT} ]] ; then
279
		eselect ${PN} clear
280
	fi
281
}
282
283
pkg_postrm() {
284
	if [[ -z ${REPLACED_BY_VERSION} ]] ; then
285
		eselect ${PN} update
286
	fi
287
}

Return to bug 471330