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

Contents of /eclass/intel-sdp.eclass

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.4 - (show annotations) (download)
Thu Sep 20 13:54:56 2012 UTC (2 years, 1 month ago) by jlec
Branch: MAIN
Changes since 1.3: +2 -2 lines
Keyword for *-linux prefix

1 # Copyright 1999-2012 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.3 2012/09/20 13:12:50 jlec Exp $
4
5 # @ECLASS: intel-sdp.eclass
6 # @MAINTAINER:
7 # S├ębastien Fabbro <bicatali@gentoo.org>
8 # Justin Lecher <jlec@gentoo.org>
9 # Sci Team <sci@gentoo.org>
10 # @BLURB: Handling of Intel's Software Development Products package management
11
12 # @ECLASS-VARIABLE: INTEL_DID
13 # @DEFAULT_UNSET
14 # @DESCRIPTION:
15 # The package download ID from Intel.
16 # To find out its value, see the links to download in
17 # https://registrationcenter.intel.com/RegCenter/MyProducts.aspx
18 #
19 # e.g. 2504
20 #
21 # Must be defined before inheriting the eclass
22
23 # @ECLASS-VARIABLE: INTEL_DPN
24 # @DEFAULT_UNSET
25 # @DESCRIPTION:
26 # The package name to download from Intel.
27 # To find out its value, see the links to download in
28 # https://registrationcenter.intel.com/RegCenter/MyProducts.aspx
29 #
30 # e.g. parallel_studio_xe
31 #
32 # Must be defined before inheriting the eclass
33
34 # @ECLASS-VARIABLE: INTEL_DPV
35 # @DEFAULT_UNSET
36 # @DESCRIPTION:
37 # The package download version from Intel.
38 # To find out its value, see the links to download in
39 # https://registrationcenter.intel.com/RegCenter/MyProducts.aspx
40 #
41 # e.g. 2011_sp1_update2
42 #
43 # Must be defined before inheriting the eclass
44
45 # @ECLASS-VARIABLE: INTEL_SUBDIR
46 # @DEFAULT_UNSET
47 # @DESCRIPTION:
48 # The package sub-directory where it will end-up in /opt/intel
49 # To find out its value, you have to do a raw install from the Intel tar ball
50
51 # @ECLASS-VARIABLE: INTEL_RPMS_DIRS
52 # @DESCRIPTION:
53 # List of subdirectories in the main archive which contains the
54 # rpms to extract.
55 : ${INTEL_RPMS_DIRS:=rpm}
56
57 # @ECLASS-VARIABLE: INTEL_X86
58 # @DESCRIPTION:
59 # 32bit arch in rpm names
60 #
61 # e.g. i484
62 : ${INTEL_X86:=i486}
63
64 # @ECLASS-VARIABLE: INTEL_BIN_RPMS
65 # @DEFAULT_UNSET
66 # @DESCRIPTION:
67 # Functional name of rpm without any version/arch tag
68 #
69 # e.g. compilerprof
70
71 # @ECLASS-VARIABLE: INTEL_DAT_RPMS
72 # @DEFAULT_UNSET
73 # @DESCRIPTION:
74 # Functional name of rpm of common data which are arch free
75 # without any version tag
76 #
77 # e.g. openmp
78
79 inherit check-reqs multilib versionator
80
81 _INTEL_PV1=$(get_version_component_range 1)
82 _INTEL_PV2=$(get_version_component_range 2)
83 _INTEL_PV3=$(get_version_component_range 3)
84 _INTEL_PV4=$(get_version_component_range 4)
85 _INTEL_URI="http://registrationcenter-download.intel.com/irc_nas/${INTEL_DID}/${INTEL_DPN}"
86
87 SRC_URI="
88 amd64? ( multilib? ( ${_INTEL_URI}_${INTEL_DPV}.tgz ) )
89 amd64? ( !multilib? ( ${_INTEL_URI}_${INTEL_DPV}_intel64.tgz ) )
90 x86? ( ${_INTEL_URI}_${INTEL_DPV}_ia32.tgz )"
91
92 LICENSE="Intel-SDP"
93 # Future work, #394411
94 #SLOT="${_INTEL_PV1}.${_INTEL_PV2}"
95 SLOT="0"
96 IUSE="multilib"
97 KEYWORDS="-* ~amd64 ~x86 ~amd64-linux ~x86-linux"
98
99 RESTRICT="mirror"
100
101 RDEPEND=""
102 DEPEND=">=app-arch/rpm2targz-9.0.0.3g"
103
104 _INTEL_SDP_YEAR=${INTEL_DPV%_update*}
105 _INTEL_SDP_YEAR=${INTEL_DPV%_sp*}
106
107 # @ECLASS-VARIABLE: INTEL_SDP_DIR
108 # @DEFAULT_UNSET
109 # @DESCRIPTION:
110 # Full rootless path to installation dir
111
112 INTEL_SDP_DIR="opt/intel/${INTEL_SUBDIR}-${_INTEL_SDP_YEAR:-${_INTEL_PV1}}.${_INTEL_PV3}.${_INTEL_PV4}"
113
114 # @ECLASS-VARIABLE: INTEL_SDP_EDIR
115 # @DEFAULT_UNSET
116 # @DESCRIPTION:
117 # Full rooted path to installation dir
118
119 INTEL_SDP_EDIR="${EROOT%/}/${INTEL_SDP_DIR}"
120
121 S="${WORKDIR}"
122
123 QA_PREBUILT="${INTEL_SDP_DIR}/*"
124
125 intel-sdp_pkg_pretend() {
126 : ${CHECKREQS_DISK_BUILD:=256M}
127 check-reqs_pkg_pretend
128 }
129
130 # @ECLASS-VARIABLE: INTEL_ARCH
131 # @DEFAULT_UNSET
132 # @DESCRIPTION:
133 # Intels internal names of the arches; will be set at runtime accordingly
134 #
135 # e.g. amd64-multilib -> INTEL_ARCH="intel64 ia32"
136
137 intel-sdp_pkg_setup() {
138 local arch a p
139 if use x86; then
140 arch=${INTEL_X86}
141 INTEL_ARCH="ia32"
142 elif use amd64; then
143 arch=x86_64
144 INTEL_ARCH="intel64"
145 if has_multilib_profile; then
146 arch="x86_64 ${INTEL_X86}"
147 INTEL_ARCH="intel64 ia32"
148 fi
149 fi
150 INTEL_RPMS=""
151 for p in ${INTEL_BIN_RPMS}; do
152 for a in ${arch}; do
153 INTEL_RPMS="${INTEL_RPMS} intel-${p}-${_INTEL_PV4}-${_INTEL_PV1}.${_INTEL_PV2}-${_INTEL_PV3}.${a}.rpm"
154 done
155 done
156 for p in ${INTEL_DAT_RPMS}; do
157 INTEL_RPMS="${INTEL_RPMS} intel-${p}-${_INTEL_PV4}-${_INTEL_PV1}.${_INTEL_PV2}-${_INTEL_PV3}.noarch.rpm"
158 done
159
160 case "${EAPI:-0}" in
161 0|1|2|3) intel-sdp_pkg_pretend ;;
162 esac
163 }
164
165 intel-sdp_src_unpack() {
166 local l r t rpmdir
167 for t in ${A}; do
168 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
172 [[ "${rpm_found}" == "true" ]] && continue
173 rpmdir=${t%%.*}/${subdir}
174 l=.${r}_$(date +'%d%m%y_%H%M%S').log
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
182 done
183 done
184 mv -v opt/intel/* ${INTEL_SDP_DIR} || die "mv to INTEL_SDP_DIR failed"
185 }
186
187 intel_link_eclipse_plugins() {
188 pushd ${INTEL_SDP_DIR}/eclipse_support > /dev/null
189 local c f
190 for c in cdt*; do
191 local cv=${c#cdt} ev=3.$(( ${cv:0:1} - 1))
192 if has_version "dev-util/eclipse-sdk:${ev}"; then
193 einfo "Linking eclipse (v${ev}) plugin cdt (v${cv})"
194 for f in cdt${cv}/eclipse/features/*; do
195 dodir /usr/$(get_libdir)/eclipse-${ev}/features
196 dosym "${INTEL_SDP_EDIR}"/eclipse_support/${f} \
197 /usr/$(get_libdir)/eclipse-${ev}/features/ || die
198 done
199 for f in cdt${cv}/eclipse/plugins/*; do
200 dodir /usr/$(get_libdir)/eclipse-${ev}/plugins
201 dosym "${INTEL_SDP_EDIR}"/eclipse_support/${f} \
202 /usr/$(get_libdir)/eclipse-${ev}/plugins/ || die
203 done
204 fi
205 done
206 popd > /dev/null
207 }
208
209 intel-sdp_src_install() {
210 [[ -d ${INTEL_SDP_DIR}/eclipse_support ]] && \
211 has eclipse ${IUSE} && \
212 use eclipse && \
213 intel_link_eclipse_plugins
214 einfo "Tagging ${PN}"
215 find opt -name \*sh -type f -exec sed -i \
216 -e "s:<.*DIR>:${INTEL_SDP_EDIR}:g" \
217 '{}' \;
218 mkdir -p "${ED:-${D}}"/ || die
219 mv opt "${ED:-${D}}"/ || die "moving files failed"
220 }
221
222
223 # @ECLASS-VARIABLE: INTEL_SDP_DB
224 # @DESCRIPTION:
225 # Full path to intel registry db
226 INTEL_SDP_DB="${EROOT%/}"/opt/intel/intel-sdp-products.db
227
228 intel-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"
235 local l r
236 for r in ${INTEL_RPMS}; do
237 l="$(ls -1 ${EROOT%/}/opt/intel/.${r}_*.log | head -n 1)"
238 echo >> ${INTEL_SDP_DB} \
239 "<:${r%-${_INTEL_PV4}*}-${_INTEL_PV4}:${r}:${INTEL_SDP_EDIR}:${l}:>"
240 done
241 }
242
243 intel-sdp_pkg_postrm() {
244 # remove from intel "database"
245 if [[ -e ${INTEL_SDP_DB} ]]; then
246 local r
247 for r in ${INTEL_RPMS}; do
248 sed -i \
249 -e "/${r}/d" \
250 ${INTEL_SDP_DB}
251 done
252 fi
253 }
254
255 EXPORT_FUNCTIONS pkg_setup src_unpack src_install pkg_postinst pkg_postrm
256 case "${EAPI:-0}" in
257 0|1|2|3) ;;
258 4) EXPORT_FUNCTIONS pkg_pretend ;;
259 *) die "EAPI=${EAPI} is not supported" ;;
260 esac

  ViewVC Help
Powered by ViewVC 1.1.20