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.2.018.ebuild
Date: Sat, 29 Mar 2008 09:12:31
Message-Id: E1JfX6x-0001cc-8W@stork.gentoo.org
1 bicatali 08/03/29 09:12:27
2
3 Modified: ChangeLog
4 Added: mkl-10.0.2.018.ebuild
5 Log:
6 Version bump. Much rewriting for new linking framework in layers, and eselect profiles. Closing bug #201465, thanks Eric Thibodeau for his initial work
7 (Portage version: 2.1.4.4)
8
9 Revision Changes Path
10 1.23 sci-libs/mkl/ChangeLog
11
12 file : http://sources.gentoo.org/viewcvs.py/gentoo-x86/sci-libs/mkl/ChangeLog?rev=1.23&view=markup
13 plain: http://sources.gentoo.org/viewcvs.py/gentoo-x86/sci-libs/mkl/ChangeLog?rev=1.23&content-type=text/plain
14 diff : http://sources.gentoo.org/viewcvs.py/gentoo-x86/sci-libs/mkl/ChangeLog?r1=1.22&r2=1.23
15
16 Index: ChangeLog
17 ===================================================================
18 RCS file: /var/cvsroot/gentoo-x86/sci-libs/mkl/ChangeLog,v
19 retrieving revision 1.22
20 retrieving revision 1.23
21 diff -u -r1.22 -r1.23
22 --- ChangeLog 8 Jan 2008 09:53:37 -0000 1.22
23 +++ ChangeLog 29 Mar 2008 09:12:26 -0000 1.23
24 @@ -1,6 +1,15 @@
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.22 2008/01/08 09:53:37 bicatali Exp $
28 +# $Header: /var/cvsroot/gentoo-x86/sci-libs/mkl/ChangeLog,v 1.23 2008/03/29 09:12:26 bicatali Exp $
29 +
30 +*mkl-10.0.2.018 (29 Mar 2008)
31 +
32 + 29 Mar 2008; Sébastien Fabbro <bicatali@g.o>
33 + +files/mkl-10.0.2.018-openmpi.patch, +files/mkl-10.0.2.018-tests.patch,
34 + +mkl-10.0.2.018.ebuild:
35 + Version bump. Much rewriting for new linking framework in layers, and
36 + eselect profiles. Closing bug #201465, thanks Eric Thibodeau for his
37 + initial work
38
39 08 Jan 2008; Sébastien Fabbro <bicatali@g.o> files/blas.pc.in,
40 files/cblas.pc.in, files/lapack.pc.in, mkl-9.1.023.ebuild:
41
42
43
44 1.1 sci-libs/mkl/mkl-10.0.2.018.ebuild
45
46 file : http://sources.gentoo.org/viewcvs.py/gentoo-x86/sci-libs/mkl/mkl-10.0.2.018.ebuild?rev=1.1&view=markup
47 plain: http://sources.gentoo.org/viewcvs.py/gentoo-x86/sci-libs/mkl/mkl-10.0.2.018.ebuild?rev=1.1&content-type=text/plain
48
49 Index: mkl-10.0.2.018.ebuild
50 ===================================================================
51 # Copyright 1999-2008 Gentoo Foundation
52 # Distributed under the terms of the GNU General Public License v2
53 # $Header: /var/cvsroot/gentoo-x86/sci-libs/mkl/mkl-10.0.2.018.ebuild,v 1.1 2008/03/29 09:12:26 bicatali Exp $
54
55 inherit eutils toolchain-funcs fortran check-reqs
56
57 PID=967
58 PB=${PN}
59 DESCRIPTION="Intel(R) Math Kernel Library: linear algebra, fft, math functions"
60 HOMEPAGE="http://developer.intel.com/software/products/mkl/"
61
62 KEYWORDS="~amd64 ~ia64 ~x86"
63 SRC_URI="http://registrationcenter-download.intel.com/irc_nas/${PID}/l_${PN}_p_${PV}.tgz"
64
65 #slotting not yet supported (need eselect-mkl)
66 #MAJOR=$(get_major_version ${PV})
67 #MINOR=$(get_version_component_range 2 ${PV})
68 #SLOT="${MAJOR}.${MINOR}"
69
70 SLOT="0"
71 LICENSE="Intel-SDP"
72
73 IUSE="doc fftw fortran95 int64 mpi"
74 RESTRICT="strip mirror"
75
76 DEPEND="app-admin/eselect-blas
77 app-admin/eselect-cblas
78 app-admin/eselect-lapack"
79
80 RDEPEND="${DEPEND}
81 dev-util/pkgconfig
82 doc? ( app-doc/blas-docs app-doc/lapack-docs )
83 mpi? ( virtual/mpi )"
84
85 MKL_DIR=/opt/intel/${PN}/${PV}
86 INTEL_LIC_DIR=/opt/intel/licenses
87
88 pkg_setup() {
89
90 # Check the license
91 [[ -z ${MKL_LICENSE} && -d ${INTEL_LIC_DIR} ]] && \
92 MKL_LICENSE=$(find ${ROOT}/${INTEL_LIC_DIR} -name "*MKL*.lic" | tail -n 1)
93 if [[ -z ${MKL_LICENSE} ]]; then
94 eerror "Did not find any valid mkl license."
95 eerror "Register at ${HOMEPAGE} to receive a license"
96 eerror "and place it in ${INTEL_LIC_DIR} or run:"
97 eerror "\t MKL_LICENSE=/my/license/dir emerge mkl"
98 die "license setup failed"
99 fi
100
101 # Check if we have enough free diskspace to install
102 CHECKREQS_DISK_BUILD="1100"
103 check_reqs
104
105 # Check and setup fortran
106 FORTRAN="gfortran ifc g77"
107 if use fortran95; then
108 FORTRAN="gfortran ifc"
109 # blas95 and lapack95 don't compile with gfortran < 4.2
110 gcc-version lt 4 2 && FORTRAN="ifc"
111 fi
112 use int64 && FORTRAN="gfortran ifc"
113 fortran_pkg_setup
114 MKL_FC="gnu"
115 [[ ${FORTRANC} == if* ]] && MKL_FC="intel"
116
117 # build profiles according to what compiler is installed
118 MKL_CC="gnu"
119 [[ $(tc-getCC) == icc ]] && MKL_CC="intel"
120
121 if has_version sys-cluster/mpich; then
122 MKL_MPI=mpich
123 elif has_version sys-cluster/mpich2; then
124 MKL_MPI=mpich2
125 elif has_version sys-cluster/openmpi; then
126 MKL_MPI=openmpi
127 elif has_version sys-cluster/lam-mpi; then
128 MKL_MPI=lam-mpi
129 else
130 MKL_MPI=intelmpi
131 fi
132 }
133
134 src_unpack() {
135
136 unpack ${A}
137 cd l_${PN}_*_${PV}/install
138
139 cp ${MKL_LICENSE} "${WORKDIR}"/
140 MKL_LIC="$(basename ${MKL_LICENSE})"
141
142 # binary blob extractor installs rpm leftovers in /opt/intel
143 addwrite /opt/intel
144 # undocumented features: INSTALLMODE_mkl=NONRPM
145
146 # We need to install mkl non-interactively.
147 # If things change between versions, first do it interactively:
148 # tar xf l_*; ./install.sh --duplicate mkl.ini;
149 # The file will be instman/mkl.ini
150 # Then check it and modify the ebuild-created one below
151 # --norpm is required to be able to install 10.x
152 cat > mkl.ini <<-EOF
153 [MKL]
154 EULA_ACCEPT_REJECT=ACCEPT
155 FLEXLM_LICENSE_LOCATION=${WORKDIR}/${MKL_LIC}
156 INSTALLMODE_mkl=NONRPM
157 INSTALL_DESTINATION=${S}
158 EOF
159 einfo "Extracting ..."
160 ./install \
161 --silent ./mkl.ini \
162 --installpath "${S}" \
163 --log log.txt &> /dev/null
164
165 if [[ -z $(find "${S}" -name libmkl.so) ]]; then
166 eerror "Could not find extracted files"
167 eerror "See ${PWD}/log.txt to see why"
168 die "extracting failed"
169 fi
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}"/${P}-openmpi.patch
177 # make scalapack tests work for gfortran
178 epatch "${FILESDIR}"/${P}-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=${prefix}/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 EOF
292 cp eselect.${x} eselect.${x}.${prof}
293 echo "${MKL_LIBDIR}/${x}-${prof}.pc /usr/@LIBDIR@/pkgconfig/${x}.pc" \
294 >> eselect.${x}.${prof}
295 doins ${x}-${prof}.pc
296 eselect ${x} add $(get_libdir) eselect.${x}.${prof} ${prof}
297 done
298 }
299
300 mkl_make_profiles() {
301 local clib
302 has_version 'dev-lang/ifc' && clib="intel"
303 built_with_use sys-devel/gcc fortran && clib="${clib} gf"
304 local slib="-lmkl_sequential"
305 local rlib="-liomp5"
306 for c in ${clib}; do
307 local ilib="-lmkl_${c}_lp64"
308 use x86 && ilib="-lmkl_${c}"
309 local tlib="-lmkl_${c/gf/gnu}_thread"
310 local comp="${c/gf/gfortran}"
311 comp="${comp/intel/ifort}"
312 mkl_add_profile mkl-${comp} ${ilib} ${slib}
313 mkl_add_profile mkl-${comp}-threads ${ilib} ${tlib} ${rlib}
314 if use int64; then
315 ilib="-lmkl_${c}_ilp64"
316 mkl_add_profile mkl-${comp}-int64 ${ilib} ${slib}
317 mkl_add_profile mkl-${comp}-threads-int64 ${ilib} ${tlib} ${rlib}
318 fi
319 done
320 }
321
322 src_install() {
323 dodir ${MKL_DIR}
324 # upstream installs a link, no idea why
325 dosym ${MKL_DIR} ${MKL_DIR/mkl/cmkl}
326
327 # install license
328 if [[ ! -f ${INTEL_LIC_DIR}/${MKL_LIC} ]]; then
329 insinto ${INTEL_LIC_DIR}
330 doins "${WORKDIR}"/${MKL_LIC} || die "install license failed"
331 fi
332
333 # install main stuff: cp faster than doins
334 einfo "Installing files..."
335 local cpdirs="benchmarks doc examples include interfaces lib man tests"
336 local doinsdirs="tools"
337 cp -pPR ${cpdirs} "${D}"${MKL_DIR} \
338 || die "installing mkl failed"
339 doins ${doinsdirs} || die "doins ${doinsdirs} failed"
340
341 # install blas/lapack profiles
342 mkl_make_generic_profile
343 mkl_make_profiles
344
345 # install env variables
346 local env_file=35mkl
347 echo "LDPATH=${MKL_LIBDIR}" > ${env_file}
348 echo "MANPATH=${MKL_DIR}/man" >> ${env_file}
349 doenvd ${env_file} || die "doenvd failed"
350 }
351
352 pkg_postinst() {
353 # if blas profile is mkl, set lapack and cblas profiles as mkl
354 local blas_lib=$(eselect blas show | cut -d' ' -f2)
355 local def_prof="mkl-gfortran-threads"
356 has_version 'dev-lang/ifc' && def_prof="mkl-ifort-threads"
357 use int64 && def_prof="${def_prof}-int64"
358 for x in blas cblas lapack; do
359 local current_lib=$(eselect ${x} show | cut -d' ' -f2)
360 if [[ -z ${current_lib} || \
361 ${current_lib} == mkl* || \
362 ${blas_lib} == mkl* ]]; then
363 # work around eselect bug #189942
364 local configfile="${ROOT}"/etc/env.d/${x}/$(get_libdir)/config
365 [[ -e ${configfile} ]] && rm -f ${configfile}
366 eselect ${x} set ${def_prof}
367 elog "${x} has been eselected to ${def_prof}"
368 if [[ ${current_lib} != ${blas_lib} ]]; then
369 eselect blas set ${def_prof}
370 elog "${x} is now set to ${def_prof} for consistency"
371 fi
372 else
373 elog "Current eselected ${x} is ${current_lib}"
374 elog "To use one of mkl profiles, issue (as root):"
375 elog "\t eselect ${x} set <profile>"
376 fi
377 done
378 }
379
380
381
382 --
383 gentoo-commits@l.g.o mailing list