From 85f8fc569d35d6691cec47ad5d594629ea9457f2 Mon Sep 17 00:00:00 2001 From: Justin Lecher Date: Fri, 23 Nov 2012 20:04:28 +0100 Subject: Resort general functions and variables at the beginning --- eclass/intel-sdp.eclass | 356 ++++++++++++++++++++++++------------------------ 1 file changed, 180 insertions(+), 176 deletions(-) (limited to 'eclass/intel-sdp.eclass') diff --git a/eclass/intel-sdp.eclass b/eclass/intel-sdp.eclass index 14dba837f..2037ed3b6 100644 --- a/eclass/intel-sdp.eclass +++ b/eclass/intel-sdp.eclass @@ -75,6 +75,11 @@ # # 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) @@ -133,6 +138,181 @@ intel-sdp_pkg_pretend() { # # e.g. amd64-multilib -> INTEL_ARCH="intel64 ia32" +# @ECLASS-FUNCTION: intel_link_eclipse_plugins +# @DESCRIPTION: +# Creating necessary links to use intel compiler with eclipse +intel_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 +} + +# @ECLASS-FUNCTION: big-warning +# @INTERNAL +# warn user that we really require a license + +big-warning() { + case ${1} in + 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 +} + +# @ECLASS-FUNCTION: _version_test +# @INTERNAL +# Testing for valid license by asking for version information of the compiler +_version-test() { + local _comp _comp_full _arch _file _warn + case ${PN} in + ifc ) + _comp=ifort + ;; + 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" ]] && big-warning test-failed +} + +# @ECLASS-FUNCTION: _compile-test +# @INTERNAL +# Testing for valid license with small compile test +_compile-test() { + local _comp _comp_full _arch _file _warn + case ${1} in + fortran ) + _file="${T}/${1}.f" + cat > "${_file}" <<- EOF + end + EOF + _comp=ifort + ;; + c ) + _file="${T}/${1}.c" + cat > "${_file}" <<- EOF + main() { + ; + } + EOF + _comp=icc + ;; + *) + die "This ${1} 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}\" -c \"${_file}" + +# LD_LIBRARY_PATH="${INTEL_SDP_EDIR}/bin/${_arch}/" "${_comp_full}" -c "${_file}" &>/dev/null + + 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" ]] && big-warning test-failed +} + +# @ECLASS-FUNCTION: _compile-fortran +# @INTERNAL +# Run fortran compile test +_compile-fortran() { _compile-test fortran; } + +# @ECLASS-FUNCTION: _compile-c +# @INTERNAL +# Run c compile test +_compile-c() { _compile-test c; } + +# @ECLASS-FUNCTION: run-test +# @INTERNAL +# Test if installed compiler is working +run-test() { + case ${PN} in + ifc ) + debug-print "Testing ifort" + _compile-fortran ;; + icc ) + debug-print "Testing icc" + _compile-c ;; + * ) + debug-print "No test available for ${PN}" + ;; + esac +} + + # @ ECLASS-FUNCTION: intel-sdp_pkg_setup # @DESCRIPTION: # The setup finction serves two purposes: @@ -214,28 +394,6 @@ intel-sdp_src_unpack() { mv -v opt/intel/* ${INTEL_SDP_DIR} || die "mv to INTEL_SDP_DIR failed" } -intel_link_eclipse_plugins() { - pushd ${INTEL_SDP_DIR}/eclipse_support > /dev/null - local c f - 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 -} - # @ ECLASS-FUNCTION: intel-sdp_src_install # @DESCRIPTION: # Install everything @@ -281,160 +439,6 @@ intel-sdp_src_install() { keepdir "${INTEL_SDP_EDIR}"/licenses } -# @ECLASS-FUNCTION: big-warning -# @INTERNAL -# warn user that we really require a license - -big-warning() { - case ${1} in - 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 -} - -# @ECLASS-FUNCTION: _version_test -# @INTERNAL -# Testing for valid license by asking for version information of the compiler -_version-test() { - local _comp _comp_full _arch _file _warn - case ${PN} in - ifc ) - _comp=ifort - ;; - 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" ]] && big-warning test-failed -} - -# @ECLASS-FUNCTION: _compile-test -# @INTERNAL -# Testing for valid license with small compile test -_compile-test() { - local _comp _comp_full _arch _file _warn - case ${1} in - fortran ) - _file="${T}/${1}.f" - cat > "${_file}" <<- EOF - end - EOF - _comp=ifort - ;; - c ) - _file="${T}/${1}.c" - cat > "${_file}" <<- EOF - main() { - ; - } - EOF - _comp=icc - ;; - *) - die "This ${1} 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}\" -c \"${_file}" - -# LD_LIBRARY_PATH="${INTEL_SDP_EDIR}/bin/${_arch}/" "${_comp_full}" -c "${_file}" &>/dev/null - - 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" ]] && big-warning test-failed -} - -# @ECLASS-FUNCTION: _compile-fortran -# @INTERNAL -# Run fortran compile test -_compile-fortran() { _compile-test fortran; } - -# @ECLASS-FUNCTION: _compile-c -# @INTERNAL -# Run c compile test -_compile-c() { _compile-test c; } - -# @ECLASS-FUNCTION: run-test -# @INTERNAL -# Test if installed compiler is working -run-test() { - case ${PN} in - ifc ) - debug-print "Testing ifort" - _compile-fortran ;; - icc ) - debug-print "Testing icc" - _compile-c ;; - * ) - debug-print "No test available for ${PN}" - ;; - esac -} - -# @ECLASS-VARIABLE: INTEL_SDP_DB -# @DESCRIPTION: -# Full path to intel registry db -INTEL_SDP_DB="${EROOT%/}"/opt/intel/intel-sdp-products.db - # @ECLASS-FUNCTION # @DESCRIPTION: # Add things to intel database -- cgit v1.2.3