Gentoo Archives: gentoo-dev

From: Mike Frysinger <vapier@g.o>
To: gentoo-dev@l.g.o
Subject: Re: [gentoo-dev] Please review fortran-2.eclass next round
Date: Fri, 17 Jun 2011 03:04:12
Message-Id: 201106162303.24142.vapier@gentoo.org
In Reply to: Re: [gentoo-dev] Please review fortran-2.eclass next round by justin
1 > # @ECLASS: fortran-2.eclass
2
3 i dont see fortran.eclass. what's with the "-2" ?
4
5 > @BLURB: Packages, which need a fortran compiler should inherit this eclass.
6
7 @BLURB: simplify fortran compiler management
8
9 >@DESCRIPTION:
10 > If you need a fortran compiler, inherit this eclass.
11
12 If you need a fortran compiler, then you should be inheriting this eclass.
13
14 > Optional, it checks for openmp capability of the current fortran compiler
15 > through FORTRAN_NEED_OPENMP=1.
16
17 Optionally, it checks for extended capabilities based on the variable options
18 selected in the ebuild.
19
20 > Only phase function exported is pkg_pretend and pkg_setup.
21
22 The only phase functions exported are pkg_pretend and pkg_setup.
23
24 > Need help? Ask the sci team.
25
26 seems redundant what with the @MAINTAINER field ...
27
28 > # @ECLASS-VARIABLE: FORTRAN_NEED_OPENMP
29 > # @DESCRIPTION:
30 > # Set FORTRAN_NEED_OPENMP=1 in order to test FC for openmp capabilities
31
32 Set to "1" in order to automatically have the eclass abort if the fortran
33 compiler lacks openmp support.
34
35 > #
36 > # Default is 0
37
38 have the code list the default and then you don't need this. simply use:
39 : ${FORTRAN_NEED_OPENMP:=0}
40
41 > # @ECLASS-VARIABLE: FORTRAN_STANDARD
42 > # @DESCRIPTION:
43 > # Set this, if a special dialect needs to be support. Generally not needed.
44
45 drop the comma and add "ed" to support
46
47 > # Valid settings are any combination of
48 > #
49 > # FORTRAN_STANDARD="77 90 95 2003"
50
51 Valid settings are any combination of: 77 90 95 2003
52
53 > # Defaults to FORTRAN_STANDARD="77" which is sufficient for most cases.
54
55 same as the openmp code; list the default after the comment:
56 : ${FORTRAN_STANDARD:=77}
57
58 > DEPEND="virtual/fortran"
59 > RDEPEND="${DEPEND}"
60
61 i'm not sure that RDEPEND is correct. do all fortran compilers additionally
62 require the fortran compiler to be available at runtime ?
63
64 > # internal function
65
66 use the @INTERNAL tag and proper eclass documentation
67
68 > local filebase=${T}/test-fortran
69
70 there is $(emktemp) ... but this is probably fine ...
71
72 > [[ -z ${fcomp} ]] && die "_compile_test() needs at least one argument"
73
74 probably want: [[ $# -eq 0 ]]
75
76 > [[ -f "${filebase}.f${fdia}" ]] || _write_testsuite
77
78 no need to quote with [[...]]
79
80 > [[ -f "${filebase}.f${fdia}" ]] || _write_testsuite
81 >
82 > ${fcomp} "${filebase}.f${fdia}" -o "${filebase}-f${fdia}" >&/dev/null
83 > local ret=$?
84 >
85 > rm -f "${filebase}-f${fdia}"
86
87 seems like you want a local var that is like:
88 ${filebase}.f${fdia}
89 and then you write the output to:
90 ${filebase}.f${fdia}.x
91 and then you don't need to repeat this logic multiple times ...
92
93 > $(tc-getFC "$@") ${flag} "${filebase}.f" -o "${filebase}" >&/dev/null
94
95 tc-getFC could expand into a bit of logic ... probably better to cache the
96 result in a local var
97
98 > local ret=$?
99
100 local is a command, and is a bit odd to see inside of a for loop. please
101 hoist it up to the top with the "local flag" decl.
102
103 > (( ${ret} )) || break
104
105 a little odd syntax, but i guess it works ...
106
107 > eerror "fortran dialects are support."
108
109 supported
110
111 > die "Currently no working fortran compiler is available"
112
113 "is available" -> "could be located"
114
115 > [[ -n ${F77} ]] || F77=$(tc-getFC)
116
117 : ${F77:=$(tc-getFC)}
118
119 although i wonder why you're not using tc-getF77 ...
120
121 > ewarn "The support for EAPI=${EAPI} by the fortran-2.eclass"
122
123 why ? it's causing you no real trouble to do so
124
125 > [[ -n ${F77} ]] || export F77=$(tc-getFC)
126
127 same comment as before ...
128
129 > [[ -n ${FC} ]] || export FC=$(tc-getFC)
130
131 tc-export FC
132
133 > case "${EAPI:-0}" in
134
135 no need to quote
136 -mike

Attachments

File name MIME type
signature.asc application/pgp-signature

Replies