Thank you all for the clarification. So yes, I had things backward, thinking that I had to use "post_args" if I just wanted to pass arguments *in addition* to DESTDIR.
Clemens's change to the Guide should prevent this kind of misunderstanding in the future, thanks. Davor On 2012-08-20, at 1:07 PM, Ryan Schmidt wrote: > > On Aug 20, 2012, at 14:52, Clemens Lang <[email protected]> wrote: > >> On Mon, Aug 20, 2012 at 12:41:52PM -0700, Davor Cubranic wrote: >>> Based on the MacPorts guide, I assumed that just setting >>> "destroot.post_args PREFIX=${prefix}" would still use the default >>> value of "destroot.destdir" (i.e., "DESTDIR=${destroot}"), but I found >>> the assembled command to be just "make -w install PREFIX=/opt/local", >>> with no DESTROOT passed through. In the end, I had to use in the >>> Portfile "destroot.post_args DESTDIR=${destroot} PREFIX=${prefix}". >>> >>> This seemed redundant, or at least inelegant. Did I miss a better way >>> to do this, or was I simply reading too much into the guide? >> >> Apparently the guide is wrong in this case; the default value of >> destroot.post_args >> is >> DESTROOT=${desroot}. >> I'll fix this shortly. > > For questions like these I like to look directly to the source for the answer. > > https://trac.macports.org/browser/trunk/base/src/port1.0/portdestroot.tcl > > > default destroot.cmd {${build.cmd}} > default destroot.pre_args {[portdestroot::destroot_getargs]} > default destroot.target install > default destroot.post_args {${destroot.destdir}} > default destroot.destdir {DESTDIR=${destroot}} > > > proc portdestroot::destroot_getargs {args} { > if {(([option build.type] == "default" && [option os.platform] != > "freebsd") || \ > ([option build.type] == "gnu")) \ > && [regexp "^(/\\S+/|)(g|gnu|)make(\\s+.*|)$" [option destroot.cmd]]} { > # Print "Entering directory" lines for better log debugging > return "-w [option destroot.target]" > } > > return "[option destroot.target]" > } > > > So destroot.pre_args will contain the target, destroot.post_args will contain > the destdir, and destroot.args is available for you to fill as desired. > > >> However, in your case, why don't you just use >> destroot.args PREFIX=${prefix}? >> The split into pre_args, args and post_args is there to allow adding >> parameters to the destroot arguments _without_ overwriting the defaults, >> i.e., exactly the use case you have. > > Yes, this is what you should be doing. Just set destroot.args. > > If you're ever unsure if a variable contains a default value, you can just > display it (i.e. "ui_msg ${destroot.args}"). Or you can append to it instead > of overwriting it (i.e. "destroot.args-append PREFIX=${prefix}"). > _______________________________________________ macports-users mailing list [email protected] http://lists.macosforge.org/mailman/listinfo/macports-users
