how to prepend or append to DYLD_LIBRARY_PATH in Portfile?

Ken Cunningham ken.cunningham.webuse at gmail.com
Sun Oct 25 00:51:43 UTC 2020



> On Oct 24, 2020, at 3:36 PM, Ryan Schmidt <ryandesign at macports.org> wrote:
> 
> 
> 
> On Oct 24, 2020, at 11:46, Ken Cunningham wrote:
> 
>> 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. 
> 
> MacPorts base makes this easier for specific variables by offering MacPorts variables to set them. For example configure.cflags to set CFLAGS, configure.pkg_config_path to set PKG_CONFIG_PATH, etc. We could consider offering e.g. configure.dyld_library_path to set DYLD_LIBRARY_PATH.

That would indeed make things easier — but with some thought I can understand why this particular env var is tricky to handle correctly for the general case...

1. User might have set it to something that should be honoured, and expect it to be reinstated after the build is done.
2. Different parts of the port tree (PortGroups, Portfiles) might try to set it to something. The order could be important.
3. The build tree won’t exist when the configure.XYZ flags are parsed, and this particular env var often uses the build tree.
4. different parts of the build (build, test, destroot) might need it set to different things.
5. Makefiles and Cmake files etc might later try to set it themselves!
6. All of that hidden away in the environment where it’s that much harder to see what is going on (or what is broken).

This one is probably always going to be messy…

Ken


More information about the macports-dev mailing list