Fortan question & devel/fortrancl/Portfile ?
Ryan Schmidt
ryandesign at macports.org
Tue Jan 29 12:06:55 PST 2013
On Jan 29, 2013, at 06:11, Peter Danecek <Peter.Danecek at bo.ingv.it> wrote:
> I am just browsing some Portfiles to understand how to handle fortran builds correctly.
>
> At this point I came about something I may not understand in devel/fortrancl/Portfile (or is it just a copy-paste bug?)
>
> Why the g95 variant would depend on port:gcc45 ?
>
> --- snip ---
> variant gcc45 conflicts g95 description {build with gfortran-mp-4.5} {
> depends_build-append port:gcc45
> configure.compiler macports-gcc-4.5
> }
>
> variant g95 conflicts gcc45 description {build with g95} {
> depends_build-append port:gcc45
> configure.fc g95
> }
> --- snap ---
That is most certainly a copy-paste mistake. Obviously a g95 variant should depend on the g95 port not the gcc45 port.
> Now my question:
> For the C compiler there is some default behaviour, how to choose the right compiler without depending on the actual system setup. Only in case a certain compiler version does not build, there is a possibility to influence the choice (at least this is what I understood).
>
> I did not find any clear indications on how to do "the right thing" for Fortran compilers, and maybe there I no a completely clear strategy (???) on how to make Fortran compilation independent of the actual system. There are all these variants around. But for example if I have installed several versions of gccXX with the respective gfortran, I may end up with quite a mix of gfortran dependencies.
>
> Then I observe that all these variants are usually conflicting. However, I guess (in theory) there are actually two different situations:
>
> (1) I have some software written in fortran, and here obviously one single compiler is be fine (for example python extensions).
> (2) I want to compile the fortran bindings of a library, to be used with "my preferred fortran compiler". Here I might want to install bindings for different compilers (or versions).
>
> I guess, however the second case is not supported for the moment.
>
> So which are the knobs to look at, when creating ports of fortran programs (or programs with fortran bindings)?
>
> Maybe I just missed the right place to look at?
I don't understand most of your questions.
With regard to (1) and (2) above, our solutions are geared toward (1); I'd never heard of the use case you describe in (2) before.
The answers I have with regard to how we handle fortran software in MacPorts are here:
https://trac.macports.org/wiki/PortfileRecipes#gcc
The intention is that the user will use the same gcc4x variant (or g95) for all the ports they install, e.g. by selecting it in their variants.conf file.
More information about the macports-dev
mailing list