alexcrichton / curl-rust

Rust bindings to libcurl
MIT License
1k stars 234 forks source link

Link to custom libcurl on macOS #522

Open jcamiel opened 10 months ago

jcamiel commented 10 months ago

I'm trying to test HTTP3 with curl-rust on macOS, so I want to link against a custom version of libcurl (that supports HTTP3).

In https://github.com/alexcrichton/curl-rust/blob/ff6ad21cc1034826b2ab3f8be0653d8c446e1bdc/curl-sys/build.rs#L18-L19

there is a feature flag force-system-lib-on-osx that forces system libcurl linking.

Few lines after:

https://github.com/alexcrichton/curl-rust/blob/ff6ad21cc1034826b2ab3f8be0653d8c446e1bdc/curl-sys/build.rs#L26-L28

If target is macOS with system curl supporting HTTP2 (like recent version Ventura for instance), we force also system libcurl linking.

It seems to me that no matter force-system-lib-on-osx, we always link to system libcurl on macOS, which seems a bug to me.

Note: I successfully link to a custom libcurl supporting HTTP3 by removing https://github.com/alexcrichton/curl-rust/blob/ff6ad21cc1034826b2ab3f8be0653d8c446e1bdc/curl-sys/build.rs#L26-L28 and relies on pkg-config code path. For building a custom libcurl supporting HTTP3, I've used the brew formulae https://github.com/cloudflare/homebrew-cloudflare with brew install --HEAD -s curl.rb