public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] gentoo-x86 commit in eclass: fortran-2.eclass
@ 2011-06-21  6:44 Justin Lecher (jlec)
  0 siblings, 0 replies; 7+ messages in thread
From: Justin Lecher (jlec) @ 2011-06-21  6:44 UTC (permalink / raw
  To: gentoo-commits

jlec        11/06/21 06:44:02

  Added:                fortran-2.eclass
  Log:
  fortran-2.eclass added

Revision  Changes    Path
1.1                  eclass/fortran-2.eclass

file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/fortran-2.eclass?rev=1.1&view=markup
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/fortran-2.eclass?rev=1.1&content-type=text/plain

Index: fortran-2.eclass
===================================================================
# Copyright 1999-2011 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/eclass/fortran-2.eclass,v 1.1 2011/06/21 06:44:02 jlec Exp $

# Author Justin Lecher <jlec@gentoo.org>
# Test functions provided by Sebastien Fabbro and Kacper Kowalik

# @ECLASS: fortran-2.eclass
# @MAINTAINER:
# jlec@gentoo.org
# sci@gentoo.org
# @BLURB: Simplify fortran compiler management
# @DESCRIPTION:
# If you need a fortran compiler, then you should be inheriting this eclass.
# 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 function exported is fortran-2_pkg_setup.

# @ECLASS-VARIABLE: FORTRAN_NEED_OPENMP
# @DESCRIPTION:
# Set to "1" in order to automatically have the eclass abort if the fortran
# compiler lacks openmp support.
: ${FORTRAN_NEED_OPENMP:=0}

# @ECLASS-VARIABLE: FORTRAN_STANDARD
# @DESCRIPTION:
# Set this, if a special dialect needs to be supported.
# Generally not needed as default is sufficient.
#
# Valid settings are any combination of: 77 90 95 2003
: ${FORTRAN_STANDARD:=77}

inherit toolchain-funcs

DEPEND="virtual/fortran"
RDEPEND="${DEPEND}"

# @FUNCTION: _write_testsuite
# @DESCRIPTION: writes fortran test code
# @INTERNAL
_write_testsuite() {
	local filebase=${T}/test-fortran

	# f77 code
	cat <<- EOF > "${filebase}.f"
	       end
	EOF

	# f90/95 code
	cat <<- EOF > "${filebase}.f90"
	end
	EOF

	# f2003 code
	cat <<- EOF > "${filebase}.f03"
	       procedure(), pointer :: p
	       end
	EOF
}

# @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=${T}/test-fortran
	local fcomp=${1}
	local fdia=${2}
	local fcode=${filebase}.f${fdia}
	local ret

	[[ $# -eq 0 ]] && die "_compile_test() needs at least one argument"

	[[ -f ${fcode} ]] || _write_testsuite

	${fcomp} "${fcode}" -o "${fcode}.x" >&/dev/null
	ret=$?

	rm -f "${fcode}.x"
	return ${ret}
}

# @FUNCTION: _fortran-has-openmp
# @DESCRIPTION:
# See if the fortran supports OpenMP.
# @INTERNAL
_fortran-has-openmp() {
	local flag
	local filebase=${T}/test-fc-openmp
	local fcode=${filebase}.f
	local ret
	local _fc=$(tc-getFC)

	cat <<- EOF > "${fcode}"
	       call omp_get_num_threads
	       end
	EOF

	for flag in -fopenmp -xopenmp -openmp -mp -omp -qsmp=omp; do
		${_fc} ${flag} "${fcode}" -o "${fcode}.x" >&/dev/null
		ret=$?
		(( ${ret} )) || break
	done

	rm -f "${fcode}.x"
	return ${ret}
}

# @FUNCTION: _die_msg
# @DESCRIPTION: Detailed description how to handle fortran support
# @INTERNAL
_die_msg() {
	echo
	eerror "Please install currently selected gcc version with USE=fortran."
	eerror "If you intend to use a different compiler then gfortran, please"
	eerror "set FC variable accordingly and take care that the neccessary"
	eerror "fortran dialects are support."
	echo
	die "Currently no working fortran compiler is available"
}

# @FUNCTION: fortran-2_pkg_setup
# @DESCRIPTION:
# Setup functionallity, checks for a valid fortran compiler and optionally for its openmp support.
fortran-2_pkg_setup() {
	local dialect

	: ${F77:=$(tc-getFC)}

	: ${FORTRAN_STANDARD:=77}
	for dialect in ${FORTRAN_STANDARD}; do
		case ${dialect} in
			77) _compile_test $(tc-getF77) || _die_msg ;;
			90|95) _compile_test $(tc-getFC) 90 || _die_msg ;;
			2003) _compile_test $(tc-getFC) 03 || _die_msg ;;
			2008) die "Future" ;;
			*) die "${dialect} is not a Fortran dialect." ;;
		esac
	done

	if [[ ${FORTRAN_NEED_OPENMP} == 1 ]]; then
		_fortran-has-openmp || \
			die "Please install current gcc with USE=openmp or set the FC variable to a compiler that supports OpenMP"
	fi
	tc-export F77 FC
}

