gnat-gcc variants

Rainer Müller raimue at macports.org
Mon Apr 19 15:40:55 PDT 2010


Hi Martin,

I tried to build gnat-gcc right now. If none of the variants have been
selected, you should return an error. Otherwise the Portfile will still
try to run the configure script which will fail anyway in the end.

Add something like this to the Portfile:

pre-configure {
  if {![variant_isset ada] && ![variant_isset macada] ... } {
    ui_msg "... select one of the variants blah ..."
    return -code error "no ada compiler variant specified"
  }
}

Also, you are printing messages in the variants every time they get
evaluated. This makes this messages visible when you use any port
command (e.g. "port info +ada"), which is not very nice. Instead, this
message should be in a pre-fetch and return an error code as it does not
make sense to continue without ada compiler.

variant ada ... {
  pre-fetch {
    if {![file executable ${prefix}/bin/gnat]} {
      ui_msg "... compiler not found ..."
      return -code error "specified ada compiler not found"
    }
  }
}

Additionally the variants are mutual exclusive and should therefore use
the "conflicts" keyword to indicate this.

variant ada conflicts gnatgpl gnuada macada description {...} {
  ...
}

In particular I don't understand why you require any gcc to be
gcc_select'ed for the +ada variant. The gcc_select script is intended to
be for the user only, the MacPorts build should definitely not be
influenced by this choice. Why can't you just use
  configure.cc ${prefix}/bin/gcc-gnat-4.4
instead?

Rainer


More information about the macports-dev mailing list