/[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.7
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.7 2013/01/23 09:44:24 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 if [[ $(echo ${INTEL_LICENSE_FILE} | grep -q @) ]]; then
131# @DEFAULT_UNSET 264 einfo "Looks like you are using following license server:"
132# @DESCRIPTION: 265 einfo " ${INTEL_LICENSE_FILE}"
133# Intels internal names of the arches; will be set at runtime accordingly 266 return 0
134# 267 fi
135# e.g. amd64-multilib -> INTEL_ARCH="intel64 ia32"
136 268
269 dirs=(
270 "${INTEL_SDP_EDIR}/licenses"
271 "${INTEL_SDP_EDIR}/Licenses"
272 "${EPREFIX}/opt/intel/licenses"
273 )
274 for dir in "${dirs[@]}" ; do
275 ebegin "Checking for a license in: ${dir}"
276 #maybe use nullglob or [[ $(echo ${dir/*lic) != "${dir}/*lic" ]]
277 [[ $( ls "${dir}"/*lic 2>/dev/null ) ]]; ret=$?
278 eend ${ret}
279 if [[ ${ret} == "0" ]]; then
280 warn=${ret}
281 break
282 fi
283 done
284 if [[ ${warn} == "1" ]]; then
285 _isdp_big-warning pre-check
286 die "Could not find license file"
287 fi
288}
289
290# @FUNCTION: intel-sdp_pkg_setup
291# @DESCRIPTION:
292# Setting up and sorting some internal variables
137intel-sdp_pkg_setup() { 293intel-sdp_pkg_setup() {
138 local arch a p 294 local arch a p
295
139 if use x86; then 296 if use x86; then
140 arch=${INTEL_X86} 297 arch=${INTEL_X86}
141 INTEL_ARCH="ia32" 298 INTEL_ARCH="ia32"
142 elif use amd64; then 299 elif use amd64; then
143 arch=x86_64 300 arch=x86_64
148 fi 305 fi
149 fi 306 fi
150 INTEL_RPMS="" 307 INTEL_RPMS=""
151 for p in ${INTEL_BIN_RPMS}; do 308 for p in ${INTEL_BIN_RPMS}; do
152 for a in ${arch}; do 309 for a in ${arch}; do
153 INTEL_RPMS="${INTEL_RPMS} intel-${p}-${_INTEL_PV4}-${_INTEL_PV1}.${_INTEL_PV2}-${_INTEL_PV3}.${a}.rpm" 310 INTEL_RPMS+=" intel-${p}-${_INTEL_PV4}-${_INTEL_PV1}.${_INTEL_PV2}-${_INTEL_PV3}.${a}.rpm"
154 done 311 done
155 done 312 done
156 for p in ${INTEL_DAT_RPMS}; do 313 for p in ${INTEL_DAT_RPMS}; do
157 INTEL_RPMS="${INTEL_RPMS} intel-${p}-${_INTEL_PV4}-${_INTEL_PV1}.${_INTEL_PV2}-${_INTEL_PV3}.noarch.rpm" 314 INTEL_RPMS+=" intel-${p}-${_INTEL_PV4}-${_INTEL_PV1}.${_INTEL_PV2}-${_INTEL_PV3}.noarch.rpm"
158 done 315 done
159 316
160 case "${EAPI:-0}" in 317 case "${EAPI:-0}" in
161 0|1|2|3) intel-sdp_pkg_pretend ;; 318 0|1|2|3) intel-sdp_pkg_pretend ;;
162 esac 319 esac
163} 320}
164 321
322# @FUNCTION: intel-sdp_src_unpack
323# @DESCRIPTION:
324# Unpacking necessary rpms from tarball, extract them and rearrange the output.
165intel-sdp_src_unpack() { 325intel-sdp_src_unpack() {
166 local l r t rpmdir 326 local l r subdir rb t list=()
327
167 for t in ${A}; do 328 for t in ${A}; do
168 for r in ${INTEL_RPMS}; do 329 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 330 for subdir in ${INTEL_RPMS_DIRS}; do
172 [[ "${rpm_found}" == "true" ]] && continue
173 rpmdir=${t%%.*}/${subdir} 331 rpmdir=${t%%.*}/${subdir}
174 l=.${r}_$(date +'%d%m%y_%H%M%S').log 332 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 333 done
182 done 334 done
335 tar xf "${DISTDIR}"/${t} ${list[@]} 2> /dev/null || die
336 for r in ${list[@]}; do
337 rb=$(basename ${r})
338 l=.${rb}_$(date +'%d%m%y_%H%M%S').log
339 einfo "Unpacking ${rb}"
340 rpm2tar -O ${r} | tar xvf - | sed -e \
341 "s:^\.:${EROOT#/}:g" > ${l} || die "unpacking ${r} failed"
342 mv ${l} opt/intel/ || die "failed moving extract log file"
183 done 343 done
344 done
345
184 mv -v opt/intel/* ${INTEL_SDP_DIR} || die "mv to INTEL_SDP_DIR failed" 346 mv opt/intel/* ${INTEL_SDP_DIR} || die "mv to INTEL_SDP_DIR failed"
185} 347}
186 348
187intel_link_eclipse_plugins() { 349# @FUNCTION: intel-sdp_src_install
188 pushd ${INTEL_SDP_DIR}/eclipse_support > /dev/null 350# @DESCRIPTION:
189 local c f 351# Install everything
190 for c in cdt*; do 352intel-sdp_src_install() {
191 local cv=${c#cdt} ev=3.$(( ${cv:0:1} - 1)) 353 if [[ -d "${INTEL_SDP_DIR}"/Documentation ]]; then
192 if has_version "dev-util/eclipse-sdk:${ev}"; then 354 dodoc -r "${INTEL_SDP_DIR}"/Documentation/*
193 einfo "Linking eclipse (v${ev}) plugin cdt (v${cv})" 355
194 for f in cdt${cv}/eclipse/features/*; do 356 ebegin "Cleaning out documentation"
195 dodir /usr/$(get_libdir)/eclipse-${ev}/features 357 find "${INTEL_SDP_DIR}"/Documentation -delete || die
196 dosym "${INTEL_SDP_EDIR}"/eclipse_support/${f} \ 358 eend
197 /usr/$(get_libdir)/eclipse-${ev}/features/ || die 359 fi
198 done 360
199 for f in cdt${cv}/eclipse/plugins/*; do 361 if [[ -d "${INTEL_SDP_DIR}"/Samples ]]; then
200 dodir /usr/$(get_libdir)/eclipse-${ev}/plugins 362 if use examples ; then
201 dosym "${INTEL_SDP_EDIR}"/eclipse_support/${f} \ 363 insinto /usr/share/${P}/examples/
202 /usr/$(get_libdir)/eclipse-${ev}/plugins/ || die 364 doins -r "${INTEL_SDP_DIR}"/Samples/*
203 done
204 fi 365 fi
205 done 366 ebegin "Cleaning out examples"
206 popd > /dev/null 367 find "${INTEL_SDP_DIR}"/Samples -delete || die
207} 368 eend
369 fi
208 370
209intel-sdp_src_install() {
210 [[ -d ${INTEL_SDP_DIR}/eclipse_support ]] && \ 371 if [[ -d "${INTEL_SDP_DIR}"/eclipse_support ]]; then
211 has eclipse ${IUSE} && \ 372 if has eclipse ${IUSE} && use eclipse; then
212 use eclipse && \
213 intel_link_eclipse_plugins 373 _isdp_link_eclipse_plugins
374 else
375 ebegin "Cleaning out eclipse plugin"
376 find "${INTEL_SDP_DIR}"/eclipse_support -delete || die
377 eend
378 fi
379 fi
380
381 if [[ -d "${INTEL_SDP_DIR}"/man ]]; then
382 doman "${INTEL_SDP_DIR}"/man/en_US/man1/*
383 if has linguas_ja ${IUSE} && use linguas_ja; then
384 doman -i18n=ja_JP "${INTEL_SDP_DIR}"/man/ja_JP/man1/*
385 fi
386
387 find "${INTEL_SDP_DIR}"/man -delete || die
388 fi
389
214 einfo "Tagging ${PN}" 390 ebegin "Tagging ${PN}"
215 find opt -name \*sh -type f -exec sed -i \ 391 find opt -name \*sh -type f -exec sed -i \
216 -e "s:<.*DIR>:${INTEL_SDP_EDIR}:g" \ 392 -e "s:<.*DIR>:${INTEL_SDP_EDIR}:g" \
217 '{}' \; 393 '{}' + || die
218 mkdir -p "${ED:-${D}}"/ || die 394 eend
395
396 [[ -d "${ED}" ]] || dodir /
219 mv opt "${ED:-${D}}"/ || die "moving files failed" 397 mv opt "${ED}"/ || die "moving files failed"
220}
221 398
399 dodir "${INTEL_SDP_DIR}"/licenses
400 keepdir "${INTEL_SDP_DIR}"/licenses
401}
222 402
223# @ECLASS-VARIABLE: INTEL_SDP_DB 403# @FUNCTION: intel-sdp_pkg_postinst
224# @DESCRIPTION: 404# @DESCRIPTION:
225# Full path to intel registry db 405# Add things to intel database
226INTEL_SDP_DB="${EROOT%/}"/opt/intel/intel-sdp-products.db
227
228intel-sdp_pkg_postinst() { 406intel-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" 407 # add product registry to intel "database"
235 local l r 408 local l r
236 for r in ${INTEL_RPMS}; do 409 for r in ${INTEL_RPMS}; do
237 l="$(ls -1 ${EROOT%/}/opt/intel/.${r}_*.log | head -n 1)" 410 l="$(ls -1 ${EROOT%/}/opt/intel/.${r}_*.log | head -n 1)"
238 echo >> ${INTEL_SDP_DB} \ 411 echo >> ${INTEL_SDP_DB} \
239 "<:${r%-${_INTEL_PV4}*}-${_INTEL_PV4}:${r}:${INTEL_SDP_EDIR}:${l}:>" 412 "<:${r%-${_INTEL_PV4}*}-${_INTEL_PV4}:${r}:${INTEL_SDP_EDIR}:${l}:>"
240 done 413 done
414 _isdp_run-test
241} 415}
242 416
417# @FUNCTION: intel-sdp_pkg_postrm
418# @DESCRIPTION:
419# Sanitize intel database
243intel-sdp_pkg_postrm() { 420intel-sdp_pkg_postrm() {
244 # remove from intel "database" 421 # remove from intel "database"
245 if [[ -e ${INTEL_SDP_DB} ]]; then 422 if [[ -e ${INTEL_SDP_DB} ]]; then
246 local r 423 local r
247 for r in ${INTEL_RPMS}; do 424 for r in ${INTEL_RPMS}; do
253} 430}
254 431
255EXPORT_FUNCTIONS pkg_setup src_unpack src_install pkg_postinst pkg_postrm 432EXPORT_FUNCTIONS pkg_setup src_unpack src_install pkg_postinst pkg_postrm
256case "${EAPI:-0}" in 433case "${EAPI:-0}" in
257 0|1|2|3) ;; 434 0|1|2|3) ;;
258 4) EXPORT_FUNCTIONS pkg_pretend ;; 435 4|5) EXPORT_FUNCTIONS pkg_pretend ;;
259 *) die "EAPI=${EAPI} is not supported" ;; 436 *) die "EAPI=${EAPI} is not supported" ;;
260esac 437esac

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

  ViewVC Help
Powered by ViewVC 1.1.20