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