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

Diff of /eclass/intel-sdp.eclass

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

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

Legend:
Removed from v.1.3  
changed lines
  Added in v.1.6

  ViewVC Help
Powered by ViewVC 1.1.20