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

Contents of /eclass/intel-sdp.eclass

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.10 - (hide annotations) (download)
Thu Feb 14 08:17:35 2013 UTC (19 months ago) by jlec
Branch: MAIN
Changes since 1.9: +1 -2 lines
Drop KEYWORDS from eclass, #342185

1 jlec 1.6 # Copyright 1999-2013 Gentoo Foundation
2 jlec 1.1 # Distributed under the terms of the GNU General Public License v2
3 jlec 1.10 # $Header: /var/cvsroot/gentoo-x86/eclass/intel-sdp.eclass,v 1.9 2013/01/23 11:14:33 jlec Exp $
4 jlec 1.1
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_SUBDIR
45     # @DEFAULT_UNSET
46     # @DESCRIPTION:
47     # The package sub-directory where it will end-up in /opt/intel
48     # To find out its value, you have to do a raw install from the Intel tar ball
49    
50     # @ECLASS-VARIABLE: INTEL_RPMS_DIRS
51     # @DESCRIPTION:
52     # List of subdirectories in the main archive which contains the
53     # rpms to extract.
54     : ${INTEL_RPMS_DIRS:=rpm}
55    
56     # @ECLASS-VARIABLE: INTEL_X86
57     # @DESCRIPTION:
58     # 32bit arch in rpm names
59     #
60     # e.g. i484
61     : ${INTEL_X86:=i486}
62    
63     # @ECLASS-VARIABLE: INTEL_BIN_RPMS
64     # @DEFAULT_UNSET
65     # @DESCRIPTION:
66     # Functional name of rpm without any version/arch tag
67     #
68     # e.g. compilerprof
69    
70     # @ECLASS-VARIABLE: INTEL_DAT_RPMS
71     # @DEFAULT_UNSET
72     # @DESCRIPTION:
73     # Functional name of rpm of common data which are arch free
74     # without any version tag
75     #
76     # e.g. openmp
77    
78 jlec 1.5 # @ECLASS-VARIABLE: INTEL_SDP_DB
79     # @DESCRIPTION:
80     # Full path to intel registry db
81     INTEL_SDP_DB="${EROOT%/}"/opt/intel/intel-sdp-products.db
82    
83 jlec 1.1 inherit check-reqs multilib versionator
84    
85     _INTEL_PV1=$(get_version_component_range 1)
86     _INTEL_PV2=$(get_version_component_range 2)
87     _INTEL_PV3=$(get_version_component_range 3)
88     _INTEL_PV4=$(get_version_component_range 4)
89     _INTEL_URI="http://registrationcenter-download.intel.com/irc_nas/${INTEL_DID}/${INTEL_DPN}"
90    
91     SRC_URI="
92     amd64? ( multilib? ( ${_INTEL_URI}_${INTEL_DPV}.tgz ) )
93     amd64? ( !multilib? ( ${_INTEL_URI}_${INTEL_DPV}_intel64.tgz ) )
94 jlec 1.5 x86? ( ${_INTEL_URI}_${INTEL_DPV}_ia32.tgz )"
95 jlec 1.1
96     LICENSE="Intel-SDP"
97     # Future work, #394411
98     #SLOT="${_INTEL_PV1}.${_INTEL_PV2}"
99     SLOT="0"
100 jlec 1.5 IUSE="examples multilib"
101 jlec 1.1
102     RESTRICT="mirror"
103    
104     RDEPEND=""
105 jlec 1.5 DEPEND="app-arch/rpm2targz"
106 jlec 1.1
107     _INTEL_SDP_YEAR=${INTEL_DPV%_update*}
108     _INTEL_SDP_YEAR=${INTEL_DPV%_sp*}
109    
110     # @ECLASS-VARIABLE: INTEL_SDP_DIR
111     # @DEFAULT_UNSET
112     # @DESCRIPTION:
113     # Full rootless path to installation dir
114     INTEL_SDP_DIR="opt/intel/${INTEL_SUBDIR}-${_INTEL_SDP_YEAR:-${_INTEL_PV1}}.${_INTEL_PV3}.${_INTEL_PV4}"
115    
116     # @ECLASS-VARIABLE: INTEL_SDP_EDIR
117     # @DEFAULT_UNSET
118     # @DESCRIPTION:
119     # Full rooted path to installation dir
120     INTEL_SDP_EDIR="${EROOT%/}/${INTEL_SDP_DIR}"
121    
122     S="${WORKDIR}"
123    
124     QA_PREBUILT="${INTEL_SDP_DIR}/*"
125    
126     # @ECLASS-VARIABLE: INTEL_ARCH
127     # @DEFAULT_UNSET
128     # @DESCRIPTION:
129     # Intels internal names of the arches; will be set at runtime accordingly
130     #
131     # e.g. amd64-multilib -> INTEL_ARCH="intel64 ia32"
132    
133 jlec 1.5 # @FUNCTION: _isdp_link_eclipse_plugins
134     # @INTERNAL
135     # @DESCRIPTION:
136     # Creating necessary links to use intel compiler with eclipse
137     _isdp_link_eclipse_plugins() {
138     local c f
139     pushd ${INTEL_SDP_DIR}/eclipse_support > /dev/null
140     for c in cdt*; do
141     local cv=${c#cdt} ev=3.$(( ${cv:0:1} - 1))
142     if has_version "dev-util/eclipse-sdk:${ev}"; then
143     einfo "Linking eclipse (v${ev}) plugin cdt (v${cv})"
144     for f in cdt${cv}/eclipse/features/*; do
145     dodir /usr/$(get_libdir)/eclipse-${ev}/features
146     dosym "${INTEL_SDP_EDIR}"/eclipse_support/${f} \
147     /usr/$(get_libdir)/eclipse-${ev}/features/ || die
148     done
149     for f in cdt${cv}/eclipse/plugins/*; do
150     dodir /usr/$(get_libdir)/eclipse-${ev}/plugins
151     dosym "${INTEL_SDP_EDIR}"/eclipse_support/${f} \
152     /usr/$(get_libdir)/eclipse-${ev}/plugins/ || die
153     done
154     fi
155     done
156     popd > /dev/null
157     }
158    
159     # @FUNCTION: _isdp_big-warning
160     # @USAGE: [pre-check | test-failed]
161     # @INTERNAL
162     # @DESCRIPTION:
163     # warn user that we really require a license
164     _isdp_big-warning() {
165     case ${1} in
166     pre-check )
167     echo ""
168     ewarn "License file not found!"
169     ;;
170    
171     test-failed )
172     echo
173     ewarn "Function test failed. Most probably due to an invalid license."
174     ewarn "This means you already tried to bypass the license check once."
175     ;;
176     esac
177    
178     echo ""
179     ewarn "Make sure you have recieved the an Intel license."
180     ewarn "To receive a non-commercial license, you need to register at:"
181     ewarn "http://software.intel.com/en-us/articles/non-commercial-software-development/"
182     ewarn "Install the license file into ${INTEL_SDP_EDIR}/licenses/"
183    
184     case ${1} in
185     pre-check )
186     ewarn "before proceeding with installation of ${P}"
187     echo ""
188     ;;
189     * )
190     echo ""
191     ;;
192     esac
193     }
194    
195     # @FUNCTION: _isdp_version_test
196     # @INTERNAL
197     # @DESCRIPTION:
198     # Testing for valid license by asking for version information of the compiler
199     _isdp_version_test() {
200     local comp comp_full arch warn
201     case ${PN} in
202     ifc )
203     debug-print "Testing ifort"
204     comp=ifort
205     ;;
206     icc )
207     debug-print "Testing icc"
208     comp=icc
209     ;;
210     *)
211     die "${PN} is not supported for testing"
212     ;;
213     esac
214    
215     for arch in ${INTEL_ARCH}; do
216     case ${EBUILD_PHASE} in
217     install )
218     comp_full="${ED}/${INTEL_SDP_DIR}/bin/${arch}/${comp}"
219     ;;
220     postinst )
221     comp_full="${INTEL_SDP_EDIR}/bin/${arch}/${comp}"
222     ;;
223     * )
224     ewarn "Compile test not supported in ${EBUILD_PHASE}"
225     continue
226     ;;
227     esac
228    
229     debug-print "LD_LIBRARY_PATH=\"${INTEL_SDP_EDIR}/bin/${arch}/\" \"${comp_full}\" -V"
230    
231     LD_LIBRARY_PATH="${INTEL_SDP_EDIR}/bin/${arch}/" "${comp_full}" -V &>/dev/null
232     [[ $? -ne 0 ]] && warn=yes
233     done
234     [[ "${warn}" == "yes" ]] && _isdp_big-warning test-failed
235     }
236    
237     # @FUNCTION: _isdp_run-test
238     # @INTERNAL
239     # Test if installed compiler is working
240     _isdp_run-test() {
241     case ${PN} in
242     ifc | icc )
243     _isdp_version_test ;;
244     * )
245     debug-print "No test available for ${PN}"
246     ;;
247     esac
248     }
249    
250     # @FUNCTION: intel-sdp_pkg_pretend
251     # @DESCRIPTION:
252     # @CODE
253     # * Check that the user has a (valid) license file before going on.
254     # * Check for space requirements being fullfilled
255     # @CODE
256     intel-sdp_pkg_pretend() {
257     local warn=1 dir dirs ret arch a p
258    
259     : ${CHECKREQS_DISK_BUILD:=256M}
260     check-reqs_pkg_pretend
261    
262 jlec 1.8 if echo ${INTEL_LICENSE_FILE} | grep -q @; then
263 jlec 1.7 einfo "Looks like you are using following license server:"
264     einfo " ${INTEL_LICENSE_FILE}"
265     return 0
266     fi
267    
268 jlec 1.5 dirs=(
269     "${INTEL_SDP_EDIR}/licenses"
270     "${INTEL_SDP_EDIR}/Licenses"
271     "${EPREFIX}/opt/intel/licenses"
272     )
273     for dir in "${dirs[@]}" ; do
274     ebegin "Checking for a license in: ${dir}"
275     #maybe use nullglob or [[ $(echo ${dir/*lic) != "${dir}/*lic" ]]
276     [[ $( ls "${dir}"/*lic 2>/dev/null ) ]]; ret=$?
277     eend ${ret}
278     if [[ ${ret} == "0" ]]; then
279     warn=${ret}
280     break
281     fi
282     done
283     if [[ ${warn} == "1" ]]; then
284     _isdp_big-warning pre-check
285     die "Could not find license file"
286     fi
287     }
288    
289     # @FUNCTION: intel-sdp_pkg_setup
290     # @DESCRIPTION:
291     # Setting up and sorting some internal variables
292 jlec 1.1 intel-sdp_pkg_setup() {
293     local arch a p
294 jlec 1.5
295 jlec 1.1 if use x86; then
296     arch=${INTEL_X86}
297     INTEL_ARCH="ia32"
298     elif use amd64; then
299     arch=x86_64
300     INTEL_ARCH="intel64"
301     if has_multilib_profile; then
302     arch="x86_64 ${INTEL_X86}"
303     INTEL_ARCH="intel64 ia32"
304     fi
305     fi
306     INTEL_RPMS=""
307     for p in ${INTEL_BIN_RPMS}; do
308     for a in ${arch}; do
309 jlec 1.5 INTEL_RPMS+=" intel-${p}-${_INTEL_PV4}-${_INTEL_PV1}.${_INTEL_PV2}-${_INTEL_PV3}.${a}.rpm"
310 jlec 1.1 done
311     done
312     for p in ${INTEL_DAT_RPMS}; do
313 jlec 1.5 INTEL_RPMS+=" intel-${p}-${_INTEL_PV4}-${_INTEL_PV1}.${_INTEL_PV2}-${_INTEL_PV3}.noarch.rpm"
314 jlec 1.1 done
315    
316     case "${EAPI:-0}" in
317     0|1|2|3) intel-sdp_pkg_pretend ;;
318     esac
319     }
320    
321 jlec 1.5 # @FUNCTION: intel-sdp_src_unpack
322     # @DESCRIPTION:
323     # Unpacking necessary rpms from tarball, extract them and rearrange the output.
324 jlec 1.1 intel-sdp_src_unpack() {
325 jlec 1.5 local l r subdir rb t list=()
326    
327 jlec 1.1 for t in ${A}; do
328     for r in ${INTEL_RPMS}; do
329     for subdir in ${INTEL_RPMS_DIRS}; do
330     rpmdir=${t%%.*}/${subdir}
331 jlec 1.5 list+=( ${rpmdir}/${r})
332 jlec 1.1 done
333     done
334 jlec 1.5 tar xf "${DISTDIR}"/${t} ${list[@]} 2> /dev/null || die
335     for r in ${list[@]}; do
336     rb=$(basename ${r})
337     l=.${rb}_$(date +'%d%m%y_%H%M%S').log
338     einfo "Unpacking ${rb}"
339     rpm2tar -O ${r} | tar xvf - | sed -e \
340     "s:^\.:${EROOT#/}:g" > ${l} || die "unpacking ${r} failed"
341     mv ${l} opt/intel/ || die "failed moving extract log file"
342     done
343 jlec 1.1 done
344 jlec 1.5
345     mv opt/intel/* ${INTEL_SDP_DIR} || die "mv to INTEL_SDP_DIR failed"
346 jlec 1.1 }
347    
348 jlec 1.5 # @FUNCTION: intel-sdp_src_install
349     # @DESCRIPTION:
350     # Install everything
351     intel-sdp_src_install() {
352     if [[ -d "${INTEL_SDP_DIR}"/Documentation ]]; then
353     dodoc -r "${INTEL_SDP_DIR}"/Documentation/*
354    
355     ebegin "Cleaning out documentation"
356     find "${INTEL_SDP_DIR}"/Documentation -delete || die
357     eend
358     fi
359    
360     if [[ -d "${INTEL_SDP_DIR}"/Samples ]]; then
361     if use examples ; then
362     insinto /usr/share/${P}/examples/
363     doins -r "${INTEL_SDP_DIR}"/Samples/*
364     fi
365     ebegin "Cleaning out examples"
366     find "${INTEL_SDP_DIR}"/Samples -delete || die
367     eend
368     fi
369    
370     if [[ -d "${INTEL_SDP_DIR}"/eclipse_support ]]; then
371     if has eclipse ${IUSE} && use eclipse; then
372     _isdp_link_eclipse_plugins
373     else
374     ebegin "Cleaning out eclipse plugin"
375     find "${INTEL_SDP_DIR}"/eclipse_support -delete || die
376     eend
377     fi
378     fi
379    
380     if [[ -d "${INTEL_SDP_DIR}"/man ]]; then
381     doman "${INTEL_SDP_DIR}"/man/en_US/man1/*
382     if has linguas_ja ${IUSE} && use linguas_ja; then
383     doman -i18n=ja_JP "${INTEL_SDP_DIR}"/man/ja_JP/man1/*
384 jlec 1.1 fi
385    
386 jlec 1.5 find "${INTEL_SDP_DIR}"/man -delete || die
387     fi
388    
389     ebegin "Tagging ${PN}"
390 jlec 1.1 find opt -name \*sh -type f -exec sed -i \
391     -e "s:<.*DIR>:${INTEL_SDP_EDIR}:g" \
392 jlec 1.5 '{}' + || die
393     eend
394    
395     [[ -d "${ED}" ]] || dodir /
396     mv opt "${ED}"/ || die "moving files failed"
397    
398 jlec 1.9 dodir "${INTEL_SDP_DIR}"/licenses /opt/intel/ism/rm
399     keepdir "${INTEL_SDP_DIR}"/licenses /opt/intel/ism/rm
400 jlec 1.1 }
401    
402 jlec 1.5 # @FUNCTION: intel-sdp_pkg_postinst
403 jlec 1.1 # @DESCRIPTION:
404 jlec 1.5 # Add things to intel database
405 jlec 1.1 intel-sdp_pkg_postinst() {
406     # add product registry to intel "database"
407     local l r
408     for r in ${INTEL_RPMS}; do
409     l="$(ls -1 ${EROOT%/}/opt/intel/.${r}_*.log | head -n 1)"
410     echo >> ${INTEL_SDP_DB} \
411     "<:${r%-${_INTEL_PV4}*}-${_INTEL_PV4}:${r}:${INTEL_SDP_EDIR}:${l}:>"
412     done
413 jlec 1.5 _isdp_run-test
414 jlec 1.1 }
415    
416 jlec 1.5 # @FUNCTION: intel-sdp_pkg_postrm
417     # @DESCRIPTION:
418     # Sanitize intel database
419 jlec 1.1 intel-sdp_pkg_postrm() {
420     # remove from intel "database"
421     if [[ -e ${INTEL_SDP_DB} ]]; then
422     local r
423     for r in ${INTEL_RPMS}; do
424     sed -i \
425     -e "/${r}/d" \
426     ${INTEL_SDP_DB}
427     done
428     fi
429     }
430    
431     EXPORT_FUNCTIONS pkg_setup src_unpack src_install pkg_postinst pkg_postrm
432     case "${EAPI:-0}" in
433     0|1|2|3) ;;
434 jlec 1.5 4|5) EXPORT_FUNCTIONS pkg_pretend ;;
435 jlec 1.1 *) die "EAPI=${EAPI} is not supported" ;;
436     esac

  ViewVC Help
Powered by ViewVC 1.1.20