case ${EAPI:-0} in
	1|2|3|4) EXPORT_FUNCTIONS pkg_setup ;;
	*) die "EAPI=${EAPI} is not supported" ;;
esac






^ permalink raw reply	[flat|nested] 7+ messages in thread

* [gentoo-commits] gentoo-x86 commit in eclass: fortran-2.eclass
@ 2011-06-21  8:06 Justin Lecher (jlec)
  0 siblings, 0 replies; 7+ messages in thread
From: Justin Lecher (jlec) @ 2011-06-21  8:06 UTC (permalink / raw
  To: gentoo-commits

jlec        11/06/21 08:06:56

  Modified:             fortran-2.eclass
  Log:
  Added EAPI=0 support to fortran.eclass

Revision  Changes    Path
1.2                  eclass/fortran-2.eclass

file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/fortran-2.eclass?rev=1.2&view=markup
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/fortran-2.eclass?rev=1.2&content-type=text/plain
diff : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/fortran-2.eclass?r1=1.1&r2=1.2

Index: fortran-2.eclass
===================================================================
RCS file: /var/cvsroot/gentoo-x86/eclass/fortran-2.eclass,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- fortran-2.eclass	21 Jun 2011 06:44:02 -0000	1.1
+++ fortran-2.eclass	21 Jun 2011 08:06:56 -0000	1.2
@@ -1,6 +1,6 @@
 # Copyright 1999-2011 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/eclass/fortran-2.eclass,v 1.1 2011/06/21 06:44:02 jlec Exp $
+# $Header: /var/cvsroot/gentoo-x86/eclass/fortran-2.eclass,v 1.2 2011/06/21 08:06:56 jlec Exp $
 
 # Author Justin Lecher <jlec@gentoo.org>
 # Test functions provided by Sebastien Fabbro and Kacper Kowalik
@@ -149,6 +149,6 @@
 }
 
 case ${EAPI:-0} in
-	1|2|3|4) EXPORT_FUNCTIONS pkg_setup ;;
+	0|1|2|3|4) EXPORT_FUNCTIONS pkg_setup ;;
 	*) die "EAPI=${EAPI} is not supported" ;;
 esac






^ permalink raw reply	[flat|nested] 7+ messages in thread

* [gentoo-commits] gentoo-x86 commit in eclass: fortran-2.eclass
@ 2011-06-21 14:05 Justin Lecher (jlec)
  0 siblings, 0 replies; 7+ messages in thread
