/[gentoo-x86]/eclass/fortran-2.eclass
Gentoo

Diff of /eclass/fortran-2.eclass

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

Revision 1.19 Revision 1.20
1# Copyright 1999-2013 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/fortran-2.eclass,v 1.19 2013/07/29 09:53:36 jlec Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/fortran-2.eclass,v 1.20 2013/07/29 20:13:57 jlec Exp $
4 4
5# @ECLASS: fortran-2.eclass 5# @ECLASS: fortran-2.eclass
6# @MAINTAINER: 6# @MAINTAINER:
7# jlec@gentoo.org 7# jlec@gentoo.org
8# sci@gentoo.org 8# sci@gentoo.org
42: ${FORTRAN_STANDARD:=77} 42: ${FORTRAN_STANDARD:=77}
43 43
44# @ECLASS-VARIABLE: FORTRAN_NEEDED 44# @ECLASS-VARIABLE: FORTRAN_NEEDED
45# @DESCRIPTION: 45# @DESCRIPTION:
46# If your package has an optional fortran support, set this variable 46# If your package has an optional fortran support, set this variable
47# to the space seperated list of USE triggering the fortran 47# to the space separated list of USE triggering the fortran
48# dependence. 48# dependency.
49# 49#
50# e.g. FORTRAN_NEEDED=lapack would result in 50# e.g. FORTRAN_NEEDED=lapack would result in
51# 51#
52# DEPEND="lapack? ( virtual/fortran )" 52# DEPEND="lapack? ( virtual/fortran )"
53# 53#
108 local fdia=${2} 108 local fdia=${2}
109 local fcode=${filebase}.f${fdia} 109 local fcode=${filebase}.f${fdia}
110 local ret 110 local ret
111 111
112 [[ $# -lt 1 ]] && \ 112 [[ $# -lt 1 ]] && \
113 die "_fortran_compile_test() needs at least one arguments" 113 die "_fortran_compile_test() needs at least one argument"
114 114
115 [[ -f ${fcode} ]] || _fortran_write_testsuite 115 [[ -f ${fcode} ]] || _fortran_write_testsuite
116 116
117 ${fcomp} "${fcode}" -o "${fcode}.x" \ 117 ${fcomp} "${fcode}" -o "${fcode}.x" \
118 >> "${T}"/_fortran_compile_test.log 2>&1 118 >> "${T}"/_fortran_compile_test.log 2>&1
121 rm -f "${fcode}.x" 121 rm -f "${fcode}.x"
122 return ${ret} 122 return ${ret}
123} 123}
124 124
125# @FUNCTION: _fortran-has-openmp 125# @FUNCTION: _fortran-has-openmp
126# @RETURN: compilers return value 126# @RETURN: return code of the compiler
127# @INTERNAL 127# @INTERNAL
128# @DESCRIPTION: 128# @DESCRIPTION:
129# See if the fortran supports OpenMP. 129# See if the fortran supports OpenMP.
130_fortran-has-openmp() { 130_fortran-has-openmp() {
131 local flag 131 local flag
156# Detailed description how to handle fortran support 156# Detailed description how to handle fortran support
157_fortran_die_msg() { 157_fortran_die_msg() {
158 echo 158 echo
159 eerror "Please install currently selected gcc version with USE=fortran." 159 eerror "Please install currently selected gcc version with USE=fortran."
160 eerror "If you intend to use a different compiler then gfortran, please" 160 eerror "If you intend to use a different compiler then gfortran, please"
161 eerror "set FC variable accordingly and take care that the neccessary" 161 eerror "set FC variable accordingly and take care that the necessary"
162 eerror "fortran dialects are support." 162 eerror "fortran dialects are supported."
163 echo 163 echo
164 die "Currently no working fortran compiler is available" 164 die "Currently no working fortran compiler is available"
165} 165}
166 166
167# @FUNCTION: _fortran_test_function 167# @FUNCTION: _fortran_test_function
168# @INTERNAL 168# @INTERNAL
169# @DESCRIPTION: 169# @DESCRIPTION:
170# Internal testfunction for working fortran compiler. 170# Internal test function for working fortran compiler.
171# It is called in fortran-2_pkg_setup. 171# It is called in fortran-2_pkg_setup.
172_fortran_test_function() { 172_fortran_test_function() {
173 local dialect 173 local dialect
174 174
175 : ${F77:=$(tc-getFC)} 175 : ${F77:=$(tc-getFC)}
195 195
196 if [[ ${FORTRAN_NEED_OPENMP} == 1 ]]; then 196 if [[ ${FORTRAN_NEED_OPENMP} == 1 ]]; then
197 if _fortran-has-openmp; then 197 if _fortran-has-openmp; then
198 einfo "${FC} has OPENMP support" 198 einfo "${FC} has OPENMP support"
199 else 199 else
200 die "Please install current gcc with USE=openmp or " \ 200 die "Please install current gcc with USE=openmp or set the FC variable to a compiler that supports OpenMP"
201 "set the FC variable to a compiler that supports OpenMP"
202 fi 201 fi
203 fi 202 fi
204} 203}
205 204
206# @FUNCTION: _fortran-2_pkg_setup 205# @FUNCTION: _fortran-2_pkg_setup
230} 229}
231 230
232 231
233# @FUNCTION: fortran-2_pkg_setup 232# @FUNCTION: fortran-2_pkg_setup
234# @DESCRIPTION: 233# @DESCRIPTION:
235# Setup functionallity, 234# Setup functionality,
236# checks for a valid fortran compiler and optionally for its openmp support. 235# checks for a valid fortran compiler and optionally for its openmp support.
237fortran-2_pkg_setup() { 236fortran-2_pkg_setup() {
238 case ${EAPI:-0} in 237 case ${EAPI:-0} in
239 0|1|2|3) 238 0|1|2|3)
240 eqawarn "Support for EAPI < 4 will be removed from the" 239 eqawarn "Support for EAPI < 4 will be removed from the"
241 eqawarn "fortran-2.eclass in until Sep 31. 2013." 240 eqawarn "fortran-2.eclass in until 2013-09-30."
242 eqawarn "Please migrate your package to a higher EAPI" 241 eqawarn "Please migrate your package to a higher EAPI"
243 eqawarn "or file a bug at https://bugs.gentoo.org" 242 eqawarn "or file a bug at https://bugs.gentoo.org"
244 _fortran-2_pkg_setup ;; 243 _fortran-2_pkg_setup ;;
245 4|5) 244 4|5)
246 if [[ ${MERGE_TYPE} != binary ]]; then 245 if [[ ${MERGE_TYPE} != binary ]]; then

Legend:
Removed from v.1.19  
changed lines
  Added in v.1.20

  ViewVC Help
Powered by ViewVC 1.1.20