<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class=""><br class=""><div><br class=""><blockquote type="cite" class=""><div class="">On Oct 24, 2020, at 8:52 AM, Joshua Root <<a href="mailto:jmr@macports.org" class="">jmr@macports.org</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div class="">On 2020-10-25 02:18 , Ken Cunningham wrote:<br class=""><blockquote type="cite" class="">It's easy to prepend or append to PATH in a Portfile, but I'm having difficulty seeing how to modify, rather than overwrite, DYLD_LIBRARY_PATH.<br class=""><br class="">Usually you just want to set it, but now that it might or might not be set in legacysupport 1.1, I was hoping to just modify rather than overwrite it.<br class=""><br class="">I tried a number of different things, but couldn't spot the magic incantation...am <br class="">i missing something simple?<br class=""></blockquote><br class="">What did you try? The configure.env, build.env etc. options can be read<br class="">like any other option. You can use lsearch on it to look for entries<br class="">starting with the variable name you're after.<br class=""><br class="">- Josh<br class=""></div></div></blockquote></div><br class=""><div class=""><br class=""></div><div class="">Ah, thanks for the clue.</div><div class=""><br class=""></div><div class=""><div class="">I had hoped that just something like this would set them both:</div><div class=""><br class=""></div><div class=""><div class="">configure.env-append        "DYLD_LIBRARY_PATH=${prefix}/lib/lilbgcc"</div><div class="">configure.env-append        “DYLD_LIBRARY_PATH=${workpath}/build”</div></div><div class=""><br class=""></div><div class="">but I found the second one just obliterates the first one.</div><div class=""><br class=""></div><div class=""><div style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">DYLD_LIBRARY_PATH='/opt/local/lib/lilbgcc'</span></div></div></div><div class=""><span style="font-variant-ligatures: no-common-ligatures;" class=""><br class=""></span></div><div class=""><span style="font-variant-ligatures: no-common-ligatures;" class=""><br class=""></span></div><div class="">So I tried variations of this construct, that works for PATH:</div><div class=""><br class=""></div><div class="">configure.env-append    "PATH=$env(PATH):${bootstrap_dir}/bin”</div><div class=""><br class=""></div><div class="">eg:</div><div class=""><br class=""></div><div class=""><div class="">configure.env-append        "DYLD_LIBRARY_PATH=${prefix}/lib/lilbgcc"</div><div class="">configure.env-append        “DYLD_LIBRARY_PATH=$env(DYLD_LIBRARY_PATH):${workpath}/build”</div></div><div class=""><br class=""></div><div class=""><br class=""></div><div class="">but that just gives </div><div class=""><br class=""></div><div class=""><div style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">DEBUG: no such variable</span></div><div style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">    (read trace on "env(DYLD_LIBRARY_PATH)")</span></div></div><div class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><br class=""></span></div><div class=""><span style="font-variant-ligatures: no-common-ligatures" class="">because the first one doesn’t get set into the environment until the whole Portfile is parsed, obviously in retrospect. </span></div><div class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><br class=""></span></div><div class=""><span style="font-variant-ligatures: no-common-ligatures" class="">And likewise testing for it with [info exists …] won’t work either, I can see, because it’s not there yet.</span></div><div class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><br class=""></span></div><div class="">So instead of this method, I will look into running lsearch on *.env, and see if I can sort out how to add some entries if something is already there. </div><div class=""><br class=""></div><div class="">It looks like the Makefile-1.0 PortGroup might be doing something along these lines — getting a tad complicated, however:</div><div class=""><br class=""></div><div class="">====</div><div class=""><div class="">        foreach env_var { \</div><div class="">            PKG_CONFIG_PATH \</div><div class="">        } {</div><div class="">            set value [option configure.[string tolower $env_var]]</div><div class="">            if {$value ne ""} {</div><div class="">                ${phase}.env-append         "$env_var=[join $value :]"</div><div class="">                if {[lsearch -exact ${makefile.override} ${env_var}] != -1} {</div><div class="">                    ${phase}.args-append    $env_var="[join $value :]"</div><div class="">                }</div><div class="">            }</div><div class="">        }</div></div><div class="">=====</div><div class=""><br class=""></div><div class=""><br class=""></div><div class=""><br class=""></div><div class=""><br class=""></div><div class="">Do you think this:</div><div class=""><br class=""></div><div class=""><div class=""><div class="">configure.env-append        "DYLD_LIBRARY_PATH=${prefix}/lib/lilbgcc"</div><div class="">configure.env-append        “DYLD_LIBRARY_PATH=${workpath}/build”</div></div></div><div class=""><br class=""></div><div class="">should “just work" to set both without added shenanigans?</div><div class=""><br class=""></div><div class="">Ken</div><div class=""><br class=""></div><div class=""><br class=""></div><div class=""><br class=""></div><div class=""><br class=""></div></body></html>