From: Justin Lecher (jlec) @ 2011-06-21 14:05 UTC (permalink / raw
  To: gentoo-commits

jlec        11/06/21 14:05:30

  Modified:             fortran-2.eclass
  Log:
  Remove dependency on virtual/fortran from fortran-2.eclass

Revision  Changes    Path
1.3                  eclass/fortran-2.eclass

file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/fortran-2.eclass?rev=1.3&view=markup
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/fortran-2.eclass?rev=1.3&content-type=text/plain
diff : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/fortran-2.eclass?r1=1.2&r2=1.3

Index: fortran-2.eclass
===================================================================
RCS file: /var/cvsroot/gentoo-x86/eclass/fortran-2.eclass,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- fortran-2.eclass	21 Jun 2011 08:06:56 -0000	1.2
+++ fortran-2.eclass	21 Jun 2011 14:05:30 -0000	1.3
@@ -1,6 +1,6 @@
 # Copyright 1999-2011 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/eclass/fortran-2.eclass,v 1.2 2011/06/21 08:06:56 jlec Exp $
+# $Header: /var/cvsroot/gentoo-x86/eclass/fortran-2.eclass,v 1.3 2011/06/21 14:05:30 jlec Exp $
 
 # Author Justin Lecher <jlec@gentoo.org>
 # Test functions provided by Sebastien Fabbro and Kacper Kowalik
@@ -34,9 +34,6 @@
 
 inherit toolchain-funcs
 
-DEPEND="virtual/fortran"
-RDEPEND="${DEPEND}"
-
 # @FUNCTION: _write_testsuite
 # @DESCRIPTION: writes fortran test code
 # @INTERNAL






^ permalink raw reply	[flat|nested] 7+ messages in thread

* [gentoo-commits] gentoo-x86 commit in eclass: fortran-2.eclass
@ 2011-06-21 14:11 Justin Lecher (jlec)
  0 siblings, 0 replies; 7+ messages in thread
From: Justin Lecher (jlec) @ 2011-06-21 14:11 UTC (permalink / raw
  To: gentoo-commits

jlec        11/06/21 14:11:31

  Modified:             fortran-2.eclass
  Log:
  Add note on dependency of virtual/fortran to fortran-2.eclass

Revision  Changes    Path
1.4                  eclass/fortran-2.eclass

file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/fortran-2.eclass?rev=1.4&view=markup
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/fortran-2.eclass?rev=1.4&content-type=text/plain
diff : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/fortran-2.eclass?r1=1.3&r2=1.4

Index: fortran-2.eclass
===================================================================
RCS file: /var/cvsroot/gentoo-x86/eclass/fortran-2.eclass,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- fortran-2.eclass	21 Jun 2011 14:05:30 -0000	1.3
+++ fortran-2.eclass	21 Jun 2011 14:11:31 -0000	1.4
@@ -1,6 +1,6 @@
 # Copyright 1999-2011 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/eclass/fortran-2.eclass,v 1.3 2011/06/21 14:05:30 jlec Exp $
+# $Header: /var/cvsroot/gentoo-x86/eclass/fortran-2.eclass,v 1.4 2011/06/21 14:11:31 jlec Exp $
 
 # Author Justin Lecher <jlec@gentoo.org>
 # Test functions provided by Sebastien Fabbro and Kacper Kowalik
@@ -11,7 +11,8 @@
 # sci@gentoo.org
 # @BLURB: Simplify fortran compiler management
 # @DESCRIPTION:
-# If you need a fortran compiler, then you should be inheriting this eclass.
+# If you need a fortran compiler, then you should be inheriting this eclass and
+# adding virtual/fortran to your dependencies.
 # The eclass tests for working fortran compilers
 # and exports the variables FC and F77.
 # Optionally, it checks for extended capabilities based on






^ permalink raw reply	[flat|nested] 7+ messages in thread

* [gentoo-commits] gentoo-x86 commit in eclass: fortran-2.eclass
@ 2012-10-07 12:06 Justin Lecher (jlec)
  0 siblings, 0 replies; 7+ messages in thread
From: Justin Lecher (jlec) @ 2012-10-07 12:06 UTC (permalink / raw
  To: gentoo-commits

jlec        12/10/07 12:06:54

  Modified:             fortran-2.eclass
  Log:
  Give some information on selected fortran compilers

Revision  Changes    Path
1.7                  eclass/fortran-2.eclass

file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/fortran-2.eclass?rev=1.7&view=markup
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/fortran-2.eclass?rev=1.7&content-type=text/plain
diff : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/fortran-2.eclass?r1=1.6&r2=1.7

Index: fortran-2.eclass
===================================================================
RCS file: /var/cvsroot/gentoo-x86/eclass/fortran-2.eclass,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- fortran-2.eclass	27 Sep 2012 16:35:41 -0000	1.6
+++ fortran-2.eclass	7 Oct 2012 12:06:54 -0000	1.7
@@ -1,6 +1,6 @@
 # Copyright 1999-2012 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/eclass/fortran-2.eclass,v 1.6 2012/09/27 16:35:41 axs Exp $
+# $Header: /var/cvsroot/gentoo-x86/eclass/fortran-2.eclass,v 1.7 2012/10/07 12:06:54 jlec Exp $
 
 # @ECLASS: fortran-2.eclass
 # @MAINTAINER:
@@ -146,6 +146,9 @@
 			die "Please install current gcc with USE=openmp or set the FC variable to a compiler that supports OpenMP"
 	fi
 	tc-export F77 FC
+	einfo "Using following Fortran compiler"
+	einfo "  F77: ${F77}"
+	einfo "  FC: ${FC}"
 }
 
 case ${EAPI:-0} in





^ permalink raw reply	[flat|nested] 7+ messages in thread

* [gentoo-commits] gentoo-x86 commit in eclass: fortran-2.eclass
@ 2012-10-18 21:08 Justin Lecher (jlec)
  0 siblings, 0 replies; 7+ messages in thread
From: Justin Lecher (jlec) @ 2012-10-18 21:08 UTC (permalink / raw
  To: gentoo-commits

jlec        12/10/18 21:08:57

  Modified:             fortran-2.eclass
  Log:
  Add space for alignment

Revision  Changes    Path
1.14                 eclass/fortran-2.eclass

file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/fortran-2.eclass?rev=1.14&view=markup
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/fortran-2.eclass?rev=1.14&content-type=text/plain
diff : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/fortran-2.eclass?r1=1.13&r2=1.14

Index: fortran-2.eclass
===================================================================
RCS file: /var/cvsroot/gentoo-x86/eclass/fortran-2.eclass,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -r1.13 -r1.14
--- fortran-2.eclass	16 Oct 2012 20:18:42 -0000	1.13
+++ fortran-2.eclass	18 Oct 2012 21:08:57 -0000	1.14
@@ -1,6 +1,6 @@
 # Copyright 1999-2012 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/eclass/fortran-2.eclass,v 1.13 2012/10/16 20:18:42 jlec Exp $
+# $Header: /var/cvsroot/gentoo-x86/eclass/fortran-2.eclass,v 1.14 2012/10/18 21:08:57 jlec Exp $
 
 # @ECLASS: fortran-2.eclass
 # @MAINTAINER:
@@ -209,7 +209,7 @@
 	tc-export F77 FC
 	einfo "Using following Fortran compiler:"
 	einfo "  F77: ${F77}"
-	einfo "  FC: ${FC}"
+	einfo "  FC:  ${FC}"
 
 	if [[ ${FORTRAN_NEED_OPENMP} == 1 ]]; then
 		if _fortran-has-openmp; then





^ permalink raw reply	[flat|nested] 7+ messages in thread

* [gentoo-commits] gentoo-x86 commit in eclass: fortran-2.eclass
@ 2013-07-29 20:13 Justin Lecher (jlec)
  0 siblings, 0 replies; 7+ messages in thread
From: Justin Lecher (jlec) @ 2013-07-29 20:13 UTC (permalink / raw
  To: gentoo-commits

jlec        13/07/29 20:13:57

  Modified:             fortran-2.eclass
  Log:
  Enhancements pointed out by Arfrever

Revision  Changes    Path
1.20                 eclass/fortran-2.eclass

file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/fortran-2.eclass?rev=1.20&view=markup
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/fortran-2.eclass?rev=1.20&content-type=text/plain
diff : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/fortran-2.eclass?r1=1.19&r2=1.20

Index: fortran-2.eclass
===================================================================
RCS file: /var/cvsroot/gentoo-x86/eclass/fortran-2.eclass,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -r1.19 -r1.20
--- fortran-2.eclass	29 Jul 2013 09:53:36 -0000	1.19
+++ fortran-2.eclass	29 Jul 2013 20:13:57 -0000	1.20
@@ -1,6 +1,6 @@
 # Copyright 1999-2013 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/eclass/fortran-2.eclass,v 1.19 2013/07/29 09:53:36 jlec Exp $
+# $Header: /var/cvsroot/gentoo-x86/eclass/fortran-2.eclass,v 1.20 2013/07/29 20:13:57 jlec Exp $
 
 # @ECLASS: fortran-2.eclass
 # @MAINTAINER:
@@ -44,8 +44,8 @@
 # @ECLASS-VARIABLE: FORTRAN_NEEDED
 # @DESCRIPTION:
 # If your package has an optional fortran support, set this variable
-# to the space seperated list of USE triggering the fortran
-# dependence.
+# to the space separated list of USE triggering the fortran
+# dependency.
 #
 # e.g. FORTRAN_NEEDED=lapack would result in
 #
@@ -110,7 +110,7 @@
 	local ret
 
 	[[ $# -lt 1 ]] && \
-		die "_fortran_compile_test() needs at least one arguments"
+		die "_fortran_compile_test() needs at least one argument"
 
 	[[ -f ${fcode} ]] || _fortran_write_testsuite
 
@@ -123,7 +123,7 @@
 }
 
 # @FUNCTION: _fortran-has-openmp
-# @RETURN: compilers return value
+# @RETURN: return code of the compiler
 # @INTERNAL
 # @DESCRIPTION:
 # See if the fortran supports OpenMP.
@@ -158,8 +158,8 @@
 	echo
 	eerror "Please install currently selected gcc version with USE=fortran."
 	eerror "If you intend to use a different compiler then gfortran, please"
-	eerror "set FC variable accordingly and take care that the neccessary"
-	eerror "fortran dialects are support."
+	eerror "set FC variable accordingly and take care that the necessary"
+	eerror "fortran dialects are supported."
 	echo
 	die "Currently no working fortran compiler is available"
 }
@@ -167,7 +167,7 @@
 # @FUNCTION: _fortran_test_function
 # @INTERNAL
 # @DESCRIPTION:
-# Internal testfunction for working fortran compiler.
+# Internal test function for working fortran compiler.
 # It is called in fortran-2_pkg_setup.
 _fortran_test_function() {
 	local dialect
@@ -197,8 +197,7 @@
 		if _fortran-has-openmp; then
 			einfo "${FC} has OPENMP support"
 		else
-			die "Please install current gcc with USE=openmp or " \
-			"set the FC variable to a compiler that supports OpenMP"
+			die "Please install current gcc with USE=openmp or set the FC variable to a compiler that supports OpenMP"
 		fi
 	fi
 }
@@ -232,13 +231,13 @@
 
 # @FUNCTION: fortran-2_pkg_setup
 # @DESCRIPTION:
-# Setup functionallity,
+# Setup functionality,
 # checks for a valid fortran compiler and optionally for its openmp support.
 fortran-2_pkg_setup() {
 	case ${EAPI:-0} in
 		0|1|2|3)
 			eqawarn "Support for EAPI < 4 will be removed from the"
-			eqawarn "fortran-2.eclass in until Sep 31. 2013."
+			eqawarn "fortran-2.eclass in until 2013-09-30."
 			eqawarn "Please migrate your package to a higher EAPI"
 			eqawarn "or file a bug at https://bugs.gentoo.org"
 			_fortran-2_pkg_setup ;;





^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2013-07-29 20:14 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-06-21  8:06 [gentoo-commits] gentoo-x86 commit in eclass: fortran-2.eclass Justin Lecher (jlec)
  -- strict thread matches above, loose matches on Subject: below --
2013-07-29 20:13 Justin Lecher (jlec)
2012-10-18 21:08 Justin Lecher (jlec)
2012-10-07 12:06 Justin Lecher (jlec)
2011-06-21 14:11 Justin Lecher (jlec)
2011-06-21 14:05 Justin Lecher (jlec)
2011-06-21  6:44 Justin Lecher (jlec)

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox