How to properly reference binary dependencies during builds with BinaryBuilder?

I am trying to wrap a library with BinaryBuilder that depends on libz. If I use the wizard, specifying “Zlib” as a dependency, I actually do get all the library files from zlib in my workspace that I need. However, for my library to find the dependencies, I seem to have to pass the full path to the library dependency to configure, like so:

CFLAGS=-I/workspace/artifacts/7846a2956a213715c2c76632f3461cef87d9d545/include \
LDFLAGS=-L/workspace/artifacts/7846a2956a213715c2c76632f3461cef87d9d545/lib \
./configure ...

However, the exact artifacts path changes from platform to platform, thus I have no way to write a build script that is portable and looks sane. I checked other libraries that have binary dependencies (e.g., Yggdrasil/build_tarballs.jl at 029e588412f232f215e5e6a7564693d3dbf8e922 · JuliaPackaging/Yggdrasil · GitHub), but they do not seem to suffer from this problem.

Could someone tell me a better way to reference to binary dependencies than this (there must be a better way…)?

The content of the artifacts are installed to proper locations the environment, see Build Tricks · JuliaPackaging/Yggdrasil Wiki · GitHub and Build Tricks · JuliaPackaging/Yggdrasil Wiki · GitHub

3 Likes

Thanks for the fast reply, this is exactly what I was looking for. I created a PR in BinaryBuilder.jl to try to get these two items included in the official docs - it seems counter-intuitive to me to have build tips at two different locations, especially since these are clearly targeting novice users.