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

Return to bug 471330