summaryrefslogtreecommitdiff
path: root/eclass
diff options
context:
space:
mode:
authorChen, Chih-Chia <pigfoot@gmail.com>2017-06-20 18:23:03 +0800
committerChen, Chih-Chia <pigfoot@gmail.com>2017-06-20 18:23:03 +0800
commitebbba7dd920f22899232384053bf85d60b88eacc (patch)
tree3b984d1d18c6c8ec947732852c4a174e07075e69 /eclass
parentUpdate golang eclass (diff)
downloadpigfoot-ebbba7dd920f22899232384053bf85d60b88eacc.tar.gz
pigfoot-ebbba7dd920f22899232384053bf85d60b88eacc.tar.bz2
pigfoot-ebbba7dd920f22899232384053bf85d60b88eacc.zip
Add sci-libs/mkl
Diffstat (limited to 'eclass')
-rw-r--r--eclass/alternatives-2.eclass142
-rw-r--r--eclass/intel-sdp-r1.eclass643
-rw-r--r--eclass/numeric-int64-multibuild.eclass396
-rw-r--r--eclass/numeric.eclass138
4 files changed, 1319 insertions, 0 deletions
diff --git a/eclass/alternatives-2.eclass b/eclass/alternatives-2.eclass
new file mode 100644
index 0000000..0682240
--- /dev/null
+++ b/eclass/alternatives-2.eclass
@@ -0,0 +1,142 @@
+# Copyright 2010-2017 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+# Based in part upon 'alternatives.exlib' from Exherbo, which is:
+# Copyright 2008, 2009 Bo Ørsted Andresen
+# Copyright 2008, 2009 Mike Kelly
+# Copyright 2009 David Leverton
+
+# @ECLASS: alternatives-2.eclass
+# @MAINTAINER:
+# Gentoo Science Project <sci@gentoo.org>
+# @BLURB: Manage alternative implementations.
+# @DESCRIPTION:
+# Autogenerate eselect modules for alternatives and ensure that valid provider
+# is set.
+#
+# Remove eselect modules when last provider is unmerged.
+#
+# If your package provides pkg_postinst or pkg_prerm phases, you need to be
+# sure you explicitly run alternatives-2_pkg_{postinst,prerm} where appropriate.
+
+case "${EAPI:-0}" in
+ 0|1|2|3|4)
+ die "Unsupported EAPI=${EAPI:-0} (too old) for ${ECLASS}"
+ ;;
+ 5|6)
+ ;;
+ *)
+ die "Unsupported EAPI=${EAPI} (unknown) for ${ECLASS}"
+ ;;
+esac
+
+DEPEND=">=app-admin/eselect-1.4.9-r100"
+RDEPEND="${DEPEND}
+ !app-eselect/eselect-blas
+ !app-eselect/eselect-cblas
+ !app-eselect/eselect-lapack"
+
+# @ECLASS-VARIABLE: ALTERNATIVES_DIR
+# @INTERNAL
+# @DESCRIPTION:
+# Alternatives directory with symlinks managed by eselect.
+ALTERNATIVES_DIR="/etc/env.d/alternatives"
+
+# @FUNCTION: alternatives_for
+# @USAGE: <alternative> <provider> <importance> <source> <target> [<source> <target> [...]]
+# @DESCRIPTION:
+# Set up alternative provider.
+#
+# EXAMPLE:
+# @CODE
+# alternatives_for sh bash 0 \
+# /usr/bin/sh bash
+# @CODE
+alternatives_for() {
+ debug-print-function ${FUNCNAME} "${@}"
+
+ dodir /etc/env.d/alternatives
+
+ ALTERNATIVESDIR_ROOT="${D%/}" \
+ eselect alternatives add ${@} || die
+
+ ALTERNATIVES_CREATED+=( ${1} )
+}
+
+# @FUNCTION: cleanup_old_alternatives_module
+# @USAGE: <alternative>
+# @DESCRIPTION:
+# Remove old alternatives module.
+cleanup_old_alternatives_module() {
+ debug-print-function ${FUNCNAME} "${@}"
+
+ local alt=${1} old_module="${EROOT%/}/usr/share/eselect/modules/${alt}.eselect"
+
+ if [[ -f "${old_module}" && $(grep 'ALTERNATIVE=' "${old_module}" | cut -d '=' -f 2) == "${alt}" ]]; then
+ local version="$(grep 'VERSION=' "${old_module}" | grep -o '[0-9.]\+')"
+ if [[ "${version}" == "0.1" || "${version}" == "20080924" ]]; then
+ einfo "rm ${old_module}"
+ rm "${old_module}" || eerror "rm ${old_module} failed"
+ fi
+ fi
+}
+
+# @FUNCTION: alternatives-2_pkg_postinst
+# @DESCRIPTION:
+# Create eselect modules for all provided alternatives if necessary and ensure
+# that valid provider is set.
+#
+# Also remove old eselect modules for provided alternatives.
+#
+# Provided alternatives are set up using alternatives_for().
+alternatives-2_pkg_postinst() {
+ debug-print-function ${FUNCNAME} "${@}"
+
+ local alt
+
+ for alt in ${ALTERNATIVES_CREATED[@]}; do
+ if ! eselect ${alt} show > /dev/null; then
+ einfo "Creating Alternative for ${alt}"
+ eselect alternatives create ${alt}
+ fi
+
+ # Set alternative provider if there is no valid provider selected
+ eselect alternatives update "${alt}"
+
+ cleanup_old_alternatives_module ${alt}
+ done
+}
+
+# @FUNCTION: alternatives-2_pkg_prerm
+# @DESCRIPTION:
+# Ensure a valid provider is set in case the package is unmerged and
+# remove autogenerated eselect modules for alternative when last
+# provider is unmerged.
+#
+# Provided alternatives are set up using alternatives_for().
+alternatives-2_pkg_prerm() {
+ debug-print-function ${FUNCNAME} "${@}"
+
+ local alt ret
+
+ # If we are uninstalling, update alternatives to valid provider
+ [[ -n ${REPLACED_BY_VERSION} ]] || ignore="--ignore"
+ for alt in ${ALTERNATIVES_CREATED[@]}; do
+ eselect alternatives update "${alt}"
+ ret=$?
+
+ case ${ret} in
+ 0) : ;;
+ 2)
+ # This was last provider for the alternative, remove eselect module
+ einfo "Cleaning up unused alternatives module for ${alt}"
+ eselect alternatives delete "${alt}" || eerror "Failed to remove ${alt}"
+ ;;
+ *)
+ eerror "eselect alternatives update returned \"${ret}\""
+ ;;
+ esac
+ done
+}
+
+EXPORT_FUNCTIONS pkg_postinst pkg_prerm
diff --git a/eclass/intel-sdp-r1.eclass b/eclass/intel-sdp-r1.eclass
new file mode 100644
index 0000000..ce191ac
--- /dev/null
+++ b/eclass/intel-sdp-r1.eclass
@@ -0,0 +1,643 @@
+# Copyright 1999-2017 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+# @ECLASS: intel-sdp-r1.eclass
+# @MAINTAINER:
+# Justin Lecher <jlec@gentoo.org>
+# David Seifert <soap@gentoo.org>
+# Sci Team <sci@gentoo.org>
+# @BLURB: Handling of Intel's Software Development Products package management
+
+MULTILIB_COMPAT=( abi_x86_{32,64} )
+
+inherit check-reqs eutils multilib-build versionator
+
+EXPORT_FUNCTIONS src_unpack src_install pkg_postinst pkg_postrm pkg_pretend
+
+if [[ ! ${_INTEL_SDP_R1_ECLASS_} ]]; then
+
+case "${EAPI}" in
+ 6) ;;
+ *) die "EAPI=${EAPI} is not supported" ;;
+esac
+
+# @ECLASS-VARIABLE: INTEL_DIST_SKU
+# @DEFAULT_UNSET
+# @DESCRIPTION:
+# The package download ID from Intel.
+# To determine its value, see the links to download in
+# https://registrationcenter.intel.com/RegCenter/MyProducts.aspx
+#
+# e.g. 8365
+#
+# Must be defined before inheriting the eclass.
+
+# @ECLASS-VARIABLE: INTEL_DIST_NAME
+# @DESCRIPTION:
+# The package name to download from Intel.
+# To determine 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.
+: ${INTEL_DIST_NAME:=parallel_studio_xe}
+
+# @ECLASS-VARIABLE: INTEL_DIST_PV
+# @DEFAULT_UNSET
+# @DESCRIPTION:
+# The package download version from Intel.
+# To determine its value, see the links to download in
+# https://registrationcenter.intel.com/RegCenter/MyProducts.aspx
+#
+# e.g. 2016_update1
+#
+# Must be defined before inheriting the eclass.
+
+# @ECLASS-VARIABLE: INTEL_DIST_TARX
+# @DESCRIPTION:
+# The package distfile suffix.
+# To determine its value, see the links to download in
+# https://registrationcenter.intel.com/RegCenter/MyProducts.aspx
+#
+# e.g. tgz
+#
+# Must be defined before inheriting the eclass.
+: ${INTEL_DIST_TARX:=tgz}
+
+# @ECLASS-VARIABLE: INTEL_SUBDIR
+# @DESCRIPTION:
+# The package sub-directory (without version numbers) where it will end-up in /opt/intel
+#
+# e.g. compilers_and_libraries
+#
+# To determine its value, you have to do a raw install from the Intel tarball.
+: ${INTEL_SUBDIR:=compilers_and_libraries}
+
+# @ECLASS-VARIABLE: INTEL_SKIP_LICENSE
+# @DEFAULT_UNSET
+# @DESCRIPTION:
+# Possibility to skip the mandatory check for licenses. Only set this if there
+# is really no fix.
+
+# @ECLASS-VARIABLE: INTEL_RPMS_DIR
+# @DESCRIPTION:
+# Main subdirectory which contains the rpms to extract.
+: ${INTEL_RPMS_DIR:=rpm}
+
+# @ECLASS-VARIABLE: INTEL_X86
+# @DESCRIPTION:
+# 32bit arch in rpm names
+#
+# e.g. i486
+: ${INTEL_X86:=i486}
+
+# @ECLASS-VARIABLE: INTEL_DIST_BIN_RPMS
+# @DESCRIPTION:
+# Functional name of rpm without any version/arch tag.
+# Has to be a bash array
+#
+# e.g. ("icc-l-all-devel")
+#
+# if the rpm is located in a directory other than INTEL_RPMS_DIR you can
+# specify the full path
+#
+# e.g. ("CLI_install/rpm/intel-vtune-amplifier-xe-cli")
+[[ ${INTEL_DIST_BIN_RPMS[@]} ]] || INTEL_DIST_BIN_RPMS=()
+
+# @ECLASS-VARIABLE: INTEL_DIST_AMD64_RPMS
+# @DESCRIPTION:
+# AMD64 single arch rpms. Same syntax as INTEL_DIST_BIN_RPMS.
+# Has to be a bash array.
+[[ ${INTEL_DIST_AMD64_RPMS[@]} ]] || INTEL_DIST_AMD64_RPMS=()
+
+# @ECLASS-VARIABLE: INTEL_DIST_X86_RPMS
+# @DESCRIPTION:
+# X86 single arch rpms. Same syntax as INTEL_DIST_BIN_RPMS.
+# Has to be a bash array.
+[[ ${INTEL_DIST_X86_RPMS[@]} ]] || INTEL_DIST_X86_RPMS=()
+
+# @ECLASS-VARIABLE: INTEL_DIST_DAT_RPMS
+# @DESCRIPTION:
+# Functional name of rpm of common data which are arch free
+# without any version tag. Has to be a bash array.
+#
+# e.g. ("openmp-l-all-devel")
+#
+# if the rpm is located in a directory different to INTEL_RPMS_DIR you can
+# specify the full path
+#
+# e.g. ("CLI_install/rpm/intel-vtune-amplifier-xe-cli-common")
+[[ ${INTEL_DIST_DAT_RPMS[@]} ]] || INTEL_DIST_DAT_RPMS=()
+
+# @ECLASS-VARIABLE: INTEL_DIST_SPLIT_ARCH
+# @DESCRIPTION:
+# Set to "true" if arches are to be fetched separately, instead of using
+# the combined tarball.
+: ${INTEL_DIST_SPLIT_ARCH:=false}
+
+# @ECLASS-VARIABLE: INTEL_SDP_FULL_PV
+# @INTERNAL
+# @DESCRIPTION:
+# Workaround the find the installed version of parallel_studio_xe.
+: ${INTEL_SDP_FULL_PV:=}
+
+# @FUNCTION: _isdp_get-sdp-full-pv
+# @INTERNAL
+# @DESCRIPTION:
+# Gets the full internal Intel version specifier.
+_isdp_get-sdp-full-pv() {
+ local _intel_pv=($(get_version_components))
+ case ${#_intel_pv[@]} in
+ 3)
+ if [[ "${INTEL_DIST_NAME}" == "l_mkl" ]] && [[ "${_intel_pv[0]}" == "2017" ]]; then
+ # workaround for mkl 2017.3.196 but in /opt/intel/compilers_and_libraries_2017.4.196
+ local _intel_pv_full="${_intel_pv[2]}-${_intel_pv[0]}.3-${_intel_pv[2]}"
+ else
+ local _intel_pv_full="${_intel_pv[0]}.${_intel_pv[1]}-${_intel_pv[2]}"
+ fi
+ ;;
+ 4)
+ local _intel_pv_full="${_intel_pv[3]}-${_intel_pv[0]}.${_intel_pv[1]}.${_intel_pv[2]}-${_intel_pv[3]}"
+ ;;
+ esac
+ echo "${_intel_pv_full}"
+}
+
+# @FUNCTION: _isdp_get-sdp-year
+# @INTERNAL
+# @DESCRIPTION:
+# Gets the year component from INTEL_DIST_PV
+_isdp_get-sdp-year() {
+ local _intel_sdp_year
+ _intel_sdp_year=${INTEL_DIST_PV}
+ _intel_sdp_year=${_intel_sdp_year%_sp*}
+ _intel_sdp_year=${_intel_sdp_year%_update*}
+ echo "${_intel_sdp_year}"
+}
+
+# @FUNCTION: isdp_get-sdp-dir
+# @DESCRIPTION:
+# Gets the full rootless path to the installation directory
+#
+# e.g. opt/intel/compilers_and_libraries_2016.1.150
+isdp_get-sdp-dir() {
+ if [[ ! -e "${T}/SDP_FULL_PV" ]]; then
+ local _intel_sdp_dir="opt/intel/${INTEL_SUBDIR}_$(_isdp_get-sdp-year).$(get_version_component_range 3-4)"
+ else
+ local _intel_sdp_dir="opt/intel/${INTEL_SUBDIR}_$(cat ${T}/SDP_FULL_PV)"
+ fi
+ echo "${_intel_sdp_dir}"
+}
+
+# @FUNCTION: isdp_get-sdp-edir
+# @DESCRIPTION:
+# Gets the full rooted/prefixed path to the installation directory
+#
+# e.g. /opt/intel/compilers_and_libraries_2016.1.150
+isdp_get-sdp-edir() {
+ local _intel_sdp_edir="${EPREFIX%/}/$(isdp_get-sdp-dir)"
+ echo "${_intel_sdp_edir}"
+}
+
+_INTEL_URI="http://registrationcenter-download.intel.com/akdlm/irc_nas/${INTEL_DIST_SKU}/${INTEL_DIST_NAME}"
+if [[ "${INTEL_DIST_SPLIT_ARCH}" != true ]]; then
+ SRC_URI="${_INTEL_URI}_${INTEL_DIST_PV}.${INTEL_DIST_TARX}"
+else
+ SRC_URI="
+ abi_x86_32? ( ${_INTEL_URI}_${INTEL_DIST_PV}_ia32.${INTEL_DIST_TARX} )
+ abi_x86_64? ( ${_INTEL_URI}_${INTEL_DIST_PV}_intel64.${INTEL_DIST_TARX} )"
+fi
+unset _INTEL_URI
+
+LICENSE="Intel-SDP"
+# TODO: Proper slotting
+# Future work, #394411
+SLOT="0"
+
+RESTRICT="mirror"
+
+RDEPEND=""
+DEPEND="app-arch/rpm2targz"
+
+S="${WORKDIR}"
+
+QA_PREBUILT="$(isdp_get-sdp-dir)/*"
+
+# @FUNCTION: isdp_convert2intel-arch
+# @USAGE: <arch>
+# @DESCRIPTION:
+# Convert between portage arch (e.g. amd64, x86) and intel installed arch
+# nomenclature (e.g. intel64, ia32)
+isdp_convert2intel-arch() {
+ debug-print-function ${FUNCNAME} "${@}"
+
+ case $1 in
+ *amd64*|abi_x86_64)
+ echo "intel64"
+ ;;
+ *x86*)
+ echo "ia32"
+ ;;
+ *)
+ die "Abi \'$1\' is unsupported"
+ ;;
+ esac
+}
+
+# @FUNCTION: isdp_get-native-abi-arch
+# @DESCRIPTION:
+# Determine the the intel arch string of the native ABI
+isdp_get-native-abi-arch() {
+ debug-print-function ${FUNCNAME} "${@}"
+
+ use amd64 && echo "$(isdp_convert2intel-arch abi_x86_64)"
+ use x86 && echo "$(isdp_convert2intel-arch abi_x86_32)"
+}
+
+# @FUNCTION: isdp_get-sdp-installed-arches
+# @DESCRIPTION:
+# Returns a space separated list of the arch suffixes used in directory
+# names for enabled ABIs. Intel uses "ia32" for x86 and "intel64" for
+# amd64. The result would be "ia32 intel64" if both ABIs were enabled.
+isdp_get-sdp-installed-arches() {
+ local arch=()
+ use abi_x86_64 && arch+=($(isdp_convert2intel-arch abi_x86_64))
+ use abi_x86_32 && arch+=($(isdp_convert2intel-arch abi_x86_32))
+ echo "${arch[*]}"
+}
+
+# @FUNCTION: _isdp_get-sdp-source-rpm-arches
+# @INTERNAL
+# @DESCRIPTION:
+# Returns a space separated list of the arch suffixes used in the RPM filenames, e.g.
+#
+# intel-openmp-l-all-150-16.0.1-150.i486.rpm
+# intel-openmp-l-all-150-16.0.1-150.x86_64.rpm
+#
+# the result would consist of "i486 x86_64".
+_isdp_get-sdp-source-rpm-arches() {
+ local arch=()
+ use abi_x86_64 && arch+=("x86_64")
+ use abi_x86_32 && arch+=("${INTEL_X86}")
+ echo "${arch[*]}"
+}
+
+# @FUNCTION: _isdp_generate-list-install-rpms
+# @INTERNAL
+# @DESCRIPTION:
+# Generates the list of fully expanded RPMs to be extracted.
+_isdp_generate-list-install-rpms() {
+ debug-print-function ${FUNCNAME} "${@}"
+
+ # Expand components into full RPM filenames
+ expand_component_into_full_rpm() {
+ local deref_var="${1}[@]"
+ local arch="${2}"
+ local p a rpm_prefix rpm_suffix expanded_full_rpms=()
+
+ for p in "${!deref_var}"; do
+ for a in ${arch}; do
+ # check if a directory is prefixed
+ if [[ "${p}" == "${p##*/}" ]]; then
+ rpm_prefix="${INTEL_RPMS_DIR}/intel-"
+ else
+ rpm_prefix=""
+ fi
+
+ # check for variables ending in ".rpm"
+ # these are excluded from version expansion, due to Intel's
+ # idiosyncratic versioning scheme beginning with their 2016
+ # suite of tools. For instance
+ #
+ # intel-ccompxe-2016.1-056.noarch.rpm
+ #
+ # which is completely unpredictable using versions
+ if [[ "${p}" == *.rpm ]]; then
+ rpm_suffix=""
+ else
+ rpm_suffix="-$(_isdp_get-sdp-full-pv).${a}.rpm"
+ #workaround to find RPM filename from tgz
+ #if [[ -z "${INTEL_SDP_FULL_PV}" ]]; then
+ # INTEL_SDP_FULL_PV=$(tar -tzf "${DISTDIR}/${t}" | sed -rn "/${rpm_prefix////\\/}${p////\\/}/s#.*\/${rpm_prefix////\\/}${p////\\/}-([[:digit:]\.-]+)\.${a}\.rpm#\1#p")
+ #fi
+ #rpm_suffix="-${INTEL_SDP_FULL_PV}.${a}.rpm"
+ fi
+
+ expanded_full_rpms+=( "${rpm_prefix}${p}${rpm_suffix}" )
+ done
+ done
+ echo ${expanded_full_rpms[*]}
+ }
+
+ local vars_to_expand=("INTEL_DIST_BIN_RPMS" "INTEL_DIST_DAT_RPMS")
+ local vars_to_expand_suffixes=("$(_isdp_get-sdp-source-rpm-arches)" "noarch")
+ if use abi_x86_32; then
+ vars_to_expand+=("INTEL_DIST_X86_RPMS")
+ vars_to_expand_suffixes+=("${INTEL_X86}")
+ fi
+ if use abi_x86_64; then
+ vars_to_expand+=("INTEL_DIST_AMD64_RPMS")
+ vars_to_expand_suffixes+=("x86_64")
+ fi
+
+ local i fully_expanded_intel_rpms=()
+ for ((i=0; i<${#vars_to_expand[@]}; i++)); do
+ fully_expanded_intel_rpms+=($(expand_component_into_full_rpm "${vars_to_expand[i]}" "${vars_to_expand_suffixes[i]}"))
+ done
+ echo ${fully_expanded_intel_rpms[*]}
+}
+
+# @FUNCTION: _isdp_big-warning
+# @USAGE: [pre-check | test-failed]
+# @INTERNAL
+# @DESCRIPTION:
+# warn user that we really require a license
+_isdp_big-warning() {
+ debug-print-function ${FUNCNAME} "${@}"
+
+ case ${1} in
+ pre-check )
+ ewarn "License file not found!"
+ ;;
+
+ test-failed )
+ ewarn "Function test failed. Most probably due to an invalid license."
+ ewarn "This means you already tried to bypass the license check once."
+ ;;
+ esac
+
+ ewarn
+ ewarn "Make sure you have received an Intel license."
+ ewarn "To receive a non-commercial license, you need to register at:"
+ ewarn "https://software.intel.com/en-us/qualify-for-free-software"
+ ewarn "Install the license file into ${EPREFIX}/opt/intel/licenses"
+ ewarn
+ ewarn "Beginning with the 2016 suite of tools, license files are keyed"
+ ewarn "to the MAC address of the eth0 interface. In order to retrieve"
+ ewarn "a personalized license file, follow the instructions at"
+ ewarn "https://software.intel.com/en-us/articles/how-do-i-get-my-license-file-for-intel-parallel-studio-xe-2016"
+
+ case ${1} in
+ pre-check )
+ ewarn "before proceeding with installation of ${P}"
+ ;;
+ * )
+ ;;
+ esac
+}
+
+# @FUNCTION: _isdp_version_test
+# @INTERNAL
+# @DESCRIPTION:
+# Testing for valid license by asking for version information of the compiler.
+_isdp_version_test() {
+ debug-print-function ${FUNCNAME} "${@}"
+
+ local comp
+ 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
+
+ local comp_full arch warn
+ for arch in $(isdp_get-sdp-installed-arches); do
+ case ${EBUILD_PHASE} in
+ install )
+ comp_full="${ED%/}/$(isdp_get-sdp-dir)/linux/bin/${arch}/${comp}"
+ ;;
+ postinst )
+ comp_full="$(isdp_get-sdp-edir)/linux/bin/${arch}/${comp}"
+ ;;
+ * )
+ die "Compile test not supported in ${EBUILD_PHASE}"
+ ;;
+ esac
+
+ debug-print "LD_LIBRARY_PATH=\"$(isdp_get-sdp-edir)/linux/bin/${arch}/\" \"${comp_full}\" -V"
+
+ LD_LIBRARY_PATH="$(isdp_get-sdp-edir)/linux/bin/${arch}/" "${comp_full}" -V &>/dev/null || warn=yes
+ done
+ [[ ${warn} == yes ]] && _isdp_big-warning test-failed
+}
+
+# @FUNCTION: _isdp_run-test
+# @INTERNAL
+# @DESCRIPTION:
+# Test if installed compiler is working.
+_isdp_run-test() {
+ debug-print-function ${FUNCNAME} "${@}"
+
+ if [[ -z ${INTEL_SKIP_LICENSE} ]]; then
+ case ${PN} in
+ ifc | icc )
+ _isdp_version_test
+ ;;
+ * )
+ debug-print "No test available for ${PN}"
+ ;;
+ esac
+ fi
+}
+
+# @FUNCTION: intel-sdp-r1_pkg_pretend
+# @DESCRIPTION:
+#
+# * Check for a (valid) license before proceeding.
+#
+# * Check for space requirements being fulfilled.
+#
+intel-sdp-r1_pkg_pretend() {
+ debug-print-function ${FUNCNAME} "${@}"
+
+ local warn=1 dir dirs ret arch a p
+
+ : ${CHECKREQS_DISK_BUILD:=256M}
+ check-reqs_pkg_pretend
+
+ if [[ -z ${INTEL_SKIP_LICENSE} ]]; then
+ if [[ ${INTEL_LICENSE_FILE} == *@* ]]; then
+ einfo "Looks like you are using following license server:"
+ einfo " ${INTEL_LICENSE_FILE}"
+ return 0
+ fi
+
+ dirs=(
+ "${EPREFIX}/opt/intel/licenses"
+ "$(isdp_get-sdp-edir)/licenses"
+ "$(isdp_get-sdp-edir)/Licenses"
+ )
+ for dir in "${dirs[@]}" ; do
+ ebegin "Checking for a license in: ${dir}"
+ path_exists "${dir}"/*lic && warn=0
+ eend ${warn} && break
+ done
+ if [[ ${warn} == 1 ]]; then
+ _isdp_big-warning pre-check
+ die "Could not find license file"
+ fi
+ else
+ eqawarn "The ebuild doesn't check for presence of a proper intel license!"
+ eqawarn "This shouldn't be done unless there is a very good reason."
+ fi
+}
+
+# @FUNCTION: intel-sdp-r1_src_unpack
+# @DESCRIPTION:
+# Unpacking necessary rpms from tarball, extract them and rearrange the output.
+intel-sdp-r1_src_unpack() {
+ local t
+ for t in ${A}; do
+ local r list=() source_rpms=($(_isdp_generate-list-install-rpms))
+ for r in "${source_rpms[@]}"; do
+ list+=( ${t%.*}/${r} )
+ done
+
+ local debug_list
+ debug_list="$(IFS=$'\n'; echo ${list[@]} )"
+
+ debug-print "Adding to decompression list:"
+ debug-print ${debug_list}
+
+ tar -xvf "${DISTDIR}"/${t} ${list[@]} &> "${T}"/rpm-extraction.log
+
+ for r in ${list[@]}; do
+ einfo "Unpacking ${r}"
+ printf "\nUnpacking %s\n" "${r}" >> "${T}"/rpm-extraction.log
+ rpm2tar -O ${r} | tar -xvf - &>> "${T}"/rpm-extraction.log; assert "Unpacking ${r} failed"
+ if [[ ! -e "${T}"/SDP_FULL_PV ]]; then
+ rpm2tar -O ${r} | tar -t | sed -rn "/${INTEL_SUBDIR}/s#.*${INTEL_SUBDIR}_([[:digit:]\.-]+)/\$#\1#p" > "${T}"/SDP_FULL_PV
+ fi
+ done
+ done
+}
+
+# @FUNCTION: intel-sdp-r1_src_install
+# @DESCRIPTION:
+# Install everything
+intel-sdp-r1_src_install() {
+ debug-print-function ${FUNCNAME} "${@}"
+
+ local i
+ # remove uninstall information
+ ebegin "Cleaning out uninstall"
+ while IFS='\n' read -r -d '' i; do
+ rm -r "${i}" || die
+ done < <(find opt -regextype posix-extended -regex '.*(uninstall|uninstall.sh)$' -print0)
+ eend
+
+ # remove remaining japanese stuff
+ if ! use linguas_ja; then
+ ebegin "Cleaning out japanese language directories"
+ while IFS='\n' read -r -d '' i; do
+ rm -r "${i}" || die
+ done < <(find opt -type d -regextype posix-extended -regex '.*(ja|ja_JP)$' -print0)
+ eend
+ fi
+
+ # handle documentation
+ if path_exists "opt/intel/documentation_$(_isdp_get-sdp-year)"; then
+ # normal man pages
+ if path_exists "opt/intel/documentation_$(_isdp_get-sdp-year)/en/man/common/man1"; then
+ doman opt/intel/documentation_"$(_isdp_get-sdp-year)"/en/man/common/man1/*
+ rm -r opt/intel/documentation_"$(_isdp_get-sdp-year)"/en/man || die
+ fi
+
+ use doc && dodoc -r opt/intel/documentation_"$(_isdp_get-sdp-year)"/*
+
+ ebegin "Cleaning out documentation"
+ rm -r "opt/intel/documentation_$(_isdp_get-sdp-year)" || die
+ rm -rf "$(isdp_get-sdp-dir)"/linux/{documentation,man} || die
+ eend
+ fi
+
+ # MPI man pages
+ if path_exists "$(isdp_get-sdp-dir)/linux/mpi/man/man3"; then
+ doman "$(isdp_get-sdp-dir)"/linux/mpi/man/man3/*
+ rm -r "$(isdp_get-sdp-dir)"/linux/mpi/man || die
+ fi
+
+ # licensing docs
+ if path_exists "$(isdp_get-sdp-dir)/licensing/documentation"; then
+ dodoc -r "$(isdp_get-sdp-dir)/licensing/documentation"/*
+ rm -rf "$(isdp_get-sdp-dir)/licensing/documentation" || die
+ fi
+
+ if path_exists opt/intel/"${INTEL_DIST_NAME}"*/licensing; then
+ dodoc -r opt/intel/"${INTEL_DIST_NAME}"*/licensing
+ rm -rf opt/intel/"${INTEL_DIST_NAME}"* || die
+ fi
+
+ # handle examples
+ if path_exists "opt/intel/samples_$(_isdp_get-sdp-year)"; then
+ use examples && dodoc -r opt/intel/samples_"$(_isdp_get-sdp-year)"/*
+
+ ebegin "Cleaning out examples"
+ rm -r "opt/intel/samples_$(_isdp_get-sdp-year)" || die
+ eend
+ fi
+
+ # remove eclipse unconditionally
+ ebegin "Cleaning out eclipse files"
+ rm -rf opt/intel/ide_support_* || die
+ eend
+
+ # repair shell scripts used for sourcing PATH (iccvars.sh and such)
+ ebegin "Tagging ${PN}"
+ find opt -name \*sh -type f -exec sed -i \
+ -e "s:<.*DIR>:$(isdp_get-sdp-edir)/linux:g" \
+ '{}' + || die
+ eend
+
+ ebegin "Removing broken symlinks"
+ while IFS='\n' read -r -d '' i; do
+ rm "${i}" || die
+ done < <(find opt -xtype l -print0)
+ eend
+
+ mv opt "${ED%/}"/ || die "moving files failed"
+
+ keepdir "$(isdp_get-sdp-dir)"/licenses /opt/intel/ism/rm
+}
+
+# @FUNCTION: intel-sdp-r1_pkg_postinst
+# @DESCRIPTION:
+# Test for all things working
+intel-sdp-r1_pkg_postinst() {
+ debug-print-function ${FUNCNAME} "${@}"
+
+ _isdp_run-test
+
+ if [[ ${PN} = icc ]] && has_version ">=dev-util/ccache-3.1.9-r2" ; then
+ #add ccache links as icc might get installed after ccache
+ "${EROOT}"/usr/bin/ccache-config --install-links
+ fi
+
+ elog "Beginning with the 2016 suite of Intel tools, Gentoo has removed"
+ elog "support for the eclipse plugin. If you require the IDE support,"
+ elog "you will have to install the suite on your own, outside portage."
+}
+
+# @FUNCTION: intel-sdp-r1_pkg_postrm
+# @DESCRIPTION:
+# Sanitize cache links
+intel-sdp-r1_pkg_postrm() {
+ debug-print-function ${FUNCNAME} "${@}"
+
+ if [[ ${PN} = icc ]] && has_version ">=dev-util/ccache-3.1.9-r2" && [[ -z ${REPLACED_BY_VERSION} ]]; then
+ # --remove-links would remove all links, --install-links updates them
+ "${EROOT}"/usr/bin/ccache-config --install-links
+ fi
+}
+
+_INTEL_SDP_R1_ECLASS_=1
+fi
diff --git a/eclass/numeric-int64-multibuild.eclass b/eclass/numeric-int64-multibuild.eclass
new file mode 100644
index 0000000..4f4dda3
--- /dev/null
+++ b/eclass/numeric-int64-multibuild.eclass
@@ -0,0 +1,396 @@
+# Copyright 1999-2017 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+# @ECLASS: numeric-int64-multilib.eclass
+# @MAINTAINER:
+# sci team <sci@gentoo.org>
+# @AUTHOR:
+# Author: Mark Wright <gienah@gentoo.org>
+# Author: Justin Lecher <jlec@gentoo.org>
+# @BLURB: Build functions for Fortran multilib int64 multibuild packages
+# @DESCRIPTION:
+# The numeric-int64-multilib.eclass exports USE flags and utility functions
+# necessary to build packages for multilib int64 multibuild in a clean
+# and uniform manner.
+
+if [[ ! ${_NUMERIC_INT64_MULTILIB_ECLASS} ]]; then
+
+# EAPI=5 is required for meaningful MULTILIB_USEDEP.
+case ${EAPI:-0} in
+ 5)
+ inherit multilib ;;
+ 6) ;;
+ *) die "EAPI=${EAPI} is not supported" ;;
+esac
+
+inherit alternatives-2 eutils fortran-2 multilib-build numeric toolchain-funcs
+
+IUSE="int64"
+
+# @ECLASS-VARIABLE: NUMERIC_INT32_SUFFIX
+# @INTERNAL
+# @DESCRIPTION:
+# MULTIBUILD_ID suffix for int32 build
+NUMERIC_INT32_SUFFIX="int32"
+
+# @ECLASS-VARIABLE: NUMERIC_INT64_SUFFIX
+# @INTERNAL
+# @DESCRIPTION:
+# MULTIBUILD_ID suffix for int64 build
+NUMERIC_INT64_SUFFIX="int64"
+
+# @ECLASS-VARIABLE: NUMERIC_STATIC_SUFFIX
+# @INTERNAL
+# @DESCRIPTION:
+# MULTIBUILD_ID suffix for static build
+NUMERIC_STATIC_SUFFIX="static"
+
+# @FUNCTION: numeric-int64_is_int64_build
+# @DESCRIPTION:
+# Returns shell true if the current multibuild is a int64 build,
+# else returns shell false.
+#
+# Example:
+#
+# @CODE
+# $(numeric-int64_is_int64_build) && \
+# openblas_abi_cflags+=" -DOPENBLAS_USE64BITINT"
+# @CODE
+numeric-int64_is_int64_build() {
+ debug-print-function ${FUNCNAME} "${@}"
+ if [[ "${MULTIBUILD_ID}" =~ "${NUMERIC_INT64_SUFFIX}" ]]; then
+ return 0
+ else
+ return 1
+ fi
+}
+
+# @FUNCTION: numeric-int64_is_static_build
+# @DESCRIPTION:
+# Returns shell true if current multibuild is a static build,
+# else returns shell false.
+#
+# Example:
+#
+# @CODE
+# if $(numeric-int64_is_static_build); then
+# dolib.a lib*a
+# fi
+# @CODE
+numeric-int64_is_static_build() {
+ debug-print-function ${FUNCNAME} "${@}"
+ if [[ "${MULTIBUILD_ID}" =~ "${NUMERIC_STATIC_SUFFIX}" ]]; then
+ return 0
+ else
+ return 1
+ fi
+}
+
+# @FUNCTION: numeric-int64_get_module_name
+# @USAGE: [<module_name>]
+# @DESCRIPTION:
+# Return the numeric module name, without the .pc extension,
+# for the current fortran int64 build. If the current build is not an int64
+# build, and the ebuild does not have dynamic, threads or openmp USE flags or
+# they are disabled, then the module_name is ${NUMERIC_MODULE_NAME} or
+# <module_name> if <module_name> is specified.
+#
+# Takes an optional <module_name> parameter. If no <module_name> is specified,
+# uses ${NUMERIC_MODULE_NAME} as the base to calculate the module_name for the
+# current build.
+#
+# Example:
+#
+# @CODE
+# NUMERIC_MODULE_NAME=blas
+# profname=$(numeric-int64_get_module_name)
+#
+# int32 build:
+# -> profname == blas
+#
+# int64 build:
+# -> profname == blas-int64
+# @CODE
+numeric-int64_get_module_name() {
+ debug-print-function ${FUNCNAME} "${@}"
+ local module_name="${1:-${NUMERIC_MODULE_NAME}}"
+ if has dynamic ${IUSE} && use dynamic; then
+ module_name+="-dynamic"
+ fi
+ if $(numeric-int64_is_int64_build); then
+ module_name+="-${NUMERIC_INT64_SUFFIX}"
+ fi
+ # choose posix threads over openmp when the two are set
+ # yet to see the need of having the two profiles simultaneously
+ if use_if_iuse threads; then
+ module_name+="-threads"
+ elif use_if_iuse openmp; then
+ module_name+="-openmp"
+ fi
+ echo "${module_name}"
+}
+
+# @FUNCTION: _numeric-int64_get_numeric_alternative
+# @INTERNAL
+_numeric-int64_get_numeric_alternative() {
+ debug-print-function ${FUNCNAME} "${@}"
+ local alternative_name="${1}"
+ if $(numeric-int64_is_int64_build); then
+ alternative_name+="-${NUMERIC_INT64_SUFFIX}"
+ fi
+ echo "${alternative_name}"
+}
+
+# @FUNCTION: numeric-int64_get_blas_alternative
+# @DESCRIPTION:
+# Returns the eselect blas alternative for the current
+# int build type. Which is blas-int64 if called from an int64 build,
+# or blas otherwise.
+numeric-int64_get_blas_alternative() {
+ debug-print-function ${FUNCNAME} "${@}"
+ _numeric-int64_get_numeric_alternative blas
+}
+
+# @FUNCTION: numeric-int64_get_cblas_alternative
+# @DESCRIPTION:
+# Returns the eselect cblas alternative for the current
+# int build type. Which is cblas-int64 if called from an int64 build,
+# or cblas otherwise.
+numeric-int64_get_cblas_alternative() {
+ debug-print-function ${FUNCNAME} "${@}"
+ _numeric-int64_get_numeric_alternative cblas
+}
+
+# @FUNCTION: numeric-int64_get_xblas_alternative
+# @DESCRIPTION:
+# Returns the eselect xblas alternative for the current
+# int build type. Which is xblas-int64 if called from an int64 build,
+# or xblas otherwise.
+numeric-int64_get_xblas_alternative() {
+ debug-print-function ${FUNCNAME} "${@}"
+ _numeric-int64_get_numeric_alternative xblas
+}
+
+# @FUNCTION: numeric-int64_get_lapack_alternative
+# @DESCRIPTION:
+# Returns the eselect lapack alternative for the current
+# int build type. Which is lapack-int64 if called from an int64 build,
+# or lapack otherwise.
+numeric-int64_get_lapack_alternative() {
+ debug-print-function ${FUNCNAME} "${@}"
+ _numeric-int64_get_numeric_alternative lapack
+}
+
+# @FUNCTION: numeric-int64_get_blas_module_name
+# @DESCRIPTION:
+# Returns the pkg-config file name, without the .pc extension,
+# for the currently selected blas-int64 module if we are performing an int64
+# build, or the currently selected blas module otherwise.
+numeric-int64_get_blas_module_name() {
+ debug-print-function ${FUNCNAME} "${@}"
+ local blas_alternative=$(numeric-int64_get_blas_alternative)
+ local blas_symlinks=( $(eselect "${blas_alternative}" files) )
+ local blas_prof_symlink="$(readlink -f ${blas_symlinks[0]})"
+ local blas_prof_file="${blas_prof_symlink##*/}"
+ echo "${blas_prof_file%.pc}"
+}
+
+# @FUNCTION: numeric-int64_get_xblas_module_name
+# @DESCRIPTION:
+# Returns the xblas pkg-config file name,
+# without the .pc extension, for the current build. Which is xblas-int64 if
+# we are performing an int64 build, or xblas otherwise.
+numeric-int64_get_xblas_module_name() {
+ debug-print-function ${FUNCNAME} "${@}"
+ local xblas_provider="xblas"
+ if $(numeric-int64_is_int64_build); then
+ xblas_provider+="-${INT64_SUFFIX}"
+ fi
+ echo "${xblas_provider}"
+}
+
+# @FUNCTION: numeric-int64_get_fortran_int64_abi_fflags
+# @DESCRIPTION:
+# Return the Fortran compiler flag to enable 64 bit integers for
+# array indices if we are performing an int64 build, or the empty string
+# otherwise.
+#
+# Example:
+#
+# @CODE
+# src_configure() {
+# my_configure() {
+# export FCFLAGS="${FCFLAGS} $(get_abi_CFLAGS) $(numeric-int64_get_fortran_int64_abi_fflags)"
+# econf $(use_enable fortran)
+# }
+# numeric-int64-multibuild_foreach_all_abi_variants run_in_build_dir my_configure
+# }
+# @CODE
+numeric-int64_get_fortran_int64_abi_fflags() {
+ debug-print-function ${FUNCNAME} "${@}"
+ $(numeric-int64_is_int64_build) && echo "$(fortran_int64_abi_fflags)"
+}
+
+# @FUNCTION: numeric-int64_get_multibuild_int_variants
+# @DESCRIPTION:
+# Returns the array of int64 and int32
+# multibuild combinations.
+numeric-int64_get_multibuild_int_variants() {
+ debug-print-function ${FUNCNAME} "${@}"
+ local MULTIBUILD_VARIANTS=( int32 ) variant
+
+ use_if_iuse int64 && MULTIBUILD_VARIANTS+=( int64 )
+
+ echo "${MULTIBUILD_VARIANTS[@]}"
+}
+
+# @FUNCTION: numeric-int64_get_multibuild_variants
+# @DESCRIPTION:
+# Returns the array of int64, int32 and static
+# multibuild combinations.
+numeric-int64_get_multibuild_variants() {
+ debug-print-function ${FUNCNAME} "${@}"
+ local MULTIBUILD_VARIANTS=$(numeric-int64_get_multibuild_int_variants)
+ if use_if_iuse static-libs; then
+ for variant in ${MULTIBUILD_VARIANTS[@]}; do
+ MULTIBUILD_VARIANTS+=( static_${variant} )
+ done
+ fi
+ echo "${MULTIBUILD_VARIANTS[@]}"
+}
+
+# @FUNCTION: numeric-int64_get_all_abi_variants
+# @DESCRIPTION:
+# Returns the array of int64, int32 and static build combinations
+# combined with all multilib ABI variants.
+numeric-int64_get_all_abi_variants() {
+ debug-print-function ${FUNCNAME} "${@}"
+ local abi ret=() variant
+
+ for abi in $(multilib_get_enabled_abis); do
+ for variant in $(numeric-int64_get_multibuild_variants); do
+ if [[ ${variant} =~ int64 ]]; then
+ [[ ${abi} =~ amd64 ]] && ret+=( ${abi}_${variant} )
+ else
+ ret+=( ${abi}_${variant} )
+ fi
+ done
+ done
+ echo "${ret[@]}"
+}
+
+# @FUNCTION: numeric-int64_ensure_blas_int_support
+# @DESCRIPTION:
+# Check the blas supports the necessary int types in the currently
+# selected blas module.
+#
+# Example:
+#
+# @CODE
+# src_prepare() {
+# numeric-int64_ensure_blas_int_support
+# ...
+# @CODE
+numeric-int64_ensure_blas_int_support() {
+ local MULTILIB_INT64_VARIANTS=( $(numeric-int64_get_multibuild_variants) )
+ local MULTIBUILD_ID
+ for MULTIBUILD_ID in "${MULTILIB_INT64_VARIANTS[@]}"; do
+ local blas_module_name=$(numeric-int64_get_blas_module_name)
+ $(tc-getPKG_CONFIG) --exists "${blas_module_name}" \
+ || die "${PN} requires the pkgbuild module ${blas_module_name}"
+ done
+}
+
+# @FUNCTION: numeric-int64-multibuild_install_alternative
+# @USAGE: <alternative name> <provider name> [extra files sources] [extra files dest]
+# @DESCRIPTION:
+# Install alternatives pc file and extra files for all providers for all multilib ABIs.
+numeric-int64-multibuild_install_alternative() {
+ debug-print-function ${FUNCNAME} "${@}"
+ [[ $# -lt 2 ]] && die "${FUNCNAME} needs at least two arguments"
+ pc_file() {
+ debug-print-function ${FUNCNAME} "${@}"
+ numeric-int64_is_static_build && return
+ local alternative=$(_numeric-int64_get_numeric_alternative "$1")
+ local module_name=$(numeric-int64_get_module_name)
+ printf \
+ "/usr/$(get_libdir)/pkgconfig/${alternative}.pc ${module_name}.pc " \
+ >> "${T}"/alternative-${alternative}.sh || die
+ }
+ pc_install() {
+ debug-print-function ${FUNCNAME} "${@}"
+ numeric-int64_is_static_build && return
+ local alternative=$(_numeric-int64_get_numeric_alternative "$1")
+ local module_name=$(numeric-int64_get_module_name $2)
+ shift 2
+ alternatives_for \
+ ${alternative} ${module_name} 0 \
+ $(cat "${T}"/alternative-${alternative}.sh) ${@}
+ rm "${T}"/alternative-${alternative}.sh || die
+ }
+ numeric-int64-multibuild_foreach_all_abi_variants pc_file ${@}
+ numeric-int64-multibuild_foreach_int_abi pc_install ${@}
+}
+
+# @FUNCTION: numeric-int64-multibuild_multilib_wrapper
+# @USAGE: <argv>...
+# @DESCRIPTION:
+# Initialize the environment for ABI selected for multibuild.
+#
+# Example:
+#
+# @CODE
+# multibuild_foreach_variant run_in_build_dir \
+# numeric-int64-multibuild_multilib_wrapper my_src_install
+# @CODE
+numeric-int64-multibuild_multilib_wrapper() {
+ debug-print-function ${FUNCNAME} "${@}"
+ local v="${MULTIBUILD_VARIANT/_${NUMERIC_INT32_SUFFIX}/}"
+ local v="${v/_${NUMERIC_INT64_SUFFIX}/}"
+ local ABI="${v/_${NUMERIC_STATIC_SUFFIX}/}"
+ multilib_toolchain_setup "${ABI}"
+ "${@}" || die
+}
+
+# @FUNCTION: numeric-int64-multibuild_foreach_int_abi
+# @USAGE: <argv> ...
+# @DESCRIPTION:
+# Run command for each enabled numeric variant (e.g. int32, int64)
+numeric-int64-multibuild_foreach_int_abi() {
+ debug-print-function ${FUNCNAME} "${@}"
+ local MULTIBUILD_VARIANTS=( $(numeric-int64_get_multibuild_int_variants) )
+ multibuild_foreach_variant numeric-int64-multibuild_multilib_wrapper "${@}"
+}
+
+# @FUNCTION: numeric-int64-multibuild_foreach_variant
+# @USAGE: <argv> ...
+# @DESCRIPTION:
+# Run command for each enabled numeric abi and static-libs (e.g. int32, int64, static)
+numeric-int64-multibuild_foreach_variant() {
+ debug-print-function ${FUNCNAME} "${@}"
+ local MULTIBUILD_VARIANTS=( $(numeric-int64_get_multibuild_variants) )
+ multibuild_foreach_variant numeric-int64-multibuild_multilib_wrapper "${@}"
+}
+
+# @FUNCTION: numeric-int64-multibuild_foreach_all_abi_variants
+# @USAGE: <argv> ...
+# @DESCRIPTION:
+# Run command for each enabled numeric variant (e.g. int32, int64, static) _AND_
+# enabled multilib ABI
+numeric-int64-multibuild_foreach_all_abi_variants() {
+ debug-print-function ${FUNCNAME} "${@}"
+ local MULTIBUILD_VARIANTS=( $(numeric-int64_get_all_abi_variants) )
+ multibuild_foreach_variant numeric-int64-multibuild_multilib_wrapper "${@}"
+}
+
+# @FUNCTION: numeric-int64-multibuild_copy_sources
+# @DESCRIPTION:
+# Thin wrapper around multibuild_copy_sources()
+numeric-int64-multibuild_copy_sources() {
+ debug-print-function ${FUNCNAME} "${@}"
+ local MULTIBUILD_VARIANTS=( $(numeric-int64_get_all_abi_variants) )
+ multibuild_copy_sources
+}
+
+_NUMERIC_INT64_MULTILIB_ECLASS=1
+fi
diff --git a/eclass/numeric.eclass b/eclass/numeric.eclass
new file mode 100644
index 0000000..cb73545
--- /dev/null
+++ b/eclass/numeric.eclass
@@ -0,0 +1,138 @@
+# Copyright 1999-2017 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+# @ECLASS: numeric.eclass
+# @MAINTAINER:
+# jlec@gentoo.org
+# @BLURB: Maintance bits needed for *lapack* and *blas* packages
+# @DESCRIPTION:
+# Various functions which make the maintenance numerical algebra packages
+# easier.
+
+if [[ ! ${_NUMERIC_ECLASS} ]]; then
+
+case ${EAPI:-0} in
+ 0|1|2|3|4|5)
+ inherit multilib ;;
+ 6) ;;
+ *) die "EAPI=${EAPI} is not supported" ;;
+esac
+
+# @VARIABLE: NUMERIC_MODULE_NAME
+# @DESCRIPTION:
+# The base pkg-config module name of the package being built.
+# NUMERIC_MODULE_NAME is used by the numeric-int64_get_module_name to
+# determine the pkg-config module name based on whether the package
+# has dynamic, threads or openmp USE flags and if so, if the user has
+# turned them or, and if the current multibuild is a int64 build or not.
+#
+# @CODE
+# NUMERIC_MODULE_NAME="openblas"
+# inherit ... numeric-int64-multibuild
+# @CODE
+: ${NUMERIC_MODULE_NAME:=blas}
+
+# @FUNCTION: create_pkgconfig
+# @USAGE: [ additional arguments ]
+# @DESCRIPTION:
+# Creates and installs pkg-config file. The function should only be executed in
+# src_install(). For further information about optional arguments please consult
+# http://people.freedesktop.org/~dbn/pkg-config-guide.html
+#
+# @CODE
+# Optional arguments are:
+#
+# -p | --prefix Offset for current package (${EPREFIX}/usr)
+# -e | --exec-prefix Offset for current package (${prefix})
+# -L | --libdir Libdir to use (${prefix}/$(get_libdir))
+# -I | --includedir Includedir to use (${prefix}/include)
+# -n | --name A human-readable name (PN}
+# -d | --description A brief description (DESCRIPTION)
+# -V | --version Version of the package (PV)
+# -u | --url Web presents (HOMEPAGE)
+# -r | --requires Packages required by this package (unset)
+# -l | --libs Link flags specific to this package (unset)
+# -c | --cflags Compiler flags specific to this package (unset)
+# --requires-private Like --requires, but not exposed (unset)
+# --conflicts Packages that this one conflicts with (unset)
+# --libs-private Like --libs, but not exposed (unset)
+# @CODE
+create_pkgconfig() {
+ debug-print-function ${FUNCNAME} "${@}"
+ local pcfilename pcrequires pcrequirespriv pcconflicts pclibs pclibspriv pccflags
+ local pcprefix="${EPREFIX}/usr"
+ local pcexecprefix="${pcprefix}"
+ local pclibdir="${EPREFIX}/usr/$(get_libdir)"
+ local pcincldir="${pcprefix}/include"
+ local pcname=${PN}
+ local pcdescription="${DESCRIPTION}"
+ local pcurl=${HOMEPAGE}
+ local pcversion=${PV}
+
+ [[ "${EBUILD_PHASE}" != "install" ]] && \
+ die "create_pkgconfig should only be used in src_install()"
+
+ while (($#)); do
+ case ${1} in
+ -p | --prefix )
+ shift; pcprefix=${1} ;;
+ -e | --exec-prefix )
+ shift; pcexecprefix=${1} ;;
+ -L | --libdir )
+ shift; pclibdir=${1} ;;
+ -I | --includedir )
+ shift; pcincldir=${1} ;;
+ -n | --name )
+ shift; pcname=${1} ;;
+ -d | --description )
+ shift; pcdescription=${1} ;;
+ -V | --version )
+ shift; pcversion=${1} ;;
+ -u | --url )
+ shift; pcurl=${1} ;;
+ -r | --requires )
+ shift; pcrequires=${1} ;;
+ --requires-private )
+ shift; pcrequirespriv=${1} ;;
+ --conflicts )
+ shift; pcconflicts=${1};;
+ -l | --libs )
+ shift; pclibs=${1} ;;
+ --libs-private )
+ shift; pclibspriv=${1} ;;
+ -c | --cflags )
+ shift; pccflags=${1} ;;
+ -* )
+ ewarn "Unknown option ${1}" ;;
+ * )
+ pcfilename=${1} ;;
+ esac
+ shift
+ done
+
+ [[ -z ${pcfilename} ]] && die "Missing name for pkg-config file"
+
+ cat > "${T}"/${pcfilename}.pc <<- EOF
+ prefix="${pcprefix}"
+ exec_prefix="${pcexecprefix}"
+ libdir="${pclibdir}"
+ includedir="${pcincldir}"
+
+ Name: ${pcname}
+ Description: ${pcdescription}
+ Version: ${pcversion}
+ URL: ${pcurl}
+ Requires: ${pcrequires}
+ Requires.private: ${pcrequirespriv}
+ Conflicts: ${pcconflicts}
+ Libs: -L\${libdir} ${pclibs}
+ Libs.private: ${pclibspriv}
+ Cflags: -I\${includedir} ${pccflags}
+ EOF
+
+ insinto /usr/$(get_libdir)/pkgconfig
+ doins "${T}"/${pcfilename}.pc
+}
+
+_NUMERIC_ECLASS=1
+fi