From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from pigeon.gentoo.org ([208.92.234.80] helo=lists.gentoo.org) by finch.gentoo.org with esmtp (Exim 4.60) (envelope-from ) id 1QYWum-0000PD-Ua for garchives@archives.gentoo.org; Mon, 20 Jun 2011 05:20:49 +0000 Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id E9C0A1C057; Mon, 20 Jun 2011 05:20:31 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) by pigeon.gentoo.org (Postfix) with ESMTP id AC63A1C057 for ; Mon, 20 Jun 2011 05:20:31 +0000 (UTC) Received: from pelican.gentoo.org (unknown [66.219.59.40]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 23E882AC017 for ; Mon, 20 Jun 2011 05:20:31 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by pelican.gentoo.org (Postfix) with ESMTP id 77B698003E for ; Mon, 20 Jun 2011 05:20:30 +0000 (UTC) From: "Justin Lecher" To: gentoo-commits@lists.gentoo.org Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Justin Lecher" Message-ID: Subject: [gentoo-commits] proj/sci:master commit in: eclass/ X-VCS-Repository: proj/sci X-VCS-Files: eclass/fortran-2.eclass X-VCS-Directories: eclass/ X-VCS-Committer: jlec X-VCS-Committer-Name: Justin Lecher X-VCS-Revision: f6c799d92e58dc170ef057ad73e44ef5db3e4f16 Date: Mon, 20 Jun 2011 05:20:30 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: quoted-printable X-Archives-Salt: X-Archives-Hash: 693920a96c23f5f0d0bee7a76ca82501 commit: f6c799d92e58dc170ef057ad73e44ef5db3e4f16 Author: Justin Lecher gentoo org> AuthorDate: Sat Jun 18 14:53:07 2011 +0000 Commit: Justin Lecher gentoo org> CommitDate: Sat Jun 18 14:53:07 2011 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=3Dproj/sci.git;a=3Dc= ommit;h=3Df6c799d9 Mikes suggestions --- eclass/fortran-2.eclass | 89 +++++++++++++++++++++++------------------= ------ 1 files changed, 44 insertions(+), 45 deletions(-) diff --git a/eclass/fortran-2.eclass b/eclass/fortran-2.eclass index b812f50..600d107 100644 --- a/eclass/fortran-2.eclass +++ b/eclass/fortran-2.eclass @@ -9,40 +9,37 @@ # @MAINTAINER: # jlec@gentoo.org # sci@gentoo.org -# @BLURB: Packages, which need a fortran compiler should inherit this ec= lass. +# @BLURB: Simplify fortran compiler management # @DESCRIPTION: -# If you need a fortran compiler, inherit this eclass. This eclass tests= for -# working fortran compilers and exports the variables FC and F77. -# Optional, it checks for openmp capability of the -# current fortran compiler through FORTRAN_NEED_OPENMP=3D1. -# Only phase function exported is pkg_pretend and pkg_setup. -# Need help? Ask the sci team. +# If you need a fortran compiler, then you should be inheriting this ecl= ass. +# The eclass tests for working fortran compilers +# and exports the variables FC and F77. +# Optionally, it checks for extended capabilities based on +# the variable options selected in the ebuild +# The only phase functions exported are pkg_pretend and pkg_setup. =20 # @ECLASS-VARIABLE: FORTRAN_NEED_OPENMP # @DESCRIPTION: -# Set FORTRAN_NEED_OPENMP=3D1 in order to test FC for openmp capabilitie= s -# -# Default is 0 +# Set to "1" in order to automatically have the eclass abort if the fort= ran +# compiler lacks openmp support. +: ${FORTRAN_NEED_OPENMP:=3D0} =20 # @ECLASS-VARIABLE: FORTRAN_STANDARD # @DESCRIPTION: -# Set this, if a special dialect needs to be support. Generally not need= ed. -# -# Valid settings are any combination of -# -# FORTRAN_STANDARD=3D"77 90 95 2003" +# Set this, if a special dialect needs to be supported. +# Generally not needed as default is sufficient. # -# Defaults to FORTRAN_STANDARD=3D"77" which is sufficient for most cases= . +# Valid settings are any combination of: 77 90 95 2003 +: ${FORTRAN_STANDARD:=3D77} =20 inherit toolchain-funcs =20 DEPEND=3D"virtual/fortran" RDEPEND=3D"${DEPEND}" =20 -# internal function -# -# FUNCTION: _write_testsuite -# DESCRIPTION: writes fortran test code +# @FUNCTION: _write_testsuite +# @DESCRIPTION: writes fortran test code +# @INTERNAL _write_testsuite() { local filebase=3D${T}/test-fortran =20 @@ -63,56 +60,58 @@ _write_testsuite() { EOF } =20 -# internal function -# -# FUNCTION: _compile_test -# DESCRIPTION: +# @FUNCTION: _compile_test +# @DESCRIPTION: # Takes fortran compiler as first argument and dialect as second. # Checks whether the passed fortran compiler speaks the fortran dialect +# @INTERNAL _compile_test() { local filebase=3D${T}/test-fortran local fcomp=3D${1} local fdia=3D${2} + local fcode=3D${filebase}.f${fdia} + local ret =20 - [[ -z ${fcomp} ]] && die "_compile_test() needs at least one argument" + [[ $# -eq 0 ]] && die "_compile_test() needs at least one argument" =20 - [[ -f "${filebase}.f${fdia}" ]] || _write_testsuite + [[ -f ${fcode} ]] || _write_testsuite =20 - ${fcomp} "${filebase}.f${fdia}" -o "${filebase}-f${fdia}" >&/dev/null - local ret=3D$? + ${fcomp} "${fcode}" -o "${fcode}.x" >&/dev/null + ret=3D$? =20 - rm -f "${filebase}-f${fdia}" + rm -f "${fcode}.x" return ${ret} } =20 -# internal function -# -# FUNCTION: _fortran-has-openmp -# DESCRIPTION: +# @FUNCTION: _fortran-has-openmp +# @DESCRIPTION: # See if the fortran supports OpenMP. +# @INTERNAL _fortran-has-openmp() { local flag local filebase=3D${T}/test-fc-openmp + local fcode=3D${filebase}.f + local ret + local _fc=3D$(tc-getFC) =20 - cat <<- EOF > "${filebase}.f" + cat <<- EOF > "${fcode}" call omp_get_num_threads end EOF =20 for flag in -fopenmp -xopenmp -openmp -mp -omp -qsmp=3Domp; do - $(tc-getFC "$@") ${flag} "${filebase}.f" -o "${filebase}" >&/dev/null - local ret=3D$? + ${_fc} ${flag} "${fcode}" -o "${fcode}.x" >&/dev/null + ret=3D$? (( ${ret} )) || break done =20 - rm -f "${filebase}"* + rm -f "${fcode}.x" return ${ret} } =20 -# internal -# -# FUNCTION: _die_msg -# DESCRIPTION: Detailed description how to handle fortran support +# @FUNCTION: _die_msg +# @DESCRIPTION: Detailed description how to handle fortran support +# @INTERNAL _die_msg() { echo eerror "Please install currently selected gcc version with USE=3Dfortra= n." @@ -129,7 +128,7 @@ _die_msg() { fortran-2_pkg_pretend() { local dialect =20 - [[ -n ${F77} ]] || F77=3D$(tc-getFC) + : ${F77:=3D$(tc-getFC)} =20 : ${FORTRAN_STANDARD:=3D77} for dialect in ${FORTRAN_STANDARD}; do @@ -151,13 +150,13 @@ fortran-2_pkg_pretend() { # @FUNCTION: fortran-2_pkg_setup # @DESCRIPTION: # In EAPI < 4 it calls the compiler check. This behavior is deprecated -# and will be removed at 01-Sep-2011. Please migrate to EAPI=3D4. +# and will be removed at 01-Okt-2011. Please migrate to EAPI=3D4. # # Exports the FC and F77 variable according to the compiler checks. fortran-2_pkg_setup() { if has ${EAPI:-0} 0 1 2 3; then ewarn "The support for EAPI=3D${EAPI} by the fortran-2.eclass" - ewarn "will be end at 01-Sep-2011" + ewarn "will be end at 01-Okt-2011" ewarn "Please migrate your package to EAPI=3D4" fortran-2_pkg_pretend fi @@ -165,7 +164,7 @@ fortran-2_pkg_setup() { [[ -n ${FC} ]] || export FC=3D$(tc-getFC) } =20 -case "${EAPI:-0}" in +case ${EAPI:-0} in 1|2|3) EXPORT_FUNCTIONS pkg_setup ;; 4) EXPORT_FUNCTIONS pkg_pretend pkg_setup ;; *) die "EAPI=3D${EAPI} is not supported" ;;