/[gentoo-x86]/eclass/intel-sdp.eclass
Gentoo

Contents of /eclass/intel-sdp.eclass

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.17 - (show annotations) (download)
Fri Feb 21 16:07:25 2014 UTC (6 months, 1 week ago) by jlec
Branch: MAIN
CVS Tags: HEAD
Changes since 1.16: +4 -3 lines
Make problems with man page installation nonfatal

1 # Copyright 1999-2014 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3 # $Header: /var/cvsroot/gentoo-x86/eclass/intel-sdp.eclass,v 1.16 2014/02/20 09:47:09 jlec Exp $
4
5 # @ECLASS: intel-sdp.eclass
6 # @MAINTAINER:
7 # Justin Lecher <jlec@gentoo.org>
8 # Sci Team <sci@gentoo.org>
9 # @BLURB: Handling of Intel's Software Development Products package management
10
11 # @ECLASS-VARIABLE: INTEL_DID
12 # @DEFAULT_UNSET
13 # @DESCRIPTION:
14 # The package download ID from Intel.
15 # To find out its value, see the links to download in
16 # https://registrationcenter.intel.com/RegCenter/MyProducts.aspx
17 #
18 # e.g. 2504
19 #
20 # Must be defined before inheriting the eclass
21
22 # @ECLASS-VARIABLE: INTEL_DPN
23 # @DEFAULT_UNSET
24 # @DESCRIPTION:
25 # The package name to download from Intel.
26 # To find out its value, see the links to download in
27 # https://registrationcenter.intel.com/RegCenter/MyProducts.aspx
28 #
29 # e.g. parallel_studio_xe
30 #
31 # Must be defined before inheriting the eclass
32
33 # @ECLASS-VARIABLE: INTEL_DPV
34 # @DEFAULT_UNSET
35 # @DESCRIPTION:
36 # The package download version from Intel.
37 # To find out its value, see the links to download in
38 # https://registrationcenter.intel.com/RegCenter/MyProducts.aspx
39 #
40 # e.g. 2011_sp1_update2
41 #
42 # Must be defined before inheriting the eclass
43
44 # @ECLASS-VARIABLE: INTEL_TARX
45 # @DEFAULT_UNSET
46 # @DESCRIPTION:
47 # The package extention.
48 # To find out its value, see the links to download in
49 # https://registrationcenter.intel.com/RegCenter/MyProducts.aspx
50 #
51 # e.g. tar.gz
52 #
53 # Must be defined before inheriting the eclass
54 : ${INTEL_TARX:=tgz}
55
56 # @ECLASS-VARIABLE: INTEL_SUBDIR
57 # @DEFAULT_UNSET
58 # @DESCRIPTION:
59 # The package sub-directory where it will end-up in /opt/intel
60 # To find out its value, you have to do a raw install from the Intel tar ball
61
62 # @ECLASS-VARIABLE: INTEL_SKIP_LICENSE
63 # @DEFAULT_UNSET
64 # @DESCRIPTION:
65 # Possibility to skip the mandatory check for licenses. Only set this if there
66 # is really no fix.
67
68 # @ECLASS-VARIABLE: INTEL_RPMS_DIR
69 # @DESCRIPTION:
70 # Main subdirectory which contains the rpms to extract.
71 : ${INTEL_RPMS_DIR:=rpm}
72
73 # @ECLASS-VARIABLE: INTEL_X86
74 # @DESCRIPTION:
75 # 32bit arch in rpm names
76 #
77 # e.g. i484
78 : ${INTEL_X86:=i486}
79
80 # @ECLASS-VARIABLE: INTEL_BIN_RPMS
81 # @DEFAULT_UNSET
82 # @DESCRIPTION:
83 # Functional name of rpm without any version/arch tag
84 #
85 # e.g. compilerprof
86 #
87 # if the rpm is located in a directory different to INTEL_RPMS_DIR you can
88 # specify the full path
89 #
90 # e.g. CLI_install/rpm/intel-vtune-amplifier-xe-cli
91
92 # @ECLASS-VARIABLE: INTEL_DAT_RPMS
93 # @DEFAULT_UNSET
94 # @DESCRIPTION:
95 # Functional name of rpm of common data which are arch free
96 # without any version tag
97 #
98 # e.g. openmp
99 #
100 # if the rpm is located in a directory different to INTEL_RPMS_DIR you can
101 # specify the full path
102 #
103 # e.g. CLI_install/rpm/intel-vtune-amplifier-xe-cli-common
104
105 # @ECLASS-VARIABLE: INTEL_SINGLE_ARCH
106 # @DESCRIPTION:
107 # Unset, if only the multilib package will be provided by intel
108 : ${INTEL_SINGLE_ARCH:=true}
109
110 # @ECLASS-VARIABLE: INTEL_SDP_DB
111 # @DESCRIPTION:
112 # Full path to intel registry db
113 INTEL_SDP_DB="${EROOT%/}"/opt/intel/intel-sdp-products.db
114
115 inherit check-reqs multilib versionator
116
117 _INTEL_PV1=$(get_version_component_range 1)
118 _INTEL_PV2=$(get_version_component_range 2)
119 _INTEL_PV3=$(get_version_component_range 3)
120 _INTEL_PV4=$(get_version_component_range 4)
121 _INTEL_URI="http://registrationcenter-download.intel.com/irc_nas/${INTEL_DID}/${INTEL_DPN}"
122
123 if [ ${INTEL_SINGLE_ARCH} == true ]; then
124 SRC_URI="
125 amd64? ( multilib? ( ${_INTEL_URI}_${INTEL_DPV}.${INTEL_TARX} ) )
126 amd64? ( !multilib? ( ${_INTEL_URI}_${INTEL_DPV}_intel64.${INTEL_TARX} ) )
127 x86? ( ${_INTEL_URI}_${INTEL_DPV}_ia32.${INTEL_TARX} )"
128 else
129 SRC_URI="${_INTEL_URI}_${INTEL_DPV}.${INTEL_TARX}"
130 fi
131
132 LICENSE="Intel-SDP"
133 # Future work, #394411
134 #SLOT="${_INTEL_PV1}.${_INTEL_PV2}"
135 SLOT="0"
136 IUSE="examples multilib"
137
138 RESTRICT="mirror"
139
140 RDEPEND=""
141 DEPEND="app-arch/rpm2targz"
142
143 _INTEL_SDP_YEAR=${INTEL_DPV%_update*}
144 _INTEL_SDP_YEAR=${INTEL_DPV%_sp*}
145
146 # @ECLASS-VARIABLE: INTEL_SDP_DIR
147 # @DEFAULT_UNSET
148 # @DESCRIPTION:
149 # Full rootless path to installation dir
150 INTEL_SDP_DIR="opt/intel/${INTEL_SUBDIR}-${_INTEL_SDP_YEAR:-${_INTEL_PV1}}.${_INTEL_PV3}.${_INTEL_PV4}"
151
152 # @ECLASS-VARIABLE: INTEL_SDP_EDIR
153 # @DEFAULT_UNSET
154 # @DESCRIPTION:
155 # Full rooted path to installation dir
156 INTEL_SDP_EDIR="${EROOT%/}/${INTEL_SDP_DIR}"
157
158 S="${WORKDIR}"
159
160 QA_PREBUILT="${INTEL_SDP_DIR}/*"
161
162 # @ECLASS-VARIABLE: INTEL_ARCH
163 # @DEFAULT_UNSET
164 # @DESCRIPTION:
165 # Intels internal names of the arches; will be set at runtime accordingly
166 #
167 # e.g. amd64-multilib -> INTEL_ARCH="intel64 ia32"
168
169 # @FUNCTION: _isdp_link_eclipse_plugins
170 # @INTERNAL
171 # @DESCRIPTION:
172 # Creating necessary links to use intel compiler with eclipse
173 _isdp_link_eclipse_plugins() {
174 local c f
175 pushd ${INTEL_SDP_DIR}/eclipse_support > /dev/null
176 for c in cdt*; do
177 local cv=${c#cdt} ev=3.$(( ${cv:0:1} - 1))
178 if has_version "dev-util/eclipse-sdk:${ev}"; then
179 einfo "Linking eclipse (v${ev}) plugin cdt (v${cv})"
180 for f in cdt${cv}/eclipse/features/*; do
181 dodir /usr/$(get_libdir)/eclipse-${ev}/features
182 dosym "${INTEL_SDP_EDIR}"/eclipse_support/${f} \
183 /usr/$(get_libdir)/eclipse-${ev}/features/ || die
184 done
185 for f in cdt${cv}/eclipse/plugins/*; do
186 dodir /usr/$(get_libdir)/eclipse-${ev}/plugins
187 dosym "${INTEL_SDP_EDIR}"/eclipse_support/${f} \
188 /usr/$(get_libdir)/eclipse-${ev}/plugins/ || die
189 done
190 fi
191 done
192 popd > /dev/null
193 }
194
195 # @FUNCTION: _isdp_big-warning
196 # @USAGE: [pre-check | test-failed]
197 # @INTERNAL
198 # @DESCRIPTION:
199 # warn user that we really require a license
200 _isdp_big-warning() {
201 case ${1} in
202 pre-check )
203 echo ""
204 ewarn "License file not found!"
205 ;;
206
207 test-failed )
208 echo
209 ewarn "Function test failed. Most probably due to an invalid license."
210 ewarn "This means you already tried to bypass the license check once."
211 ;;
212 esac
213
214 echo ""
215 ewarn "Make sure you have recieved the an Intel license."
216 ewarn "To receive a non-commercial license, you need to register at:"
217 ewarn "http://software.intel.com/en-us/articles/non-commercial-software-development/"
218 ewarn "Install the license file into ${INTEL_SDP_EDIR}/licenses/"
219
220 case ${1} in
221 pre-check )
222 ewarn "before proceeding with installation of ${P}"
223 echo ""
224 ;;
225 * )
226 echo ""
227 ;;
228 esac
229 }
230
231 # @FUNCTION: _isdp_version_test
232 # @INTERNAL
233 # @DESCRIPTION:
234 # Testing for valid license by asking for version information of the compiler
235 _isdp_version_test() {
236 local comp comp_full arch warn
237 case ${PN} in
238 ifc )
239 debug-print "Testing ifort"
240 comp=ifort
241 ;;
242 icc )
243 debug-print "Testing icc"
244 comp=icc
245 ;;
246 *)
247 die "${PN} is not supported for testing"
248 ;;
249 esac
250
251 for arch in ${INTEL_ARCH}; do
252 case ${EBUILD_PHASE} in
253 install )
254 comp_full="${ED}/${INTEL_SDP_DIR}/bin/${arch}/${comp}"
255 ;;
256 postinst )
257 comp_full="${INTEL_SDP_EDIR}/bin/${arch}/${comp}"
258 ;;
259 * )
260 ewarn "Compile test not supported in ${EBUILD_PHASE}"
261 continue
262 ;;
263 esac
264
265 debug-print "LD_LIBRARY_PATH=\"${INTEL_SDP_EDIR}/bin/${arch}/\" \"${comp_full}\" -V"
266
267 LD_LIBRARY_PATH="${INTEL_SDP_EDIR}/bin/${arch}/" "${comp_full}" -V &>/dev/null
268 [[ $? -ne 0 ]] && warn=yes
269 done
270 [[ "${warn}" == "yes" ]] && _isdp_big-warning test-failed
271 }
272
273 # @FUNCTION: _isdp_run-test
274 # @INTERNAL
275 # Test if installed compiler is working
276 _isdp_run-test() {
277 if [[ -z ${INTEL_SKIP_LICENSE} ]]; then
278 case ${PN} in
279 ifc | icc )
280 _isdp_version_test ;;
281 * )
282 debug-print "No test available for ${PN}"
283 ;;
284 esac
285 fi
286 }
287
288 # @FUNCTION: intel-sdp_pkg_pretend
289 # @DESCRIPTION:
290 # @CODE
291 # * Check that the user has a (valid) license file before going on.
292 # * Check for space requirements being fullfilled
293 # @CODE
294 intel-sdp_pkg_pretend() {
295 local warn=1 dir dirs ret arch a p
296
297 : ${CHECKREQS_DISK_BUILD:=256M}
298 check-reqs_pkg_pretend
299
300 if [[ -z ${INTEL_SKIP_LICENSE} ]]; then
301 if echo ${INTEL_LICENSE_FILE} | grep -q @; then
302 einfo "Looks like you are using following license server:"
303 einfo " ${INTEL_LICENSE_FILE}"
304 return 0
305 fi
306
307 dirs=(
308 "${INTEL_SDP_EDIR}/licenses"
309 "${INTEL_SDP_EDIR}/Licenses"
310 "${EPREFIX}/opt/intel/licenses"
311 )
312 for dir in "${dirs[@]}" ; do
313 ebegin "Checking for a license in: ${dir}"
314 #maybe use nullglob or [[ $(echo ${dir/*lic) != "${dir}/*lic" ]]
315 [[ $( ls "${dir}"/*lic 2>/dev/null ) ]]; ret=$?
316 eend ${ret}
317 if [[ ${ret} == "0" ]]; then
318 warn=${ret}
319 break
320 fi
321 done
322 if [[ ${warn} == "1" ]]; then
323 _isdp_big-warning pre-check
324 die "Could not find license file"
325 fi
326 else
327 eqawarn "The ebuild doesn't check for presents of a proper intel license!"
328 eqawarn "This shouldn't be done unless there is a serious reason."
329 fi
330 }
331
332 # @FUNCTION: intel-sdp_pkg_setup
333 # @DESCRIPTION:
334 # Setting up and sorting some internal variables
335 intel-sdp_pkg_setup() {
336 local arch a p
337
338 if use x86; then
339 arch=${INTEL_X86}
340 INTEL_ARCH="ia32"
341 elif use amd64; then
342 arch=x86_64
343 INTEL_ARCH="intel64"
344 if has_multilib_profile; then
345 arch="x86_64 ${INTEL_X86}"
346 INTEL_ARCH="intel64 ia32"
347 fi
348 fi
349 INTEL_RPMS=()
350 INTEL_RPMS_FULL=()
351 for p in ${INTEL_BIN_RPMS}; do
352 for a in ${arch}; do
353 if [ ${p} == $(basename ${p}) ]; then
354 INTEL_RPMS+=( intel-${p}-${_INTEL_PV4}-${_INTEL_PV1}.${_INTEL_PV2}-${_INTEL_PV3}.${a}.rpm )
355 else
356 INTEL_RPMS_FULL+=( ${p}-${_INTEL_PV4}-${_INTEL_PV1}.${_INTEL_PV2}-${_INTEL_PV3}.${a}.rpm )
357 fi
358 done
359 done
360 for p in ${INTEL_DAT_RPMS}; do
361 if [ ${p} == $(basename ${p}) ]; then
362 INTEL_RPMS+=( intel-${p}-${_INTEL_PV4}-${_INTEL_PV1}.${_INTEL_PV2}-${_INTEL_PV3}.noarch.rpm )
363 else
364 INTEL_RPMS_FULL+=( ${p}-${_INTEL_PV4}-${_INTEL_PV1}.${_INTEL_PV2}-${_INTEL_PV3}.noarch.rpm )
365 fi
366 done
367 }
368
369 # @FUNCTION: intel-sdp_src_unpack
370 # @DESCRIPTION:
371 # Unpacking necessary rpms from tarball, extract them and rearrange the output.
372 intel-sdp_src_unpack() {
373 local l r subdir rb t list=() debug_list
374
375 for t in ${A}; do
376 for r in ${INTEL_RPMS[@]}; do
377 rpmdir=${t%%.*}/${INTEL_RPMS_DIR}
378 list+=( ${rpmdir}/${r} )
379 done
380
381 for r in ${INTEL_RPMS_FULL[@]}; do
382 list+=( ${t%%.*}/${r} )
383 done
384
385 debug_list="$(IFS=$'\n'; echo ${list[@]} )"
386
387 debug-print "Adding to decompression list:"
388 debug-print ${debug_list}
389
390 tar xvf "${DISTDIR}"/${t} ${list[@]} &> "${T}"/rpm-extraction.log
391
392 for r in ${list[@]}; do
393 rb=$(basename ${r})
394 l=.${rb}_$(date +'%d%m%y_%H%M%S').log
395 einfo "Unpacking ${rb}"
396 rpm2tar -O ${r} | tar xvf - | sed -e \
397 "s:^\.:${EROOT#/}:g" > ${l}; assert "unpacking ${r} failed"
398 mv ${l} opt/intel/ || die "failed moving extract log file"
399 done
400 done
401
402 mv opt/intel/* ${INTEL_SDP_DIR} || die "mv to INTEL_SDP_DIR failed"
403 }
404
405 # @FUNCTION: intel-sdp_src_install
406 # @DESCRIPTION:
407 # Install everything
408 intel-sdp_src_install() {
409 if [[ -d "${INTEL_SDP_DIR}"/Documentation ]]; then
410 dodoc -r "${INTEL_SDP_DIR}"/Documentation/*
411
412 ebegin "Cleaning out documentation"
413 find "${INTEL_SDP_DIR}"/Documentation -delete || die
414 eend
415 fi
416
417 if [[ -d "${INTEL_SDP_DIR}"/Samples ]]; then
418 if use examples ; then
419 insinto /usr/share/${P}/examples/
420 doins -r "${INTEL_SDP_DIR}"/Samples/*
421 fi
422 ebegin "Cleaning out examples"
423 find "${INTEL_SDP_DIR}"/Samples -delete || die
424 eend
425 fi
426
427 if [[ -d "${INTEL_SDP_DIR}"/eclipse_support ]]; then
428 if has eclipse ${IUSE} && use eclipse; then
429 _isdp_link_eclipse_plugins
430 else
431 ebegin "Cleaning out eclipse plugin"
432 find "${INTEL_SDP_DIR}"/eclipse_support -delete || die
433 eend
434 fi
435 fi
436
437 if [[ -d "${INTEL_SDP_DIR}"/man ]]; then
438 nonfatal doman "${INTEL_SDP_DIR}"/man/en_US/man1/*
439 nonfatal doman "${INTEL_SDP_DIR}"/man/man1/*
440 if has linguas_ja ${IUSE} && use linguas_ja; then
441 doman -i18n=ja_JP "${INTEL_SDP_DIR}"/man/ja_JP/man1/*
442 fi
443
444 find "${INTEL_SDP_DIR}"/man -delete || die
445 fi
446
447 ebegin "Tagging ${PN}"
448 find opt -name \*sh -type f -exec sed -i \
449 -e "s:<.*DIR>:${INTEL_SDP_EDIR}:g" \
450 '{}' + || die
451 eend
452
453 [[ -d "${ED}" ]] || dodir /
454 mv opt "${ED}"/ || die "moving files failed"
455
456 dodir "${INTEL_SDP_DIR}"/licenses /opt/intel/ism/rm
457 keepdir "${INTEL_SDP_DIR}"/licenses /opt/intel/ism/rm
458 }
459
460 # @FUNCTION: intel-sdp_pkg_postinst
461 # @DESCRIPTION:
462 # Add things to intel database
463 intel-sdp_pkg_postinst() {
464 # add product registry to intel "database"
465 local l r
466 for r in ${INTEL_RPMS}; do
467 l="$(ls -1 ${EROOT%/}/opt/intel/.${r}_*.log | head -n 1)"
468 echo >> ${INTEL_SDP_DB} \
469 "<:${r%-${_INTEL_PV4}*}-${_INTEL_PV4}:${r}:${INTEL_SDP_EDIR}:${l}:>"
470 done
471 _isdp_run-test
472
473 if [[ ${PN} = icc ]] && has_version ">=dev-util/ccache-3.1.9-r2" ; then
474 #add ccache links as icc might get installed after ccache
475 "${EROOT}"/usr/bin/ccache-config --install-links
476 fi
477 }
478
479 # @FUNCTION: intel-sdp_pkg_postrm
480 # @DESCRIPTION:
481 # Sanitize intel database
482 intel-sdp_pkg_postrm() {
483 # remove from intel "database"
484 if [[ -e ${INTEL_SDP_DB} ]]; then
485 local r
486 for r in ${INTEL_RPMS}; do
487 sed -i \
488 -e "/${r}/d" \
489 ${INTEL_SDP_DB}
490 done
491 fi
492
493 if [[ ${PN} = icc ]] && has_version ">=dev-util/ccache-3.1.9-r2" && [[ -z ${REPLACED_BY_VERSION} ]]; then
494 # --remove-links would remove all links, --install-links updates them
495 "${EROOT}"/usr/bin/ccache-config --install-links
496 fi
497 }
498
499 EXPORT_FUNCTIONS pkg_setup src_unpack src_install pkg_postinst pkg_postrm pkg_pretend
500 case "${EAPI:-0}" in
501 0|1|2|3)die "EAPI=${EAPI} is not supported anymore" ;;
502 4|5) ;;
503 *) die "EAPI=${EAPI} is not supported" ;;
504 esac

  ViewVC Help
Powered by ViewVC 1.1.20