diff options
author | Justin Lecher <jlec@gentoo.org> | 2012-11-29 09:17:55 +0100 |
---|---|---|
committer | Justin Lecher <jlec@gentoo.org> | 2012-11-29 09:17:55 +0100 |
commit | 1a92c734df8facccb0cd960144034f2fad7333f5 (patch) | |
tree | e3f1b8161593fb17dba2f8d6cde2bd6a03638ae2 /eclass | |
parent | sci-libs/mmdb: Test version for new eclass (diff) | |
parent | Merge branch 'master' of git+ssh://git.overlays.gentoo.org/proj/sci (diff) | |
download | sci-1a92c734df8facccb0cd960144034f2fad7333f5.tar.gz sci-1a92c734df8facccb0cd960144034f2fad7333f5.tar.bz2 sci-1a92c734df8facccb0cd960144034f2fad7333f5.zip |
Merge branch 'master' of git+ssh://git.overlays.gentoo.org/proj/sci into pkg-config
# By Justin Lecher (68) and others
# Via Justin Lecher (10) and others
* 'master' of git+ssh://git.overlays.gentoo.org/proj/sci: (94 commits)
sci-libs/tmglib: Initial import
removed mac files from jlec
sci-astronomy/starlink-bin: Version bump
sci-libs/plasma: Version bump. Introduce testing
sci-libs/lapacke-reference: added tmg for testing, cleaning up ebuild
sci-libs/lapack-reference: removed tmg flag, now separate ebuild
sci-libs/lapack-reference: tmg flag description
sci-libs/lapack-reference: Added tmg use flag, fix a failing post command test
Implemented comments from g-dev review
Be bin package friendly
Fix typo in Copyright year
Implemented comments from g-dev review
Only handle documentation if present
intel-sdp.eclass: fix install on x86 + qa
dev-python/pytools: fix test related stuff and license
Drop USE=doc and add static-libs support
Speed up unpacking #431614
Drop additional blank lines.
Drop old testing functions
Resort general functions and variables at the beginning
...
# By Justin Lecher (68) and others
# Via Justin Lecher (10) and others
* master: (94 commits)
sci-libs/tmglib: Initial import
removed mac files from jlec
sci-astronomy/starlink-bin: Version bump
sci-libs/plasma: Version bump. Introduce testing
sci-libs/lapacke-reference: added tmg for testing, cleaning up ebuild
sci-libs/lapack-reference: removed tmg flag, now separate ebuild
sci-libs/lapack-reference: tmg flag description
sci-libs/lapack-reference: Added tmg use flag, fix a failing post command test
Implemented comments from g-dev review
Be bin package friendly
Fix typo in Copyright year
Implemented comments from g-dev review
Only handle documentation if present
intel-sdp.eclass: fix install on x86 + qa
dev-python/pytools: fix test related stuff and license
Drop USE=doc and add static-libs support
Speed up unpacking #431614
Drop additional blank lines.
Drop old testing functions
Resort general functions and variables at the beginning
...
Diffstat (limited to 'eclass')
-rw-r--r-- | eclass/cuda.eclass | 132 | ||||
-rw-r--r-- | eclass/intel-sdp.eclass | 433 |
2 files changed, 565 insertions, 0 deletions
diff --git a/eclass/cuda.eclass b/eclass/cuda.eclass new file mode 100644 index 000000000..beac08239 --- /dev/null +++ b/eclass/cuda.eclass @@ -0,0 +1,132 @@ +# Copyright 1999-2012 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: $ + +inherit toolchain-funcs versionator + +# @ECLASS: cuda.eclass +# @MAINTAINER: +# Justin Lecher <jlec@gentoo.org> +# @BLURB: Common functions for cuda packages +# @DESCRIPTION: +# This eclass contains functions to be used with cuda package. Currently it is +# setting and/or sanitizing NVCCFLAGS, the compiler flags for nvcc. This is +# automatically done and exported in src_prepare() or manually by calling +# cuda_sanatize. +# @EXAMPLE: +# inherit cuda + +# @ECLASS-VARIABLE: NVCCFLAGS +# @DESCRIPTION: +# nvcc compiler flags (see nvcc --help), which should be used like +# CFLAGS for c compiler +: ${NVCCFLAGS:=-O2} + +# @ECLASS-VARIABLE: CUDA_VERBOSE +# @DESCRIPTION: +# Being verbose during compilation to see underlying commands +: ${CUDA_VERBOSE:=true} + +# @FUNCTION: cuda_gccdir +# @USAGE: [-f] +# @RETURN: gcc bindir compatible with current cuda, optionally (-f) prefixed with "--compiler-bindir=" +# @DESCRIPTION: +# Helper for determination of the latest gcc bindir supported by +# then current nvidia cuda toolkit. +# +# Example: +# @CODE +# cuda_gccdir -f +# -> --compiler-bindir="/usr/x86_64-pc-linux-gnu/gcc-bin/4.6.3" +# @CODE +cuda_gccdir() { + local gcc_bindir ver args="" flag ret + + # Currently we only support the gnu compiler suite + if [[ $(tc-getCXX) != *g++* ]]; then + ewarn "Currently we only support the gnu compiler suite" + return 2 + fi + + while [ "$1" ]; do + case $1 in + -f) + flag="--compiler-bindir=" + ;; + *) + ;; + esac + shift + done + + if ! args=$(cuda-config -s); then + eerror "Could not execute cuda-config" + eerror "Make sure >=dev-util/nvidia-cuda-toolkit-4.2.9-r1 is installed" + die "cuda-config not found" + else + args=$(version_sort ${args}) + if [[ -z ${args} ]]; then + die "Could not determine supported gcc versions from cuda-config" + fi + fi + + for ver in ${args}; do + has_version sys-devel/gcc:${ver} && \ + gcc_bindir="$(ls -d ${EPREFIX}/usr/*pc-linux-gnu/gcc-bin/${ver}* | tail -n 1)" + done + + if [[ -n ${gcc_bindir} ]]; then + if [[ -n ${flag} ]]; then + ret="${flag}\\\"${gcc_bindir}\\\"" + else + ret="${gcc_bindir}" + fi + echo ${ret} + return 0 + else + eerror "Only gcc version(s) ${args} are supported," + eerror "of which none is installed" + die "Only gcc version(s) ${args} are supported" + return 1 + fi +} + +# @FUNCTION: cuda_sanitize +# @DESCRIPTION: +# Correct NVCCFLAGS by adding the necessary reference to gcc bindir and +# passing CXXFLAGS to underlying compiler without disturbing nvcc. +cuda_sanitize() { + # Be verbose if wanted + [[ "${CUDA_VERBOSE}" == true ]] && NVCCFLAGS+=" -v" + + # Tell nvcc where to find a compatible compiler + NVCCFLAGS+=" $(cuda_gccdir -f)" + + # Tell nvcc which flags should be used for underlying C compiler + NVCCFLAGS+=" --compiler-options=\"${CXXFLAGS}\"" + + export NVCCFLAGS +} + +# @FUNCTION: cuda_pkg_setup +# @DESCRIPTION: +# Call cuda_src_prepare for EAPIs not supporting src_prepare +cuda_pkg_setup() { + cuda_src_prepare +} + +# @FUNCTION: cuda_src_prepare +# @DESCRIPTION: +# Sanitise and export NVCCFLAGS by default +cuda_src_prepare() { + cuda_sanitize +} + + +case "${EAPI:-0}" in + 0|1) + EXPORT_FUNCTIONS pkg_setup ;; + 2|3|4|5) + EXPORT_FUNCTIONS src_prepare ;; + *) die "EAPI=${EAPI} is not supported" ;; +esac diff --git a/eclass/intel-sdp.eclass b/eclass/intel-sdp.eclass new file mode 100644 index 000000000..1b6051454 --- /dev/null +++ b/eclass/intel-sdp.eclass @@ -0,0 +1,433 @@ +# Copyright 1999-2012 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/eclass/intel-sdp.eclass,v 1.4 2012/09/20 13:54:56 jlec Exp $ + +# @ECLASS: intel-sdp.eclass +# @MAINTAINER: +# Justin Lecher <jlec@gentoo.org> +# Sci Team <sci@gentoo.org> +# @BLURB: Handling of Intel's Software Development Products package management + +# @ECLASS-VARIABLE: INTEL_DID +# @DEFAULT_UNSET +# @DESCRIPTION: +# The package download ID from Intel. +# To find out its value, see the links to download in +# https://registrationcenter.intel.com/RegCenter/MyProducts.aspx +# +# e.g. 2504 +# +# Must be defined before inheriting the eclass + +# @ECLASS-VARIABLE: INTEL_DPN +# @DEFAULT_UNSET +# @DESCRIPTION: +# The package name to download from Intel. +# To find out its value, see the links to download in +# https://registrationcenter.intel.com/RegCenter/MyProducts.aspx +# +# e.g. parallel_studio_xe +# +# Must be defined before inheriting the eclass + +# @ECLASS-VARIABLE: INTEL_DPV +# @DEFAULT_UNSET +# @DESCRIPTION: +# The package download version from Intel. +# To find out its value, see the links to download in +# https://registrationcenter.intel.com/RegCenter/MyProducts.aspx +# +# e.g. 2011_sp1_update2 +# +# Must be defined before inheriting the eclass + +# @ECLASS-VARIABLE: INTEL_SUBDIR +# @DEFAULT_UNSET +# @DESCRIPTION: +# The package sub-directory where it will end-up in /opt/intel +# To find out its value, you have to do a raw install from the Intel tar ball + +# @ECLASS-VARIABLE: INTEL_RPMS_DIRS +# @DESCRIPTION: +# List of subdirectories in the main archive which contains the +# rpms to extract. +: ${INTEL_RPMS_DIRS:=rpm} + +# @ECLASS-VARIABLE: INTEL_X86 +# @DESCRIPTION: +# 32bit arch in rpm names +# +# e.g. i484 +: ${INTEL_X86:=i486} + +# @ECLASS-VARIABLE: INTEL_BIN_RPMS +# @DEFAULT_UNSET +# @DESCRIPTION: +# Functional name of rpm without any version/arch tag +# +# e.g. compilerprof + +# @ECLASS-VARIABLE: INTEL_DAT_RPMS +# @DEFAULT_UNSET +# @DESCRIPTION: +# Functional name of rpm of common data which are arch free +# without any version tag +# +# e.g. openmp + +# @ECLASS-VARIABLE: INTEL_SDP_DB +# @DESCRIPTION: +# Full path to intel registry db +INTEL_SDP_DB="${EROOT%/}"/opt/intel/intel-sdp-products.db + +inherit check-reqs multilib versionator + +_INTEL_PV1=$(get_version_component_range 1) +_INTEL_PV2=$(get_version_component_range 2) +_INTEL_PV3=$(get_version_component_range 3) +_INTEL_PV4=$(get_version_component_range 4) +_INTEL_URI="http://registrationcenter-download.intel.com/irc_nas/${INTEL_DID}/${INTEL_DPN}" + +SRC_URI=" + amd64? ( multilib? ( ${_INTEL_URI}_${INTEL_DPV}.tgz ) ) + amd64? ( !multilib? ( ${_INTEL_URI}_${INTEL_DPV}_intel64.tgz ) ) + x86? ( ${_INTEL_URI}_${INTEL_DPV}_ia32.tgz )" + +LICENSE="Intel-SDP" +# Future work, #394411 +#SLOT="${_INTEL_PV1}.${_INTEL_PV2}" +SLOT="0" +IUSE="examples multilib static-libs" +KEYWORDS="-* ~amd64 ~x86 ~amd64-linux ~x86-linux" + +RESTRICT="mirror" + +RDEPEND="" +DEPEND="app-arch/rpm2targz" + +_INTEL_SDP_YEAR=${INTEL_DPV%_update*} +_INTEL_SDP_YEAR=${INTEL_DPV%_sp*} + +# @ECLASS-VARIABLE: INTEL_SDP_DIR +# @DEFAULT_UNSET +# @DESCRIPTION: +# Full rootless path to installation dir +INTEL_SDP_DIR="opt/intel/${INTEL_SUBDIR}-${_INTEL_SDP_YEAR:-${_INTEL_PV1}}.${_INTEL_PV3}.${_INTEL_PV4}" + +# @ECLASS-VARIABLE: INTEL_SDP_EDIR +# @DEFAULT_UNSET +# @DESCRIPTION: +# Full rooted path to installation dir +INTEL_SDP_EDIR="${EROOT%/}/${INTEL_SDP_DIR}" + +S="${WORKDIR}" + +QA_PREBUILT="${INTEL_SDP_DIR}/*" + +# @ECLASS-VARIABLE: INTEL_ARCH +# @DEFAULT_UNSET +# @DESCRIPTION: +# Intels internal names of the arches; will be set at runtime accordingly +# +# e.g. amd64-multilib -> INTEL_ARCH="intel64 ia32" + +# @FUNCTION: _isdp_link_eclipse_plugins +# @INTERNAL +# @DESCRIPTION: +# Creating necessary links to use intel compiler with eclipse +_isdp_link_eclipse_plugins() { + local c f + pushd ${INTEL_SDP_DIR}/eclipse_support > /dev/null + for c in cdt*; do + local cv=${c#cdt} ev=3.$(( ${cv:0:1} - 1)) + if has_version "dev-util/eclipse-sdk:${ev}"; then + einfo "Linking eclipse (v${ev}) plugin cdt (v${cv})" + for f in cdt${cv}/eclipse/features/*; do + dodir /usr/$(get_libdir)/eclipse-${ev}/features + dosym "${INTEL_SDP_EDIR}"/eclipse_support/${f} \ + /usr/$(get_libdir)/eclipse-${ev}/features/ || die + done + for f in cdt${cv}/eclipse/plugins/*; do + dodir /usr/$(get_libdir)/eclipse-${ev}/plugins + dosym "${INTEL_SDP_EDIR}"/eclipse_support/${f} \ + /usr/$(get_libdir)/eclipse-${ev}/plugins/ || die + done + fi + done + popd > /dev/null +} + +# @FUNCTION: _isdp_big-warning +# @USAGE: [pre-check | test-failed] +# @INTERNAL +# @DESCRIPTION: +# warn user that we really require a license +_isdp_big-warning() { + case ${1} in + pre-check ) + echo "" + ewarn "License file not found!" + ;; + + test-failed ) + echo + ewarn "Function test failed. Most probably due to an invalid license." + ewarn "This means you already tried to bypass the license check once." + ;; + esac + + echo "" + ewarn "Make sure you have recieved the an Intel license." + ewarn "To receive a non-commercial license, you need to register at:" + ewarn "http://software.intel.com/en-us/articles/non-commercial-software-development/" + ewarn "Install the license file into ${INTEL_SDP_EDIR}/licenses/" + + case ${1} in + pre-check ) + ewarn "before proceeding with installation of ${P}" + echo "" + ;; + * ) + echo "" + ;; + esac +} + +# @FUNCTION: _isdp_version_test +# @INTERNAL +# @DESCRIPTION: +# Testing for valid license by asking for version information of the compiler +_isdp_version_test() { + local comp comp_full arch warn + case ${PN} in + ifc ) + debug-print "Testing ifort" + comp=ifort + ;; + icc ) + debug-print "Testing icc" + comp=icc + ;; + *) + die "${PN} is not supported for testing" + ;; + esac + + for arch in ${INTEL_ARCH}; do + case ${EBUILD_PHASE} in + install ) + comp_full="${ED}/${INTEL_SDP_DIR}/bin/${arch}/${comp}" + ;; + postinst ) + comp_full="${INTEL_SDP_EDIR}/bin/${arch}/${comp}" + ;; + * ) + ewarn "Compile test not supported in ${EBUILD_PHASE}" + continue + ;; + esac + + debug-print "LD_LIBRARY_PATH=\"${INTEL_SDP_EDIR}/bin/${arch}/\" \"${comp_full}\" -V" + + LD_LIBRARY_PATH="${INTEL_SDP_EDIR}/bin/${arch}/" "${comp_full}" -V &>/dev/null + [[ $? -ne 0 ]] && warn=yes + done + [[ "${warn}" == "yes" ]] && _isdp_big-warning test-failed +} + +# @FUNCTION: _isdp_run-test +# @INTERNAL +# Test if installed compiler is working +_isdp_run-test() { + case ${PN} in + ifc | icc ) + _isdp_version_test ;; + * ) + debug-print "No test available for ${PN}" + ;; + esac +} + +# @FUNCTION: intel-sdp_pkg_pretend +# @DESCRIPTION: +# @CODE +# * Check that the user has a (valid) license file before going on. +# * Check for space requirements being fullfilled +# @CODE +intel-sdp_pkg_pretend() { + local warn=1 dir dirs i ret arch a p + + : ${CHECKREQS_DISK_BUILD:=256M} + check-reqs_pkg_pretend + + _dirs=( + "${INTEL_SDP_EDIR}/licenses" + "${INTEL_SDP_EDIR}/Licenses" + "${EPREFIX}/opt/intel/licenses" + ) + for dir in "${dirs[@]}" ; do + ebegin "Checking for a license in: ${dirs[$i]}" + [[ $( ls "${dirs[$i]}"/*lic 2>/dev/null ) ]]; ret=$? + eend ${ret} + if [[ ${ret} == "0" ]]; then + warn=${ret} + break + fi + done + if [[ ${warn} == "1" ]]; then + _isdp_big-warning pre-check + die "Could not find license file" + fi +} + +# @FUNCTION: intel-sdp_pkg_setup +# @DESCRIPTION: +# Setting up and sorting some internal variables +intel-sdp_pkg_setup() { + local arch a p + + if use x86; then + arch=${INTEL_X86} + INTEL_ARCH="ia32" + elif use amd64; then + arch=x86_64 + INTEL_ARCH="intel64" + if has_multilib_profile; then + arch="x86_64 ${INTEL_X86}" + INTEL_ARCH="intel64 ia32" + fi + fi + INTEL_RPMS="" + for p in ${INTEL_BIN_RPMS}; do + for a in ${arch}; do + INTEL_RPMS+=" intel-${p}-${_INTEL_PV4}-${_INTEL_PV1}.${_INTEL_PV2}-${_INTEL_PV3}.${a}.rpm" + done + done + for p in ${INTEL_DAT_RPMS}; do + INTEL_RPMS+=" intel-${p}-${_INTEL_PV4}-${_INTEL_PV1}.${_INTEL_PV2}-${_INTEL_PV3}.noarch.rpm" + done + + case "${EAPI:-0}" in + 0|1|2|3) intel-sdp_pkg_pretend ;; + esac +} + +# @FUNCTION: intel-sdp_src_unpack +# @DESCRIPTION: +# Unpacking necessary rpms from tarball, extract them and rearrange the output. +intel-sdp_src_unpack() { + local l r subdir rb t list=() + + for t in ${A}; do + for r in ${INTEL_RPMS}; do + for subdir in ${INTEL_RPMS_DIRS}; do + rpmdir=${t%%.*}/${subdir} + list+=( ${rpmdir}/${r}) + done + done + tar xf "${DISTDIR}"/${t} ${list[@]} 2> /dev/null || die + for r in ${list[@]}; do + rb=$(basename ${r}) + l=.${rb}_$(date +'%d%m%y_%H%M%S').log + einfo "Unpacking ${rb}" + rpm2tar -O ${r} | tar xvf - | sed -e \ + "s:^\.:${EROOT#/}:g" > ${l} || die "unpacking ${r} failed" + mv ${l} opt/intel/ || die "failed moving extract log file" + done + done + + mv opt/intel/* ${INTEL_SDP_DIR} || die "mv to INTEL_SDP_DIR failed" +} + +# @FUNCTION: intel-sdp_src_install +# @DESCRIPTION: +# Install everything +intel-sdp_src_install() { + if [[ -d "${INTEL_SDP_DIR}"/Documentation ]]; then + dodoc -r "${INTEL_SDP_DIR}"/Documentation/* + + ebegin "Cleaning out documentation" + find "${INTEL_SDP_DIR}"/Documentation -delete || die + eend + fi + + if [[ -d "${INTEL_SDP_DIR}"/Samples ]]; then + if use examples ; then + insinto /usr/share/${P}/examples/ + doins -r "${INTEL_SDP_DIR}"/Samples/* + fi + ebegin "Cleaning out examples" + find "${INTEL_SDP_DIR}"/Samples -delete || die + eend + fi + + if [[ -d "${INTEL_SDP_DIR}"/eclipse_support ]]; then + if has eclipse ${IUSE} && use eclipse; then + _isdp_link_eclipse_plugins + else + ebegin "Cleaning out eclipse plugin" + find "${INTEL_SDP_DIR}"/eclipse_support -delete || die + eend + fi + fi + + if [[ -d "${INTEL_SDP_DIR}"/man ]]; then + doman "${INTEL_SDP_DIR}"/man/en_US/man1/* + if has linguas_ja ${IUSE} && use linguas_ja; then + doman -i18n=ja_JP "${INTEL_SDP_DIR}"/man/ja_JP/man1/* + fi + + find "${INTEL_SDP_DIR}"/man -delete || die + fi + + use static-libs || \ + find opt -type f -name "*.a" -delete || die + + ebegin "Tagging ${PN}" + find opt -name \*sh -type f -exec sed -i \ + -e "s:<.*DIR>:${INTEL_SDP_EDIR}:g" \ + '{}' + || die + eend + + [[ -d "${ED}" ]] || dodir / + mv opt "${ED}"/ || die "moving files failed" + + dodir "${INTEL_SDP_EDIR}"/licenses + keepdir "${INTEL_SDP_EDIR}"/licenses +} + +# @FUNCTION: intel-sdp_pkg_postinst +# @DESCRIPTION: +# Add things to intel database +intel-sdp_pkg_postinst() { + # add product registry to intel "database" + local l r + for r in ${INTEL_RPMS}; do + l="$(ls -1 ${EROOT%/}/opt/intel/.${r}_*.log | head -n 1)" + echo >> ${INTEL_SDP_DB} \ + "<:${r%-${_INTEL_PV4}*}-${_INTEL_PV4}:${r}:${INTEL_SDP_EDIR}:${l}:>" + done + _isdp_run-test +} + +# @FUNCTION: intel-sdp_pkg_postrm +# @DESCRIPTION: +# Sanitize intel database +intel-sdp_pkg_postrm() { + # remove from intel "database" + if [[ -e ${INTEL_SDP_DB} ]]; then + local r + for r in ${INTEL_RPMS}; do + sed -i \ + -e "/${r}/d" \ + ${INTEL_SDP_DB} + done + fi +} + +EXPORT_FUNCTIONS pkg_setup src_unpack src_install pkg_postinst pkg_postrm +case "${EAPI:-0}" in + 0|1|2|3) ;; + 4|5) EXPORT_FUNCTIONS pkg_pretend ;; + *) die "EAPI=${EAPI} is not supported" ;; +esac |