Hi,

I want to add following change to fortran-2.eclass to achieve more
simpler usage.

The patch will make the eclass depend on virtual/fortran so that no
manual addition is needed.
Two exception are present, a) the ebuild has the USE flag fortran, then
we check for that, or b) the FORTRAN_OPTIONAL variable is set, which
leaves the control to the ebuild (e.g. for cases like "lapack? (
virtual/fortran )").

This is the best coverage of the use cases present, because

* most ebuild using the eclass want to have a fortran compiler
* most other trigger optional fortran support through USE=fortran
* only minor have different USE for this purpose (e.g. numpy)

Thanks for comments,

Justin
Index: fortran-2.eclass
===================================================================
RCS file: /var/cvsroot/gentoo-x86/eclass/fortran-2.eclass,v
retrieving revision 1.11
diff -u -B -r1.11 fortran-2.eclass
--- fortran-2.eclass    7 Oct 2012 14:53:43 -0000       1.11
+++ fortran-2.eclass    7 Oct 2012 17:18:28 -0000
@@ -35,6 +35,26 @@
 
 inherit eutils toolchain-funcs
 
+# @ECLASS-VARIABLE: FORTRAN_OPTIONAL
+# @DEFAULT_UNSET
+# @DESCRIPTION:
+# Set this before inheriting the eclass, if your package has an optional 
+# fortran support, which is triggered by a different USE flag than 'fortran'.
+# This requires manual handling of the dependency on virtual/fortran.
+#
+# If unset, the dependency on virtual/fortran is added directly.
+
+if [[ -n ${FORTRAN_OPTIONAL} ]]; then
+       if in_iuse fortran; then
+               DEPEND="fortran? ( virtual/fortran )"
+       else
+               DEPEND="virtual/fortran"
+       fi
+fi
+
+RDEPEND="${DEPEND}"
+
+
 # @FUNCTION: _write_testsuite
 # @INTERNAL
 # @DESCRIPTION:

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to