On 10/7/12 8:19 PM, Chí-Thanh Christopher Nguyễn wrote:
> justin schrieb:
>> 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 )").
> 
> I suggest that you do something similar to the XORG_DRI variable in
> xorg-2.eclass.
> 
> For example:
> FORTRAN_WANT_COMPILER=no would not add a virtual/fortran dependency
> FORTRAN_WANT_COMPILER=always would unconditionally depend on
> virtual/fortran
> FORTRAN_WANT_COMPILER=useflag would depend on useflag? ( virtual/fortran )
> 
> To avoid breaking existing packages, you could default to
> FORTRAN_WANT_COMPILER=fortran
> 
> 
> Best regards,
> Chí-Thanh Christopher Nguyễn
> 
> 

Thanks for that suggestion. Please find the new version attached. It
basically follows what is done in the xorg-2.eclass. But we allow a list
of USE and don't allow a no, because the eclass itself needs a fortran
compiler.

Thanks,
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 18:52:49 -0000
@@ -35,6 +35,32 @@
 
 inherit eutils toolchain-funcs
 
+# @ECLASS-VARIABLE: FORTRAN_SUPPORT
+# @DESCRIPTION:
+# If your package has an optional fortran support, set this variable
+# to the space seperated list of USE triggering the fortran
+# dependence.
+#
+# e.g. FORTRAN_SUPPORT=lapack would result in
+#
+# DEPEND="lapack? ( virtual/fortran )"
+#
+# If unset, we always depend on virtual/fortran.
+: ${FORTRAN_SUPPORT:=always}
+
+DEPEND=""
+for _f_use in ${FORTRAN_SUPPORT}; do
+       case ${_f_use} in
+               always)
+                       DEPEND+=" virtual/fortran"
+                       ;;
+               *)
+                       DEPEND+=" ${FORTRAN_SUPPORT}? ( virtual/fortran )"
+                       ;;
+       esac
+done
+RDEPEND="${DEPEND}"
+
 # @FUNCTION: _write_testsuite
 # @INTERNAL
 # @DESCRIPTION:

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to