jean-airoldie / zeromq-src-rs

Source code and logic to build ZeroMQ from source
MIT License
11 stars 15 forks source link

Add libsodium feature in the crate #32

Closed conanoc closed 1 year ago

conanoc commented 1 year ago

libsodium feature is only in the testcrate. Can we have it in the zeromq-src crate also?

jean-airoldie commented 1 year ago

The test crate does nothing special. You can simply copy the configuration to your own crate if you need to link to libsodium.

conanoc commented 1 year ago

I see. The testcrate is just an example to show how to link to libsodium. It is not clear how to use DEP_SODIUM_LIB and DEP_SODIUM_INCLUDE in the build.rs of testcrate. Must I set env variables? or I can use any static strings for lib_dir and include_dir to create zeromq_src::LibLocation::new(lib_dir, include_dir)?

I thought the reason that rust-zmq does not support libsodium was because zeromq-src does not support it. Do you have any idea?

jean-airoldie commented 1 year ago

The DEP_* env variables are produced during the build and are specific to each library. The specific variables you talk about are described here. In this case they are used to indicate the locations of files for the build script.

See this link for more information.

I thought the reason that https://github.com/erickt/rust-zmq/issues/357 was because zeromq-src does not support it. Do you have any idea?

There's no reason why libsodium wouldn't be supported. Last time I used zeromq (about 6 years ago), it could link to libsodium just fine. Could be a bug in the windows build script, based on the issue you showed.

jean-airoldie commented 1 year ago

You can take a look at this archived repo for an example that should work.

conanoc commented 1 year ago

Those env variables are set by sodium side and zmq builders can use them. testcrate's build.rs demonstrates it. Thank you for your kind explanation.

jean-airoldie commented 1 year ago

You're welcome.