Gentoo Archives: gentoo-commits

From: "Sebastien Fabbro (bicatali)" <bicatali@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] gentoo-x86 commit in sci-libs/mkl: ChangeLog mkl-10.0.3.020-r1.ebuild
Date: Mon, 23 Jun 2008 08:52:03
Message-Id: E1KAhmG-0007An-JA@stork.gentoo.org
1 bicatali 08/06/23 08:51:56
2
3 Modified: ChangeLog
4 Added: mkl-10.0.3.020-r1.ebuild
5 Log:
6 Added a symlink for cblas.h, pkg-config options for include directories, and removed rpm cruft from unpacking.
7 (Portage version: 2.1.4.4)
8
9 Revision Changes Path
10 1.30 sci-libs/mkl/ChangeLog
11
12 file : http://sources.gentoo.org/viewcvs.py/gentoo-x86/sci-libs/mkl/ChangeLog?rev=1.30&view=markup
13 plain: http://sources.gentoo.org/viewcvs.py/gentoo-x86/sci-libs/mkl/ChangeLog?rev=1.30&content-type=text/plain
14 diff : http://sources.gentoo.org/viewcvs.py/gentoo-x86/sci-libs/mkl/ChangeLog?r1=1.29&r2=1.30
15
16 Index: ChangeLog
17 ===================================================================
18 RCS file: /var/cvsroot/gentoo-x86/sci-libs/mkl/ChangeLog,v
19 retrieving revision 1.29
20 retrieving revision 1.30
21 diff -u -r1.29 -r1.30
22 --- ChangeLog 29 May 2008 09:44:11 -0000 1.29
23 +++ ChangeLog 23 Jun 2008 08:51:56 -0000 1.30
24 @@ -1,6 +1,13 @@
25 # ChangeLog for sci-libs/mkl
26 # Copyright 2002-2008 Gentoo Foundation; Distributed under the GPL v2
27 -# $Header: /var/cvsroot/gentoo-x86/sci-libs/mkl/ChangeLog,v 1.29 2008/05/29 09:44:11 bicatali Exp $
28 +# $Header: /var/cvsroot/gentoo-x86/sci-libs/mkl/ChangeLog,v 1.30 2008/06/23 08:51:56 bicatali Exp $
29 +
30 +*mkl-10.0.3.020-r1 (23 Jun 2008)
31 +
32 + 23 Jun 2008; Sébastien Fabbro <bicatali@g.o>
33 + +mkl-10.0.3.020-r1.ebuild:
34 + Added a symlink for cblas.h, pkg-config options for include directories,
35 + and removed rpm cruft from unpacking.
36
37 29 May 2008; Sébastien Fabbro <bicatali@g.o>
38 mkl-10.0.3.020.ebuild:
39
40
41
42 1.1 sci-libs/mkl/mkl-10.0.3.020-r1.ebuild
43
44 file : http://sources.gentoo.org/viewcvs.py/gentoo-x86/sci-libs/mkl/mkl-10.0.3.020-r1.ebuild?rev=1.1&view=markup
45 plain: http://sources.gentoo.org/viewcvs.py/gentoo-x86/sci-libs/mkl/mkl-10.0.3.020-r1.ebuild?rev=1.1&content-type=text/plain
46
47 Index: mkl-10.0.3.020-r1.ebuild
48 ===================================================================
49 # Copyright 1999-2008 Gentoo Foundation
50 # Distributed under the terms of the GNU General Public License v2
51 # $Header: /var/cvsroot/gentoo-x86/sci-libs/mkl/mkl-10.0.3.020-r1.ebuild,v 1.1 2008/06/23 08:51:56 bicatali Exp $
52
53 inherit eutils toolchain-funcs fortran check-reqs
54
55 PID=1088
56 PB=${PN}
57 DESCRIPTION="Intel(R) Math Kernel Library: linear algebra, fft, math functions"
58 HOMEPAGE="http://developer.intel.com/software/products/mkl/"
59
60 KEYWORDS="~amd64 ~ia64 ~x86"
61 SRC_URI="http://registrationcenter-download.intel.com/irc_nas/${PID}/l_${PN}_p_${PV}.tgz"
62
63 #slotting not yet supported (need eselect-mkl)
64 #MAJOR=$(get_major_version ${PV})
65 #MINOR=$(get_version_component_range 2 ${PV})
66 #SLOT="${MAJOR}.${MINOR}"
67
68 SLOT="0"
69 LICENSE="Intel-SDP"
70
71 IUSE="doc fftw fortran95 int64 mpi"
72 RESTRICT="strip mirror"
73
74 DEPEND="app-admin/eselect-blas
75 app-admin/eselect-cblas
76 app-admin/eselect-lapack"
77
78 RDEPEND="${DEPEND}
79 doc? ( app-doc/blas-docs app-doc/lapack-docs )
80 mpi? ( virtual/mpi )"
81
82 MKL_DIR=/opt/intel/${PN}/${PV}
83 INTEL_LIC_DIR=/opt/intel/licenses
84
85 pkg_setup() {
86 # Check the license
87 if [[ -z ${MKL_LICENSE} ]]; then
88 MKL_LICENSE="$(grep -ls MKern ${ROOT}${INTEL_LIC_DIR}/* | tail -n 1)"
89 MKL_LICENSE=${MKL_LICENSE/${ROOT}/}
90 fi
91 if [[ -z ${MKL_LICENSE} ]]; then
92 eerror "Did not find any valid mkl license."
93 eerror "Register at ${HOMEPAGE} to receive a license"
94 eerror "and place it in ${INTEL_LIC_DIR} or run:"
95 eerror "export MKL_LICENSE=/my/license/file emerge mkl"
96 die "license setup failed"
97 fi
98
99 # Check if we have enough free diskspace to install
100 CHECKREQS_DISK_BUILD="1100"
101 check_reqs
102
103 # Check and setup fortran
104 FORTRAN="gfortran ifc g77"
105 use int64 && FORTRAN="gfortran ifc"
106 if use fortran95; then
107 FORTRAN="gfortran ifc"
108 # blas95 and lapack95 don't compile with gfortran < 4.2
109 [[ $(gcc-major-version)$(gcc-minor-version) -lt 42 ]] && FORTRAN="ifc"
110 fi
111 fortran_pkg_setup
112 MKL_FC="gnu"
113 [[ ${FORTRANC} == if* ]] && MKL_FC="intel"
114
115 # build profiles according to what compiler is installed
116 MKL_CC="gnu"
117 [[ $(tc-getCC) == icc ]] && MKL_CC="intel"
118
119 if has_version sys-cluster/mpich; then
120 MKL_MPI=mpich
121 elif has_version sys-cluster/mpich2; then
122 MKL_MPI=mpich2
123 elif has_version sys-cluster/openmpi; then
124 MKL_MPI=openmpi
125 elif has_version sys-cluster/lam-mpi; then
126 MKL_MPI=lam-mpi
127 else
128 MKL_MPI=intelmpi
129 fi
130 }
131
132 src_unpack() {
133
134 unpack ${A}
135 cd l_${PN}_*_${PV}/install
136
137 cp ${MKL_LICENSE} "${WORKDIR}"/
138 MKL_LIC="$(basename ${MKL_LICENSE})"
139
140 # binary blob extractor installs rpm leftovers in /opt/intel
141 addwrite /opt/intel
142 # undocumented features: INSTALLMODE_mkl=NONRPM
143
144 # We need to install mkl non-interactively.
145 # If things change between versions, first do it interactively:
146 # tar xf l_*; ./install.sh --duplicate mkl.ini;
147 # The file will be instman/mkl.ini
148 # Then check it and modify the ebuild-created one below
149 # --norpm is required to be able to install 10.x
150 cat > mkl.ini <<-EOF
151 [MKL]
152 EULA_ACCEPT_REJECT=ACCEPT
153 FLEXLM_LICENSE_LOCATION=${WORKDIR}/${MKL_LIC}
154 INSTALLMODE_mkl=NONRPM
155 INSTALL_DESTINATION=${S}
156 EOF
157 einfo "Extracting ..."
158 ./install \
159 --silent ./mkl.ini \
160 --installpath "${S}" \
161 --log log.txt &> /dev/null
162
163 if [[ -z $(find "${S}" -name libmkl.so) ]]; then
164 eerror "Could not find extracted files"
165 eerror "See ${PWD}/log.txt to see why"
166 die "extracting failed"
167 fi
168 # remove left over
169 rm -f /opt/intel/.*mkl*.log /opt/intel/intel_sdp_products.db
170
171 # remove unused stuff and set up intel names
172 rm -rf "${WORKDIR}"/l_*
173
174 cd "${S}"
175 # allow openmpi to work
176 epatch "${FILESDIR}"/${PN}-10.0.2.018-openmpi.patch
177 # make scalapack tests work for gfortran
178 epatch "${FILESDIR}"/${PN}-10.0.2.018-tests.patch
179 case ${ARCH} in
180 x86) MKL_ARCH=32
181 MKL_KERN=ia32
182 rm -rf lib*/{em64t,64}
183 ;;
184
185 amd64) MKL_ARCH=em64t
186 MKL_KERN=em64t
187 rm -rf lib*/{32,64}
188 ;;
189
190 ia64) MKL_ARCH=64
191 MKL_KERN=ipf
192 rm -rf lib*/{32,em64t}
193 ;;
194 esac
195 MKL_LIBDIR=${MKL_DIR}/lib/${MKL_ARCH}
196 }
197
198 src_compile() {
199 cd "${S}"/interfaces
200 if use fortran95; then
201 einfo "Compiling fortan95 static lib wrappers"
202 local myconf="lib${MKL_ARCH}"
203 [[ ${FORTRANC} == gfortran ]] && \
204 myconf="${myconf} FC=gfortran"
205 if use int64; then
206 myconf="${myconf} interface=ilp64"
207 [[ ${FORTRANC} == gfortran ]] && \
208 myconf="${myconf} FOPTS=-fdefault-integer-8"
209 fi
210 for x in blas95 lapack95; do
211 pushd ${x}
212 emake ${myconf} || die "emake ${x} failed"
213 popd
214 done
215 fi
216
217 if use fftw; then
218 local fftwdirs="fftw2xc fftw2xf fftw3xc fftw3xf"
219 local myconf="lib${MKL_ARCH} compiler=${MKL_CC}"
220 if use mpi; then
221 fftwdirs="${fftwdirs} fftw2x_cdft"
222 myconf="${myconf} mpi=${MKL_MPI}"
223 fi
224 einfo "Compiling fftw static lib wrappers"
225 for x in ${fftwdirs}; do
226 pushd ${x}
227 emake ${myconf} || die "emake ${x} failed"
228 popd
229 done
230 fi
231 }
232
233 src_test() {
234 cd "${S}"/tests
235 local myconf
236 local testdirs="blas cblas"
237 use int64 && myconf="${myconf} interface=ilp64"
238 if use mpi; then
239 testdirs="${testdirs} scalapack"
240 myconf="${myconf} mpi=${MKL_MPI}"
241 fi
242 for x in ${testdirs}; do
243 pushd ${x}
244 einfo "Testing ${x}"
245 emake \
246 compiler=${MKL_FC} \
247 ${myconf} \
248 so${MKL_ARCH} \
249 || die "emake ${x} failed"
250 popd
251 done
252 }
253
254 mkl_make_generic_profile() {
255 cd "${S}"
256 # produce eselect files
257 # don't make them in FILESDIR, it changes every major version
258 cat > eselect.blas <<-EOF
259 ${MKL_LIBDIR}/libmkl_${MKL_KERN}.a /usr/@LIBDIR@/libblas.a
260 ${MKL_LIBDIR}/libmkl.so /usr/@LIBDIR@/libblas.so
261 ${MKL_LIBDIR}/libmkl.so /usr/@LIBDIR@/libblas.so.0
262 EOF
263 cat > eselect.cblas <<-EOF
264 ${MKL_LIBDIR}/libmkl_${MKL_KERN}.a /usr/@LIBDIR@/libcblas.a
265 ${MKL_LIBDIR}/libmkl.so /usr/@LIBDIR@/libcblas.so
266 ${MKL_LIBDIR}/libmkl.so /usr/@LIBDIR@/libcblas.so.0
267 ${MKL_DIR}/include/mkl_cblas.h /usr/include/cblas.h
268 EOF
269 cat > eselect.lapack <<-EOF
270 ${MKL_LIBDIR}/libmkl_lapack.a /usr/@LIBDIR@/liblapack.a
271 ${MKL_LIBDIR}/libmkl_lapack.so /usr/@LIBDIR@/liblapack.so
272 ${MKL_LIBDIR}/libmkl_lapack.so /usr/@LIBDIR@/liblapack.so.0
273 EOF
274 }
275
276 # usage: mkl_add_profile <profile> <interface_lib> <thread_lib> <rtl_lib>
277 mkl_add_profile() {
278 cd "${S}"
279 local prof=${1}
280 insinto ${MKL_LIBDIR}
281 for x in blas cblas lapack; do
282 cat > ${x}-${prof}.pc <<-EOF
283 prefix=/usr
284 libdir=${MKL_LIBDIR}
285 includedir=${MKL_DIR}/include
286 Name: ${x}
287 Description: Intel(R) Math Kernel Library implementation of ${p}
288 Version: ${PV}
289 URL: ${HOMEPAGE}
290 Libs: -Wl,--no-as-needed -L\${libdir} ${2} ${3} -lmkl_core ${4} -lpthread
291 Cflags: -I${includedir}
292 EOF
293 cp eselect.${x} eselect.${x}.${prof}
294 echo "${MKL_LIBDIR}/${x}-${prof}.pc /usr/@LIBDIR@/pkgconfig/${x}.pc" \
295 >> eselect.${x}.${prof}
296 doins ${x}-${prof}.pc
297 eselect ${x} add $(get_libdir) eselect.${x}.${prof} ${prof}
298 done
299 }
300
301 mkl_make_profiles() {
302 local clib
303 has_version 'dev-lang/ifc' && clib="intel"
304 built_with_use sys-devel/gcc fortran && clib="${clib} gf"
305 local slib="-lmkl_sequential"
306 local rlib="-liomp5"
307 for c in ${clib}; do
308 local ilib="-lmkl_${c}_lp64"
309 use x86 && ilib="-lmkl_${c}"
310 local tlib="-lmkl_${c/gf/gnu}_thread"
311 local comp="${c/gf/gfortran}"
312 comp="${comp/intel/ifort}"
313 mkl_add_profile mkl-${comp} ${ilib} ${slib}
314 mkl_add_profile mkl-${comp}-threads ${ilib} ${tlib} ${rlib}
315 if use int64; then
316 ilib="-lmkl_${c}_ilp64"
317 mkl_add_profile mkl-${comp}-int64 ${ilib} ${slib}
318 mkl_add_profile mkl-${comp}-threads-int64 ${ilib} ${tlib} ${rlib}
319 fi
320 done
321 }
322
323 src_install() {
324 dodir ${MKL_DIR}
325 # upstream installs a link, no idea why
326 dosym ${MKL_DIR} ${MKL_DIR/mkl/cmkl}
327
328 # install license
329 if [[ ! -f ${INTEL_LIC_DIR}/${MKL_LIC} ]]; then
330 insinto ${INTEL_LIC_DIR}
331 doins "${WORKDIR}"/${MKL_LIC} || die "install license failed"
332 fi
333
334 # install main stuff: cp faster than doins
335 einfo "Installing files..."
336 local cpdirs="benchmarks doc examples include interfaces lib man tests"
337 local doinsdirs="tools"
338 cp -pPR ${cpdirs} "${D}"${MKL_DIR} \
339 || die "installing mkl failed"
340 insinto ${MKL_DIR}
341 doins -r ${doinsdirs} || die "doins ${doinsdirs} failed"
342 dosym mkl_cblas.h ${MKL_DIR}/include/mkl_cblas.h
343
344 # install blas/lapack profiles
345 mkl_make_generic_profile
346 mkl_make_profiles
347
348 # install env variables
349 local env_file=35mkl
350 echo "LDPATH=${MKL_LIBDIR}" > ${env_file}
351 echo "MANPATH=${MKL_DIR}/man" >> ${env_file}
352 doenvd ${env_file} || die "doenvd failed"
353 }
354
355 pkg_postinst() {
356 # if blas profile is mkl, set lapack and cblas profiles as mkl
357 local blas_lib=$(eselect blas show | cut -d' ' -f2)
358 local def_prof="mkl-gfortran-threads"
359 has_version 'dev-lang/ifc' && def_prof="mkl-ifort-threads"
360 use int64 && def_prof="${def_prof}-int64"
361 for x in blas cblas lapack; do
362 local current_lib=$(eselect ${x} show | cut -d' ' -f2)
363 if [[ -z ${current_lib} || \
364 ${current_lib} == mkl* || \
365 ${blas_lib} == mkl* ]]; then
366 # work around eselect bug #189942
367 local configfile="${ROOT}"/etc/env.d/${x}/$(get_libdir)/config
368 [[ -e ${configfile} ]] && rm -f ${configfile}
369 eselect ${x} set ${def_prof}
370 elog "${x} has been eselected to ${def_prof}"
371 if [[ ${current_lib} != ${blas_lib} ]]; then
372 eselect blas set ${def_prof}
373 elog "${x} is now set to ${def_prof} for consistency"
374 fi
375 else
376 elog "Current eselected ${x} is ${current_lib}"
377 elog "To use one of mkl profiles, issue (as root):"
378 elog "\t eselect ${x} set <profile>"
379 fi
380 done
381 }
382
383
384
385 --
386 gentoo-commits@l.g.o mailing list