On May 11, 2009, at 13:37, Darren Weber wrote:

I'm getting a little confused. There must be some discussion of this in another thread. It may be that in some places I've defined a variable within a variant and it doesn't pass into the post- destroot of that variant, so even though the syntax appears to wrap the post-destroot within the variant, that's not actually what happens. That is, this fails:

variant foo {
  set myPortLibPath ${prefix}/lib/myPort
  configure.args-append  LIB=${myPortLibPath}
  ...
  post-destroot {
     move ${build.dir}/bin/*.dylib ${myPortLibPath}
  }
}

I can see that it can be confusing.

What is happening is that within the variant you are declaring and setting a local variable (myPortLibPath). That variable ceases to exist once the variant has been processed. Yes, your variant lists a post-destroot phase, but all MacPorts does at the time that it parses the variant is to add that post-destroot phase to its list of things to do at post-destroot time. By the time that code actually gets executed, the myPortLibPath has long since gone out of scope.


However, I think what your saying is that this works for both the variant and the post-destroot, without global:

set myPortLibPath ${prefix}/lib/myPort

variant foo {
  configure.args-append  LIB=${myPortLibPath}
  ...
  post-destroot {
     move ${build.dir}/bin/*.dylib ${myPortLibPath}
  }
}

Yes, that will work, because here you are declaring myPortLibPath as a global variable, so it is available everywhere.



I don't know whether the current behavior should be considered a bug, but at least, that is how it behaves, so now you know.



_______________________________________________
macports-dev mailing list
[email protected]
http://lists.macosforge.org/mailman/listinfo.cgi/macports-dev

Reply via email to