Compiler Portgroup ...

Sean Farley sean at macports.org
Wed Feb 26 11:46:51 PST 2014


Peter Danecek <Peter.Danecek at bo.ingv.it> writes:

> Sean,
>
> I am looking into the compilers Portgroup again. But I have the impression to know really what I am actually doing. See details below.

Cool! Thanks for taking interest in this :-)

> On 10 Feb 2014, at 22:03, Sean Farley <sean at macports.org> wrote:
>
>> 
>> Peter.Danecek at bo.ingv.it writes:
>> 
>>> Unfortunately, I have no complete picture of how this port group is supposed to be used and miss some documentation, nothing found in Guide 5.9, introductory comment in the tcl file, no Recipe. 
>> 
>> Patches would be welcomed :-) but, yes, you are correct. I have very
>> little documentation since some of these ideas are still fluid and open
>> to discussion.
>
> I could try to contribute once I have understood the logic. Anyway, if you still consider this WIP, maybe just add a somewhat extended Usage comment to the tcl file itself and change it along with this file. Ones, this is consolidated we could add documentation to the Guide at that point the `Recipes` might not be necessary any more.

Sure, that could work.

>> You could take a look at netcdf-fortran to see how a port can require a
>> fortran compiler. Probably, the best way to document this stuff is to
>> ask questions on the mailing list so everyone can remain in the loop
>> (and it can help guide me to write documentation).
>
> I am not sure if the cited port is really representative for the situation I am interested in, i.e. replacing the Fortran recipe. This is from the cited netcdf-fortran Portfile:
>
> --- snip ---
> PortSystem                  1.0
> PortGroup                   muniversal 1.0
> PortGroup                   mpi 1.0
>
> compilers.choose            f77 f90 fc
> mpi.setup                   require_fortran
>
> mpi.enforce_variant         hdf5-18
>
> […]
> --- snip ---
>
> So it actually used the MPI portgroup not the compilers group directly. Okay, the MPI group used compiles. So I tried replacing mpi.* with compilers.*. It somehow works, but I do not get the the desired result. 
>
> My Portfile now starts this way:
> --- snip ---
> PortSystem          1.0
> PortGroup           python 1.0
> PortGroup           github 1.0
> PortGroup           compilers 1.0
>
> github.setup        obspy obspy 4d67519
> compilers.setup     require_fortran
> compilers.choose    f77 f90 fc
> --- snip ---

Well, you didn't replace 'mpi' with 'compilers' exactly, else you would
end up with the same order (which is important; more below)

> 1) there is no default variant set. I would expect that if I require Fortran (the only motivation to care about all this), this would be set to some defaults which would work;
>
> 2) When testing with the +gcc48 (the former default) the port now compiles also C extensions with the selected GCC variant. This might be okay for the particular port. But actually this was what the Fortran recipe wanted to avoid.
>
> So would be the correct use here? I just want to replace the recipe here.

The important part that I didn't really document is that compilers.setup
has to be the last call. In all the examples, I have compilers/mpi calls
after the PortGroup but before everything else and also with the setup
call last.

I think you'll get the desired outcome if you change the order to:
--- snip ---
PortSystem          1.0
PortGroup           python 1.0
PortGroup           github 1.0
PortGroup           compilers 1.0

compilers.choose    f77 f90 fc
compilers.setup     require_fortran

github.setup        obspy obspy 4d67519
--- snip ---

If this were Python, I could make lazily evaluated properties for this
but, unfortunately, this is not Python and my Tcl is pretty mediocre.


More information about the macports-dev mailing list