From 2a877245e56ccec4a4746eabf595a0e6c1eba508 Mon Sep 17 00:00:00 2001 From: Klemens Baum Date: Mon, 15 Jul 2013 21:24:14 +0200 Subject: [PATCH] sys-devel/{llvm,clang}: Add SLOT support This change makes the LLVM and Clang ebuilds SLOTted. There are two new packages used to manage the active LLVM and Clang versions: * app-admin/eselect-llvm * app-admin/eselect-clang The output of llvm-config has been adjusted so that programs built against inactive versions of LLVM or Clang will continue to work. --- app-admin/eselect-clang/ChangeLog | 0 app-admin/eselect-clang/Manifest | 4 + app-admin/eselect-clang/eselect-clang-0.1.ebuild | 26 +++ app-admin/eselect-clang/files/clang.eselect-0.1 | 246 +++++++++++++++++++++ app-admin/eselect-clang/metadata.xml | 4 + app-admin/eselect-llvm/ChangeLog | 0 app-admin/eselect-llvm/Manifest | 4 + app-admin/eselect-llvm/eselect-llvm-0.1.ebuild | 26 +++ app-admin/eselect-llvm/files/llvm.eselect-0.1 | 264 +++++++++++++++++++++++ app-admin/eselect-llvm/metadata.xml | 4 + sys-devel/clang/Manifest | 26 +-- sys-devel/clang/clang-2.8-r3.ebuild | 117 +++++++++- sys-devel/clang/clang-2.9-r1.ebuild | 117 +++++++++- sys-devel/clang/clang-3.0-r4.ebuild | 119 +++++++++- sys-devel/clang/clang-3.1-r5.ebuild | 116 +++++++++- sys-devel/clang/clang-3.2.ebuild | 125 ++++++++++- sys-devel/clang/clang-3.3.ebuild | 129 ++++++++++- sys-devel/clang/clang-9999.ebuild | 157 ++++++++++++-- sys-devel/llvm/Manifest | 24 +-- sys-devel/llvm/llvm-2.8-r2.ebuild | 123 ++++++++++- sys-devel/llvm/llvm-2.9-r2.ebuild | 120 ++++++++++- sys-devel/llvm/llvm-3.0-r2.ebuild | 120 ++++++++++- sys-devel/llvm/llvm-3.1-r2.ebuild | 124 ++++++++++- sys-devel/llvm/llvm-3.2.ebuild | 124 ++++++++++- sys-devel/llvm/llvm-3.3.ebuild | 128 +++++++++-- sys-devel/llvm/llvm-9999.ebuild | 128 ++++++++++- 26 files changed, 2214 insertions(+), 161 deletions(-) create mode 100644 app-admin/eselect-clang/ChangeLog create mode 100644 app-admin/eselect-clang/Manifest create mode 100644 app-admin/eselect-clang/eselect-clang-0.1.ebuild create mode 100644 app-admin/eselect-clang/files/clang.eselect-0.1 create mode 100644 app-admin/eselect-clang/metadata.xml create mode 100644 app-admin/eselect-llvm/ChangeLog create mode 100644 app-admin/eselect-llvm/Manifest create mode 100644 app-admin/eselect-llvm/eselect-llvm-0.1.ebuild create mode 100644 app-admin/eselect-llvm/files/llvm.eselect-0.1 create mode 100644 app-admin/eselect-llvm/metadata.xml diff --git a/app-admin/eselect-clang/ChangeLog b/app-admin/eselect-clang/ChangeLog new file mode 100644 index 0000000..e69de29 diff --git a/app-admin/eselect-clang/Manifest b/app-admin/eselect-clang/Manifest new file mode 100644 index 0000000..f48af82 --- /dev/null +++ b/app-admin/eselect-clang/Manifest @@ -0,0 +1,4 @@ +AUX clang.eselect-0.1 6673 SHA256 3fc476383588298fe469895cb3f5ff2b648db810e21fee62e24c8b6d52f3a09a SHA512 5f895eb7ba85f238ab222af22ce44925fb78b91ea3811a9c690d790c862bc4bd4b293acbdb962ef0570a5ddcd8de3f3196fc6dafdb91f56d9473145a8217e114 WHIRLPOOL 2cbcbdd9ce83ec3ade31b9ec806a97d726e6039912eb28d76b65765859f3b672f0bd2838f579c395dc91269df21b65a4be0138945bac36647abde4a256e8a167 +EBUILD eselect-clang-0.1.ebuild 556 SHA256 a58ffb95db94693ea95d0f37c1c43f0a721ac07f689d75a0e411a36a84664487 SHA512 f2302a9dec6ec0bb2082d81405acb80d6548a899b7701e2682dddcd3d6fc2ec1ee7d1f4a4dca9a7a2f3f0bbff5b2dca546f64ab8d9b652dc2b5f786c61d2de0e WHIRLPOOL 2558c6503324f4f45bbad58be678eb05b6ba60d8874ed611a35bb107be7ec8a0cae7db28399f067a77540420f73568c476eab24a1789ba5a9da5f15d4fcee61c +MISC ChangeLog 0 SHA256 e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 SHA512 cf83e1357eefb8bdf1542850d66d8007d620e4050b5715dc83f4a921d36ce9ce47d0d13c5d85f2b0ff8318d2877eec2f63b931bd47417a81a538327af927da3e WHIRLPOOL 19fa61d75522a4669b44e39c1d2e1726c530232130d407f89afee0964997f7a73e83be698b288febcf88e3e03c4f0757ea8964e59b63d93708b138cc42a66eb3 +MISC metadata.xml 139 SHA256 5cdc1888ebc8807b9a37b1d33429c61cabe7415a4f240e21a4c2ff8eca7a34ed SHA512 8be912ace7468a4396eb1da00a9785030a8ce35da4357a01591876a1056fd45e44da65de2af3e1eb0506ce6551714962c40c3ae5a3aefa2ad231de35af2519be WHIRLPOOL 620431014dd4fb752c3d46d11904ecb2c6d4525f5b4e30f4f778a3b74d3f7187ae4ccd856ebd7eabb48ce261b21849c732928fe647edce024a3fdc082d8f8630 diff --git a/app-admin/eselect-clang/eselect-clang-0.1.ebuild b/app-admin/eselect-clang/eselect-clang-0.1.ebuild new file mode 100644 index 0000000..c3cf75a --- /dev/null +++ b/app-admin/eselect-clang/eselect-clang-0.1.ebuild @@ -0,0 +1,26 @@ +# Copyright 1999-2013 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: $ + +EAPI="2" + +DESCRIPTION="Clang module for eselect" +HOMEPAGE="http://www.gentoo.org/proj/en/eselect/" +SRC_URI="" + +LICENSE="GPL-2" +SLOT="0" +KEYWORDS="~amd64" +IUSE="" + +# Need skel.bash lib +RDEPEND=">=app-admin/eselect-1.0.5" +DEPEND="${RDEPEND} + !!sys-devel/clang:0" + +src_install() { + local MODULEDIR="/usr/share/eselect/modules" + local MODULE="clang" + insinto ${MODULEDIR} + newins "${FILESDIR}"/${MODULE}.eselect-${PVR} ${MODULE}.eselect +} diff --git a/app-admin/eselect-clang/files/clang.eselect-0.1 b/app-admin/eselect-clang/files/clang.eselect-0.1 new file mode 100644 index 0000000..2ee294c --- /dev/null +++ b/app-admin/eselect-clang/files/clang.eselect-0.1 @@ -0,0 +1,246 @@ +# Copyright 2013 Gentoo Foundation +# Distributed under the terms of the GNU GPL version 2 or later + +inherit config multilib + +DESCRIPTION="Manage active Clang version" +MAINTAINER="eselect@gentoo.org" +VERSION="20130521" + +B_PATH="${EROOT%/}/usr" +S_PATH="${EROOT%/}/usr/share/eselect-clang" + +# Global Data +active_slot() { + local link="${B_PATH}/bin/clang" + if [[ -e "${link}" ]] ; then + echo $(readlink -sf "${link}") | \ + sed -re 's#.*clang-([0-9]+(\.[0-9]+)?)$#\1#' + fi +} + +# Utility Functions +add_slot_suffix() { + local file="$1" + local slot="$2" + local ext="" + if [[ "${file}" =~ \. ]] ; then + ext=".${file#*.}" + fi + local base="${file%%.*}" + echo "${base}-${slot}${ext}" +} + +### Linker Function ### +# Takes two arguments: +# - Full path to versioned file (e.g. /usr/share/eselect-clang/slots/3.2/versioned) +# - Slot to link (e.g. 3.2) +linker() { + local versioned_file=$1 + local slot=$2 + if [[ -r ${versioned_file} ]] ; then + local versioned=($(<"${versioned_file}")) + + local link_path + for link_path in "${versioned[@]}" ; do + link_path="${ROOT%/}/${link_path#/}" + local link_dir=$(dirname "${link_path}") + local link_name=$(basename "${link_path}") + local rel_target=$(add_slot_suffix "${link_name}" "${slot}") + local target="${link_dir}/${rel_target}" + + # For good measure, remove target before creating the symlink + [[ -h ${link_path} ]] && rm -f "${link_path}" + [[ -e ${link_path} ]] && \ + die -q "The target '${link_path}' still exists and could not be removed!" + + if [[ ! -e "${target}" ]] && [[ "${link_path}" == *man* ]] ; then + local suffix=$(echo "${target}"* | sed 's/.*\.1//') + if [[ "${suffix}" != "*" ]] ; then + rel_target="${rel_target}${suffix}" + link_path="${link_path}${suffix}" + fi + fi + + # Create relative links so that they work both here and inside the new + # root if $ROOT is not "/". + ln -s "${rel_target}" "${link_path}" || die -q "Unable to create link!" + done + fi +} + +### Unlinker Function ### +# Takes one argument: +# - Full path to versioned file (e.g. /usr/share/eselect-clang/slots/3.2/versioned) +unlinker() { + local versioned_file=$1 + + if [[ -r ${versioned_file} ]] ; then + local versioned=($(<"${versioned_file}")) + + local link_path + for link_path in "${versioned[@]}" ; do + if [[ ! -e "${link_path}" ]] && [[ "${link_path}" == *man* ]] ; then + local suffix=$(echo "${link_path}"* | sed 's/.*\.1//') + if [[ "${suffix}" != "*" ]] ; then + link_path="${link_path}${suffix}" + fi + fi + + [[ -h "${ROOT%/}/${link_path}" ]] && \ + rm -f "${ROOT%/}/${link_path}" + [[ -e "${ROOT%/}/${link_path}" ]] && \ + die -q "The target '${link_path}' still exists and could not be removed!" + done + fi +} + +### Get Slots Function ### +# Find all available slots and return them. +get_slots() { + echo $(find "${B_PATH}/bin/" -maxdepth 1 -type f \ + -regex '.*clang-[0-9][0-9]*\(\.[0-9][0-9]*\)?' | \ + sed -re 's#.*clang-([0-9]+(\.[0-9]+)?)$#\1#' | sort -n) +} + +### List Action ### +describe_list() { + echo "List available Clang slots." +} + +do_list() { + write_list_start "Available Clang slots" + + if $(is_output_mode brief) ; then + echo $(get_slots) + else + local slot + for slot in $(get_slots) ; do + local ebuild=($(<"${S_PATH}/slots/${slot}/ebuild")) + + case "${slot}" in + "$(active_slot)" ) write_kv_list_entry \ + "$(highlight_marker ${slot})" "${ebuild}";; + * ) write_kv_list_entry \ + "${slot}" "${ebuild}";; + esac + done + + [[ -z "${slot}" ]] && write_warning_msg "No slots available." + fi +} + +### Show Action ### +describe_show() { + echo "Show which slot is currently active." +} + +do_show() { + local slot=$(active_slot) + if [[ -n "${slot}" ]] ; then + echo "${slot}" + else + echo "(none)" + fi +} + +### Set Action ### +describe_set() { + echo "Create symbolic links for Clang libraries and applications." +} + +do_set() { + local slot=$1 + if [[ ! -e ${B_PATH}/bin/clang-${slot} ]] ; then + die -q "Not a valid slot." + fi + + echo -ne "Switching to Clang-${slot}... " + + # Remove the active links to start a fresh list + local active=$(active_slot) + if [[ -n "${active}" ]] ; then + unlinker "${S_PATH}/slots/${active}/versioned" + fi + + linker "${S_PATH}/slots/${slot}/versioned" ${slot} + echo "done." +} + +### Unset Action ### +describe_unset() { + echo "Deselect the current or given slot." +} + +do_unset() { + local slot=${1:-$(active_slot)} + if [[ -n ${slot} ]] && [[ ${slot} = $(active_slot) ]] ; then + echo -n "Removing symlinks... " + unlinker "${S_PATH}/slots/${slot}/versioned" + echo "done." + do_update + else + echo "Inactive slot selected. Nothing to do." + fi +} + +### Clear Action ### +describe_clear() { + echo "Remove all active symlinks." +} + +do_clear() { + local slot=$(active_slot) + if [[ -n ${slot} ]] ; then + echo -n "Removing symlinks... " + unlinker "${S_PATH}/slots/${slot}/versioned" + echo "done." + else + echo "No slot selected. Nothing to do." + fi +} + +### Reset Action ### +describe_reset() { + echo "Recreate symbolic links for currently active slot." +} + +do_reset() { + local slot=$(active_slot) + [[ -z ${slot} ]] && die -q "No active slot to reset." + do_clear + do_set ${slot} +} + +### Update Action ### +describe_update() { + echo "Refreshes all symbolic links managed by this module" +} + +do_update() { + local slot=$(active_slot) + + local slots=($(get_slots)) + local index=${#slots[@]} + + # In case all slots have been unmerged + if [[ ${index} -eq 0 ]] ; then + if [[ -n ${slot} ]] ; then + do_clear + else + write_warning_msg "No slots found! Nothing to do." + fi + return 0 + fi + + # Reset, otherwise set the highest slot available. + if [[ -n ${slot} ]] && [[ ${slots[@]} =~ ${slot} ]] ; then + do_set ${slot} + else + # best_version doesn't work here as pkg_postrm runs before the world + # file is updated, thereby returning a false positive. + do_set ${slots[$index-1]} + fi + + do_action env update &> /dev/null +} diff --git a/app-admin/eselect-clang/metadata.xml b/app-admin/eselect-clang/metadata.xml new file mode 100644 index 0000000..097975e --- /dev/null +++ b/app-admin/eselect-clang/metadata.xml @@ -0,0 +1,4 @@ + + + + diff --git a/app-admin/eselect-llvm/ChangeLog b/app-admin/eselect-llvm/ChangeLog new file mode 100644 index 0000000..e69de29 diff --git a/app-admin/eselect-llvm/Manifest b/app-admin/eselect-llvm/Manifest new file mode 100644 index 0000000..ed73018 --- /dev/null +++ b/app-admin/eselect-llvm/Manifest @@ -0,0 +1,4 @@ +AUX llvm.eselect-0.1 7181 SHA256 c9e193cefa346ba0a1fa5aa00e436fbc19f3808c8dad035896b23d494b298d34 SHA512 8eb68d5c81a2193b7e35003ecc5302a9b7ac7293b3ee53534c623d60298dab6200f336596aec69ff40759a38e900855d2ed32338bc228065e09e60a269455617 WHIRLPOOL 99386db902ab338be2ca2d2d27b6bead1048c6cd4cb8d0c1e24881acaaa78d8880536ce090de64ead3b3529388257a48cbb90c03b51998ec2f69dd0b15164725 +EBUILD eselect-llvm-0.1.ebuild 553 SHA256 8e0e01e7769ecb63855716a2e659caf90d0904a2e3db484e888da701f2f5604e SHA512 6d9ecb4044eee516ccc176811d0bbe81455192bc02c0c4ad98f720bd2d215fec3b780e6b55f944543bf2126a2b2377d55b2beeda2f8da6c4dfbb9c0a972ff5f0 WHIRLPOOL 22f15a6bfe0f509275db93bd5da31c60951cb5db4e26995caa3c80f35817f8f3d6fd3acd19054ffd82a550e816060d5c8ced2a257d6a41dfcd36139ea284b576 +MISC ChangeLog 0 SHA256 e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 SHA512 cf83e1357eefb8bdf1542850d66d8007d620e4050b5715dc83f4a921d36ce9ce47d0d13c5d85f2b0ff8318d2877eec2f63b931bd47417a81a538327af927da3e WHIRLPOOL 19fa61d75522a4669b44e39c1d2e1726c530232130d407f89afee0964997f7a73e83be698b288febcf88e3e03c4f0757ea8964e59b63d93708b138cc42a66eb3 +MISC metadata.xml 139 SHA256 5cdc1888ebc8807b9a37b1d33429c61cabe7415a4f240e21a4c2ff8eca7a34ed SHA512 8be912ace7468a4396eb1da00a9785030a8ce35da4357a01591876a1056fd45e44da65de2af3e1eb0506ce6551714962c40c3ae5a3aefa2ad231de35af2519be WHIRLPOOL 620431014dd4fb752c3d46d11904ecb2c6d4525f5b4e30f4f778a3b74d3f7187ae4ccd856ebd7eabb48ce261b21849c732928fe647edce024a3fdc082d8f8630 diff --git a/app-admin/eselect-llvm/eselect-llvm-0.1.ebuild b/app-admin/eselect-llvm/eselect-llvm-0.1.ebuild new file mode 100644 index 0000000..a2281b6 --- /dev/null +++ b/app-admin/eselect-llvm/eselect-llvm-0.1.ebuild @@ -0,0 +1,26 @@ +# Copyright 1999-2013 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: $ + +EAPI="2" + +DESCRIPTION="LLVM module for eselect" +HOMEPAGE="http://www.gentoo.org/proj/en/eselect/" +SRC_URI="" + +LICENSE="GPL-2" +SLOT="0" +KEYWORDS="~amd64" +IUSE="" + +# Need skel.bash lib +RDEPEND=">=app-admin/eselect-1.0.5" +DEPEND="${RDEPEND} + !!sys-devel/llvm:0" + +src_install() { + local MODULEDIR="/usr/share/eselect/modules" + local MODULE="llvm" + insinto ${MODULEDIR} + newins "${FILESDIR}"/${MODULE}.eselect-${PVR} ${MODULE}.eselect +} diff --git a/app-admin/eselect-llvm/files/llvm.eselect-0.1 b/app-admin/eselect-llvm/files/llvm.eselect-0.1 new file mode 100644 index 0000000..113ab6e --- /dev/null +++ b/app-admin/eselect-llvm/files/llvm.eselect-0.1 @@ -0,0 +1,264 @@ +# Copyright 2013 Gentoo Foundation +# Distributed under the terms of the GNU GPL version 2 or later + +inherit config multilib + +DESCRIPTION="Manage active LLVM version" +MAINTAINER="eselect@gentoo.org" +VERSION="20130521" + +B_PATH="${EROOT%/}/usr" +S_PATH="${EROOT%/}/usr/share/eselect-llvm" + +# Global Data +active_slot() { + local link="${B_PATH}/$(lib_dir)/llvm" + if [[ -e "${link}" ]] ; then + echo $(readlink -sf "${link}") | \ + sed -re 's#.*llvm-([0-9]+(\.[0-9]+)?)$#\1#' + fi +} + +lib_dir() { + local lib_list=$(list_libdirs) + if [[ ${lib_list} =~ .*lib64.* && \ + -n $(ls -d ${B_PATH}/lib64/llvm-*/lib64 2> /dev/null) ]] ; then + echo "lib64" + elif [[ ${lib_list} =~ .*lib32.* && \ + -n $(ls -d ${B_PATH}/lib32/llvm-*/lib32 2> /dev/null) ]] ; then + echo "lib32" + else + echo "lib" + fi +} + +# Utility Functions +add_slot_suffix() { + local file="$1" + local slot="$2" + local ext="" + if [[ "${file}" =~ \. ]] ; then + ext=".${file#*.}" + fi + local base="${file%%.*}" + echo "${base}-${slot}${ext}" +} + +### Linker Function ### +# Takes two arguments: +# - Full path to versioned file (e.g. /usr/share/eselect-llvm/slots/3.2/versioned) +# - Slot to link (e.g. 3.2) +linker() { + local versioned_file=$1 + local slot=$2 + if [[ -r ${versioned_file} ]] ; then + local versioned=($(<"${versioned_file}")) + + local link_path + for link_path in "${versioned[@]}" ; do + link_path="${ROOT%/}/${link_path#/}" + local link_dir=$(dirname "${link_path}") + local link_name=$(basename "${link_path}") + local rel_target=$(add_slot_suffix "${link_name}" "${slot}") + local target="${link_dir}/${rel_target}" + + # For good measure, remove target before creating the symlink + [[ -h ${link_path} ]] && rm -f "${link_path}" + [[ -e ${link_path} ]] && \ + die -q "The target '${link_path}' still exists and could not be removed!" + + if [[ ! -e "${target}" ]] && [[ "${link_path}" == *man* ]] ; then + local suffix=$(echo "${target}"* | sed 's/.*\.1//') + if [[ "${suffix}" != "*" ]] ; then + rel_target="${rel_target}${suffix}" + link_path="${link_path}${suffix}" + fi + fi + + # Create relative links so that they work both here and inside the new + # root if $ROOT is not "/". + ln -s "${rel_target}" "${link_path}" || die -q "Unable to create link!" + done + fi +} + +### Unlinker Function ### +# Takes one argument: +# - Full path to versioned file (e.g. /usr/share/eselect-llvm/slots/3.2/versioned) +unlinker() { + local versioned_file=$1 + + if [[ -r ${versioned_file} ]] ; then + local versioned=($(<"${versioned_file}")) + + local link_path + for link_path in "${versioned[@]}" ; do + if [[ ! -e "${link_path}" ]] && [[ "${link_path}" == *man* ]] ; then + local suffix=$(echo "${link_path}"* | sed 's/.*\.1//') + if [[ "${suffix}" != "*" ]] ; then + link_path="${link_path}${suffix}" + fi + fi + + [[ -h "${ROOT%/}/${link_path}" ]] && \ + rm -f "${ROOT%/}/${link_path}" + [[ -e "${ROOT%/}/${link_path}" ]] && \ + die -q "The target '${link_path}' still exists and could not be removed!" + done + fi +} + +### Get Slots Function ### +# Find all available slots in the preferred lib_dir() and return them. +get_slots() { + echo $(find "${B_PATH}/$(lib_dir)/" -maxdepth 1 -type d \ + -regex '.*llvm-[0-9][0-9]*\(\.[0-9][0-9]*\)?' | \ + sed -re 's#.*llvm-([0-9]+(\.[0-9]+)?)$#\1#' | sort -n) +} + +### List Action ### +describe_list() { + echo "List available LLVM slots." +} + +do_list() { + write_list_start "Available LLVM slots" + + if $(is_output_mode brief) ; then + echo $(get_slots) + else + local slot + for slot in $(get_slots) ; do + local ebuild=($(<"${S_PATH}/slots/${slot}/ebuild")) + + case "${slot}" in + "$(active_slot)" ) write_kv_list_entry \ + "$(highlight_marker ${slot})" "${ebuild}";; + * ) write_kv_list_entry \ + "${slot}" "${ebuild}";; + esac + done + + [[ -z "${slot}" ]] && write_warning_msg "No slots available." + fi +} + +### Show Action ### +describe_show() { + echo "Show which slot is currently active." +} + +do_show() { + local slot=$(active_slot) + if [[ -n "${slot}" ]] ; then + echo "${slot}" + else + echo "(none)" + fi +} + +### Set Action ### +describe_set() { + echo "Create symbolic links for LLVM libraries and applications." +} + +do_set() { + local slot=$1 + if [[ ! -d ${B_PATH}/$(lib_dir)/llvm-${slot} ]] ; then + die -q "Not a valid slot." + fi + + echo -ne "Switching to LLVM-${slot}... " + + # Remove the active links to start a fresh list + local active=$(active_slot) + if [[ -n "${active}" ]] ; then + unlinker "${S_PATH}/slots/${active}/versioned" + fi + + linker "${S_PATH}/slots/${slot}/versioned" ${slot} + echo "done." + + local SLOT=$1 + if [[ ! -d ${B_PATH}/$(lib_dir)/llvm-${SLOT} ]] ; then + die -q "Not a valid slot." + fi +} + +### Unset Action ### +describe_unset() { + echo "Deselect the current or given slot." +} + +do_unset() { + local slot=${1:-$(active_slot)} + if [[ -n ${slot} ]] && [[ ${slot} = $(active_slot) ]] ; then + echo -n "Removing symlinks... " + unlinker "${S_PATH}/slots/${slot}/versioned" + echo "done." + do_update + else + echo "Inactive slot selected. Nothing to do." + fi +} + +### Clear Action ### +describe_clear() { + echo "Remove all active symlinks." +} + +do_clear() { + local slot=$(active_slot) + if [[ -n ${slot} ]] ; then + echo -n "Removing symlinks... " + unlinker "${S_PATH}/slots/${slot}/versioned" + echo "done." + else + echo "No slot selected. Nothing to do." + fi +} + +### Reset Action ### +describe_reset() { + echo "Recreate symbolic links for currently active slot." +} + +do_reset() { + local slot=$(active_slot) + [[ -z ${slot} ]] && die -q "No active slot to reset." + do_clear + do_set ${slot} +} + +### Update Action ### +describe_update() { + echo "Refreshes all symbolic links managed by this module" +} + +do_update() { + local slot=$(active_slot) + + local slots=($(get_slots)) + local index=${#slots[@]} + + # In case all slots have been unmerged + if [[ ${index} -eq 0 ]] ; then + if [[ -n ${slot} ]] ; then + do_clear + else + write_warning_msg "No slots found! Nothing to do." + fi + return 0 + fi + + # Reset, otherwise set the highest slot available. + if [[ -n ${slot} ]] && [[ ${slots[@]} =~ ${slot} ]] ; then + do_set ${slot} + else + # best_version doesn't work here as pkg_postrm runs before the world + # file is updated, thereby returning a false positive. + do_set ${slots[$index-1]} + fi + + do_action env update &> /dev/null +} diff --git a/app-admin/eselect-llvm/metadata.xml b/app-admin/eselect-llvm/metadata.xml new file mode 100644 index 0000000..097975e --- /dev/null +++ b/app-admin/eselect-llvm/metadata.xml @@ -0,0 +1,4 @@ + + + + diff --git a/sys-devel/clang/Manifest b/sys-devel/clang/Manifest index 1499fe2..03f1185 100644 --- a/sys-devel/clang/Manifest +++ b/sys-devel/clang/Manifest @@ -1,6 +1,3 @@ ------BEGIN PGP SIGNED MESSAGE----- -Hash: SHA256 - AUX cl-patches/clang-0001-Add-r600-TargetInfo.patch 2801 SHA256 619a510c819ee4033e00ce4e42ab9f73409346edc3bba6243c3d0868face826c SHA512 41159ce46525878fbead0a64582fd522d5643c4ce9841f7a1259d6fcee2c0382babf8f734bf47c0c32c8d9e54633c8e2d3eef67b85426ac4f873d47fd8dd6ac1 WHIRLPOOL 074aae16c6e23f7db036a3e13f4c8ba976d0f27adae2e05c957a10d1931098d04f766a0ac35bf1589541e710acd18370bdee18205f612fd7da4aab926e306ace AUX cl-patches/clang-0002-r600-Add-some-target-builtins.patch 3535 SHA256 620411208e4609ac2b77412f31774b2d6fb7403b0d8fccd250a4d613cfc1a5ca SHA512 872156d6e4721b01aef05ac4c829f5635abd205c5f05dc66f20a9e59e7f8165464c55f730a0890af5220b917bc8ebede58e63ca401165e6cef77a8c2d0fd40ab WHIRLPOOL 8bd671a6cca645bae6d9888345319ed3f5476991716f0cf909435d988ed4c6db4b06d8b8e93e07baffe83b741fc58ea4dc67aac7203e7d4e2d71e71190e05cd7 AUX cl-patches/clang-0003-r600-Add-read_global_size-and-read_local_size-builti.patch 1132 SHA256 cf9888b9bd13e5daff6c2806c4324c99a20c3ce16570e7e0d6776baeb512bc2c SHA512 cff65845acedd72c2066e568bdf7da9a5b2e5d98737b8bb99be1b2dceefd096470e17b86ee04795339ab7cebbc72ea54c465a9a3640d2daafce9ddad1d5444e7 WHIRLPOOL 054b159e7e4d07acfea74ff8b1f79acf1b29de300903d4ae69a0f9ce5ad77495ce772a5bd1ce244badd8fe3502b1e6f833353478ee68252bf616fc81d251a8a7 @@ -22,7 +19,7 @@ AUX clang-3.1-gentoo-freebsd-fix-lib-path.patch 1048 SHA256 e3475478acef91fcc484 AUX clang-3.1-gentoo-runtime-gcc-detection-v3.patch 1457 SHA256 f4b22281d21e39bc4681519cec90243c0e50262ce56ae68b0a8d9e7d92ce0375 SHA512 81c582791f4b0b1ccfcf3e8c82fbb68312320c5287402236d8c6d2d76767bbba031094c26d2b7bd9581c473896b78dda5a6284c5a87726e1bc0c539ae9294763 WHIRLPOOL bb68797804c89f8797561964697a72a015daf2c951d92f490f8c83f38aac6f50ce1527f39b53ccc6a3d93f84ec8f868e40340a5472b9e7ee4c34ceaa4b9ca845 AUX clang-3.1-increase-parser-recursion-limit.patch 480 SHA256 8c2fce5bbbeac965e0f116533e06a58d1a67df545855b7513c1ab6189596f757 SHA512 20a6caf48c1960883ea43243395e47fc44ce3de162552af89660949374c16a4ec1c651e8bb073feb015a8c3c6684f7e76ead927d58fc8a1b1d606bf89325535d WHIRLPOOL b701661a1bfce3091b6f57c99a790638ee1ced9ff35860c91cf43adf96901f8ead8bd6e984e48fb49f5035e26bd43076e9947b8496f9c9ebc952104548dd690c DIST cfe-3.3.src.tar.gz 9425539 SHA256 b1b55de4ab3a57d3e0331a83e0284610191c77d924e3446498d9113d08dfb996 SHA512 06773f43f7d3529f06edb029f7de398f06a700a0f2476e00c4727e70c291028221bfac23625dfd2c220d6ac91a21670848187a934b99a21801c695127371afcc WHIRLPOOL 8b97b527f19015dd3283b9e174615170e639793f64c635ccc4ee4d8216f8de759fd0121a8ef3513fa1c6ad19b31aa3529091ffb44a01ee858edfef400881596a -DIST clang-2.8.tgz 5666777 SHA256 ed83481553e6a39a8a2953e89630d881d87833506f096a90f18d93ec2bdee0c1 +DIST clang-2.8.tgz 5666777 SHA256 ed83481553e6a39a8a2953e89630d881d87833506f096a90f18d93ec2bdee0c1 SHA512 938e6b32f8280ffc2b4354b3f5ee7c70ae671e05a5908ee54aa17ac7bef7835d73c318fe8a0ce8b1f657a803feee547c026c4a2239e3bfbf77f3a7c1d52479c3 WHIRLPOOL 132ed96b97989758996fea96f5b9f6cba1ee824df58cf61bd04f28e771fed639216b41c72c94c1fc52c9ccdf835436f06481cb5a27c7c8683e723515d58e80db DIST clang-2.9.tgz 6243772 SHA256 70c41f3f782a71cbaa7bc8d6ea29fce4263ad3e8558dfecc6dc11cdef17909df SHA512 0046b716eae7c398a61fb733239f209b60bdd1817e6724730b9515e7ae765565a1e42a805cc06e6f1393d8254ebc845335b244aff825f3fcce551b958683d8f5 WHIRLPOOL 4c745b7c6a21035595307ba5e2d95c2262a5ca1d52cca413a822186b9d450fec384d514175cf384e35e7169ce41ac5152222fcc9cbee4af85695c78d7cd5492e DIST clang-3.0.tar.gz 7240578 SHA256 b64e72da356d7c3428cfd7ac620d49ec042c84eaee13c26024879f555f4e126d SHA512 0a31a2600cd4555424259331e0762f7fceeb5d828e7792983b2f8ae92bb75b3dc92cf84474e047deb5d4dab46062b4ac6273e6079159052debb76ae69927e517 WHIRLPOOL 521169cc588520090423cd1a2fa639da84e119281bf8260ea4b7b24fd2d8627806a281ddbbba5c378a736fc31279e25f10c4d3a3c81abd2c202970079a949ba5 DIST clang-3.1.src.tar.gz 8158418 SHA256 ff63e215dcd3e2838ffdea38502f8d35bab17e487f3c3799579961e452d5a786 SHA512 14c033eda3e0c0a887a8410f6b6a1335e0f6bfa05950a903d302b06b95fd58b03894320e91e50fb4d330c5323be9e955d9054cee62d035e2753290354ea8f8cd WHIRLPOOL cdb578c287a417896d2d6fb297e96e44e8b951bad6e7d286b97bdd346b40dac6ffbb7015b39d69fa0f9e0994dede26612307b643f71480e3c8917199fe926357 @@ -36,19 +33,12 @@ DIST llvm-3.0.tar.gz 10350539 SHA256 519eb11d3499ce99c6ffdb8718651fc91425ed7690e DIST llvm-3.1.src.tar.gz 11077429 SHA256 1ea05135197b5400c1f88d00ff280d775ce778f8f9ea042e25a1e1e734a4b9ab SHA512 fb941094601043e405ccc57473414ef92437b09c200e71614f93d8e93b2a58cca8d78c385be037e064b0711cd6268802c774ce4a40fc0ea17bf576305304d2aa WHIRLPOOL c5c72e139296e1c186131f991010f52f958063a4fcfcb1f8527b53a2aaa7edcaca70ab6cf86c25d08640dcf6d720a865fda7dc7eb06cf1ce9c23fd37b5d597ef DIST llvm-3.2.src.tar.gz 12275252 SHA256 125090c4d26740f1d5e9838477c931ed7d9ad70d599ba265f46f3a42cb066343 SHA512 cc66171322dbbe40bcac0e0ea5b09df8ff52df63ded304f841f32f702270d6ab1512216413ee52498c3ebee8cd39c4cd23e3855d591944bc2ac0ae76f5be62cc WHIRLPOOL c3a39b2426293d0251b7769607ade873bb6bf8d54e7c8055773a9b75742bc8e39049fb71409a258c6f3d98775b78c280d4bfe4223ba91e5ed6ecae0eddf910e5 DIST llvm-3.3.src.tar.gz 13602421 SHA256 68766b1e70d05a25e2f502e997a3cb3937187a3296595cf6e0977d5cd6727578 SHA512 1b7f7c5e907a68f642dcbe48fdff9585cb1504022bc9d386f310ebe5d25103d0d5f7cf0abf19e0e3fd666970160a98c90033754e2b79b2fac0cf866c984f8038 WHIRLPOOL a89c0b470fde562a3402e7878b91bc0573d433ca0a60e62c9c46946d7948a4fb657b116b6bac032555e29c70d82c751876adb398fe240f5c8d0a9a2378ce1866 -EBUILD clang-2.8-r3.ebuild 6775 SHA256 2e356a45d80b276e8a349b7525f2526094ba03fe83ac9f49e7fb5136bd3a983d SHA512 c67e745804d7894597531328a30e6e0c171e34a1d6242f708d3f02dbb1c9383d94e9a9fbd641ca49a80959b454ddb1b6ca44289ce70eb674befde82c82c51c81 WHIRLPOOL faee8941ef6dcf173d9fa21ee3f01f4fb3d43377d5b7855138edd49388e411fbff519fffebaf65e2e2cd32071ebaea12f7c75a16c9dccb0e27c12b47a8229651 -EBUILD clang-2.9-r1.ebuild 6438 SHA256 00d9147d62dc19548c841243fccb3b81aa5abb32ba46480d528952dcd4756711 SHA512 b0d2862222e87c3cdcec18d80ff08ed369cd21a8f5ec76b32b03dcf4cb14f0876e4b8ebb3868ab537615c080ce8b2134b5148f4cfef648ef8f40e7cb7deaee04 WHIRLPOOL 7b39c433ff21e1c2ef39d988678c9cc068c298e84118c0a4e669b2f1d43e988fa65b8fd37d37311d4b1e2b7d9a6b762a3795ac8a8fccdb774c06d5b830d91c33 -EBUILD clang-3.0-r4.ebuild 7166 SHA256 50fe174e45d88d5f1b31119600ae9c8f06f27b14b497d8eee4a1c805bcba92f3 SHA512 834247ed9475353da30946eeabd206a6164eddff8195b5a717fa1bf0e1760d910ee7e0943fe805f3c259a811c0f4514e5bb5aa272a049a195e9f12f68b554669 WHIRLPOOL a8432fb8a00f29a0cd7126f0d028866c893f07d2d92122d09d952caf1c62fdbb0eaa18faa230ecab4bea556252085db152e8c0a3ed6d3cd1adcf3d987cfb9a67 -EBUILD clang-3.1-r5.ebuild 6696 SHA256 4a4d884d8c37044fe7dc5f325e88f4733140997b3d2de64c0d6e35d9604c477f SHA512 2ba6057e08c8533fbaa45810f4d9588b57b20b08c9b99b8a53ed32b95d17a43ce13f15d81618e4cb3bc6cb4ded3c50fbba2a866a0d130a69a107195c90dc58ea WHIRLPOOL 890f64a0309c731e7784f5196ac3da602e204c65566412a398a8f9bd862d1b1e5337eae56fd309c1ffb9fc750741982481abcc13567973017df650c6e5dd1be8 -EBUILD clang-3.2.ebuild 6519 SHA256 35e962bcd5fea3f406e4b684aaa74bb1be4bdfcda63d963a9bbab604a858fe50 SHA512 20afd7ecc1af578ac3e1d9b6694c3d82d6d6591153496c5a1a07eeb4189f1e3be54d8b18006239ced612bd9d94912bdbc34706599383beff46fe4aca9ed93952 WHIRLPOOL 1fbef46523a62b049375445b4749d42ec93ddae4966a1dcf818b2e1e1e770a8cc67c00ed849fdb291ad29100a5f8b66236a6317b7ecf9bdab02826396be2d18e -EBUILD clang-3.3.ebuild 6916 SHA256 5bbaf90c57e9e10d2c325feec28466366fe1e8bac214f4e5d0291f6b7a1b534a SHA512 c4f2d747f07dc9c0b8b7366554c0fd51cede1eb8327b8529c534c3003f005efecdeacee7acb49521fc2fad3a90f62aa41b67fc1e51951fac52a3debe3f655da7 WHIRLPOOL e3ce031b19658760fa5ef0456ce356a1941dd8a98112e7aa0948aaa73ff3cb925607f689579f5c87bee961ab199f84e772638ea5a523500f60951509864d3478 -EBUILD clang-9999.ebuild 5989 SHA256 a36d63cbefd5e7d6db8f39acdfed9754156810efc912626a221e2d1d3533992e SHA512 091f36174231f6a9d0a913cf9a0232829d55aa824319d78ec3370e6fbfce805bc76769cdc02dcdc54f2d5895f14da4a8c6ee7592d208556d38e501dc7822b660 WHIRLPOOL d16bc8d75c7cb53274bdc261ba415db56b69b4fc7c46feaca470060a2b7af8fb4abfa4a024d528a33f853611f1c165731afe0e36f435d088165348047113f4ff +EBUILD clang-2.8-r3.ebuild 9342 SHA256 be5c9b3744f4dd52fad2307680c1c760d86a247b36e7edfe810e816c97a8a707 SHA512 220864b58327fe89b71023d520212d492fca8c12099dcdead247aa781db4f1fca42995adee91a86c1a99eb230278ba8a4ead8a3f18a542bf865dbad8d6a5de20 WHIRLPOOL 3adb25fbfc16982d183b2cc47e8c02048b56625d498431979f9114f5787e3c9ce08c18170594dc916aacff234384dcc15605a6bc1bc3f28ea3559557661a3874 +EBUILD clang-2.9-r1.ebuild 9005 SHA256 da220a5459ee7d6000d81560045ccc8a85ad36563e3485479b31f4fb6b4c9035 SHA512 9484131de34771e2d146b3b4d25661f124b660e706204f1ea8761d31b16b64b451c01447cba2de5ebe8d93cf858323066821535e887dfa2f69517978c280f889 WHIRLPOOL cebfd685bec788e56fe2e3816ff0172d714f4ca9c2708d6772e9cae68744fa3b22bc692d93bc11097b4f62fb17c6e18e14ae4c302803faee2c8a033dfc03cbbe +EBUILD clang-3.0-r4.ebuild 9741 SHA256 e33903b9080ab06233c01936e0449979513248c9078ce59767d20880763ac70d SHA512 88068bed026a61c5648aa3ef7954d4e9dc42f82df3a9dceb4362a76193ff25a3a1a00b19045a65ab79418b292d2e999f28e9f2cb097d39b239b9c3bdde4aa83b WHIRLPOOL 63807c537dd3d56b13686c811da8e5910b4b1fd9607e9be84ac47fdaf65cb7eed0e09675b3c8fd9fea4e2ab5723ba1afd55efac26575a04f51662740ede39171 +EBUILD clang-3.1-r5.ebuild 9268 SHA256 7f932ebf8cc35e1361a2f59d4e41cdaa0d023553b732e0f7ad465f542156527e SHA512 60d8b1d764a1645e8458deb66a4d40018a626e8abc1251ca2befb1b98048f41360a61e93ac64fc82f005af0691ef69dcfca392fda915e0279b396bae73143b11 WHIRLPOOL 8b9256da5cf9a22618b77a25863a48e76c521e4fd4feaa929a6cefb279565d3ba4b08d5815854005f541255d5462a2234fbbd95c10b9b230e569d9393d73ab19 +EBUILD clang-3.2.ebuild 9365 SHA256 40060644a78d4f0b2f1b4264b8a77485ab94b6cbbfaa6db9d559968b5fcc9499 SHA512 3a48e5e7aaa348ab0b6655162b0541b67f5accd0b494094aceceb66466fb79ed78fa5d07fb2cbd386afcb6407592d9f92d35348f60c67e25d008900ffe1dacd2 WHIRLPOOL 656295d94399074f740a1ee5b22b61b510b5784c50dc9a9e47312d569de976eab915797d26a5d13683070cd2e55c2e1d14fbc9d9744bfa24db8b52d9897cae8e +EBUILD clang-3.3.ebuild 9758 SHA256 2efe64d4fc425a6ac444d886b8821923264f2202d2e8dbc088f979e2f0a5a1fc SHA512 9a031edda6a30a1c76c9f3e93bee03e978432e1b5fa39b6300b549910d7c0c19d336bc30dba300a9ccc4799a206cd60a4dca030ddc770a1bc6bf04b458e0e01b WHIRLPOOL e455c404e7eaa4fdf7a8fcfe57ba6837f21e035470c1c852b71e68ce42b39cf93370f6a4366e2f09881595f780073f869bfd3c054d9a02588299b140ba856839 +EBUILD clang-9999.ebuild 9658 SHA256 4b054c2e41456e6f5b7fbd3c658ddbf14613fdc8c71fc60a01f64c0076995fff SHA512 96f790feda0bccec21b1377d44a3964941d59ed6f00777db6645647b16e8842b7e0fcf1318b28cf44ba72908d813006d55e99c986c015c78606be32dced34f4f WHIRLPOOL ec060c8c58cd407f3eb848e00b52fb75db6183e3c860070c2a3df5383caa70dfdd37c61edc5dc2239fcc6fcabb9cc33660c0a6f1a263be1ca8bd84bdd9ea0398 MISC ChangeLog 18021 SHA256 379d9f1da98a54c618426d53923e5f22c2f2235e1cee0722bdc16fd4c188aea6 SHA512 42798e7f7c197a70e8cfbd686319776a2b2d31b5c7ea5defc4c6b6c2d6120400dfc6dd34fa76183835daebca28b2da4fc125f1e327e1caa7dc4faa1ac3a10ce5 WHIRLPOOL 2218b9eddb6dcb3706c4f5a707b690fb12b44d8b76272b52b035ed1ea697c5ef61014870455e42291dde3d56cd8f24ef5da0f471442b01111cca2f6f31212374 MISC metadata.xml 1522 SHA256 c0c8a45b9d836fac31adc4d76a2de92abf2c8d603b69146fc72e6c2484331f42 SHA512 b8780e7a635fa8c32c6cf73c842982d85a11f24daf8049bb3efb165808635875a2331072c01865df230b1dcac7135fcdf9fa7ea19ac46a35ac9f50ffaf4c5067 WHIRLPOOL 2bc088ce4d44c7d0d2673449116052d70ed7298afc14bc5cc460d5c60dda2c1df65a3cf89e8cd79e52e96414b2eb759dd95ed97055cfd41822a4b9f540fb662c ------BEGIN PGP SIGNATURE----- -Version: GnuPG v2.0.20 (GNU/Linux) - -iF4EAREIAAYFAlHA3R8ACgkQFYEBGcdFJfJddgD/SZOu7B+8xlR3sOWPuyd4y8f+ -Zk6Pc99Hmt9jD6F64BkBAIMAmTjf7mrWyRmh43Owq7PuLLl+3T87GptzRmgH5or0 -=t72i ------END PGP SIGNATURE----- diff --git a/sys-devel/clang/clang-2.8-r3.ebuild b/sys-devel/clang/clang-2.8-r3.ebuild index c77ac22..ef6d930 100644 --- a/sys-devel/clang/clang-2.8-r3.ebuild +++ b/sys-devel/clang/clang-2.8-r3.ebuild @@ -2,7 +2,7 @@ # Distributed under the terms of the GNU General Public License v2 # $Header: /var/cvsroot/gentoo-x86/sys-devel/clang/clang-2.8-r3.ebuild,v 1.8 2013/01/03 23:36:58 voyageur Exp $ -EAPI=3 +EAPI=5 RESTRICT_PYTHON_ABIS="3.*" SUPPORT_PYTHON_ABIS="1" @@ -17,18 +17,19 @@ SRC_URI="http://llvm.org/releases/${PV}/llvm-${PV}.tgz -> llvm-${PV}-r1.tgz http://llvm.org/releases/${PV}/${P}.tgz" LICENSE="UoI-NCSA" -SLOT="0" +SLOT="${PV}" KEYWORDS="~amd64 ~x86 ~amd64-linux ~x86-linux ~ppc-macos" IUSE="debug multitarget +static-analyzer system-cxx-headers test" # Note: for LTO support, clang will depend on binutils with gold plugins, and LLVM built after that - http://llvm.org/docs/GoldPlugin.html DEPEND="static-analyzer? ( dev-lang/perl )" -RDEPEND="~sys-devel/llvm-${PV}[debug=,multitarget=]" +RDEPEND="sys-devel/llvm:${SLOT}=[debug=,multitarget=] + app-admin/eselect-clang" S="${WORKDIR}/llvm-${PV}" src_prepare() { - mv "${WORKDIR}"/clang-${PV} "${S}"/tools/clang || die "clang source directory not found" + mv "${WORKDIR}"/${P} "${S}"/tools/clang || die "clang source directory not found" # Same as llvm doc patches epatch "${FILESDIR}"/${PN}-2.7-fixdoc.patch @@ -68,7 +69,7 @@ src_prepare() { -i Makefile.config.in || die "Makefile.config sed failed" einfo "Fixing rpath and CFLAGS" - sed -e 's,\$(RPATH) -Wl\,\$(\(ToolDir\|LibDir\)),$(RPATH) -Wl\,'"${EPREFIX}"/usr/$(get_libdir)/llvm, \ + sed -e "s@\$(RPATH) -Wl,\$(\(ToolDir\|LibDir\))@\$(RPATH) -Wl,'${EPREFIX}/usr/$(get_libdir)/llvm-${SLOT}'@" \ -e '/OmitFramePointer/s/-fomit-frame-pointer//' \ -i Makefile.rules || die "rpath sed failed" } @@ -153,14 +154,101 @@ src_install() { cd tools/scan-view || die "cd scan-view failed" dobin scan-view + fi + + # Register slot for app-admin/eselect-clang + local eselect_dir="/usr/share/eselect-clang/slots/${SLOT}" + dodir "${eselect_dir}" + eselect_dir="${ED}/${eselect_dir}" + echo "${CATEGORY}/${PF}" > "${eselect_dir}/ebuild" + + with_slot_suffix() { + local file=$(echo "$1" | sed -e "s/-${SLOT}//") + local ext="" + if [[ "${file}" =~ \. ]] ; then + ext=".${file#*.}" + fi + local base="${file%%.*}" + echo "${base}-${SLOT}${ext}" + } + + make_versioned() { + local dir=$1 + local candidates=(${ED%/}/${dir}) + if [[ ! ${dir##*/} ]] ; then + dir=${dir%/} + candidates=( "${candidates}"* ) + else + dir=$(dirname "${dir}") + fi + + pushd ${ED%/}/${dir} >/dev/null || die + + local candidate + for candidate in "${candidates[@]}" ; do + if [[ -h "${candidate}" ]] ; then + # Add slot suffix to symlink target + local target=$(readlink -s "${candidate}") + local slotted_target=$(with_slot_suffix "${target}") + if [[ -e "${target}" ]] || [[ -e "${slotted_target}" ]] ; then + ln -sf "${slotted_target}" "${candidate}" \ + || die "Could not update symlink" + fi + fi + + local base_name=$(basename "${candidate}") + local slotted_name=$(with_slot_suffix "${base_name}") + mv "${candidate}" "${ED}/${dir}/${slotted_name}" \ + || die "Could not rename ${candidate} to ${slotted_name}" + echo "/${dir#/}/${base_name}" >> "${eselect_dir}/versioned" + done + + popd >/dev/null || die + } + + # Trailing slash => version the content + # No trailing slash => version the directory itself + local paths=( + /usr/bin/ + /usr/$(get_libdir)/llvm + /usr/include/ + /usr/share/clang + /usr/share/man/man1/ + ) + + local path + for path in "${paths[@]}" ; do + make_versioned "${path}" + done + + if use static-analyzer ; then + cd "${S}"/tools/clang/tools/scan-view || die "cd scan-view failed" + install-scan-view() { insinto "$(python_get_sitedir)"/clang doins Reporter.py Resources ScanView.py startfile.py touch "${ED}"/"$(python_get_sitedir)"/clang/__init__.py + make_versioned "$(python_get_sitedir)/clang" } python_execute_function install-scan-view fi + install_symlinks() { + local dir=${ED%/}/${1#/} + local category=$(basename "${dir}") + local symlink_dir=${ED%/}/usr/$(get_libdir)/llvm-${SLOT}/${category} + mkdir ${symlink_dir} + + local output + for output in $(grep $1 ${eselect_dir}/versioned) ; do + ln -s $(with_slot_suffix ${output}) ${symlink_dir%/}/$(basename ${output}) + done + } + + # Expose clang binaries and includes to llvm-config + install_symlinks /usr/bin/ + install_symlinks /usr/include/ + # Fix install_names on Darwin. The build system is too complicated # to just fix this, so we correct it post-install if [[ ${CHOST} == *-darwin* ]] ; then @@ -186,7 +274,12 @@ src_install() { } pkg_postinst() { - python_mod_optimize clang + python_mod_optimize ${P} + + if [[ $(eselect ${PN} show) = "(none)" ]] ; then + eselect ${PN} set ${SLOT} + fi + if use system-cxx-headers; then elog "C++ headers search path is hardcoded to the active gcc profile one" elog "If you change the active gcc profile, or update gcc to a new version," @@ -198,6 +291,16 @@ pkg_postinst() { fi } +pkg_prerm() { + if [[ $(eselect ${PN} show) = ${SLOT} ]] ; then + eselect ${PN} clear + fi +} + pkg_postrm() { - python_mod_cleanup clang + python_mod_cleanup ${P} + + if [[ -z ${REPLACED_BY_VERSION} ]] ; then + eselect ${PN} update + fi } diff --git a/sys-devel/clang/clang-2.9-r1.ebuild b/sys-devel/clang/clang-2.9-r1.ebuild index 8f11373..c9a8e2a 100644 --- a/sys-devel/clang/clang-2.9-r1.ebuild +++ b/sys-devel/clang/clang-2.9-r1.ebuild @@ -2,7 +2,7 @@ # Distributed under the terms of the GNU General Public License v2 # $Header: /var/cvsroot/gentoo-x86/sys-devel/clang/clang-2.9-r1.ebuild,v 1.5 2013/01/03 23:36:58 voyageur Exp $ -EAPI=3 +EAPI=5 RESTRICT_PYTHON_ABIS="3.*" SUPPORT_PYTHON_ABIS="1" @@ -16,18 +16,19 @@ SRC_URI="http://llvm.org/releases/${PV}/llvm-${PV}.tgz http://llvm.org/releases/${PV}/${P}.tgz" LICENSE="UoI-NCSA" -SLOT="0" +SLOT="${PV}" KEYWORDS="~amd64 ~x86 ~amd64-linux ~x86-linux ~ppc-macos" IUSE="debug multitarget +static-analyzer +system-cxx-headers test" # Note: for LTO support, clang will depend on binutils with gold plugins, and LLVM built after that - http://llvm.org/docs/GoldPlugin.html DEPEND="static-analyzer? ( dev-lang/perl )" -RDEPEND="~sys-devel/llvm-${PV}[debug=,multitarget=]" +RDEPEND="sys-devel/llvm:${SLOT}=[debug=,multitarget=] + app-admin/eselect-clang" S="${WORKDIR}/llvm-${PV}" src_prepare() { - mv "${WORKDIR}"/clang-${PV} "${S}"/tools/clang || die "clang source directory not found" + mv "${WORKDIR}"/${P} "${S}"/tools/clang || die "clang source directory not found" # Workaround GCC versions' list (bug #377949) epatch "${FILESDIR}"/${P}-gccversions.patch @@ -65,7 +66,7 @@ src_prepare() { -i Makefile.config.in || die "Makefile.config sed failed" einfo "Fixing rpath and CFLAGS" - sed -e 's,\$(RPATH) -Wl\,\$(\(ToolDir\|LibDir\)),$(RPATH) -Wl\,'"${EPREFIX}"/usr/$(get_libdir)/llvm, \ + sed -e "s@\$(RPATH) -Wl,\$(\(ToolDir\|LibDir\))@\$(RPATH) -Wl,'${EPREFIX}/usr/$(get_libdir)/llvm-${SLOT}'@" \ -e '/OmitFramePointer/s/-fomit-frame-pointer//' \ -i Makefile.rules || die "rpath sed failed" } @@ -142,14 +143,101 @@ src_install() { cd tools/scan-view || die "cd scan-view failed" dobin scan-view + fi + + # Register slot for app-admin/eselect-clang + local eselect_dir="/usr/share/eselect-clang/slots/${SLOT}" + dodir "${eselect_dir}" + eselect_dir="${ED}/${eselect_dir}" + echo "${CATEGORY}/${PF}" > "${eselect_dir}/ebuild" + + with_slot_suffix() { + local file=$(echo "$1" | sed -e "s/-${SLOT}//") + local ext="" + if [[ "${file}" =~ \. ]] ; then + ext=".${file#*.}" + fi + local base="${file%%.*}" + echo "${base}-${SLOT}${ext}" + } + + make_versioned() { + local dir=$1 + local candidates=(${ED%/}/${dir}) + if [[ ! ${dir##*/} ]] ; then + dir=${dir%/} + candidates=( "${candidates}"* ) + else + dir=$(dirname "${dir}") + fi + + pushd ${ED%/}/${dir} >/dev/null || die + + local candidate + for candidate in "${candidates[@]}" ; do + if [[ -h "${candidate}" ]] ; then + # Add slot suffix to symlink target + local target=$(readlink -s "${candidate}") + local slotted_target=$(with_slot_suffix "${target}") + if [[ -e "${target}" ]] || [[ -e "${slotted_target}" ]] ; then + ln -sf "${slotted_target}" "${candidate}" \ + || die "Could not update symlink" + fi + fi + + local base_name=$(basename "${candidate}") + local slotted_name=$(with_slot_suffix "${base_name}") + mv "${candidate}" "${ED}/${dir}/${slotted_name}" \ + || die "Could not rename ${candidate} to ${slotted_name}" + echo "/${dir#/}/${base_name}" >> "${eselect_dir}/versioned" + done + + popd >/dev/null || die + } + + # Trailing slash => version the content + # No trailing slash => version the directory itself + local paths=( + /usr/bin/ + /usr/$(get_libdir)/llvm + /usr/include/ + /usr/share/clang + /usr/share/man/man1/ + ) + + local path + for path in "${paths[@]}" ; do + make_versioned "${path}" + done + + if use static-analyzer ; then + cd "${S}"/tools/clang/tools/scan-view || die "cd scan-view failed" + install-scan-view() { insinto "$(python_get_sitedir)"/clang doins Reporter.py Resources ScanView.py startfile.py touch "${ED}"/"$(python_get_sitedir)"/clang/__init__.py + make_versioned "$(python_get_sitedir)/clang" } python_execute_function install-scan-view fi + install_symlinks() { + local dir=${ED%/}/${1#/} + local category=$(basename "${dir}") + local symlink_dir=${ED%/}/usr/$(get_libdir)/llvm-${SLOT}/${category} + mkdir ${symlink_dir} + + local output + for output in $(grep $1 ${eselect_dir}/versioned) ; do + ln -s $(with_slot_suffix ${output}) ${symlink_dir%/}/$(basename ${output}) + done + } + + # Expose clang binaries and includes to llvm-config + install_symlinks /usr/bin/ + install_symlinks /usr/include/ + # Fix install_names on Darwin. The build system is too complicated # to just fix this, so we correct it post-install if [[ ${CHOST} == *-darwin* ]] ; then @@ -175,7 +263,12 @@ src_install() { } pkg_postinst() { - python_mod_optimize clang + python_mod_optimize ${P} + + if [[ $(eselect ${PN} show) = "(none)" ]] ; then + eselect ${PN} set ${SLOT} + fi + if use system-cxx-headers; then elog "C++ headers search path is hardcoded to the active gcc profile one" elog "If you change the active gcc profile, or update gcc to a new version," @@ -187,6 +280,16 @@ pkg_postinst() { fi } +pkg_prerm() { + if [[ $(eselect ${PN} show) = ${SLOT} ]] ; then + eselect ${PN} clear + fi +} + pkg_postrm() { - python_mod_cleanup clang + python_mod_cleanup ${P} + + if [[ -z ${REPLACED_BY_VERSION} ]] ; then + eselect ${PN} update + fi } diff --git a/sys-devel/clang/clang-3.0-r4.ebuild b/sys-devel/clang/clang-3.0-r4.ebuild index 90230a0..0c4a3c9 100644 --- a/sys-devel/clang/clang-3.0-r4.ebuild +++ b/sys-devel/clang/clang-3.0-r4.ebuild @@ -2,7 +2,7 @@ # Distributed under the terms of the GNU General Public License v2 # $Header: /var/cvsroot/gentoo-x86/sys-devel/clang/clang-3.0-r4.ebuild,v 1.2 2013/01/03 23:36:58 voyageur Exp $ -EAPI=3 +EAPI=5 RESTRICT_PYTHON_ABIS="3.*" SUPPORT_PYTHON_ABIS="1" @@ -16,17 +16,18 @@ SRC_URI="http://llvm.org/releases/${PV}/llvm-${PV}.tar.gz http://llvm.org/releases/${PV}/${P}.tar.gz" LICENSE="UoI-NCSA" -SLOT="0" +SLOT="${PV}" KEYWORDS="~amd64 ~x86 ~amd64-linux ~x86-linux ~ppc-macos" IUSE="debug kernel_FreeBSD multitarget +static-analyzer system-cxx-headers test" DEPEND="static-analyzer? ( dev-lang/perl )" -RDEPEND="~sys-devel/llvm-${PV}[debug=,multitarget=]" +RDEPEND="sys-devel/llvm:${SLOT}=[debug=,multitarget=] + app-admin/eselect-clang" S=${WORKDIR}/llvm-${PV}.src src_prepare() { - mv "${WORKDIR}"/clang-${PV}.src "${S}"/tools/clang || die "clang source directory move failed" + mv "${WORKDIR}"/${P}.src "${S}"/tools/clang || die "clang source directory move failed" # Same as llvm doc patches epatch "${FILESDIR}"/${PN}-2.7-fixdoc.patch @@ -45,7 +46,7 @@ src_prepare() { -i tools/clang/tools/scan-build/scan-build \ || die "scan-build sed failed" # Set correct path for gold plugin - sed -e "/LLVMgold.so/s#lib/#$(get_libdir)/llvm/#" \ + sed -e "/LLVMgold.so/s#lib/#$(get_libdir)/llvm-${SLOT}/#" \ -i tools/clang/lib/Driver/Tools.cpp \ || die "gold plugin path sed failed" # Properly detect Gentoo's binutils-apple version (committed in trunk) @@ -62,7 +63,7 @@ src_prepare() { -i Makefile.config.in || die "Makefile.config sed failed" einfo "Fixing rpath and CFLAGS" - sed -e 's,\$(RPATH) -Wl\,\$(\(ToolDir\|LibDir\)),$(RPATH) -Wl\,'"${EPREFIX}"/usr/$(get_libdir)/llvm, \ + sed -e "s@\$(RPATH) -Wl,\$(\(ToolDir\|LibDir\))@\$(RPATH) -Wl,'${EPREFIX}/usr/$(get_libdir)/llvm-${SLOT}'@" \ -e '/OmitFramePointer/s/-fomit-frame-pointer//' \ -i Makefile.rules || die "rpath sed failed" @@ -160,14 +161,101 @@ src_install() { cd tools/scan-view || die "cd scan-view failed" dobin scan-view + fi + + # Register slot for app-admin/eselect-clang + local eselect_dir="/usr/share/eselect-clang/slots/${SLOT}" + dodir "${eselect_dir}" + eselect_dir="${ED}/${eselect_dir}" + echo "${CATEGORY}/${PF}" > "${eselect_dir}/ebuild" + + with_slot_suffix() { + local file=$(echo "$1" | sed -e "s/-${SLOT}//") + local ext="" + if [[ "${file}" =~ \. ]] ; then + ext=".${file#*.}" + fi + local base="${file%%.*}" + echo "${base}-${SLOT}${ext}" + } + + make_versioned() { + local dir=$1 + local candidates=(${ED%/}/${dir}) + if [[ ! ${dir##*/} ]] ; then + dir=${dir%/} + candidates=( "${candidates}"* ) + else + dir=$(dirname "${dir}") + fi + + pushd ${ED%/}/${dir} >/dev/null || die + + local candidate + for candidate in "${candidates[@]}" ; do + if [[ -h "${candidate}" ]] ; then + # Add slot suffix to symlink target + local target=$(readlink -s "${candidate}") + local slotted_target=$(with_slot_suffix "${target}") + if [[ -e "${target}" ]] || [[ -e "${slotted_target}" ]] ; then + ln -sf "${slotted_target}" "${candidate}" \ + || die "Could not update symlink" + fi + fi + + local base_name=$(basename "${candidate}") + local slotted_name=$(with_slot_suffix "${base_name}") + mv "${candidate}" "${ED}/${dir}/${slotted_name}" \ + || die "Could not rename ${candidate} to ${slotted_name}" + echo "/${dir#/}/${base_name}" >> "${eselect_dir}/versioned" + done + + popd >/dev/null || die + } + + # Trailing slash => version the content + # No trailing slash => version the directory itself + local paths=( + /usr/bin/ + /usr/$(get_libdir)/llvm + /usr/include/ + /usr/share/clang + /usr/share/man/man1/ + ) + + local path + for path in "${paths[@]}" ; do + make_versioned "${path}" + done + + if use static-analyzer ; then + cd "${S}"/tools/clang/tools/scan-view || die "cd scan-view failed" + install-scan-view() { insinto "$(python_get_sitedir)"/clang doins Reporter.py Resources ScanView.py startfile.py touch "${ED}"/"$(python_get_sitedir)"/clang/__init__.py + make_versioned "$(python_get_sitedir)/clang" } python_execute_function install-scan-view fi + install_symlinks() { + local dir=${ED%/}/${1#/} + local category=$(basename "${dir}") + local symlink_dir=${ED%/}/usr/$(get_libdir)/llvm-${SLOT}/${category} + mkdir ${symlink_dir} + + local output + for output in $(grep $1 ${eselect_dir}/versioned) ; do + ln -s $(with_slot_suffix ${output}) ${symlink_dir%/}/$(basename ${output}) + done + } + + # Expose clang binaries and includes to llvm-config + install_symlinks /usr/bin/ + install_symlinks /usr/include/ + # Fix install_names on Darwin. The build system is too complicated # to just fix this, so we correct it post-install if [[ ${CHOST} == *-darwin* ]] ; then @@ -196,7 +284,12 @@ src_install() { } pkg_postinst() { - python_mod_optimize clang + python_mod_optimize ${P} + + if [[ $(eselect ${PN} show) = "(none)" ]] ; then + eselect ${PN} set ${SLOT} + fi + if use system-cxx-headers; then elog "C++ headers search path is hardcoded to the active gcc profile one" elog "If you change the active gcc profile, or update gcc to a new version," @@ -208,6 +301,16 @@ pkg_postinst() { fi } +pkg_prerm() { + if [[ $(eselect ${PN} show) = ${SLOT} ]] ; then + eselect ${PN} clear + fi +} + pkg_postrm() { - python_mod_cleanup clang + python_mod_cleanup ${P} + + if [[ -z ${REPLACED_BY_VERSION} ]] ; then + eselect ${PN} update + fi } diff --git a/sys-devel/clang/clang-3.1-r5.ebuild b/sys-devel/clang/clang-3.1-r5.ebuild index f65f8d9..44a3959 100644 --- a/sys-devel/clang/clang-3.1-r5.ebuild +++ b/sys-devel/clang/clang-3.1-r5.ebuild @@ -2,7 +2,7 @@ # Distributed under the terms of the GNU General Public License v2 # $Header: /var/cvsroot/gentoo-x86/sys-devel/clang/clang-3.1-r5.ebuild,v 1.4 2013/01/03 23:36:58 voyageur Exp $ -EAPI=4 +EAPI=5 RESTRICT_PYTHON_ABIS="3.*" SUPPORT_PYTHON_ABIS="1" @@ -17,17 +17,18 @@ SRC_URI="http://llvm.org/releases/${PV}/llvm-${PV}.src.tar.gz http://llvm.org/releases/${PV}/${P}.src.tar.gz" LICENSE="UoI-NCSA" -SLOT="0" +SLOT="${PV}" KEYWORDS="~amd64 ~arm ~x86 ~amd64-fbsd ~x64-freebsd ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos" IUSE="debug kernel_FreeBSD multitarget +static-analyzer test" DEPEND="static-analyzer? ( dev-lang/perl )" -RDEPEND="~sys-devel/llvm-${PV}[debug=,multitarget=]" +RDEPEND="sys-devel/llvm:${SLOT}=[debug=,multitarget=] + app-admin/eselect-clang" S=${WORKDIR}/llvm-${PV}.src src_prepare() { - mv "${WORKDIR}"/clang-${PV}.src "${S}"/tools/clang \ + mv "${WORKDIR}"/${P}.src "${S}"/tools/clang \ || die "clang source directory move failed" mv "${WORKDIR}"/compiler-rt-${PV}.src "${S}"/projects/compiler-rt \ || die "compiler-rt source directory move failed" @@ -50,7 +51,7 @@ src_prepare() { -i tools/clang/tools/scan-build/scan-build \ || die "scan-build sed failed" # Set correct path for gold plugin - sed -e "/LLVMgold.so/s#lib/#$(get_libdir)/llvm/#" \ + sed -e "/LLVMgold.so/s#lib/#$(get_libdir)/llvm-${SLOT}/#" \ -i tools/clang/lib/Driver/Tools.cpp \ || die "gold plugin path sed failed" # Specify python version @@ -66,7 +67,7 @@ src_prepare() { -i Makefile.config.in || die "Makefile.config sed failed" einfo "Fixing rpath and CFLAGS" - sed -e 's,\$(RPATH) -Wl\,\$(\(ToolDir\|LibDir\)),$(RPATH) -Wl\,'"${EPREFIX}"/usr/$(get_libdir)/llvm, \ + sed -e "s@\$(RPATH) -Wl,\$(\(ToolDir\|LibDir\))@\$(RPATH) -Wl,'${EPREFIX}/usr/$(get_libdir)/llvm-${SLOT}'@" \ -e '/OmitFramePointer/s/-fomit-frame-pointer//' \ -i Makefile.rules || die "rpath sed failed" @@ -160,14 +161,101 @@ src_install() { cd tools/scan-view || die "cd scan-view failed" dobin scan-view + fi + + # Register slot for app-admin/eselect-clang + local eselect_dir="/usr/share/eselect-clang/slots/${SLOT}" + dodir "${eselect_dir}" + eselect_dir="${ED}/${eselect_dir}" + echo "${CATEGORY}/${PF}" > "${eselect_dir}/ebuild" + + with_slot_suffix() { + local file=$(echo "$1" | sed -e "s/-${SLOT}//") + local ext="" + if [[ "${file}" =~ \. ]] ; then + ext=".${file#*.}" + fi + local base="${file%%.*}" + echo "${base}-${SLOT}${ext}" + } + + make_versioned() { + local dir=$1 + local candidates=(${ED%/}/${dir}) + if [[ ! ${dir##*/} ]] ; then + dir=${dir%/} + candidates=( "${candidates}"* ) + else + dir=$(dirname "${dir}") + fi + + pushd ${ED%/}/${dir} >/dev/null || die + + local candidate + for candidate in "${candidates[@]}" ; do + if [[ -h "${candidate}" ]] ; then + # Add slot suffix to symlink target + local target=$(readlink -s "${candidate}") + local slotted_target=$(with_slot_suffix "${target}") + if [[ -e "${target}" ]] || [[ -e "${slotted_target}" ]] ; then + ln -sf "${slotted_target}" "${candidate}" \ + || die "Could not update symlink" + fi + fi + + local base_name=$(basename "${candidate}") + local slotted_name=$(with_slot_suffix "${base_name}") + mv "${candidate}" "${ED}/${dir}/${slotted_name}" \ + || die "Could not rename ${candidate} to ${slotted_name}" + echo "/${dir#/}/${base_name}" >> "${eselect_dir}/versioned" + done + + popd >/dev/null || die + } + + # Trailing slash => version the content + # No trailing slash => version the directory itself + local paths=( + /usr/bin/ + /usr/$(get_libdir)/llvm + /usr/include/ + /usr/share/clang + /usr/share/man/man1/ + ) + + local path + for path in "${paths[@]}" ; do + make_versioned "${path}" + done + + if use static-analyzer ; then + cd "${S}"/tools/clang/tools/scan-view || die "cd scan-view failed" + install-scan-view() { insinto "$(python_get_sitedir)"/clang doins Reporter.py Resources ScanView.py startfile.py touch "${ED}"/"$(python_get_sitedir)"/clang/__init__.py + make_versioned "$(python_get_sitedir)/clang" } python_execute_function install-scan-view fi + install_symlinks() { + local dir=${ED%/}/${1#/} + local category=$(basename "${dir}") + local symlink_dir=${ED%/}/usr/$(get_libdir)/llvm-${SLOT}/${category} + mkdir ${symlink_dir} + + local output + for output in $(grep $1 ${eselect_dir}/versioned) ; do + ln -s $(with_slot_suffix ${output}) ${symlink_dir%/}/$(basename ${output}) + done + } + + # Expose clang binaries and includes to llvm-config + install_symlinks /usr/bin/ + install_symlinks /usr/include/ + # Fix install_names on Darwin. The build system is too complicated # to just fix this, so we correct it post-install if [[ ${CHOST} == *-darwin* ]] ; then @@ -196,9 +284,21 @@ src_install() { } pkg_postinst() { - python_mod_optimize clang + python_mod_optimize ${P} + if [[ $(eselect ${PN} show) = "(none)" ]] ; then + eselect ${PN} set ${SLOT} + fi +} + +pkg_prerm() { + if [[ $(eselect ${PN} show) = ${SLOT} ]] ; then + eselect ${PN} clear + fi } pkg_postrm() { - python_mod_cleanup clang + python_mod_cleanup ${P} + if [[ -z ${REPLACED_BY_VERSION} ]] ; then + eselect ${PN} update + fi } diff --git a/sys-devel/clang/clang-3.2.ebuild b/sys-devel/clang/clang-3.2.ebuild index 5a06209..3ed57be 100644 --- a/sys-devel/clang/clang-3.2.ebuild +++ b/sys-devel/clang/clang-3.2.ebuild @@ -16,13 +16,14 @@ SRC_URI="http://llvm.org/releases/${PV}/llvm-${PV}.src.tar.gz http://llvm.org/releases/${PV}/${P}.src.tar.gz" LICENSE="UoI-NCSA" -SLOT="0" +SLOT="${PV}" KEYWORDS="~amd64 ~arm ~x86 ~amd64-fbsd ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos" IUSE="debug kernel_FreeBSD multitarget python +static-analyzer test" DEPEND="static-analyzer? ( dev-lang/perl ) ${PYTHON_DEPS}" -RDEPEND="~sys-devel/llvm-${PV}[debug=,multitarget=] +RDEPEND="sys-devel/llvm:${SLOT}=[debug=,multitarget=] + app-admin/eselect-clang ${PYTHON_DEPS}" S=${WORKDIR}/llvm-${PV}.src @@ -53,7 +54,7 @@ src_prepare() { -i tools/clang/tools/scan-build/scan-build \ || die "scan-build sed failed" # Set correct path for gold plugin - sed -e "/LLVMgold.so/s#lib/#$(get_libdir)/llvm/#" \ + sed -e "/LLVMgold.so/s#lib/#$(get_libdir)/llvm-${SLOT}/#" \ -i tools/clang/lib/Driver/Tools.cpp \ || die "gold plugin path sed failed" @@ -65,7 +66,7 @@ src_prepare() { -i Makefile.config.in || die "Makefile.config sed failed" einfo "Fixing rpath and CFLAGS" - sed -e 's,\$(RPATH) -Wl\,\$(\(ToolDir\|LibDir\)),$(RPATH) -Wl\,'"${EPREFIX}"/usr/$(get_libdir)/llvm, \ + sed -e "s@\$(RPATH) -Wl,\$(\(ToolDir\|LibDir\))@\$(RPATH) -Wl,'${EPREFIX}/usr/$(get_libdir)/llvm-${SLOT}'@" \ -e '/OmitFramePointer/s/-fomit-frame-pointer//' \ -i Makefile.rules || die "rpath sed failed" @@ -147,11 +148,86 @@ src_install() { doins tools/scan-build/sorttable.js fi + # Register slot for app-admin/eselect-clang + local eselect_dir="/usr/share/eselect-clang/slots/${SLOT}" + dodir "${eselect_dir}" + eselect_dir="${ED}/${eselect_dir}" + echo "${CATEGORY}/${PF}" > "${eselect_dir}/ebuild" + + with_slot_suffix() { + local file=$(echo "$1" | sed -e "s/-${SLOT}//") + local ext="" + if [[ "${file}" =~ \. ]] ; then + ext=".${file#*.}" + fi + local base="${file%%.*}" + echo "${base}-${SLOT}${ext}" + } + + make_versioned() { + local dir=$1 + local candidates=(${ED%/}/${dir}) + if [[ ! ${dir##*/} ]] ; then + dir=${dir%/} + candidates=( "${candidates}"* ) + else + dir=$(dirname "${dir}") + fi + + pushd ${ED%/}/${dir} >/dev/null || die + + local candidate + for candidate in "${candidates[@]}" ; do + if [[ -h "${candidate}" ]] ; then + # Add slot suffix to symlink target + local target=$(readlink -s "${candidate}") + local slotted_target=$(with_slot_suffix "${target}") + if [[ -e "${target}" ]] || [[ -e "${slotted_target}" ]] ; then + ln -sf "${slotted_target}" "${candidate}" \ + || die "Could not update symlink" + fi + fi + + local base_name=$(basename "${candidate}") + local slotted_name=$(with_slot_suffix "${base_name}") + mv "${candidate}" "${ED}/${dir}/${slotted_name}" \ + || die "Could not rename ${candidate} to ${slotted_name}" + echo "/${dir#/}/${base_name}" >> "${eselect_dir}/versioned" + done + + popd >/dev/null || die + } + + # Trailing slash => version the content + # No trailing slash => version the directory itself + local paths=( + /usr/bin/ + /usr/$(get_libdir)/llvm + /usr/include/ + /usr/share/clang + /usr/share/man/man1/ + ) + + local path + for path in "${paths[@]}" ; do + make_versioned "${path}" + done + + python_doscript_versioned() { + local path="$1" + local file=$(basename "${path}") + + python_newscript "${path}" $(with_slot_suffix "${file}") + + local scriptroot=${python_scriptroot:-${DESTTREE%/}/bin} + echo "${scriptroot%/}/${file}" >> "${eselect_dir}/versioned" + } + python_inst() { if use static-analyzer ; then pushd tools/scan-view >/dev/null || die - python_doscript scan-view + python_doscript_versioned scan-view touch __init__.py || die python_moduleinto clang @@ -169,11 +245,30 @@ src_install() { popd >/dev/null || die fi + use static-analyzer || use python && \ + make_versioned "$(python_get_sitedir)/clang" + # AddressSanitizer symbolizer (currently separate) - python_doscript "${S}"/projects/compiler-rt/lib/asan/scripts/asan_symbolize.py + python_doscript_versioned "${S}"/projects/compiler-rt/lib/asan/scripts/asan_symbolize.py } python_foreach_impl python_inst + install_symlinks() { + local dir=${ED%/}/${1#/} + local category=$(basename "${dir}") + local symlink_dir=${ED%/}/usr/$(get_libdir)/llvm-${SLOT}/${category} + mkdir ${symlink_dir} + + local output + for output in $(grep $1 ${eselect_dir}/versioned) ; do + ln -s $(with_slot_suffix ${output}) ${symlink_dir%/}/$(basename ${output}) + done + } + + # Expose clang binaries and includes to llvm-config + install_symlinks /usr/bin/ + install_symlinks /usr/include/ + # Fix install_names on Darwin. The build system is too complicated # to just fix this, so we correct it post-install if [[ ${CHOST} == *-darwin* ]] ; then @@ -200,3 +295,21 @@ src_install() { # Remove unnecessary headers on FreeBSD, bug #417171 use kernel_FreeBSD && rm "${ED}"usr/$(get_libdir)/clang/${PV}/include/{arm_neon,std,float,iso,limits,tgmath,varargs}*.h } + +pkg_postinst() { + if [[ $(eselect ${PN} show) = "(none)" ]] ; then + eselect ${PN} set ${SLOT} + fi +} + +pkg_prerm() { + if [[ $(eselect ${PN} show) = ${SLOT} ]] ; then + eselect ${PN} clear + fi +} + +pkg_postrm() { + if [[ -z ${REPLACED_BY_VERSION} ]] ; then + eselect ${PN} update + fi +} diff --git a/sys-devel/clang/clang-3.3.ebuild b/sys-devel/clang/clang-3.3.ebuild index 5a7c79a..24bcd1b 100644 --- a/sys-devel/clang/clang-3.3.ebuild +++ b/sys-devel/clang/clang-3.3.ebuild @@ -16,13 +16,14 @@ SRC_URI="http://llvm.org/releases/${PV}/llvm-${PV}.src.tar.gz http://llvm.org/releases/${PV}/cfe-${PV}.src.tar.gz" LICENSE="UoI-NCSA" -SLOT="0" -KEYWORDS="~amd64 ~arm ~x86 ~amd64-fbsd ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos" +SLOT="${PV}" +KEYWORDS="~amd64 ~arm ~x86 ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos" IUSE="debug kernel_FreeBSD multitarget python +static-analyzer test" DEPEND="static-analyzer? ( dev-lang/perl ) ${PYTHON_DEPS}" -RDEPEND="~sys-devel/llvm-${PV}[debug=,multitarget=] +RDEPEND="sys-devel/llvm:${SLOT}=[debug=,multitarget=] + app-admin/eselect-clang ${PYTHON_DEPS}" S=${WORKDIR}/llvm-${PV}.src @@ -56,8 +57,8 @@ src_prepare() { -i tools/clang/tools/scan-build/scan-build \ || die "scan-build sed failed" # Set correct path for gold plugin and coverage lib - sed -e "/LLVMgold.so/s#lib/#$(get_libdir)/llvm/#" \ - -e "s#lib\(/libprofile_rt.a\)#$(get_libdir)/llvm\1#" \ + sed -e "/LLVMgold.so/s#lib/#$(get_libdir)/llvm-${SLOT}/#" \ + -e "s#lib\(/libprofile_rt.a\)#$(get_libdir)/llvm-${SLOT}\1#" \ -i tools/clang/lib/Driver/Tools.cpp \ || die "Tools.cpp paths sed failed" @@ -69,7 +70,7 @@ src_prepare() { -i Makefile.config.in || die "Makefile.config sed failed" einfo "Fixing rpath and CFLAGS" - sed -e 's,\$(RPATH) -Wl\,\$(\(ToolDir\|LibDir\)),$(RPATH) -Wl\,'"${EPREFIX}"/usr/$(get_libdir)/llvm, \ + sed -e "s@\$(RPATH) -Wl,\$(\(ToolDir\|LibDir\))@\$(RPATH) -Wl,'${EPREFIX}/usr/$(get_libdir)/llvm-${SLOT}'@" \ -e '/OmitFramePointer/s/-fomit-frame-pointer//' \ -i Makefile.rules || die "rpath sed failed" @@ -154,11 +155,86 @@ src_install() { doins tools/scan-build/sorttable.js fi + # Register slot for app-admin/eselect-clang + local eselect_dir="/usr/share/eselect-clang/slots/${SLOT}" + dodir "${eselect_dir}" + eselect_dir="${ED}/${eselect_dir}" + echo "${CATEGORY}/${PF}" > "${eselect_dir}/ebuild" + + with_slot_suffix() { + local file=$(echo "$1" | sed -e "s/-${SLOT}//") + local ext="" + if [[ "${file}" =~ \. ]] ; then + ext=".${file#*.}" + fi + local base="${file%%.*}" + echo "${base}-${SLOT}${ext}" + } + + make_versioned() { + local dir=$1 + local candidates=(${ED%/}/${dir}) + if [[ ! ${dir##*/} ]] ; then + dir=${dir%/} + candidates=( "${candidates}"* ) + else + dir=$(dirname "${dir}") + fi + + pushd ${ED%/}/${dir} >/dev/null || die + + local candidate + for candidate in "${candidates[@]}" ; do + if [[ -h "${candidate}" ]] ; then + # Add slot suffix to symlink target + local target=$(readlink -s "${candidate}") + local slotted_target=$(with_slot_suffix "${target}") + if [[ -e "${target}" ]] || [[ -e "${slotted_target}" ]] ; then + ln -sf "${slotted_target}" "${candidate}" \ + || die "Could not update symlink" + fi + fi + + local base_name=$(basename "${candidate}") + local slotted_name=$(with_slot_suffix "${base_name}") + mv "${candidate}" "${ED}/${dir}/${slotted_name}" \ + || die "Could not rename ${candidate} to ${slotted_name}" + echo "/${dir#/}/${base_name}" >> "${eselect_dir}/versioned" + done + + popd >/dev/null || die + } + + # Trailing slash => version the content + # No trailing slash => version the directory itself + local paths=( + /usr/bin/ + /usr/$(get_libdir)/llvm + /usr/include/ + /usr/share/clang + /usr/share/man/man1/ + ) + + local path + for path in "${paths[@]}" ; do + make_versioned "${path}" + done + + python_doscript_versioned() { + local path="$1" + local file=$(basename "${path}") + + python_newscript "${path}" $(with_slot_suffix "${file}") + + local scriptroot=${python_scriptroot:-${DESTTREE%/}/bin} + echo "${scriptroot%/}/${file}" >> "${eselect_dir}/versioned" + } + python_inst() { if use static-analyzer ; then pushd tools/scan-view >/dev/null || die - python_doscript scan-view + python_doscript_versioned scan-view touch __init__.py || die python_moduleinto clang @@ -176,11 +252,30 @@ src_install() { popd >/dev/null || die fi + use static-analyzer || use python && \ + make_versioned "$(python_get_sitedir)/clang" + # AddressSanitizer symbolizer (currently separate) - python_doscript "${S}"/projects/compiler-rt/lib/asan/scripts/asan_symbolize.py + python_doscript_versioned "${S}"/projects/compiler-rt/lib/asan/scripts/asan_symbolize.py } python_foreach_impl python_inst + install_symlinks() { + local dir=${ED%/}/${1#/} + local category=$(basename "${dir}") + local symlink_dir=${ED%/}/usr/$(get_libdir)/llvm-${SLOT}/${category} + mkdir ${symlink_dir} + + local output + for output in $(grep $1 ${eselect_dir}/versioned) ; do + ln -s $(with_slot_suffix ${output}) ${symlink_dir%/}/$(basename ${output}) + done + } + + # Expose clang binaries and includes to llvm-config + install_symlinks /usr/bin/ + install_symlinks /usr/include/ + # Fix install_names on Darwin. The build system is too complicated # to just fix this, so we correct it post-install if [[ ${CHOST} == *-darwin* ]] ; then @@ -207,3 +302,21 @@ src_install() { # Remove unnecessary headers on FreeBSD, bug #417171 use kernel_FreeBSD && rm "${ED}"usr/$(get_libdir)/clang/${PV}/include/{arm_neon,std,float,iso,limits,tgmath,varargs}*.h } + +pkg_postinst() { + if [[ $(eselect ${PN} show) = "(none)" ]] ; then + eselect ${PN} set ${SLOT} + fi +} + +pkg_prerm() { + if [[ $(eselect ${PN} show) = ${SLOT} ]] ; then + eselect ${PN} clear + fi +} + +pkg_postrm() { + if [[ -z ${REPLACED_BY_VERSION} ]] ; then + eselect ${PN} update + fi +} diff --git a/sys-devel/clang/clang-9999.ebuild b/sys-devel/clang/clang-9999.ebuild index 2187937..036bbb4 100644 --- a/sys-devel/clang/clang-9999.ebuild +++ b/sys-devel/clang/clang-9999.ebuild @@ -14,13 +14,14 @@ SRC_URI="" ESVN_REPO_URI="http://llvm.org/svn/llvm-project/cfe/trunk" LICENSE="UoI-NCSA" -SLOT="0" +SLOT="${PV}" KEYWORDS="" IUSE="debug multitarget python +static-analyzer test" DEPEND="static-analyzer? ( dev-lang/perl ) ${PYTHON_DEPS}" -RDEPEND="~sys-devel/llvm-${PV}[debug=,multitarget=] +RDEPEND="sys-devel/llvm:${SLOT}=[debug=,multitarget=] + app-admin/eselect-clang ${PYTHON_DEPS}" S="${WORKDIR}/llvm" @@ -54,10 +55,22 @@ src_prepare() { -i tools/clang/tools/scan-build/scan-build \ || die "scan-build sed failed" # Set correct path for gold plugin and coverage lib - sed -e "/LLVMgold.so/s#lib/#$(get_libdir)/llvm/#" \ - -e "s#lib\(/libprofile_rt.a\)#$(get_libdir)/llvm\1#" \ + sed -e "/LLVMgold.so/s#lib/#$(get_libdir)/llvm-${SLOT}/#" \ + -e "s#lib\(/libprofile_rt.a\)#$(get_libdir)/llvm-${SLOT}\1#" \ -i tools/clang/lib/Driver/Tools.cpp \ || die "driver tools paths sed failed" + # Add slot suffix for the live ebuild + sed -e "/LLVM_VERSION =/s/\('[0-9.]*\)svn'$/\1-${SLOT}'/" \ + -i bindings/python/llvm/common.py || die "python bindings version sed failed" + sed -e "/PACKAGE_VERSION=/s/\('[0-9.]*\)svn'$/\1-${SLOT}'/" \ + -i configure || die "configure version sed faile" + sed -e "/#define CLANG_MAKE_VERSION_STRING2/s/#X/#X \"-${SLOT}\"/" \ + -i tools/clang/include/clang/Basic/Version.h \ + || die "Version sed #1 failed" + sed -e "/@CLANG_VERSION@/s/#g/-${SLOT}#g/" \ + -e "/subst rc/aCLANG_VERSION := \$(subst -${SLOT},,\$(CLANG_VERSION))" \ + -i tools/clang/include/clang/Basic/Makefile \ + || die "Version sed #2 failed" # From llvm src_prepare einfo "Fixing install dirs" @@ -67,7 +80,7 @@ src_prepare() { -i Makefile.config.in || die "Makefile.config sed failed" einfo "Fixing rpath and CFLAGS" - sed -e 's,\$(RPATH) -Wl\,\$(\(ToolDir\|LibDir\)),$(RPATH) -Wl\,'"${EPREFIX}"/usr/$(get_libdir)/llvm, \ + sed -e "s@\$(RPATH) -Wl,'\$\$ORIGIN/../lib'@\$(RPATH) -Wl,'${EPREFIX}/usr/$(get_libdir)/llvm-${SLOT}'@" \ -e '/OmitFramePointer/s/-fomit-frame-pointer//' \ -i Makefile.rules || die "rpath sed failed" @@ -80,13 +93,15 @@ src_prepare() { } src_configure() { - # Update resource dir version after first RC + local LLVM_VERSION=`sed -n "s/PACKAGE_VERSION='\([0-9.]*-${SLOT}\)'$/\1/p" configure` + [[ -n "${LLVM_VERSION}" ]] || die "Could not extract LLVM version" + local CONF_FLAGS="--enable-shared --with-optimize-option= $(use_enable !debug optimized) $(use_enable debug assertions) $(use_enable debug expensive-checks) - --with-clang-resource-dir=../$(get_libdir)/clang/3.4" + --with-clang-resource-dir=../$(get_libdir)/clang/${LLVM_VERSION}" # Setup the search path to include the Prefix includes if use prefix ; then @@ -141,11 +156,86 @@ src_install() { doins tools/scan-build/sorttable.js fi + # Register slot for app-admin/eselect-clang + local eselect_dir="/usr/share/eselect-clang/slots/${SLOT}" + dodir "${eselect_dir}" + eselect_dir="${ED}/${eselect_dir}" + echo "${CATEGORY}/${PF}" > "${eselect_dir}/ebuild" + + with_slot_suffix() { + local file=$(echo "$1" | sed -e "s/-${SLOT}//") + local ext="" + if [[ "${file}" =~ \. ]] ; then + ext=".${file#*.}" + fi + local base="${file%%.*}" + echo "${base}-${SLOT}${ext}" + } + + make_versioned() { + local dir=$1 + local candidates=(${ED%/}/${dir}) + if [[ ! ${dir##*/} ]] ; then + dir=${dir%/} + candidates=( "${candidates}"* ) + else + dir=$(dirname "${dir}") + fi + + pushd ${ED%/}/${dir} >/dev/null || die + + local candidate + for candidate in "${candidates[@]}" ; do + if [[ -h "${candidate}" ]] ; then + # Add slot suffix to symlink target + local target=$(readlink -s "${candidate}") + local slotted_target=$(with_slot_suffix "${target}") + if [[ -e "${target}" ]] || [[ -e "${slotted_target}" ]] ; then + ln -sf "${slotted_target}" "${candidate}" \ + || die "Could not update symlink" + fi + fi + + local base_name=$(basename "${candidate}") + local slotted_name=$(with_slot_suffix "${base_name}") + mv "${candidate}" "${ED}/${dir}/${slotted_name}" \ + || die "Could not rename ${candidate} to ${slotted_name}" + echo "/${dir#/}/${base_name}" >> "${eselect_dir}/versioned" + done + + popd >/dev/null || die + } + + # Trailing slash => version the content + # No trailing slash => version the directory itself + local paths=( + /usr/bin/ + /usr/$(get_libdir)/llvm + /usr/include/ + /usr/share/clang + /usr/share/man/man1/ + ) + + local path + for path in "${paths[@]}" ; do + make_versioned "${path}" + done + + python_doscript_versioned() { + local path="$1" + local file=$(basename "${path}") + + python_newscript "${path}" $(with_slot_suffix "${file}") + + local scriptroot=${python_scriptroot:-${DESTTREE%/}/bin} + echo "${scriptroot%/}/${file}" >> "${eselect_dir}/versioned" + } + python_inst() { if use static-analyzer ; then pushd tools/scan-view >/dev/null || die - python_doscript scan-view + python_doscript_versioned scan-view touch __init__.py || die python_moduleinto clang @@ -163,31 +253,68 @@ src_install() { popd >/dev/null || die fi + use static-analyzer || use python && \ + make_versioned "$(python_get_sitedir)/clang" + # AddressSanitizer symbolizer (currently separate) - python_doscript "${S}"/projects/compiler-rt/lib/asan/scripts/asan_symbolize.py + python_doscript_versioned "${S}"/projects/compiler-rt/lib/asan/scripts/asan_symbolize.py } python_foreach_impl python_inst + install_symlinks() { + local dir=${ED%/}/${1#/} + local category=$(basename "${dir}") + local symlink_dir=${ED%/}/usr/$(get_libdir)/llvm-${SLOT}/${category} + mkdir ${symlink_dir} + + local output + for output in $(grep $1 ${eselect_dir}/versioned) ; do + ln -s $(with_slot_suffix ${output}) ${symlink_dir%/}/$(basename ${output}) + done + } + + # Expose clang binaries and includes to llvm-config + install_symlinks /usr/bin/ + install_symlinks /usr/include/ + # Fix install_names on Darwin. The build system is too complicated # to just fix this, so we correct it post-install if [[ ${CHOST} == *-darwin* ]] ; then for lib in libclang.dylib ; do ebegin "fixing install_name of $lib" - install_name_tool -id "${EPREFIX}"/usr/lib/llvm/${lib} \ - "${ED}"/usr/lib/llvm/${lib} + install_name_tool -id "${EPREFIX}"/usr/lib/llvm-${SLOT}/${lib} \ + "${ED}"/usr/lib/llvm-${SLOT}/${lib} eend $? done - for f in usr/bin/{c-index-test,clang} usr/lib/llvm/libclang.dylib ; do + for f in usr/bin/{c-index-test,clang} usr/lib/llvm-${SLOT}/libclang.dylib ; do ebegin "fixing references in ${f##*/}" install_name_tool \ -change "@rpath/libclang.dylib" \ - "${EPREFIX}"/usr/lib/llvm/libclang.dylib \ + "${EPREFIX}"/usr/lib/llvm-${SLOT}/libclang.dylib \ -change "@executable_path/../lib/libLLVM-${PV}.dylib" \ - "${EPREFIX}"/usr/lib/llvm/libLLVM-${PV}.dylib \ + "${EPREFIX}"/usr/lib/llvm-${SLOT}/libLLVM-${PV}.dylib \ -change "${S}"/Release/lib/libclang.dylib \ - "${EPREFIX}"/usr/lib/llvm/libclang.dylib \ + "${EPREFIX}"/usr/lib/llvm-${SLOT}/libclang.dylib \ "${ED}"/$f eend $? done fi } + +pkg_postinst() { + if [[ $(eselect ${PN} show) = "(none)" ]] ; then + eselect ${PN} set ${SLOT} + fi +} + +pkg_prerm() { + if [[ $(eselect ${PN} show) = ${SLOT} ]] ; then + eselect ${PN} clear + fi +} + +pkg_postrm() { + if [[ -z ${REPLACED_BY_VERSION} ]] ; then + eselect ${PN} update + fi +} diff --git a/sys-devel/llvm/Manifest b/sys-devel/llvm/Manifest index 5536c99..122994b 100644 --- a/sys-devel/llvm/Manifest +++ b/sys-devel/llvm/Manifest @@ -1,6 +1,3 @@ ------BEGIN PGP SIGNED MESSAGE----- -Hash: SHA256 - AUX cl-patches/0001-r600-Add-some-intrinsic-definitions.patch 2450 SHA256 b0a718800c8969e174f3a22e61c15a370376f477e031fe97fff6aaab152f9867 SHA512 d23f9645d3e3364b1e9ce522eb15022fd3f2a685741db88b117b409ee33a07344a8e9ba9d89dc3535e5289edf79c6beb7ff144659f4e725b1a8f2c4256f9aad0 WHIRLPOOL c549806dbe5309dc441b65c942de488c6afc8c511d060d5c1459a4f99b97a357acbec51ce51bd704e5e1e74437cd413755f15377ad6b96c235242bc370af096f AUX cl-patches/0002-r600-Add-get_global_size-and-get_local_size-intrinsi.patch 1189 SHA256 172bbb3cb1214e61ee2684c133317bb997e94a34c91dae94d4848cbd0c216436 SHA512 cf711149c421b4258bc64b81018d0a9474d8b4e4128d0cc0cea788b54c93e9512397b2310db8a1834c3507b4d893d5743dbc53183ac0daca23da55601b976c16 WHIRLPOOL 8e6bd9f005a6a941c55d7c8d9b127826191944fab9e404f8ed958efd07017f5f9301273739f869a73f15fc2a79af9dc18687ff85403acf24e175a464838b3f2e AUX llvm-2.6-commandguide-nops.patch 975 SHA256 0e36fb43e020fa380230a8c6f2a79b9a19e12e857e833ef856e2b41aaa283649 SHA512 6842285e499b86581ca12fd94f5335e0dcd7afcaf0cdc5042ee8d84d0da6aba6659652eb639027bcad7caf77b0c994ac7e181a15bc609c4b3882e0f391c8cd33 WHIRLPOOL bf1212a8fd06214dba0916a73266842558bed740220d68e3447701ffeba1b3020ca4b4ab5c6d57772a60a6e09f153232f680b1e0b11cbd5d430bd9ef693d2926 @@ -28,19 +25,12 @@ DIST llvm-3.2-manpages.tar.bz2 25962 SHA256 159eaaaf59a2cee66f6aa0bbc93ca4c9fa37 DIST llvm-3.2.src.tar.gz 12275252 SHA256 125090c4d26740f1d5e9838477c931ed7d9ad70d599ba265f46f3a42cb066343 SHA512 cc66171322dbbe40bcac0e0ea5b09df8ff52df63ded304f841f32f702270d6ab1512216413ee52498c3ebee8cd39c4cd23e3855d591944bc2ac0ae76f5be62cc WHIRLPOOL c3a39b2426293d0251b7769607ade873bb6bf8d54e7c8055773a9b75742bc8e39049fb71409a258c6f3d98775b78c280d4bfe4223ba91e5ed6ecae0eddf910e5 DIST llvm-3.3-manpages.tar.bz2 27098 SHA256 46bb22d63d5fe7dd04e1a7bb7e16c03d93f2ed51d31540cfb9d97ed70059aa77 SHA512 6f24b66b13025d0606908f91ad9b4fc6de1b4aac2d97d261f6b989065476cf153d2f84792f8dd4972b95fb1a45a3931c328df3bcf8ce5ab21170a7a912a39783 WHIRLPOOL 31b9c3635b698f404b75b87c7891b4b6be9cbeb6062bcb6fba5476b0b3069a486ba60c27ab2b12b8a2da9404f666617162041860f023951050a9fc4c7d27748a DIST llvm-3.3.src.tar.gz 13602421 SHA256 68766b1e70d05a25e2f502e997a3cb3937187a3296595cf6e0977d5cd6727578 SHA512 1b7f7c5e907a68f642dcbe48fdff9585cb1504022bc9d386f310ebe5d25103d0d5f7cf0abf19e0e3fd666970160a98c90033754e2b79b2fac0cf866c984f8038 WHIRLPOOL a89c0b470fde562a3402e7878b91bc0573d433ca0a60e62c9c46946d7948a4fb657b116b6bac032555e29c70d82c751876adb398fe240f5c8d0a9a2378ce1866 -EBUILD llvm-2.8-r2.ebuild 6305 SHA256 0d3960a19619eaa4c532ec703afda259851e40649ddec4133148459bc7e667a2 SHA512 d397e3a098bcbf9ec91bcb0520d73fc188a00c68ef2392f66bdfa5ee7902f0e3d76bf2263c499f336489eb91391fd5f52ca1918e9e6e27a009c8d87c4058db70 WHIRLPOOL d8049c39b65046a93e10016c7b12cd49246228e032258e78726f74a4471873fba7dabf57db02d7d4a99539465cad653d02efeae54dd3aaeac4bf3a03a6a5a99b -EBUILD llvm-2.9-r2.ebuild 6380 SHA256 e95d4d6c0fefb602a04197b10d31fff3c4ef997ff7351deeb2b170033d4048a9 SHA512 afffc1450d8c6b45f88180187e13894aceb1cb8d62ba5ee3467d7d891e34259a29173db6596c43ad9f082430d75e5ce89612ef9de6c48716a410b69d05d62ea3 WHIRLPOOL 4659745840411d9787087d38368181054acab9ef5bd7359c56e96269ab8d169783ccb65b1a5948a9a2d35c401c91f46d61d3717730ce71d67bba6832286bc990 -EBUILD llvm-3.0-r2.ebuild 5767 SHA256 62fca1169c63516f29102a3a1bb4ea74408dfd151d97a9edbfb165a2def317c3 SHA512 f7ee2bbf8b31d86c11ab07f530278e3240ec21f3c58144a9e627aef3c1fb7690935786f33368a6f56062b5daf501adebfc164fd6712985a91076897b89cdd85f WHIRLPOOL be1a6edd697e2504df033705c2cb8e37f6c17a13d77558d231172c00f91ec247785469b6e1265e25c42eb3f6f394614cf516e0e422cb54094d9ba25669c8406c -EBUILD llvm-3.1-r2.ebuild 6033 SHA256 9b9a587d30419fa646764a96e12fc6272f73f7246138c76ba577f0d6ab3afe59 SHA512 8b969084210af4203c029bb33d5b984e0b17f6770fd489dad818154ac9f6a87bfad069eff71776f678d9eb5d5136af472d3008d5bc73fab9dc1f36811af906c4 WHIRLPOOL 928459551d7cf6e8d18244026ba82cc3dbaf2b65bd6eac8adb617695c95535ba65bd013909730d5922de5764e9d6c6c4cf007aa6acd0b493826aa938d0389a5d -EBUILD llvm-3.2.ebuild 6534 SHA256 5532d849a32e9f7a02f6bf6d16b01cc734132fdc9a192c46ec0e25cd8b3da7cf SHA512 bc8d3a7726a7cefc1de40e3e1be0bc06d89bdad9b3462e6ad1ef96f6d850fef3e708ebef3af20fc05a66b55f2837601ccff15b528bc088c8ceb715ed12212b25 WHIRLPOOL 5105558b2422e1d01d5aab4a52a8b434f357d481156d3885375987e9b34b001b427403407349ea82511a4230dcdfad60b08a30a20b6dc5ce4839ceb035e1163a -EBUILD llvm-3.3.ebuild 6741 SHA256 e1f89537832dfd507c15880aee4e50ff5ac9163b2e0318783efd9470f83cab5e SHA512 bdf380643739a73fccae18abda3268912d8639b1dcf06f2c62e2832026ef82183fc736e7bdeb6582934b852ab70def1ce1b649d0128b9a680fd971db822b53fa WHIRLPOOL aad005b5d0c5f117b23cb9e365f967f928c09a75c58992dbd04b6545e9ce9020f2187fbc3071b2acf85f8e5a4092ef0fd75a34008228ca4d7441b638b4ce0cb4 -EBUILD llvm-9999.ebuild 6403 SHA256 0bf8cf6152efca605f4dae6d2ff8dd50741a4b982df3a6a5dd983eb2084aea81 SHA512 522af6dc0e657f7a3b7b53662c540a1618e229f30f47169542675a26bea9024da234eb6b265d93cd68bc3ecb95b5c2d16997d83faf8a55d2514a99a62ab021c9 WHIRLPOOL 0b59232b99db28eb39e5bfcf00447dcc8213247691ed7942648c3bbfd1ca091c98d8f9c1b5b06dd04aefcd6612fe03c38d30fc1df2c5d84ab85c0afa0554da8f +EBUILD llvm-2.8-r2.ebuild 9228 SHA256 ecabc9ef925b615556acb694273746ee469970f3853e9bdaa0e921bf0c5853e6 SHA512 efbbcc826a14158294b153863de41fc5912269ab97b0a81e0c2e2435eefda809de4eed698f86fce12e1e5921ae59fb1daa738303ad361119a7767735730b5911 WHIRLPOOL 73ef71136d55c85b63d97d9761f94134bce0a75f37bb1e419d83f024fb77b6d4da6e45458336b2e9f7ec312380fc77da4ef99694a0efb06275c7fb5e4a2aa4a3 +EBUILD llvm-2.9-r2.ebuild 9302 SHA256 e6de4c80de6386c32ec6caa03792fa5521d2372ab173c3e9d2c0f24a01b9dad0 SHA512 9ef2511ecb1c41b1ab7e630b202ad08bc64308c33d5798aab1648cd2aad63fd656bc568fdc3502352b9c5d7205440d454466f5804f7935072ef0c16a96a44802 WHIRLPOOL 4c282c0001d0196cb7661f9b003a37614436b7f97a73a0ddf68d0a28bb614a37ebf26aa9f243355a2b5604b38e9c4c2e034c371c8bec1b974045afce10a56f82 +EBUILD llvm-3.0-r2.ebuild 8689 SHA256 c0122b0f2edf3cb96b5c20534348dc54abf19b8a0d0370c31d8c106a833b9af2 SHA512 f94bed3775258f673b66992042756860a87ae3334ba1595ce0c7c6139e5bcc349f13fa7e45caa69ff01cac0606b9315698a3ba5e46c164f9917a14ae6221e285 WHIRLPOOL 1a8674181b9c38511bd43ee548d35da51d1dcf6dc1232841f3ba347b1f54f8af69eb62b301d32dc9704b47cfc3a2538f439cebf576e8f975e102a21f1b2da8b0 +EBUILD llvm-3.1-r2.ebuild 8955 SHA256 813232f15b94567a56e749049bbf60a1f7f560c3b786400f906554f08306c24d SHA512 4419bc4ab9ffc037320ecaa02dfa02bf5bda59fcb576d9754477c165df571fa75717178fe9fcf11c384266b61b4c6ad363480e2898cf5ccbec881e42fc037b10 WHIRLPOOL 5184f98d43705d6f887910fe6c02be0b08c5da347533be1799535fbeb829ab21cb0619fb829b8ee9ec70a7512933cc6eb87d2df1a2b5fb323808289f2a22fa08 +EBUILD llvm-3.2.ebuild 9456 SHA256 5cb88d0b2795bdb0b5e464af23df0163645dffc363a215f8ad6be3fb894336e0 SHA512 053b61913bd77f4e0971b69e4be0d405ea1a8c2a35a3cb40378af866fd914e8abba07e808c53f6ca7a79b99bb4826f0031c23f834f1d9a5bd023984dee5a749e WHIRLPOOL b8e4bb98a7718ab18946c97331c1410b49f7c47d40c80c97e3659cc6a82465a884d0eaba1af5c1802cdc23e4d7ccc16007e07d2939edd370ced823aa01a51c0d +EBUILD llvm-3.3.ebuild 9669 SHA256 810f123e8fad603bec9a19f25e11a6659435800384db88a567e9734406764039 SHA512 a05bde9bb9bc81549fbd89524f8e212c7a87ee2b45011914325b7acf2b9d019ead986e582bb9230f95c3f72ae2f273c750e81cc74698ec107f9e4e36b8f9375d WHIRLPOOL 83fdb0e5e445390d08bd7109b81c63f6f24cae2218c3c78427f3d4daf232750fcb700018b15bd2d6df052b131bf460f717dad10c4af69ddb15719539fed82019 +EBUILD llvm-9999.ebuild 9577 SHA256 7bc11548d4b0f0552088251564fdd2b64e5031031259b78c3c5ca8be545f62e9 SHA512 8b1062134fd38d83fd468aba4fce5c75f6de100e9718ae15344cb4add5aab71113e534955fb4ff162b4d58ba8c11003cd1d98ad1ee15284470dadce54b244d3a WHIRLPOOL a9ad78c27e985fa02b3a92ba3b940ab7f7848f649c2606ae08a111f2101fb4ee4d9e76a1b95c3176db39844d48754f55cbdcd01b97d209577742894088262c48 MISC ChangeLog 19126 SHA256 f01fe4c4183b4a91b567341cc4258232c6555d6a7924e9194d7f46a77e475357 SHA512 d0cea5de1193aeec32b80f708e16da9c0aece78710e8042692af69c7e42bfcc6fa3dffe59578e11665edce8d2c2ed2499732037ac2a5fe31b43650954602f118 WHIRLPOOL e0dc717dc73ad79d9916bede92453d5ebe2d1c5c2dd916e5dca4b733c0fab96a6cd35837d97c43902ec11e46dcdc79e6d6874f9da0b99587ca24ce6ea6b77350 MISC metadata.xml 2480 SHA256 7900bb9405502b6fca3ddf84e4927a9353d2f70fa7be4a32b674cad604e01c24 SHA512 42093ff40389c310ca3e316d8ea63d751e530f7af4efa7820f14a8979d337dcedaa61ef35f2e8dc226d7c55177c70e0bb8512e434e8d4b1c050aefd2914dcb02 WHIRLPOOL 695127371c9fa28f1b44517d8b6b123e1479048578adb84673f41b1a1fa5bdb7a3d424635ace6f08ad41eda1207a6d46ebe03f4b1be604adf2947af155bef3bd ------BEGIN PGP SIGNATURE----- -Version: GnuPG v2.0.20 (GNU/Linux) - -iF4EAREIAAYFAlHIWvwACgkQFYEBGcdFJfKPLQD+PHVy9ihOiQVMkb3Bm/rTSHd3 -F6FKFDhirt2F8pI2+XAA/138gT1ivIFEZjAZ+f+r3falIPxi9MlpY9S/Vr7lobhB -=qwQx ------END PGP SIGNATURE----- diff --git a/sys-devel/llvm/llvm-2.8-r2.ebuild b/sys-devel/llvm/llvm-2.8-r2.ebuild index c902036..3b2bf25 100644 --- a/sys-devel/llvm/llvm-2.8-r2.ebuild +++ b/sys-devel/llvm/llvm-2.8-r2.ebuild @@ -12,7 +12,7 @@ HOMEPAGE="http://llvm.org/" SRC_URI="http://llvm.org/releases/${PV}/${P}.tgz -> ${P}-r1.tgz" LICENSE="UoI-NCSA" -SLOT="0" +SLOT="${PV}" KEYWORDS="amd64 ppc x86 ~amd64-linux ~x86-linux ~ppc-macos" IUSE="debug +libffi llvm-gcc multitarget ocaml test udis86" @@ -25,7 +25,9 @@ DEPEND="dev-lang/perl libffi? ( virtual/libffi ) ocaml? ( dev-lang/ocaml ) udis86? ( dev-libs/udis86[pic(+)] )" -RDEPEND="dev-lang/perl" +RDEPEND="dev-lang/perl + app-admin/eselect-llvm" + S=${WORKDIR}/${PN}-${PV/_pre*} @@ -71,11 +73,16 @@ src_prepare() { -e 's,^PROJ_etcdir.*,PROJ_etcdir := '"${EPREFIX}"'/etc/llvm,' \ -e 's,^PROJ_libdir.*,PROJ_libdir := $(PROJ_prefix)/'$(get_libdir)/${PN}, \ -i Makefile.config.in || die "Makefile.config sed failed" - sed -e 's,$ABS_RUN_DIR/lib,'"${EPREFIX}"/usr/$(get_libdir)/${PN}, \ + sed -e 's,$ABS_RUN_DIR/lib,'"${EPREFIX}"/usr/$(get_libdir)/${PN}-${SLOT}, \ + -e 's,$ABS_RUN_DIR/bin,'"${EPREFIX}"/usr/$(get_libdir)/${PN}-${SLOT}/bin, \ + -e 's,$ABS_RUN_DIR/include,'"${EPREFIX}"/usr/$(get_libdir)/${PN}-${SLOT}/include, \ -i tools/llvm-config/llvm-config.in.in || die "llvm-config sed failed" + sed -e "/SUB_LDFLAGS :=/s@:=@:= \$(RPATH) -Wl,\'${EPREFIX}/usr/$(get_libdir)/${PN}-${SLOT}\'@" \ + -e "s:'s/@LLVM_LDFLAGS@/\$(subst /,\\\\/,\$(SUB_LDFLAGS))/':\"s?@LLVM_LDFLAGS@?\$(SUB_LDFLAGS)?\":" \ + -i tools/llvm-config/Makefile || die "llvm-config LDFLAGS sed failed" einfo "Fixing rpath and CFLAGS" - sed -e 's,\$(RPATH) -Wl\,\$(\(ToolDir\|LibDir\)),$(RPATH) -Wl\,'"${EPREFIX}"/usr/$(get_libdir)/${PN}, \ + sed -e "s@\$(RPATH) -Wl,\$(\(ToolDir\|LibDir\))@\$(RPATH) -Wl,'${EPREFIX}/usr/$(get_libdir)/${PN}-${SLOT}'@" \ -e '/OmitFramePointer/s/-fomit-frame-pointer//' \ -i Makefile.rules || die "rpath sed failed" @@ -163,27 +170,125 @@ src_compile() { src_install() { emake KEEP_SYMBOLS=1 DESTDIR="${D}" install || die "install failed" + # Register slot for app-admin/eselect-llvm + local eselect_dir="/usr/share/eselect-llvm/slots/${SLOT}" + dodir "${eselect_dir}" + eselect_dir="${ED}/${eselect_dir}" + echo "${CATEGORY}/${PF}" > "${eselect_dir}/ebuild" + + with_slot_suffix() { + local file=$(echo "$1" | sed -e "s/-${SLOT}//") + local ext="" + if [[ "${file}" =~ \. ]] ; then + ext=".${file#*.}" + fi + local base="${file%%.*}" + echo "${base}-${SLOT}${ext}" + } + + make_versioned() { + local dir=$1 + local candidates=(${ED%/}/${dir#/}) + if [[ ! ${dir##*/} ]] ; then + dir=${dir%/} + candidates=( "${candidates}"* ) + else + dir=$(dirname "${dir}") + fi + + pushd ${ED%/}/${dir#/} >/dev/null || die + + local candidate + for candidate in "${candidates[@]}" ; do + if [[ -h "${candidate}" ]] ; then + # Add slot suffix to symlink target + local target=$(readlink -s "${candidate}") + local slotted_target=$(with_slot_suffix "${target}") + if [[ -e "${target}" ]] || [[ -e "${slotted_target}" ]] ; then + ln -sf "${slotted_target}" "${candidate}" \ + || die "Could not update symlink" + fi + fi + + local base_name=$(basename "${candidate}") + local slotted_name=$(with_slot_suffix "${base_name}") + mv "${candidate}" "${ED}/${dir#/}/${slotted_name}" \ + || die "Could not rename ${candidate} to ${slotted_name}" + echo "/${dir#/}/${base_name}" >> "${eselect_dir}/versioned" + done + + popd >/dev/null || die + } + + # Trailing slash => version the content + # No trailing slash => version the directory itself + local paths=( + /usr/bin/ + /usr/$(get_libdir)/ + /usr/include/ + /usr/share/man/man1/ + ) + use vim-syntax && paths+=( /usr/share/vim/vimfiles/syntax/ ) + + local path + for path in "${paths[@]}" ; do + make_versioned "${path}" + done + + install_symlinks() { + local dir=${ED%/}/${1#/} + local category=$(basename "${dir}") + local symlink_dir=${ED%/}/usr/$(get_libdir)/${P}/${category} + mkdir ${symlink_dir} + + local output + for output in $(grep $1 ${eselect_dir}/versioned) ; do + ln -s $(with_slot_suffix ${output}) ${symlink_dir%/}/$(basename ${output}) + done + } + + install_symlinks /usr/bin/ + install_symlinks /usr/include/ + # Fix install_names on Darwin. The build system is too complicated # to just fix this, so we correct it post-install local lib= f= odylib= if [[ ${CHOST} == *-darwin* ]] ; then for lib in lib{EnhancedDisassembly,LLVM-${PV},BugpointPasses,LLVMHello,LTO,profile_rt}.dylib ; do # libEnhancedDisassembly is Darwin10 only, so non-fatal - [[ -f ${ED}/usr/lib/${PN}/${lib} ]] || continue + [[ -f ${ED}/usr/lib/${PN}-${SLOT}/${lib} ]] || continue ebegin "fixing install_name of $lib" install_name_tool \ - -id "${EPREFIX}"/usr/lib/${PN}/${lib} \ - "${ED}"/usr/lib/${PN}/${lib} + -id "${EPREFIX}"/usr/lib/${PN}-${SLOT}/${lib} \ + "${ED}"/usr/lib/${PN}-${SLOT}/${lib} eend $? done - for f in "${ED}"/usr/bin/* "${ED}"/usr/lib/${PN}/libLTO.dylib ; do + for f in "${ED}"/usr/bin/* "${ED}"/usr/lib/${PN}-${SLOT}/libLTO.dylib ; do odylib=$(scanmacho -BF'%n#f' "${f}" | tr ',' '\n' | grep libLLVM-${PV}.dylib) ebegin "fixing install_name reference to ${odylib} of ${f##*/}" install_name_tool \ -change "${odylib}" \ - "${EPREFIX}"/usr/lib/${PN}/libLLVM-${PV}.dylib \ + "${EPREFIX}"/usr/lib/${PN}-${SLOT}/libLLVM-${PV}.dylib \ "${f}" eend $? done fi } + +pkg_postinst() { + if [[ $(eselect ${PN} show) = "(none)" ]] ; then + eselect ${PN} set ${SLOT} + fi +} + +pkg_prerm() { + if [[ $(eselect ${PN} show) = ${SLOT} ]] ; then + eselect ${PN} clear + fi +} + +pkg_postrm() { + if [[ -z ${REPLACED_BY_VERSION} ]] ; then + eselect ${PN} update + fi +} diff --git a/sys-devel/llvm/llvm-2.9-r2.ebuild b/sys-devel/llvm/llvm-2.9-r2.ebuild index 3d85d33..e5edffb 100644 --- a/sys-devel/llvm/llvm-2.9-r2.ebuild +++ b/sys-devel/llvm/llvm-2.9-r2.ebuild @@ -10,7 +10,7 @@ HOMEPAGE="http://llvm.org/" SRC_URI="http://llvm.org/releases/${PV}/${P}.tgz" LICENSE="UoI-NCSA" -SLOT="0" +SLOT="${PV}" KEYWORDS="amd64 ~ppc x86 ~x86-fbsd ~amd64-linux ~x86-linux ~ppc-macos" IUSE="debug +libffi llvm-gcc multitarget ocaml test udis86 vim-syntax" @@ -25,6 +25,7 @@ DEPEND="dev-lang/perl ocaml? ( dev-lang/ocaml ) udis86? ( dev-libs/udis86[pic(+)] )" RDEPEND="dev-lang/perl + app-admin/eselect-llvm libffi? ( virtual/libffi ) vim-syntax? ( || ( app-editors/vim app-editors/gvim ) )" @@ -72,11 +73,16 @@ src_prepare() { -e 's,^PROJ_etcdir.*,PROJ_etcdir := '"${EPREFIX}"'/etc/llvm,' \ -e 's,^PROJ_libdir.*,PROJ_libdir := $(PROJ_prefix)/'$(get_libdir)/${PN}, \ -i Makefile.config.in || die "Makefile.config sed failed" - sed -e 's,$ABS_RUN_DIR/lib,'"${EPREFIX}"/usr/$(get_libdir)/${PN}, \ + sed -e 's,$ABS_RUN_DIR/lib,'"${EPREFIX}"/usr/$(get_libdir)/${PN}-${SLOT}, \ + -e 's,$ABS_RUN_DIR/bin,'"${EPREFIX}"/usr/$(get_libdir)/${PN}-${SLOT}/bin, \ + -e 's,$ABS_RUN_DIR/include,'"${EPREFIX}"/usr/$(get_libdir)/${PN}-${SLOT}/include, \ -i tools/llvm-config/llvm-config.in.in || die "llvm-config sed failed" + sed -e "/SUB_LDFLAGS :=/s@:=@:= \$(RPATH) -Wl,\'${EPREFIX}/usr/$(get_libdir)/${PN}-${SLOT}\'@" \ + -e "s:'s/@LLVM_LDFLAGS@/\$(subst /,\\\\/,\$(SUB_LDFLAGS))/':\"s?@LLVM_LDFLAGS@?\$(SUB_LDFLAGS)?\":" \ + -i tools/llvm-config/Makefile || die "llvm-config LDFLAGS sed failed" einfo "Fixing rpath and CFLAGS" - sed -e 's,\$(RPATH) -Wl\,\$(\(ToolDir\|LibDir\)),$(RPATH) -Wl\,'"${EPREFIX}"/usr/$(get_libdir)/${PN}, \ + sed -e "s@\$(RPATH) -Wl,\$(\(ToolDir\|LibDir\))@\$(RPATH) -Wl,'${EPREFIX}/usr/$(get_libdir)/${PN}-${SLOT}'@" \ -e '/OmitFramePointer/s/-fomit-frame-pointer//' \ -i Makefile.rules || die "rpath sed failed" @@ -170,27 +176,125 @@ src_install() { doins utils/vim/*.vim fi + # Register slot for app-admin/eselect-llvm + local eselect_dir="/usr/share/eselect-llvm/slots/${SLOT}" + dodir "${eselect_dir}" + eselect_dir="${ED}/${eselect_dir}" + echo "${CATEGORY}/${PF}" > "${eselect_dir}/ebuild" + + with_slot_suffix() { + local file=$(echo "$1" | sed -e "s/-${SLOT}//") + local ext="" + if [[ "${file}" =~ \. ]] ; then + ext=".${file#*.}" + fi + local base="${file%%.*}" + echo "${base}-${SLOT}${ext}" + } + + make_versioned() { + local dir=$1 + local candidates=(${ED%/}/${dir#/}) + if [[ ! ${dir##*/} ]] ; then + dir=${dir%/} + candidates=( "${candidates}"* ) + else + dir=$(dirname "${dir}") + fi + + pushd ${ED%/}/${dir#/} >/dev/null || die + + local candidate + for candidate in "${candidates[@]}" ; do + if [[ -h "${candidate}" ]] ; then + # Add slot suffix to symlink target + local target=$(readlink -s "${candidate}") + local slotted_target=$(with_slot_suffix "${target}") + if [[ -e "${target}" ]] || [[ -e "${slotted_target}" ]] ; then + ln -sf "${slotted_target}" "${candidate}" \ + || die "Could not update symlink" + fi + fi + + local base_name=$(basename "${candidate}") + local slotted_name=$(with_slot_suffix "${base_name}") + mv "${candidate}" "${ED}/${dir#/}/${slotted_name}" \ + || die "Could not rename ${candidate} to ${slotted_name}" + echo "/${dir#/}/${base_name}" >> "${eselect_dir}/versioned" + done + + popd >/dev/null || die + } + + # Trailing slash => version the content + # No trailing slash => version the directory itself + local paths=( + /usr/bin/ + /usr/$(get_libdir)/ + /usr/include/ + /usr/share/man/man1/ + ) + use vim-syntax && paths+=( /usr/share/vim/vimfiles/syntax/ ) + + local path + for path in "${paths[@]}" ; do + make_versioned "${path}" + done + + install_symlinks() { + local dir=${ED%/}/${1#/} + local category=$(basename "${dir}") + local symlink_dir=${ED%/}/usr/$(get_libdir)/${P}/${category} + mkdir ${symlink_dir} + + local output + for output in $(grep $1 ${eselect_dir}/versioned) ; do + ln -s $(with_slot_suffix ${output}) ${symlink_dir%/}/$(basename ${output}) + done + } + + install_symlinks /usr/bin/ + install_symlinks /usr/include/ + # Fix install_names on Darwin. The build system is too complicated # to just fix this, so we correct it post-install local lib= f= odylib= if [[ ${CHOST} == *-darwin* ]] ; then for lib in lib{EnhancedDisassembly,LLVM-${PV},LTO}.dylib {BugpointPasses,LLVMHello,profile_rt}.dylib ; do # libEnhancedDisassembly is Darwin10 only, so non-fatal - [[ -f ${ED}/usr/lib/${PN}/${lib} ]] || continue + [[ -f ${ED}/usr/lib/${PN}-${SLOT}/${lib} ]] || continue ebegin "fixing install_name of $lib" install_name_tool \ - -id "${EPREFIX}"/usr/lib/${PN}/${lib} \ - "${ED}"/usr/lib/${PN}/${lib} + -id "${EPREFIX}"/usr/lib/${PN}-${SLOT}/${lib} \ + "${ED}"/usr/lib/${PN}-${SLOT}/${lib} eend $? done - for f in "${ED}"/usr/bin/* "${ED}"/usr/lib/${PN}/libLTO.dylib ; do + for f in "${ED}"/usr/bin/* "${ED}"/usr/lib/${PN}-${SLOT}/libLTO.dylib ; do odylib=$(scanmacho -BF'%n#f' "${f}" | tr ',' '\n' | grep libLLVM-${PV}.dylib) ebegin "fixing install_name reference to ${odylib} of ${f##*/}" install_name_tool \ -change "${odylib}" \ - "${EPREFIX}"/usr/lib/${PN}/libLLVM-${PV}.dylib \ + "${EPREFIX}"/usr/lib/${PN}-${SLOT}/libLLVM-${PV}.dylib \ "${f}" eend $? done fi } + +pkg_postinst() { + if [[ $(eselect ${PN} show) = "(none)" ]] ; then + eselect ${PN} set ${SLOT} + fi +} + +pkg_prerm() { + if [[ $(eselect ${PN} show) = ${SLOT} ]] ; then + eselect ${PN} clear + fi +} + +pkg_postrm() { + if [[ -z ${REPLACED_BY_VERSION} ]] ; then + eselect ${PN} update + fi +} diff --git a/sys-devel/llvm/llvm-3.0-r2.ebuild b/sys-devel/llvm/llvm-3.0-r2.ebuild index c11cae8..8090969 100644 --- a/sys-devel/llvm/llvm-3.0-r2.ebuild +++ b/sys-devel/llvm/llvm-3.0-r2.ebuild @@ -11,7 +11,7 @@ HOMEPAGE="http://llvm.org/" SRC_URI="http://llvm.org/releases/${PV}/${P}.tar.gz" LICENSE="UoI-NCSA" -SLOT="0" +SLOT="${PV}" KEYWORDS="amd64 ~ppc x86 ~x86-fbsd ~amd64-linux ~x86-linux ~ppc-macos" IUSE="debug gold +libffi multitarget ocaml test udis86 vim-syntax" @@ -27,6 +27,7 @@ DEPEND="dev-lang/perl ocaml? ( dev-lang/ocaml ) udis86? ( dev-libs/udis86[pic(+)] )" RDEPEND="dev-lang/perl + app-admin/eselect-llvm libffi? ( virtual/libffi ) vim-syntax? ( || ( app-editors/vim app-editors/gvim ) )" @@ -78,11 +79,16 @@ src_prepare() { -e 's,^PROJ_etcdir.*,PROJ_etcdir := '"${EPREFIX}"'/etc/llvm,' \ -e 's,^PROJ_libdir.*,PROJ_libdir := $(PROJ_prefix)/'$(get_libdir)/${PN}, \ -i Makefile.config.in || die "Makefile.config sed failed" - sed -e 's,$ABS_RUN_DIR/lib,'"${EPREFIX}"/usr/$(get_libdir)/${PN}, \ + sed -e 's,$ABS_RUN_DIR/lib,'"${EPREFIX}"/usr/$(get_libdir)/${PN}-${SLOT}, \ + -e 's,$ABS_RUN_DIR/bin,'"${EPREFIX}"/usr/$(get_libdir)/${PN}-${SLOT}/bin, \ + -e 's,$ABS_RUN_DIR/include,'"${EPREFIX}"/usr/$(get_libdir)/${PN}-${SLOT}/include, \ -i tools/llvm-config/llvm-config.in.in || die "llvm-config sed failed" + sed -e "/SUB_LDFLAGS :=/s@:=@:= \$(RPATH) -Wl,\'${EPREFIX}/usr/$(get_libdir)/${PN}-${SLOT}\'@" \ + -e "s:'s/@LLVM_LDFLAGS@/\$(subst /,\\\\/,\$(SUB_LDFLAGS))/':\"s?@LLVM_LDFLAGS@?\$(SUB_LDFLAGS)?\":" \ + -i tools/llvm-config/Makefile || die "llvm-config LDFLAGS sed failed" einfo "Fixing rpath and CFLAGS" - sed -e 's,\$(RPATH) -Wl\,\$(\(ToolDir\|LibDir\)),$(RPATH) -Wl\,'"${EPREFIX}"/usr/$(get_libdir)/${PN}, \ + sed -e "s@\$(RPATH) -Wl,\$(\(ToolDir\|LibDir\))@\$(RPATH) -Wl,'${EPREFIX}/usr/$(get_libdir)/${PN}-${SLOT}'@" \ -e '/OmitFramePointer/s/-fomit-frame-pointer//' \ -i Makefile.rules || die "rpath sed failed" @@ -155,27 +161,125 @@ src_install() { doins utils/vim/*.vim fi + # Register slot for app-admin/eselect-llvm + local eselect_dir="/usr/share/eselect-llvm/slots/${SLOT}" + dodir "${eselect_dir}" + eselect_dir="${ED}/${eselect_dir}" + echo "${CATEGORY}/${PF}" > "${eselect_dir}/ebuild" + + with_slot_suffix() { + local file=$(echo "$1" | sed -e "s/-${SLOT}//") + local ext="" + if [[ "${file}" =~ \. ]] ; then + ext=".${file#*.}" + fi + local base="${file%%.*}" + echo "${base}-${SLOT}${ext}" + } + + make_versioned() { + local dir=$1 + local candidates=(${ED%/}/${dir#/}) + if [[ ! ${dir##*/} ]] ; then + dir=${dir%/} + candidates=( "${candidates}"* ) + else + dir=$(dirname "${dir}") + fi + + pushd ${ED%/}/${dir#/} >/dev/null || die + + local candidate + for candidate in "${candidates[@]}" ; do + if [[ -h "${candidate}" ]] ; then + # Add slot suffix to symlink target + local target=$(readlink -s "${candidate}") + local slotted_target=$(with_slot_suffix "${target}") + if [[ -e "${target}" ]] || [[ -e "${slotted_target}" ]] ; then + ln -sf "${slotted_target}" "${candidate}" \ + || die "Could not update symlink" + fi + fi + + local base_name=$(basename "${candidate}") + local slotted_name=$(with_slot_suffix "${base_name}") + mv "${candidate}" "${ED}/${dir#/}/${slotted_name}" \ + || die "Could not rename ${candidate} to ${slotted_name}" + echo "/${dir#/}/${base_name}" >> "${eselect_dir}/versioned" + done + + popd >/dev/null || die + } + + # Trailing slash => version the content + # No trailing slash => version the directory itself + local paths=( + /usr/bin/ + /usr/$(get_libdir)/ + /usr/include/ + /usr/share/man/man1/ + ) + use vim-syntax && paths+=( /usr/share/vim/vimfiles/syntax/ ) + + local path + for path in "${paths[@]}" ; do + make_versioned "${path}" + done + + install_symlinks() { + local dir=${ED%/}/${1#/} + local category=$(basename "${dir}") + local symlink_dir=${ED%/}/usr/$(get_libdir)/${P}/${category} + mkdir ${symlink_dir} + + local output + for output in $(grep $1 ${eselect_dir}/versioned) ; do + ln -s $(with_slot_suffix ${output}) ${symlink_dir%/}/$(basename ${output}) + done + } + + install_symlinks /usr/bin/ + install_symlinks /usr/include/ + # Fix install_names on Darwin. The build system is too complicated # to just fix this, so we correct it post-install local lib= f= odylib= if [[ ${CHOST} == *-darwin* ]] ; then for lib in lib{EnhancedDisassembly,LLVM-${PV},LTO,profile_rt}.dylib {BugpointPasses,LLVMHello}.dylib ; do # libEnhancedDisassembly is Darwin10 only, so non-fatal - [[ -f ${ED}/usr/lib/${PN}/${lib} ]] || continue + [[ -f ${ED}/usr/lib/${PN}-${SLOT}/${lib} ]] || continue ebegin "fixing install_name of $lib" install_name_tool \ - -id "${EPREFIX}"/usr/lib/${PN}/${lib} \ - "${ED}"/usr/lib/${PN}/${lib} + -id "${EPREFIX}"/usr/lib/${PN}-${SLOT}/${lib} \ + "${ED}"/usr/lib/${PN}-${SLOT}/${lib} eend $? done - for f in "${ED}"/usr/bin/* "${ED}"/usr/lib/${PN}/libLTO.dylib ; do + for f in "${ED}"/usr/bin/* "${ED}"/usr/lib/${PN}-${SLOT}/libLTO.dylib ; do odylib=$(scanmacho -BF'%n#f' "${f}" | tr ',' '\n' | grep libLLVM-${PV}.dylib) ebegin "fixing install_name reference to ${odylib} of ${f##*/}" install_name_tool \ -change "${odylib}" \ - "${EPREFIX}"/usr/lib/${PN}/libLLVM-${PV}.dylib \ + "${EPREFIX}"/usr/lib/${PN}-${SLOT}/libLLVM-${PV}.dylib \ "${f}" eend $? done fi } + +pkg_postinst() { + if [[ $(eselect ${PN} show) = "(none)" ]] ; then + eselect ${PN} set ${SLOT} + fi +} + +pkg_prerm() { + if [[ $(eselect ${PN} show) = ${SLOT} ]] ; then + eselect ${PN} clear + fi +} + +pkg_postrm() { + if [[ -z ${REPLACED_BY_VERSION} ]] ; then + eselect ${PN} update + fi +} diff --git a/sys-devel/llvm/llvm-3.1-r2.ebuild b/sys-devel/llvm/llvm-3.1-r2.ebuild index f70b29e..f9abba3 100644 --- a/sys-devel/llvm/llvm-3.1-r2.ebuild +++ b/sys-devel/llvm/llvm-3.1-r2.ebuild @@ -11,7 +11,7 @@ HOMEPAGE="http://llvm.org/" SRC_URI="http://llvm.org/releases/${PV}/${P}.src.tar.gz" LICENSE="UoI-NCSA" -SLOT="0" +SLOT="${PV}" KEYWORDS="amd64 arm ppc x86 ~amd64-fbsd ~x86-fbsd ~x64-freebsd ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos" IUSE="debug gold +libffi multitarget ocaml test udis86 vim-syntax" @@ -27,6 +27,7 @@ DEPEND="dev-lang/perl ocaml? ( dev-lang/ocaml ) udis86? ( dev-libs/udis86[pic(+)] )" RDEPEND="dev-lang/perl + app-admin/eselect-llvm libffi? ( virtual/libffi ) vim-syntax? ( || ( app-editors/vim app-editors/gvim ) )" @@ -78,15 +79,20 @@ src_prepare() { -e 's,^PROJ_etcdir.*,PROJ_etcdir := '"${EPREFIX}"'/etc/llvm,' \ -e 's,^PROJ_libdir.*,PROJ_libdir := $(PROJ_prefix)/'$(get_libdir)/${PN}, \ -i Makefile.config.in || die "Makefile.config sed failed" - sed -e "/ActiveLibDir = ActivePrefix/s/lib/$(get_libdir)\/${PN}/" \ - -i tools/llvm-config/llvm-config.cpp || die "llvm-config sed failed" + sed -e "/ActiveLibDir = ActivePrefix/s/lib/$(get_libdir)\/${P}/" \ + -e "/ActiveBinDir = ActivePrefix/s/bin/$(get_libdir)\/${P}\/bin/" \ + -e "/ActiveIncludeDir = ActivePrefix/s/include/$(get_libdir)\/${P}\/include/" \ + -i tools/llvm-config/llvm-config.cpp || die "llvm-config ActiveLibDir sed failed" + sed -e "/SUB_LDFLAGS :=/s@:=@:= \$(RPATH) -Wl,\'${EPREFIX}/usr/$(get_libdir)/${PN}-${SLOT}\'@" \ + -e "s:'s/@LLVM_LDFLAGS@/\$(subst /,\\\\/,\$(SUB_LDFLAGS))/':\"s?@LLVM_LDFLAGS@?\$(SUB_LDFLAGS)?\":" \ + -i tools/llvm-config/Makefile || die "llvm-config LDFLAGS sed failed" einfo "Fixing rpath and CFLAGS" - sed -e 's,\$(RPATH) -Wl\,\$(\(ToolDir\|LibDir\)),$(RPATH) -Wl\,'"${EPREFIX}"/usr/$(get_libdir)/${PN}, \ + sed -e "s@\$(RPATH) -Wl,\$(\(ToolDir\|LibDir\))@\$(RPATH) -Wl,'${EPREFIX}/usr/$(get_libdir)/${PN}-${SLOT}'@" \ -e '/OmitFramePointer/s/-fomit-frame-pointer//' \ -i Makefile.rules || die "rpath sed failed" if use gold; then - sed -e 's,\$(SharedLibDir),'"${EPREFIX}"/usr/$(get_libdir)/${PN}, \ + sed -e 's,\$(SharedLibDir),'"${EPREFIX}"/usr/$(get_libdir)/${PN}-${SLOT}, \ -i tools/gold/Makefile || die "gold rpath sed failed" fi @@ -164,27 +170,125 @@ src_install() { doins utils/vim/*.vim fi + # Register slot for app-admin/eselect-llvm + local eselect_dir="/usr/share/eselect-llvm/slots/${SLOT}" + dodir "${eselect_dir}" + eselect_dir="${ED}/${eselect_dir}" + echo "${CATEGORY}/${PF}" > "${eselect_dir}/ebuild" + + with_slot_suffix() { + local file=$(echo "$1" | sed -e "s/-${SLOT}//") + local ext="" + if [[ "${file}" =~ \. ]] ; then + ext=".${file#*.}" + fi + local base="${file%%.*}" + echo "${base}-${SLOT}${ext}" + } + + make_versioned() { + local dir=$1 + local candidates=(${ED%/}/${dir#/}) + if [[ ! ${dir##*/} ]] ; then + dir=${dir%/} + candidates=( "${candidates}"* ) + else + dir=$(dirname "${dir}") + fi + + pushd ${ED%/}/${dir#/} >/dev/null || die + + local candidate + for candidate in "${candidates[@]}" ; do + if [[ -h "${candidate}" ]] ; then + # Add slot suffix to symlink target + local target=$(readlink -s "${candidate}") + local slotted_target=$(with_slot_suffix "${target}") + if [[ -e "${target}" ]] || [[ -e "${slotted_target}" ]] ; then + ln -sf "${slotted_target}" "${candidate}" \ + || die "Could not update symlink" + fi + fi + + local base_name=$(basename "${candidate}") + local slotted_name=$(with_slot_suffix "${base_name}") + mv "${candidate}" "${ED}/${dir#/}/${slotted_name}" \ + || die "Could not rename ${candidate} to ${slotted_name}" + echo "/${dir#/}/${base_name}" >> "${eselect_dir}/versioned" + done + + popd >/dev/null || die + } + + # Trailing slash => version the content + # No trailing slash => version the directory itself + local paths=( + /usr/bin/ + /usr/$(get_libdir)/ + /usr/include/ + /usr/share/man/man1/ + ) + use vim-syntax && paths+=( /usr/share/vim/vimfiles/syntax/ ) + + local path + for path in "${paths[@]}" ; do + make_versioned "${path}" + done + + install_symlinks() { + local dir=${ED%/}/${1#/} + local category=$(basename "${dir}") + local symlink_dir=${ED%/}/usr/$(get_libdir)/${P}/${category} + mkdir ${symlink_dir} + + local output + for output in $(grep $1 ${eselect_dir}/versioned) ; do + ln -s $(with_slot_suffix ${output}) ${symlink_dir%/}/$(basename ${output}) + done + } + + install_symlinks /usr/bin/ + install_symlinks /usr/include/ + # Fix install_names on Darwin. The build system is too complicated # to just fix this, so we correct it post-install local lib= f= odylib= if [[ ${CHOST} == *-darwin* ]] ; then for lib in lib{EnhancedDisassembly,LLVM-${PV},LTO,profile_rt}.dylib {BugpointPasses,LLVMHello}.dylib ; do # libEnhancedDisassembly is Darwin10 only, so non-fatal - [[ -f ${ED}/usr/lib/${PN}/${lib} ]] || continue + [[ -f ${ED}/usr/lib/${PN}-${SLOT}/${lib} ]] || continue ebegin "fixing install_name of $lib" install_name_tool \ - -id "${EPREFIX}"/usr/lib/${PN}/${lib} \ - "${ED}"/usr/lib/${PN}/${lib} + -id "${EPREFIX}"/usr/lib/${PN}-${SLOT}/${lib} \ + "${ED}"/usr/lib/${PN}-${SLOT}/${lib} eend $? done - for f in "${ED}"/usr/bin/* "${ED}"/usr/lib/${PN}/libLTO.dylib ; do + for f in "${ED}"/usr/bin/* "${ED}"/usr/lib/${PN}-${SLOT}/libLTO.dylib ; do odylib=$(scanmacho -BF'%n#f' "${f}" | tr ',' '\n' | grep libLLVM-${PV}.dylib) ebegin "fixing install_name reference to ${odylib} of ${f##*/}" install_name_tool \ -change "${odylib}" \ - "${EPREFIX}"/usr/lib/${PN}/libLLVM-${PV}.dylib \ + "${EPREFIX}"/usr/lib/${PN}-${SLOT}/libLLVM-${PV}.dylib \ "${f}" eend $? done fi } + +pkg_postinst() { + if [[ $(eselect ${PN} show) = "(none)" ]] ; then + eselect ${PN} set ${SLOT} + fi +} + +pkg_prerm() { + if [[ $(eselect ${PN} show) = ${SLOT} ]] ; then + eselect ${PN} clear + fi +} + +pkg_postrm() { + if [[ -z ${REPLACED_BY_VERSION} ]] ; then + eselect ${PN} update + fi +} diff --git a/sys-devel/llvm/llvm-3.2.ebuild b/sys-devel/llvm/llvm-3.2.ebuild index a54a740..7e0a4ad 100644 --- a/sys-devel/llvm/llvm-3.2.ebuild +++ b/sys-devel/llvm/llvm-3.2.ebuild @@ -16,7 +16,7 @@ SRC_URI="http://llvm.org/releases/${PV}/${P}.src.tar.gz !doc? ( http://dev.gentoo.org/~voyageur/distfiles/${P}-manpages.tar.bz2 )" LICENSE="UoI-NCSA" -SLOT="0" +SLOT="${PV}" KEYWORDS="~amd64 ~arm ~ppc ~x86 ~amd64-fbsd ~x86-fbsd ~x64-freebsd ~amd64-linux ~arm-linux ~x86-linux ~ppc-macos ~x64-macos" IUSE="debug doc gold +libffi multitarget ocaml test udis86 vim-syntax" @@ -34,6 +34,7 @@ DEPEND="dev-lang/perl udis86? ( dev-libs/udis86[pic(+)] ) ${PYTHON_DEPS}" RDEPEND="dev-lang/perl + app-admin/eselect-llvm libffi? ( virtual/libffi ) vim-syntax? ( || ( app-editors/vim app-editors/gvim ) )" @@ -84,15 +85,20 @@ src_prepare() { -e 's,^PROJ_etcdir.*,PROJ_etcdir := '"${EPREFIX}"'/etc/llvm,' \ -e 's,^PROJ_libdir.*,PROJ_libdir := $(PROJ_prefix)/'$(get_libdir)/${PN}, \ -i Makefile.config.in || die "Makefile.config sed failed" - sed -e "/ActiveLibDir = ActivePrefix/s/lib/$(get_libdir)\/${PN}/" \ - -i tools/llvm-config/llvm-config.cpp || die "llvm-config sed failed" + sed -e "/ActiveLibDir = ActivePrefix/s/lib/$(get_libdir)\/${P}/" \ + -e "/ActiveBinDir = ActivePrefix/s/bin/$(get_libdir)\/${P}\/bin/" \ + -e "/ActiveIncludeDir = ActivePrefix/s/include/$(get_libdir)\/${P}\/include/" \ + -i tools/llvm-config/llvm-config.cpp || die "llvm-config ActiveLibDir sed failed" + sed -e "/SUB_LDFLAGS :=/s@:=@:= \$(RPATH) -Wl,\'${EPREFIX}/usr/$(get_libdir)/${PN}-${SLOT}\'@" \ + -e "s:'s/@LLVM_LDFLAGS@/\$(subst /,\\\\/,\$(SUB_LDFLAGS))/':\"s?@LLVM_LDFLAGS@?\$(SUB_LDFLAGS)?\":" \ + -i tools/llvm-config/Makefile || die "llvm-config LDFLAGS sed failed" einfo "Fixing rpath and CFLAGS" - sed -e 's,\$(RPATH) -Wl\,\$(\(ToolDir\|LibDir\)),$(RPATH) -Wl\,'"${EPREFIX}"/usr/$(get_libdir)/${PN}, \ + sed -e "s@\$(RPATH) -Wl,\$(\(ToolDir\|LibDir\))@\$(RPATH) -Wl,'${EPREFIX}/usr/$(get_libdir)/${PN}-${SLOT}'@" \ -e '/OmitFramePointer/s/-fomit-frame-pointer//' \ -i Makefile.rules || die "rpath sed failed" if use gold; then - sed -e 's,\$(SharedLibDir),'"${EPREFIX}"/usr/$(get_libdir)/${PN}, \ + sed -e 's,\$(SharedLibDir),'"${EPREFIX}"/usr/$(get_libdir)/${PN}-${SLOT}, \ -i tools/gold/Makefile || die "gold rpath sed failed" fi @@ -178,6 +184,86 @@ src_install() { doins utils/vim/*.vim fi + # Register slot for app-admin/eselect-llvm + local eselect_dir="/usr/share/eselect-llvm/slots/${SLOT}" + dodir "${eselect_dir}" + eselect_dir="${ED}/${eselect_dir}" + echo "${CATEGORY}/${PF}" > "${eselect_dir}/ebuild" + + with_slot_suffix() { + local file=$(echo "$1" | sed -e "s/-${SLOT}//") + local ext="" + if [[ "${file}" =~ \. ]] ; then + ext=".${file#*.}" + fi + local base="${file%%.*}" + echo "${base}-${SLOT}${ext}" + } + + make_versioned() { + local dir=$1 + local candidates=(${ED%/}/${dir#/}) + if [[ ! ${dir##*/} ]] ; then + dir=${dir%/} + candidates=( "${candidates}"* ) + else + dir=$(dirname "${dir}") + fi + + pushd ${ED%/}/${dir#/} >/dev/null || die + + local candidate + for candidate in "${candidates[@]}" ; do + if [[ -h "${candidate}" ]] ; then + # Add slot suffix to symlink target + local target=$(readlink -s "${candidate}") + local slotted_target=$(with_slot_suffix "${target}") + if [[ -e "${target}" ]] || [[ -e "${slotted_target}" ]] ; then + ln -sf "${slotted_target}" "${candidate}" \ + || die "Could not update symlink" + fi + fi + + local base_name=$(basename "${candidate}") + local slotted_name=$(with_slot_suffix "${base_name}") + mv "${candidate}" "${ED}/${dir#/}/${slotted_name}" \ + || die "Could not rename ${candidate} to ${slotted_name}" + echo "/${dir#/}/${base_name}" >> "${eselect_dir}/versioned" + done + + popd >/dev/null || die + } + + # Trailing slash => version the content + # No trailing slash => version the directory itself + local paths=( + /usr/bin/ + /usr/$(get_libdir)/ + /usr/include/ + /usr/share/man/man1/ + ) + use vim-syntax && paths+=( /usr/share/vim/vimfiles/syntax/ ) + + local path + for path in "${paths[@]}" ; do + make_versioned "${path}" + done + + install_symlinks() { + local dir=${ED%/}/${1#/} + local category=$(basename "${dir}") + local symlink_dir=${ED%/}/usr/$(get_libdir)/${P}/${category} + mkdir ${symlink_dir} + + local output + for output in $(grep $1 ${eselect_dir}/versioned) ; do + ln -s $(with_slot_suffix ${output}) ${symlink_dir%/}/$(basename ${output}) + done + } + + install_symlinks /usr/bin/ + install_symlinks /usr/include/ + # Fix install_names on Darwin. The build system is too complicated # to just fix this, so we correct it post-install local lib= f= odylib= libpv=${PV} @@ -186,21 +272,39 @@ src_install() { [[ -n ${PACKAGE_VERSION} ]] && libpv=${PACKAGE_VERSION} for lib in lib{EnhancedDisassembly,LLVM-${libpv},LTO,profile_rt}.dylib {BugpointPasses,LLVMHello}.dylib ; do # libEnhancedDisassembly is Darwin10 only, so non-fatal - [[ -f ${ED}/usr/lib/${PN}/${lib} ]] || continue + [[ -f ${ED}/usr/lib/${PN}-${SLOT}/${lib} ]] || continue ebegin "fixing install_name of $lib" install_name_tool \ - -id "${EPREFIX}"/usr/lib/${PN}/${lib} \ - "${ED}"/usr/lib/${PN}/${lib} + -id "${EPREFIX}"/usr/lib/${PN}-${SLOT}/${lib} \ + "${ED}"/usr/lib/${PN}-${SLOT}/${lib} eend $? done - for f in "${ED}"/usr/bin/* "${ED}"/usr/lib/${PN}/libLTO.dylib ; do + for f in "${ED}"/usr/bin/* "${ED}"/usr/lib/${PN}-${SLOT}/libLTO.dylib ; do odylib=$(scanmacho -BF'%n#f' "${f}" | tr ',' '\n' | grep libLLVM-${libpv}.dylib) ebegin "fixing install_name reference to ${odylib} of ${f##*/}" install_name_tool \ -change "${odylib}" \ - "${EPREFIX}"/usr/lib/${PN}/libLLVM-${libpv}.dylib \ + "${EPREFIX}"/usr/lib/${PN}-${SLOT}/libLLVM-${libpv}.dylib \ "${f}" eend $? done fi } + +pkg_postinst() { + if [[ $(eselect ${PN} show) = "(none)" ]] ; then + eselect ${PN} set ${SLOT} + fi +} + +pkg_prerm() { + if [[ $(eselect ${PN} show) = ${SLOT} ]] ; then + eselect ${PN} clear + fi +} + +pkg_postrm() { + if [[ -z ${REPLACED_BY_VERSION} ]] ; then + eselect ${PN} update + fi +} diff --git a/sys-devel/llvm/llvm-3.3.ebuild b/sys-devel/llvm/llvm-3.3.ebuild index adcae05..13aab7d 100644 --- a/sys-devel/llvm/llvm-3.3.ebuild +++ b/sys-devel/llvm/llvm-3.3.ebuild @@ -16,7 +16,7 @@ SRC_URI="http://llvm.org/releases/${PV}/${P}.src.tar.gz !doc? ( http://dev.gentoo.org/~voyageur/distfiles/${P}-manpages.tar.bz2 )" LICENSE="UoI-NCSA" -SLOT="0" +SLOT="${PV}" KEYWORDS="~amd64 ~arm ~ppc ~x86 ~amd64-fbsd ~x86-fbsd ~x64-freebsd ~amd64-linux ~arm-linux ~x86-linux ~ppc-macos ~x64-macos" IUSE="debug doc gold +libffi multitarget ocaml test udis86 vim-syntax video_cards_radeon" @@ -35,6 +35,7 @@ DEPEND="dev-lang/perl udis86? ( dev-libs/udis86[pic(+)] ) ${PYTHON_DEPS}" RDEPEND="dev-lang/perl + app-admin/eselect-llvm libffi? ( virtual/libffi ) vim-syntax? ( || ( app-editors/vim app-editors/gvim ) )" @@ -85,15 +86,20 @@ src_prepare() { -e 's,^PROJ_etcdir.*,PROJ_etcdir := '"${EPREFIX}"'/etc/llvm,' \ -e 's,^PROJ_libdir.*,PROJ_libdir := $(PROJ_prefix)/'$(get_libdir)/${PN}, \ -i Makefile.config.in || die "Makefile.config sed failed" - sed -e "/ActiveLibDir = ActivePrefix/s/lib/$(get_libdir)\/${PN}/" \ - -i tools/llvm-config/llvm-config.cpp || die "llvm-config sed failed" + sed -e "/ActiveLibDir = ActivePrefix/s/lib/$(get_libdir)\/${P}/" \ + -e "/ActiveBinDir = ActivePrefix/s/bin/$(get_libdir)\/${P}\/bin/" \ + -e "/ActiveIncludeDir = ActivePrefix/s/include/$(get_libdir)\/${P}\/include/" \ + -i tools/llvm-config/llvm-config.cpp || die "llvm-config ActiveLibDir sed failed" + sed -e "/SUB_LDFLAGS :=/s@:=@:= \$(RPATH) -Wl,\'${EPREFIX}/usr/$(get_libdir)/${PN}-${SLOT}\'@" \ + -e "s:'s/@LLVM_LDFLAGS@/\$(subst /,\\\\/,\$(SUB_LDFLAGS))/':\"s?@LLVM_LDFLAGS@?\$(SUB_LDFLAGS)?\":" \ + -i tools/llvm-config/Makefile || die "llvm-config LDFLAGS sed failed" einfo "Fixing rpath and CFLAGS" - sed -e 's,\$(RPATH) -Wl\,\$(\(ToolDir\|LibDir\)),$(RPATH) -Wl\,'"${EPREFIX}"/usr/$(get_libdir)/${PN}, \ + sed -e "s@\$(RPATH) -Wl,\$(\(ToolDir\|LibDir\))@\$(RPATH) -Wl,'${EPREFIX}/usr/$(get_libdir)/${PN}-${SLOT}'@" \ -e '/OmitFramePointer/s/-fomit-frame-pointer//' \ -i Makefile.rules || die "rpath sed failed" if use gold; then - sed -e 's,\$(SharedLibDir),'"${EPREFIX}"/usr/$(get_libdir)/${PN}, \ + sed -e 's,\$(SharedLibDir),'"${EPREFIX}"/usr/$(get_libdir)/${PN}-${SLOT}, \ -i tools/gold/Makefile || die "gold rpath sed failed" fi @@ -157,9 +163,9 @@ src_compile() { emake VERBOSE=1 KEEP_SYMBOLS=1 REQUIRES_RTTI=1 if use doc; then - emake -C docs -f Makefile.sphinx man - emake -C docs -f Makefile.sphinx html + emake -C docs -f Makefile.sphinx man html fi + # emake -C docs -f Makefile.sphinx html if use debug; then pax-mark m Debug+Asserts+Checks/bin/lli @@ -188,6 +194,86 @@ src_install() { doins utils/vim/*.vim fi + # Register slot for app-admin/eselect-llvm + local eselect_dir="/usr/share/eselect-llvm/slots/${SLOT}" + dodir "${eselect_dir}" + eselect_dir="${ED}/${eselect_dir}" + echo "${CATEGORY}/${PF}" > "${eselect_dir}/ebuild" + + with_slot_suffix() { + local file=$(echo "$1" | sed -e "s/-${SLOT}//") + local ext="" + if [[ "${file}" =~ \. ]] ; then + ext=".${file#*.}" + fi + local base="${file%%.*}" + echo "${base}-${SLOT}${ext}" + } + + make_versioned() { + local dir=$1 + local candidates=(${ED%/}/${dir#/}) + if [[ ! ${dir##*/} ]] ; then + dir=${dir%/} + candidates=( "${candidates}"* ) + else + dir=$(dirname "${dir}") + fi + + pushd ${ED%/}/${dir#/} >/dev/null || die + + local candidate + for candidate in "${candidates[@]}" ; do + if [[ -h "${candidate}" ]] ; then + # Add slot suffix to symlink target + local target=$(readlink -s "${candidate}") + local slotted_target=$(with_slot_suffix "${target}") + if [[ -e "${target}" ]] || [[ -e "${slotted_target}" ]] ; then + ln -sf "${slotted_target}" "${candidate}" \ + || die "Could not update symlink" + fi + fi + + local base_name=$(basename "${candidate}") + local slotted_name=$(with_slot_suffix "${base_name}") + mv "${candidate}" "${ED}/${dir#/}/${slotted_name}" \ + || die "Could not rename ${candidate} to ${slotted_name}" + echo "/${dir#/}/${base_name}" >> "${eselect_dir}/versioned" + done + + popd >/dev/null || die + } + + # Trailing slash => version the content + # No trailing slash => version the directory itself + local paths=( + /usr/bin/ + /usr/$(get_libdir)/ + /usr/include/ + /usr/share/man/man1/ + ) + use vim-syntax && paths+=( /usr/share/vim/vimfiles/syntax/ ) + + local path + for path in "${paths[@]}" ; do + make_versioned "${path}" + done + + install_symlinks() { + local dir=${ED%/}/${1#/} + local category=$(basename "${dir}") + local symlink_dir=${ED%/}/usr/$(get_libdir)/${P}/${category} + mkdir ${symlink_dir} + + local output + for output in $(grep $1 ${eselect_dir}/versioned) ; do + ln -s $(with_slot_suffix ${output}) ${symlink_dir%/}/$(basename ${output}) + done + } + + install_symlinks /usr/bin/ + install_symlinks /usr/include/ + # Fix install_names on Darwin. The build system is too complicated # to just fix this, so we correct it post-install local lib= f= odylib= libpv=${PV} @@ -196,21 +282,39 @@ src_install() { [[ -n ${PACKAGE_VERSION} ]] && libpv=${PACKAGE_VERSION} for lib in lib{EnhancedDisassembly,LLVM-${libpv},LTO,profile_rt}.dylib {BugpointPasses,LLVMHello}.dylib ; do # libEnhancedDisassembly is Darwin10 only, so non-fatal - [[ -f ${ED}/usr/lib/${PN}/${lib} ]] || continue + [[ -f ${ED}/usr/lib/${PN}-${SLOT}/${lib} ]] || continue ebegin "fixing install_name of $lib" install_name_tool \ - -id "${EPREFIX}"/usr/lib/${PN}/${lib} \ - "${ED}"/usr/lib/${PN}/${lib} + -id "${EPREFIX}"/usr/lib/${PN}-${SLOT}/${lib} \ + "${ED}"/usr/lib/${PN}-${SLOT}/${lib} eend $? done - for f in "${ED}"/usr/bin/* "${ED}"/usr/lib/${PN}/libLTO.dylib ; do + for f in "${ED}"/usr/bin/* "${ED}"/usr/lib/${PN}-${SLOT}/libLTO.dylib ; do odylib=$(scanmacho -BF'%n#f' "${f}" | tr ',' '\n' | grep libLLVM-${libpv}.dylib) ebegin "fixing install_name reference to ${odylib} of ${f##*/}" install_name_tool \ -change "${odylib}" \ - "${EPREFIX}"/usr/lib/${PN}/libLLVM-${libpv}.dylib \ + "${EPREFIX}"/usr/lib/${PN}-${SLOT}/libLLVM-${libpv}.dylib \ "${f}" eend $? done fi } + +pkg_postinst() { + if [[ $(eselect ${PN} show) = "(none)" ]] ; then + eselect ${PN} set ${SLOT} + fi +} + +pkg_prerm() { + if [[ $(eselect ${PN} show) = ${SLOT} ]] ; then + eselect ${PN} clear + fi +} + +pkg_postrm() { + if [[ -z ${REPLACED_BY_VERSION} ]] ; then + eselect ${PN} update + fi +} diff --git a/sys-devel/llvm/llvm-9999.ebuild b/sys-devel/llvm/llvm-9999.ebuild index 235be01..412d67c 100644 --- a/sys-devel/llvm/llvm-9999.ebuild +++ b/sys-devel/llvm/llvm-9999.ebuild @@ -16,7 +16,7 @@ SRC_URI="" ESVN_REPO_URI="http://llvm.org/svn/llvm-project/llvm/trunk" LICENSE="UoI-NCSA" -SLOT="0" +SLOT="${PV}" KEYWORDS="" IUSE="debug doc gold +libffi multitarget ocaml test udis86 vim-syntax video_cards_radeon" @@ -35,6 +35,7 @@ DEPEND="dev-lang/perl udis86? ( dev-libs/udis86[pic(+)] ) ${PYTHON_DEPS}" RDEPEND="dev-lang/perl + app-admin/eselect-llvm libffi? ( virtual/libffi ) vim-syntax? ( || ( app-editors/vim app-editors/gvim ) )" @@ -83,15 +84,24 @@ src_prepare() { -e 's,^PROJ_etcdir.*,PROJ_etcdir := '"${EPREFIX}"'/etc/llvm,' \ -e 's,^PROJ_libdir.*,PROJ_libdir := $(PROJ_prefix)/'$(get_libdir)/${PN}, \ -i Makefile.config.in || die "Makefile.config sed failed" - sed -e "/ActiveLibDir = ActivePrefix/s/lib/$(get_libdir)\/${PN}/" \ - -i tools/llvm-config/llvm-config.cpp || die "llvm-config sed failed" + sed -e "/ActiveLibDir = ActivePrefix/s/lib/$(get_libdir)\/${P}/" \ + -e "/ActiveBinDir = ActivePrefix/s/bin/$(get_libdir)\/${P}\/bin/" \ + -e "/ActiveIncludeDir = ActivePrefix/s/include/$(get_libdir)\/${P}\/include/" \ + -i tools/llvm-config/llvm-config.cpp || die "llvm-config ActiveLibDir sed failed" + sed -e "/SUB_LDFLAGS :=/s@:=@:= \$(RPATH) -Wl,\'${EPREFIX}/usr/$(get_libdir)/${PN}-${SLOT}\'@" \ + -e "s:'s/@LLVM_LDFLAGS@/\$(subst /,\\\\/,\$(SUB_LDFLAGS))/':\"s?@LLVM_LDFLAGS@?\$(SUB_LDFLAGS)?\":" \ + -i tools/llvm-config/Makefile || die "llvm-config LDFLAGS sed failed" + sed -e "/LLVM_VERSION =/s/\('[0-9.]*\)svn'$/\1-${SLOT}'/" \ + -i bindings/python/llvm/common.py || die "python bindings version sed failed" + sed -e "/PACKAGE_VERSION=/s/\('[0-9.]*\)svn'$/\1-${SLOT}'/" \ + -i configure || die "configure version sed faile" einfo "Fixing rpath and CFLAGS" - sed -e 's,\$(RPATH) -Wl\,\$(\(ToolDir\|LibDir\)),$(RPATH) -Wl\,'"${EPREFIX}"/usr/$(get_libdir)/${PN}, \ + sed -e "s@\$(RPATH) -Wl,'\$\$ORIGIN/../lib'@\$(RPATH) -Wl,'${EPREFIX}/usr/$(get_libdir)/${PN}-${SLOT}'@" \ -e '/OmitFramePointer/s/-fomit-frame-pointer//' \ -i Makefile.rules || die "rpath sed failed" if use gold; then - sed -e 's,\$(SharedLibDir),'"${EPREFIX}"/usr/$(get_libdir)/${PN}, \ + sed -e 's,\$(SharedLibDir),'"${EPREFIX}"/usr/$(get_libdir)/${PN}-${SLOT}, \ -i tools/gold/Makefile || die "gold rpath sed failed" fi @@ -177,6 +187,86 @@ src_install() { doins utils/vim/*.vim fi + # Register slot for app-admin/eselect-llvm + local eselect_dir="/usr/share/eselect-llvm/slots/${SLOT}" + dodir "${eselect_dir}" + eselect_dir="${ED}/${eselect_dir}" + echo "${CATEGORY}/${PF}" > "${eselect_dir}/ebuild" + + with_slot_suffix() { + local file=$(echo "$1" | sed -e "s/-${SLOT}//") + local ext="" + if [[ "${file}" =~ \. ]] ; then + ext=".${file#*.}" + fi + local base="${file%%.*}" + echo "${base}-${SLOT}${ext}" + } + + make_versioned() { + local dir=$1 + local candidates=(${ED%/}/${dir#/}) + if [[ ! ${dir##*/} ]] ; then + dir=${dir%/} + candidates=( "${candidates}"* ) + else + dir=$(dirname "${dir}") + fi + + pushd ${ED%/}/${dir#/} >/dev/null || die + + local candidate + for candidate in "${candidates[@]}" ; do + if [[ -h "${candidate}" ]] ; then + # Add slot suffix to symlink target + local target=$(readlink -s "${candidate}") + local slotted_target=$(with_slot_suffix "${target}") + if [[ -e "${target}" ]] || [[ -e "${slotted_target}" ]] ; then + ln -sf "${slotted_target}" "${candidate}" \ + || die "Could not update symlink" + fi + fi + + local base_name=$(basename "${candidate}") + local slotted_name=$(with_slot_suffix "${base_name}") + mv "${candidate}" "${ED}/${dir#/}/${slotted_name}" \ + || die "Could not rename ${candidate} to ${slotted_name}" + echo "/${dir#/}/${base_name}" >> "${eselect_dir}/versioned" + done + + popd >/dev/null || die + } + + # Trailing slash => version the content + # No trailing slash => version the directory itself + local paths=( + /usr/bin/ + /usr/$(get_libdir)/ + /usr/include/ + /usr/share/man/man1/ + ) + use vim-syntax && paths+=( /usr/share/vim/vimfiles/syntax/ ) + + local path + for path in "${paths[@]}" ; do + make_versioned "${path}" + done + + install_symlinks() { + local dir=${ED%/}/${1#/} + local category=$(basename "${dir}") + local symlink_dir=${ED%/}/usr/$(get_libdir)/${P}/${category} + mkdir ${symlink_dir} + + local output + for output in $(grep $1 ${eselect_dir}/versioned) ; do + ln -s $(with_slot_suffix ${output}) ${symlink_dir%/}/$(basename ${output}) + done + } + + install_symlinks /usr/bin/ + install_symlinks /usr/include/ + # Fix install_names on Darwin. The build system is too complicated # to just fix this, so we correct it post-install local lib= f= odylib= libpv=${PV} @@ -185,21 +275,39 @@ src_install() { [[ -n ${PACKAGE_VERSION} ]] && libpv=${PACKAGE_VERSION} for lib in lib{EnhancedDisassembly,LLVM-${libpv},LTO,profile_rt}.dylib {BugpointPasses,LLVMHello}.dylib ; do # libEnhancedDisassembly is Darwin10 only, so non-fatal - [[ -f ${ED}/usr/lib/${PN}/${lib} ]] || continue + [[ -f ${ED}/usr/lib/${PN}-${SLOT}/${lib} ]] || continue ebegin "fixing install_name of $lib" install_name_tool \ - -id "${EPREFIX}"/usr/lib/${PN}/${lib} \ - "${ED}"/usr/lib/${PN}/${lib} + -id "${EPREFIX}"/usr/lib/${PN}-${SLOT}/${lib} \ + "${ED}"/usr/lib/${PN}-${SLOT}/${lib} eend $? done - for f in "${ED}"/usr/bin/* "${ED}"/usr/lib/${PN}/libLTO.dylib ; do + for f in "${ED}"/usr/bin/* "${ED}"/usr/lib/${PN}-${SLOT}/libLTO.dylib ; do odylib=$(scanmacho -BF'%n#f' "${f}" | tr ',' '\n' | grep libLLVM-${libpv}.dylib) ebegin "fixing install_name reference to ${odylib} of ${f##*/}" install_name_tool \ -change "${odylib}" \ - "${EPREFIX}"/usr/lib/${PN}/libLLVM-${libpv}.dylib \ + "${EPREFIX}"/usr/lib/${PN}-${SLOT}/libLLVM-${libpv}.dylib \ "${f}" eend $? done fi } + +pkg_postinst() { + if [[ $(eselect ${PN} show) = "(none)" ]] ; then + eselect ${PN} set ${SLOT} + fi +} + +pkg_prerm() { + if [[ $(eselect ${PN} show) = ${SLOT} ]] ; then + eselect ${PN} clear + fi +} + +pkg_postrm() { + if [[ -z ${REPLACED_BY_VERSION} ]] ; then + eselect ${PN} update + fi +} -- 1.8.1.5