Gentoo Archives: gentoo-commits

From: Justin Lecher <jlec@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/sci:master commit in: eclass/
Date: Tue, 27 Nov 2012 19:34:59
Message-Id: 1354044116.85f8fc569d35d6691cec47ad5d594629ea9457f2.jlec@gentoo
1 commit: 85f8fc569d35d6691cec47ad5d594629ea9457f2
2 Author: Justin Lecher <jlec <AT> gentoo <DOT> org>
3 AuthorDate: Fri Nov 23 19:04:28 2012 +0000
4 Commit: Justin Lecher <jlec <AT> gentoo <DOT> org>
5 CommitDate: Tue Nov 27 19:21:56 2012 +0000
6 URL: http://git.overlays.gentoo.org/gitweb/?p=proj/sci.git;a=commit;h=85f8fc56
7
8 Resort general functions and variables at the beginning
9
10 ---
11 eclass/intel-sdp.eclass | 356 ++++++++++++++++++++++++-----------------------
12 1 files changed, 180 insertions(+), 176 deletions(-)
13
14 diff --git a/eclass/intel-sdp.eclass b/eclass/intel-sdp.eclass
15 index 14dba83..2037ed3 100644
16 --- a/eclass/intel-sdp.eclass
17 +++ b/eclass/intel-sdp.eclass
18 @@ -75,6 +75,11 @@
19 #
20 # e.g. openmp
21
22 +# @ECLASS-VARIABLE: INTEL_SDP_DB
23 +# @DESCRIPTION:
24 +# Full path to intel registry db
25 +INTEL_SDP_DB="${EROOT%/}"/opt/intel/intel-sdp-products.db
26 +
27 inherit check-reqs multilib versionator
28
29 _INTEL_PV1=$(get_version_component_range 1)
30 @@ -133,6 +138,181 @@ intel-sdp_pkg_pretend() {
31 #
32 # e.g. amd64-multilib -> INTEL_ARCH="intel64 ia32"
33
34 +# @ECLASS-FUNCTION: intel_link_eclipse_plugins
35 +# @DESCRIPTION:
36 +# Creating necessary links to use intel compiler with eclipse
37 +intel_link_eclipse_plugins() {
38 + local c f
39 + pushd ${INTEL_SDP_DIR}/eclipse_support > /dev/null
40 + for c in cdt*; do
41 + local cv=${c#cdt} ev=3.$(( ${cv:0:1} - 1))
42 + if has_version "dev-util/eclipse-sdk:${ev}"; then
43 + einfo "Linking eclipse (v${ev}) plugin cdt (v${cv})"
44 + for f in cdt${cv}/eclipse/features/*; do
45 + dodir /usr/$(get_libdir)/eclipse-${ev}/features
46 + dosym "${INTEL_SDP_EDIR}"/eclipse_support/${f} \
47 + /usr/$(get_libdir)/eclipse-${ev}/features/ || die
48 + done
49 + for f in cdt${cv}/eclipse/plugins/*; do
50 + dodir /usr/$(get_libdir)/eclipse-${ev}/plugins
51 + dosym "${INTEL_SDP_EDIR}"/eclipse_support/${f} \
52 + /usr/$(get_libdir)/eclipse-${ev}/plugins/ || die
53 + done
54 + fi
55 + done
56 + popd > /dev/null
57 +}
58 +
59 +# @ECLASS-FUNCTION: big-warning
60 +# @INTERNAL
61 +# warn user that we really require a license
62 +
63 +big-warning() {
64 + case ${1} in
65 + test-failed )
66 + echo
67 + ewarn "Function test failed. Most probably due to an invalid license."
68 + ewarn "This means you already tried to bypass the license check once."
69 + ;;
70 + esac
71 +
72 + echo ""
73 + ewarn "Make sure you have recieved the an Intel license."
74 + ewarn "To receive a non-commercial license, you need to register at:"
75 + ewarn "http://software.intel.com/en-us/articles/non-commercial-software-development/"
76 + ewarn "Install the license file into ${INTEL_SDP_EDIR}/licenses/"
77 +
78 + case ${1} in
79 + pre-check )
80 + ewarn "before proceeding with installation of ${P}"
81 + echo ""
82 + ;;
83 + * )
84 + echo ""
85 + ;;
86 + esac
87 +}
88 +
89 +# @ECLASS-FUNCTION: _version_test
90 +# @INTERNAL
91 +# Testing for valid license by asking for version information of the compiler
92 +_version-test() {
93 + local _comp _comp_full _arch _file _warn
94 + case ${PN} in
95 + ifc )
96 + _comp=ifort
97 + ;;
98 + icc )
99 + _comp=icc
100 + ;;
101 + *)
102 + die "${PN} is not supported for testing"
103 + ;;
104 + esac
105 +
106 + for _arch in ${INTEL_ARCH}; do
107 + case ${EBUILD_PHASE} in
108 + install )
109 + _comp_full="${ED}/${INTEL_SDP_DIR}/bin/${_arch}/${_comp}"
110 + ;;
111 + postinst )
112 + _comp_full="${INTEL_SDP_EDIR}/bin/${_arch}/${_comp}"
113 + ;;
114 + * )
115 + ewarn "Compile test not supported in ${EBUILD_PHASE}"
116 + continue
117 + ;;
118 + esac
119 +
120 + debug-print "LD_LIBRARY_PATH=\"${INTEL_SDP_EDIR}/bin/${_arch}/\" \"${_comp_full}\" -V"
121 +
122 + LD_LIBRARY_PATH="${INTEL_SDP_EDIR}/bin/${_arch}/" "${_comp_full}" -V &>/dev/null
123 + [[ $? -ne 0 ]] && _warn=yes
124 + done
125 + [[ "${_warn}" == "yes" ]] && big-warning test-failed
126 +}
127 +
128 +# @ECLASS-FUNCTION: _compile-test
129 +# @INTERNAL
130 +# Testing for valid license with small compile test
131 +_compile-test() {
132 + local _comp _comp_full _arch _file _warn
133 + case ${1} in
134 + fortran )
135 + _file="${T}/${1}.f"
136 + cat > "${_file}" <<- EOF
137 + end
138 + EOF
139 + _comp=ifort
140 + ;;
141 + c )
142 + _file="${T}/${1}.c"
143 + cat > "${_file}" <<- EOF
144 + main() {
145 + ;
146 + }
147 + EOF
148 + _comp=icc
149 + ;;
150 + *)
151 + die "This ${1} is not supported for testing"
152 + ;;
153 + esac
154 +
155 + for _arch in ${INTEL_ARCH}; do
156 + case ${EBUILD_PHASE} in
157 + install )
158 + _comp_full="${ED}/${INTEL_SDP_DIR}/bin/${_arch}/${_comp}"
159 + ;;
160 + postinst )
161 + _comp_full="${INTEL_SDP_EDIR}/bin/${_arch}/${_comp}"
162 + ;;
163 + * )
164 + ewarn "Compile test not supported in ${EBUILD_PHASE}"
165 + continue
166 + ;;
167 + esac
168 +
169 +# debug-print "LD_LIBRARY_PATH=\"${INTEL_SDP_EDIR}/bin/${_arch}/\" \"${_comp_full}\" -c \"${_file}"
170 +
171 +# LD_LIBRARY_PATH="${INTEL_SDP_EDIR}/bin/${_arch}/" "${_comp_full}" -c "${_file}" &>/dev/null
172 +
173 + debug-print "LD_LIBRARY_PATH=\"${INTEL_SDP_EDIR}/bin/${_arch}/\" \"${_comp_full}\" -V"
174 +
175 + LD_LIBRARY_PATH="${INTEL_SDP_EDIR}/bin/${_arch}/" "${_comp_full}" -V &>/dev/null
176 + [[ $? -ne 0 ]] && _warn=yes
177 + done
178 + [[ "${_warn}" == "yes" ]] && big-warning test-failed
179 +}
180 +
181 +# @ECLASS-FUNCTION: _compile-fortran
182 +# @INTERNAL
183 +# Run fortran compile test
184 +_compile-fortran() { _compile-test fortran; }
185 +
186 +# @ECLASS-FUNCTION: _compile-c
187 +# @INTERNAL
188 +# Run c compile test
189 +_compile-c() { _compile-test c; }
190 +
191 +# @ECLASS-FUNCTION: run-test
192 +# @INTERNAL
193 +# Test if installed compiler is working
194 +run-test() {
195 + case ${PN} in
196 + ifc )
197 + debug-print "Testing ifort"
198 + _compile-fortran ;;
199 + icc )
200 + debug-print "Testing icc"
201 + _compile-c ;;
202 + * )
203 + debug-print "No test available for ${PN}"
204 + ;;
205 + esac
206 +}
207 +
208 +
209 # @ ECLASS-FUNCTION: intel-sdp_pkg_setup
210 # @DESCRIPTION:
211 # The setup finction serves two purposes:
212 @@ -214,28 +394,6 @@ intel-sdp_src_unpack() {
213 mv -v opt/intel/* ${INTEL_SDP_DIR} || die "mv to INTEL_SDP_DIR failed"
214 }
215
216 -intel_link_eclipse_plugins() {
217 - pushd ${INTEL_SDP_DIR}/eclipse_support > /dev/null
218 - local c f
219 - for c in cdt*; do
220 - local cv=${c#cdt} ev=3.$(( ${cv:0:1} - 1))
221 - if has_version "dev-util/eclipse-sdk:${ev}"; then
222 - einfo "Linking eclipse (v${ev}) plugin cdt (v${cv})"
223 - for f in cdt${cv}/eclipse/features/*; do
224 - dodir /usr/$(get_libdir)/eclipse-${ev}/features
225 - dosym "${INTEL_SDP_EDIR}"/eclipse_support/${f} \
226 - /usr/$(get_libdir)/eclipse-${ev}/features/ || die
227 - done
228 - for f in cdt${cv}/eclipse/plugins/*; do
229 - dodir /usr/$(get_libdir)/eclipse-${ev}/plugins
230 - dosym "${INTEL_SDP_EDIR}"/eclipse_support/${f} \
231 - /usr/$(get_libdir)/eclipse-${ev}/plugins/ || die
232 - done
233 - fi
234 - done
235 - popd > /dev/null
236 -}
237 -
238 # @ ECLASS-FUNCTION: intel-sdp_src_install
239 # @DESCRIPTION:
240 # Install everything
241 @@ -281,160 +439,6 @@ intel-sdp_src_install() {
242 keepdir "${INTEL_SDP_EDIR}"/licenses
243 }
244
245 -# @ECLASS-FUNCTION: big-warning
246 -# @INTERNAL
247 -# warn user that we really require a license
248 -
249 -big-warning() {
250 - case ${1} in
251 - test-failed )
252 - echo
253 - ewarn "Function test failed. Most probably due to an invalid license."
254 - ewarn "This means you already tried to bypass the license check once."
255 - ;;
256 - esac
257 -
258 - echo ""
259 - ewarn "Make sure you have recieved the an Intel license."
260 - ewarn "To receive a non-commercial license, you need to register at:"
261 - ewarn "http://software.intel.com/en-us/articles/non-commercial-software-development/"
262 - ewarn "Install the license file into ${INTEL_SDP_EDIR}/licenses/"
263 -
264 - case ${1} in
265 - pre-check )
266 - ewarn "before proceeding with installation of ${P}"
267 - echo ""
268 - ;;
269 - * )
270 - echo ""
271 - ;;
272 - esac
273 -}
274 -
275 -# @ECLASS-FUNCTION: _version_test
276 -# @INTERNAL
277 -# Testing for valid license by asking for version information of the compiler
278 -_version-test() {
279 - local _comp _comp_full _arch _file _warn
280 - case ${PN} in
281 - ifc )
282 - _comp=ifort
283 - ;;
284 - icc )
285 - _comp=icc
286 - ;;
287 - *)
288 - die "${PN} is not supported for testing"
289 - ;;
290 - esac
291 -
292 - for _arch in ${INTEL_ARCH}; do
293 - case ${EBUILD_PHASE} in
294 - install )
295 - _comp_full="${ED}/${INTEL_SDP_DIR}/bin/${_arch}/${_comp}"
296 - ;;
297 - postinst )
298 - _comp_full="${INTEL_SDP_EDIR}/bin/${_arch}/${_comp}"
299 - ;;
300 - * )
301 - ewarn "Compile test not supported in ${EBUILD_PHASE}"
302 - continue
303 - ;;
304 - esac
305 -
306 - debug-print "LD_LIBRARY_PATH=\"${INTEL_SDP_EDIR}/bin/${_arch}/\" \"${_comp_full}\" -V"
307 -
308 - LD_LIBRARY_PATH="${INTEL_SDP_EDIR}/bin/${_arch}/" "${_comp_full}" -V &>/dev/null
309 - [[ $? -ne 0 ]] && _warn=yes
310 - done
311 - [[ "${_warn}" == "yes" ]] && big-warning test-failed
312 -}
313 -
314 -# @ECLASS-FUNCTION: _compile-test
315 -# @INTERNAL
316 -# Testing for valid license with small compile test
317 -_compile-test() {
318 - local _comp _comp_full _arch _file _warn
319 - case ${1} in
320 - fortran )
321 - _file="${T}/${1}.f"
322 - cat > "${_file}" <<- EOF
323 - end
324 - EOF
325 - _comp=ifort
326 - ;;
327 - c )
328 - _file="${T}/${1}.c"
329 - cat > "${_file}" <<- EOF
330 - main() {
331 - ;
332 - }
333 - EOF
334 - _comp=icc
335 - ;;
336 - *)
337 - die "This ${1} is not supported for testing"
338 - ;;
339 - esac
340 -
341 - for _arch in ${INTEL_ARCH}; do
342 - case ${EBUILD_PHASE} in
343 - install )
344 - _comp_full="${ED}/${INTEL_SDP_DIR}/bin/${_arch}/${_comp}"
345 - ;;
346 - postinst )
347 - _comp_full="${INTEL_SDP_EDIR}/bin/${_arch}/${_comp}"
348 - ;;
349 - * )
350 - ewarn "Compile test not supported in ${EBUILD_PHASE}"
351 - continue
352 - ;;
353 - esac
354 -
355 -# debug-print "LD_LIBRARY_PATH=\"${INTEL_SDP_EDIR}/bin/${_arch}/\" \"${_comp_full}\" -c \"${_file}"
356 -
357 -# LD_LIBRARY_PATH="${INTEL_SDP_EDIR}/bin/${_arch}/" "${_comp_full}" -c "${_file}" &>/dev/null
358 -
359 - debug-print "LD_LIBRARY_PATH=\"${INTEL_SDP_EDIR}/bin/${_arch}/\" \"${_comp_full}\" -V"
360 -
361 - LD_LIBRARY_PATH="${INTEL_SDP_EDIR}/bin/${_arch}/" "${_comp_full}" -V &>/dev/null
362 - [[ $? -ne 0 ]] && _warn=yes
363 - done
364 - [[ "${_warn}" == "yes" ]] && big-warning test-failed
365 -}
366 -
367 -# @ECLASS-FUNCTION: _compile-fortran
368 -# @INTERNAL
369 -# Run fortran compile test
370 -_compile-fortran() { _compile-test fortran; }
371 -
372 -# @ECLASS-FUNCTION: _compile-c
373 -# @INTERNAL
374 -# Run c compile test
375 -_compile-c() { _compile-test c; }
376 -
377 -# @ECLASS-FUNCTION: run-test
378 -# @INTERNAL
379 -# Test if installed compiler is working
380 -run-test() {
381 - case ${PN} in
382 - ifc )
383 - debug-print "Testing ifort"
384 - _compile-fortran ;;
385 - icc )
386 - debug-print "Testing icc"
387 - _compile-c ;;
388 - * )
389 - debug-print "No test available for ${PN}"
390 - ;;
391 - esac
392 -}
393 -
394 -# @ECLASS-VARIABLE: INTEL_SDP_DB
395 -# @DESCRIPTION:
396 -# Full path to intel registry db
397 -INTEL_SDP_DB="${EROOT%/}"/opt/intel/intel-sdp-products.db
398 -
399 # @ECLASS-FUNCTION
400 # @DESCRIPTION:
401 # Add things to intel database