1 |
|
# Copyright 1999-2021 Gentoo Authors
|
|
1 |
# Copyright 1999-2022 Gentoo Authors
|
2 |
2 |
# Distributed under the terms of the GNU General Public License v2
|
3 |
3 |
|
4 |
|
EAPI=7
|
|
4 |
EAPI=8
|
5 |
5 |
|
6 |
|
MULTILIB_COMPAT=( abi_x86_{32,64} )
|
7 |
|
inherit multilib-build rpm
|
8 |
|
|
9 |
|
MAGIC=16917 # from registration center
|
10 |
|
MY_P=${P/-/_} # mkl_2020.4.304
|
11 |
|
MY_PV=$(ver_rs 2 '-') # 2020.4-304
|
|
6 |
inherit unpacker
|
12 |
7 |
|
13 |
8 |
DESCRIPTION="Intel Math Kernel Library"
|
14 |
|
HOMEPAGE="https://software.intel.com/en-us/intel-mkl"
|
15 |
|
SRC_URI="http://registrationcenter-download.intel.com/akdlm/irc_nas/tec/${MAGIC}/l_${MY_P}.tgz -> ${P}.tar.gz"
|
16 |
|
S="${WORKDIR}"/l_${MY_P}
|
|
9 |
HOMEPAGE="https://www.intel.com/content/www/us/en/developer/tools/oneapi/onemkl.html"
|
|
10 |
SRC_URI="
|
|
11 |
https://apt.repos.intel.com/oneapi/pool/main/intel-oneapi-${PN}-$(ver_cut 1-3)-$(ver_cut 1-3)-$(ver_cut 4)_amd64.deb
|
|
12 |
https://apt.repos.intel.com/oneapi/pool/main/intel-oneapi-${PN}-devel-$(ver_cut 1-3)-$(ver_cut 1-3)-$(ver_cut 4)_amd64.deb
|
|
13 |
https://apt.repos.intel.com/oneapi/pool/main/intel-oneapi-${PN}-common-$(ver_cut 1-3)-$(ver_cut 1-3)-$(ver_cut 4)_all.deb
|
|
14 |
https://apt.repos.intel.com/oneapi/pool/main/intel-oneapi-${PN}-common-devel-$(ver_cut 1-3)-$(ver_cut 1-3)-$(ver_cut 4)_all.deb
|
|
15 |
"
|
|
16 |
S="${WORKDIR}"
|
17 |
17 |
|
18 |
18 |
LICENSE="ISSL"
|
19 |
19 |
SLOT="0"
|
20 |
|
KEYWORDS="~amd64 ~x86"
|
|
20 |
KEYWORDS="~amd64"
|
21 |
21 |
IUSE="static-libs"
|
22 |
22 |
RESTRICT="strip"
|
23 |
23 |
|
... | ... | |
27 |
27 |
RDEPEND="
|
28 |
28 |
app-eselect/eselect-blas
|
29 |
29 |
app-eselect/eselect-lapack
|
30 |
|
sys-libs/libomp[${MULTILIB_USEDEP}]
|
|
30 |
dev-cpp/tbb
|
|
31 |
dev-libs/opencl-icd-loader
|
|
32 |
sys-cluster/mpich
|
|
33 |
sys-libs/libomp
|
31 |
34 |
"
|
32 |
35 |
# bug #801460
|
33 |
36 |
BDEPEND="app-arch/xz-utils[extra-filters]"
|
... | ... | |
35 |
38 |
QA_PREBUILT="*"
|
36 |
39 |
QA_TEXTRELS="*"
|
37 |
40 |
QA_SONAME="*"
|
38 |
|
QA_MULTILIB_PATHS="/usr/lib.*/libmkl_tbb_thread.so"
|
39 |
|
|
40 |
|
# first unpack all rpms
|
41 |
|
# find folders containing header like, static and dynamic lib files
|
42 |
|
# these are the only folders we care about
|
43 |
|
# find "${S}"/rpm -type f \( -name "*.a" -o -name "*.so" -o -wholename "*mkl/include*" \) \
|
44 |
|
# | tr '/' ' ' | awk '{ print $2 }' | sort | uniq
|
45 |
|
|
46 |
|
# ignore all conda-* rpms
|
47 |
|
# ignore all empty rpms
|
48 |
|
# information about rest:
|
49 |
|
#
|
50 |
|
# mkl-core-ps-32bit-2020.3-279-2020.3-279.x86_64.rpm | some prebuilt benchmark executables
|
51 |
|
# psxe-common-2020.3-111-2020.3-111.noarch.rpm
|
52 |
|
# comp-l-all-vars-19.1.2-279-19.1.2-279.noarch.rpm
|
53 |
|
# comp-nomcu-vars-19.1.2-279-19.1.2-279.noarch.rpm
|
54 |
|
# mkl-cluster-c-2020.3-279-2020.3-279.noarch.rpm
|
55 |
|
# mkl-cluster-f-2020.3-279-2020.3-279.noarch.rpm
|
56 |
|
# mkl-doc-2020-2020.3-279.noarch.rpm
|
57 |
|
# mkl-common-ps-2020.3-279-2020.3-279.noarch.rpm | only contains benchmarks
|
58 |
|
# compxe-pset-2020.3-111-2020.3-111.noarch.rpm | only contains benchmarks
|
59 |
|
# mkl-doc-ps-2020-2020.3-279.noarch.rpm
|
60 |
|
# mkl-common-2020.3-279-2020.3-279.noarch.rpm | setting up environment vars (might be needed for parallel studio)
|
61 |
|
# mkl-installer-license-2020.3-279-2020.3-279.noarch.rpm | already have license
|
62 |
|
# mkl-psxe-2020.3-111-2020.3-111.noarch.rpm | useless files
|
63 |
|
# mkl-common-c-ps-2020.3-279-2020.3-279.noarch.rpm | contained in common-c
|
64 |
|
|
65 |
|
INTEL_DIST_X86_RPMS=(
|
66 |
|
mkl-core-32bit
|
67 |
|
mkl-core-rt-32bit
|
68 |
|
mkl-f95-32bit
|
69 |
|
mkl-gnu-32bit
|
70 |
|
mkl-gnu-f-32bit
|
71 |
|
mkl-gnu-f-rt-32bit
|
72 |
|
mkl-gnu-rt-32bit
|
73 |
|
mkl-tbb-32bit
|
74 |
|
mkl-tbb-rt
|
75 |
|
intel-openmp-32bit-19.1.3-304-19.1.3-304.x86_64.rpm
|
76 |
|
)
|
77 |
|
INTEL_DIST_AMD64_RPMS=(
|
78 |
|
mkl-cluster
|
79 |
|
mkl-cluster-rt
|
80 |
|
mkl-core
|
81 |
|
mkl-core-ps
|
82 |
|
mkl-core-rt
|
83 |
|
mkl-f95
|
84 |
|
mkl-gnu
|
85 |
|
mkl-gnu-f
|
86 |
|
mkl-gnu-rt
|
87 |
|
mkl-gnu-f-rt
|
88 |
|
mkl-pgi
|
89 |
|
mkl-pgi-rt
|
90 |
|
mkl-tbb
|
91 |
|
mkl-tbb-rt
|
92 |
|
intel-openmp-19.1.3-304-19.1.3-304.x86_64.rpm
|
93 |
|
)
|
94 |
|
INTEL_DIST_DAT_RPMS=(
|
95 |
|
mkl-common-c
|
96 |
|
mkl-common-f
|
97 |
|
mkl-f95-common
|
98 |
|
)
|
99 |
|
|
100 |
|
rpm_dirname() {
|
101 |
|
local rpm="${1}" suffix="x86_64"
|
102 |
|
if [[ $# -eq 2 ]]; then
|
103 |
|
suffix="$2"
|
104 |
|
fi
|
105 |
|
if [[ ! ${rpm} =~ "rpm" ]] ; then
|
106 |
|
rpm="intel-${rpm}-${MY_PV}-${MY_PV}.${suffix}"
|
107 |
|
fi
|
108 |
|
printf '%s\n' "${rpm%%.rpm}"
|
109 |
|
}
|
110 |
|
|
111 |
|
rpm_unpack() {
|
112 |
|
local rpm="$1" suffix="x86_64"
|
113 |
|
if [[ $# -eq 2 ]]; then
|
114 |
|
suffix="$2"
|
115 |
|
fi
|
116 |
|
rpm="$(rpm_dirname $rpm $suffix)"
|
117 |
|
elog "Unpacking - ${rpm}.rpm"
|
118 |
|
rpmunpack "${rpm}.rpm" || die
|
119 |
|
}
|
120 |
41 |
|
121 |
|
src_unpack() {
|
|
42 |
src_prepare() {
|
122 |
43 |
default
|
123 |
|
cd "${S}"/rpm
|
124 |
|
local rpm
|
125 |
|
for rpm in ${INTEL_DIST_DAT_RPMS[@]}; do
|
126 |
|
rpm_unpack ${rpm} noarch
|
127 |
|
done
|
128 |
|
if use abi_x86_64 ; then
|
129 |
|
for rpm in ${INTEL_DIST_AMD64_RPMS[@]}; do
|
130 |
|
rpm_unpack ${rpm}
|
131 |
|
done
|
132 |
|
fi
|
133 |
|
if use abi_x86_32 ; then
|
134 |
|
for rpm in ${INTEL_DIST_X86_RPMS[@]}; do
|
135 |
|
rpm_unpack ${rpm}
|
136 |
|
done
|
137 |
|
fi
|
|
44 |
# Drop conda stuff
|
|
45 |
rm -r opt/intel/oneapi/conda_channel || die
|
138 |
46 |
}
|
139 |
47 |
|
140 |
|
multilib_src_install() {
|
141 |
|
cd "${S}"/rpm
|
142 |
|
elog "current variant - ${MULTIBUILD_VARIANT}"
|
143 |
|
local rpm rpm_list libdir=$(get_libdir)
|
144 |
|
if [[ ${MULTIBUILD_VARIANT} =~ 'amd64' ]] ; then
|
145 |
|
rpm_list="${INTEL_DIST_AMD64_RPMS[@]}"
|
146 |
|
else
|
147 |
|
rpm_list="${INTEL_DIST_X86_RPMS[@]}"
|
148 |
|
fi
|
149 |
|
for rpm in ${rpm_list} ; do
|
150 |
|
rpm=$(rpm_dirname ${rpm})
|
151 |
|
elog "installing libs from - ${rpm}"
|
152 |
|
local libso liba
|
153 |
|
for libso in $(find "${S}"/rpm/${rpm} -name "*.so") ; do
|
154 |
|
dolib.so "${libso}"
|
155 |
|
done
|
156 |
|
use static-libs && \
|
157 |
|
for liba in $(find "${S}"/rpm/${rpm} -name "*.a") ; do
|
158 |
|
dolib.a "${liba}"
|
159 |
|
done
|
|
48 |
src_install() {
|
|
49 |
# Symlink pkgconfig and cmake files
|
|
50 |
pushd "opt/intel/oneapi/mkl/$(ver_cut 1-3)/lib/pkgconfig" || die
|
|
51 |
for file in *.pc; do
|
|
52 |
dosym "../../../opt/intel/oneapi/mkl/$(ver_cut 1-3)/lib/pkgconfig/${file}" "/usr/share/pkgconfig/${file}"
|
160 |
53 |
done
|
161 |
|
|
162 |
|
dodir /usr/$(get_libdir)/blas/mkl
|
163 |
|
dosym ../../libmkl_rt.so usr/$(get_libdir)/blas/mkl/libblas.so
|
164 |
|
dosym ../../libmkl_rt.so usr/$(get_libdir)/blas/mkl/libblas.so.3
|
165 |
|
dosym ../../libmkl_rt.so usr/$(get_libdir)/blas/mkl/libcblas.so
|
166 |
|
dosym ../../libmkl_rt.so usr/$(get_libdir)/blas/mkl/libcblas.so.3
|
167 |
|
dodir /usr/$(get_libdir)/lapack/mkl
|
168 |
|
dosym ../../libmkl_rt.so usr/$(get_libdir)/lapack/mkl/liblapack.so
|
169 |
|
dosym ../../libmkl_rt.so usr/$(get_libdir)/lapack/mkl/liblapack.so.3
|
170 |
|
dosym ../../libmkl_rt.so usr/$(get_libdir)/lapack/mkl/liblapacke.so
|
171 |
|
dosym ../../libmkl_rt.so usr/$(get_libdir)/lapack/mkl/liblapacke.so.3
|
172 |
|
|
173 |
|
# for some reason pkgconfig files are only for amd64
|
174 |
|
[[ ${MULTIBUILD_VARIANT} =~ 'amd64' ]] || return
|
175 |
|
local pc_files=( "${FILESDIR}"/*.pc )
|
176 |
|
insinto /usr/$(get_libdir)/pkgconfig
|
177 |
|
for pc in "${pc_files[@]}" ; do
|
178 |
|
doins "${pc}"
|
179 |
|
sed -e "s:@PREFIX@:${EPREFIX}/usr:" \
|
180 |
|
-i "${ED}"/usr/$(get_libdir)/pkgconfig/${pc##*/} || die
|
|
54 |
popd || die
|
|
55 |
pushd "opt/intel/oneapi/mkl/$(ver_cut 1-3)/lib/cmake/mkl" || die
|
|
56 |
for file in *.cmake; do
|
|
57 |
dosym "../../../../opt/intel/oneapi/mkl/$(ver_cut 1-3)/lib/cmake/mkl/${file}" "/usr/$(get_libdir)/cmake/mkl/${file}"
|
181 |
58 |
done
|
182 |
|
}
|
|
59 |
popd || die
|
183 |
60 |
|
184 |
|
src_install() {
|
185 |
|
# install bunch of header like files
|
186 |
|
dodir /usr/include/mkl
|
187 |
|
for idir in $(find "${S}"/rpm -type d -wholename "*mkl/include"); do
|
188 |
|
cp -a "${idir}"/. "${ED}"/usr/include/mkl || die
|
|
61 |
# Symlink files in locale directory
|
|
62 |
pushd "opt/intel/oneapi/mkl/$(ver_cut 1-3)/lib/intel64/locale/en_US" || die
|
|
63 |
for file in *; do
|
|
64 |
dosym "../../../../opt/intel/oneapi/mkl/$(ver_cut 1-3)/lib/intel64/locale/en_US/${file}" "/usr/share/locale/en_US/${file}"
|
189 |
65 |
done
|
|
66 |
popd || die
|
190 |
67 |
|
191 |
|
multilib_foreach_abi multilib_src_install
|
|
68 |
# Move everything over to the image directory
|
|
69 |
mv "${S}/"* "${ED}" || die
|
|
70 |
|
|
71 |
# Create convenience symlink that does not include the version number
|
|
72 |
dosym "$(ver_cut 1-3)" /opt/intel/oneapi/mkl/latest
|
|
73 |
|
|
74 |
dodir /usr/$(get_libdir)/blas/mkl
|
|
75 |
dosym ../../../../opt/intel/oneapi/mkl/$(ver_cut 1-3)/lib/intel64/libmkl_rt.so usr/$(get_libdir)/blas/mkl/libblas.so
|
|
76 |
dosym ../../../../opt/intel/oneapi/mkl/$(ver_cut 1-3)/lib/intel64/libmkl_rt.so usr/$(get_libdir)/blas/mkl/libblas.so.3
|
|
77 |
dosym ../../../../opt/intel/oneapi/mkl/$(ver_cut 1-3)/lib/intel64/libmkl_rt.so usr/$(get_libdir)/blas/mkl/libcblas.so
|
|
78 |
dosym ../../../../opt/intel/oneapi/mkl/$(ver_cut 1-3)/lib/intel64/libmkl_rt.so usr/$(get_libdir)/blas/mkl/libcblas.so.3
|
|
79 |
dodir /usr/$(get_libdir)/lapack/mkl
|
|
80 |
dosym ../../../../opt/intel/oneapi/mkl/$(ver_cut 1-3)/lib/intel64/libmkl_rt.so usr/$(get_libdir)/lapack/mkl/liblapack.so
|
|
81 |
dosym ../../../../opt/intel/oneapi/mkl/$(ver_cut 1-3)/lib/intel64/libmkl_rt.so usr/$(get_libdir)/lapack/mkl/liblapack.so.3
|
|
82 |
dosym ../../../../opt/intel/oneapi/mkl/$(ver_cut 1-3)/lib/intel64/libmkl_rt.so usr/$(get_libdir)/lapack/mkl/liblapacke.so
|
|
83 |
dosym ../../../../opt/intel/oneapi/mkl/$(ver_cut 1-3)/lib/intel64/libmkl_rt.so usr/$(get_libdir)/lapack/mkl/liblapacke.so.3
|
|
84 |
|
|
85 |
newenvd - "70intel-mkl" <<-_EOF_
|
|
86 |
MKLROOT="${EPREFIX}/opt/intel/oneapi/mkl/$(ver_cut 1-3)"
|
|
87 |
PATH="${EPREFIX}/opt/intel/oneapi/mkl/$(ver_cut 1-3)/bin/intel64"
|
|
88 |
# we need to duplicate it in ROOTPATH for Portage to respect...
|
|
89 |
ROOTPATH="${EPREFIX}/opt/intel/oneapi/mkl/$(ver_cut 1-3)/bin/intel64"
|
|
90 |
LDPATH="${EPREFIX}/opt/intel/oneapi/mkl/$(ver_cut 1-3)/lib/intel64"
|
|
91 |
_EOF_
|
192 |
92 |
}
|
193 |
93 |
|
194 |
|
library-provider_pkg_postinst() {
|
|
94 |
pkg_postinst() {
|
195 |
95 |
local libdir=$(get_libdir) me="mkl"
|
196 |
96 |
|
197 |
97 |
# check blas
|
... | ... | |
219 |
119 |
fi
|
220 |
120 |
}
|
221 |
121 |
|
222 |
|
pkg_postinst() {
|
223 |
|
multilib_foreach_abi library-provider_pkg_postinst
|
224 |
|
}
|
225 |
|
|
226 |
|
library-provider_pkg_postrm() {
|
|
122 |
pkg_postrm() {
|
227 |
123 |
eselect blas validate
|
228 |
124 |
eselect lapack validate
|
229 |
125 |
}
|
230 |
|
|
231 |
|
pkg_postrm() {
|
232 |
|
multilib_foreach_abi library-provider_pkg_postrm
|
233 |
|
}
|