/[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.1 Revision 1.8
1# Copyright 1999-2011 Gentoo Foundation 1# Copyright 1999-2012 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.1 2011/06/21 06:44:02 jlec Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/fortran-2.eclass,v 1.8 2012/10/07 13:10:27 jlec Exp $
4
5# Author Justin Lecher <jlec@gentoo.org>
6# Test functions provided by Sebastien Fabbro and Kacper Kowalik
7 4
8# @ECLASS: fortran-2.eclass 5# @ECLASS: fortran-2.eclass
9# @MAINTAINER: 6# @MAINTAINER:
10# jlec@gentoo.org 7# jlec@gentoo.org
11# sci@gentoo.org 8# sci@gentoo.org
9# @AUTHOR:
10# Author Justin Lecher <jlec@gentoo.org>
11# Test functions provided by Sebastien Fabbro and Kacper Kowalik
12# @BLURB: Simplify fortran compiler management 12# @BLURB: Simplify fortran compiler management
13# @DESCRIPTION: 13# @DESCRIPTION:
14# If you need a fortran compiler, then you should be inheriting this eclass. 14# If you need a fortran compiler, then you should be inheriting this eclass
15# The eclass tests for working fortran compilers 15# The eclass tests for working fortran compilers
16# and exports the variables FC and F77. 16# and exports the variables FC and F77.
17# Optionally, it checks for extended capabilities based on 17# Optionally, it checks for extended capabilities based on
18# the variable options selected in the ebuild 18# the variable options selected in the ebuild
19# The only phase function exported is fortran-2_pkg_setup. 19# The only phase function exported is fortran-2_pkg_setup.
32# Valid settings are any combination of: 77 90 95 2003 32# Valid settings are any combination of: 77 90 95 2003
33: ${FORTRAN_STANDARD:=77} 33: ${FORTRAN_STANDARD:=77}
34 34
35inherit toolchain-funcs 35inherit toolchain-funcs
36 36
37DEPEND="virtual/fortran"
38RDEPEND="${DEPEND}"
39
40# @FUNCTION: _write_testsuite 37# @FUNCTION: _write_testsuite
41# @DESCRIPTION: writes fortran test code
42# @INTERNAL 38# @INTERNAL
39# @DESCRIPTION:
40# writes fortran test code
43_write_testsuite() { 41_write_testsuite() {
44 local filebase=${T}/test-fortran 42 local filebase=${T}/test-fortran
45 43
46 # f77 code 44 # f77 code
47 cat <<- EOF > "${filebase}.f" 45 cat <<- EOF > "${filebase}.f"
59 end 57 end
60 EOF 58 EOF
61} 59}
62 60
63# @FUNCTION: _compile_test 61# @FUNCTION: _compile_test
62# @INTERNAL
64# @DESCRIPTION: 63# @DESCRIPTION:
65# Takes fortran compiler as first argument and dialect as second. 64# Takes fortran compiler as first argument and dialect as second.
66# Checks whether the passed fortran compiler speaks the fortran dialect 65# Checks whether the passed fortran compiler speaks the fortran dialect
67# @INTERNAL
68_compile_test() { 66_compile_test() {
69 local filebase=${T}/test-fortran 67 local filebase=${T}/test-fortran
70 local fcomp=${1} 68 local fcomp=${1}
71 local fdia=${2} 69 local fdia=${2}
72 local fcode=${filebase}.f${fdia} 70 local fcode=${filebase}.f${fdia}
82 rm -f "${fcode}.x" 80 rm -f "${fcode}.x"
83 return ${ret} 81 return ${ret}
84} 82}
85 83
86# @FUNCTION: _fortran-has-openmp 84# @FUNCTION: _fortran-has-openmp
85# @INTERNAL
87# @DESCRIPTION: 86# @DESCRIPTION:
88# See if the fortran supports OpenMP. 87# See if the fortran supports OpenMP.
89# @INTERNAL
90_fortran-has-openmp() { 88_fortran-has-openmp() {
91 local flag 89 local flag
92 local filebase=${T}/test-fc-openmp 90 local filebase=${T}/test-fc-openmp
93 local fcode=${filebase}.f 91 local fcode=${filebase}.f
94 local ret 92 local ret
108 rm -f "${fcode}.x" 106 rm -f "${fcode}.x"
109 return ${ret} 107 return ${ret}
110} 108}
111 109
112# @FUNCTION: _die_msg 110# @FUNCTION: _die_msg
113# @DESCRIPTION: Detailed description how to handle fortran support
114# @INTERNAL 111# @INTERNAL
112# @DESCRIPTION:
113# Detailed description how to handle fortran support
115_die_msg() { 114_die_msg() {
116 echo 115 echo
117 eerror "Please install currently selected gcc version with USE=fortran." 116 eerror "Please install currently selected gcc version with USE=fortran."
118 eerror "If you intend to use a different compiler then gfortran, please" 117 eerror "If you intend to use a different compiler then gfortran, please"
119 eerror "set FC variable accordingly and take care that the neccessary" 118 eerror "set FC variable accordingly and take care that the neccessary"
144 if [[ ${FORTRAN_NEED_OPENMP} == 1 ]]; then 143 if [[ ${FORTRAN_NEED_OPENMP} == 1 ]]; then
145 _fortran-has-openmp || \ 144 _fortran-has-openmp || \
146 die "Please install current gcc with USE=openmp or set the FC variable to a compiler that supports OpenMP" 145 die "Please install current gcc with USE=openmp or set the FC variable to a compiler that supports OpenMP"
147 fi 146 fi
148 tc-export F77 FC 147 tc-export F77 FC
148 einfo "Using following Fortran compiler"
149 einfo " F77: ${F77}"
150 einfo " FC: ${FC}"
149} 151}
150 152
151case ${EAPI:-0} in 153case ${EAPI:-0} in
152 1|2|3|4) EXPORT_FUNCTIONS pkg_setup ;; 154 0|1|2|3|4|5) EXPORT_FUNCTIONS pkg_setup ;;
153 *) die "EAPI=${EAPI} is not supported" ;; 155 *) die "EAPI=${EAPI} is not supported" ;;
154esac 156esac
157
158DEPEND="virtual/fortran"
159RDEPEND="${DEPEND}"

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.8

  ViewVC Help
Powered by ViewVC 1.1.20