build: support user-set `RUSTFLAGS`
At Homebrew, we set RUSTFLAGS
during the build in order to set appropriate -rpath
flags for the built plugins:
# Set `RPATH` since `cargo-c` doesn't seem to.
# https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/issues/279
plugin_dir = lib/"gstreamer-1.0"
rpath_args = [loader_path, rpath(source: plugin_dir)].map { |path| "-rpath,#{path}" }
ENV["RUSTFLAGS"] = "--codegen link-args=-Wl,#{rpath_args.join(",")}"
However, recently, we noticed that these plugins were no longer being linked with the requested -rpath
flags. See Homebrew/homebrew-core#132804. It seems that this is due to 8e4fd2c1.
We can apply a patch so that meson.build
continues to respect our desired RUSTFLAGS
, but it seems to me that this should be handled here instead. I suspect we're not the only ones who find it surprising that meson
seems to respect environment variables such as CFLAGS
or LDFLAGS
but not RUSTFLAGS
.
I'm happy to send a patch, but I opened this for discussion first for feedback on your preferred way to handle this. Thanks!