File tree Expand file tree Collapse file tree 2 files changed +16
-6
lines changed Expand file tree Collapse file tree 2 files changed +16
-6
lines changed Original file line number Diff line number Diff line change @@ -14,15 +14,16 @@ build = "build/main.rs"
1414links = " zmq"
1515
1616[features ]
17- # Build libzmq from source.
18- vendored = [' zeromq-src' ]
17+ # Build libzmq from source with encryption support via libsodium .
18+ vendored = [' zeromq-src' , ' libsodium-sys-stable ' ]
1919
2020[dependencies ]
2121libc = " 0.2.15"
22+ libsodium-sys-stable = { version = " 1.0" , optional = true }
2223
2324[build-dependencies ]
2425metadeps = " 1"
25- zeromq-src = { version = " 0.1.6 " , optional = true }
26+ zeromq-src = { version = " 0.2.0 " , optional = true }
2627
2728[package .metadata .pkg-config ]
2829libzmq = " 4.1"
Original file line number Diff line number Diff line change @@ -4,8 +4,17 @@ pub fn configure() {
44 println ! ( "cargo:rerun-if-changed=build.rs" ) ;
55 println ! ( "cargo:rerun-if-env-changed=PROFILE" ) ;
66
7- let wants_debug = env:: var ( "PROFILE" ) . unwrap ( ) == "debug" ;
7+ let lib_dir = env:: var ( "DEP_SODIUM_LIB" ) . expect ( "build metadata `DEP_SODIUM_LIB` required" ) ;
8+ let include_dir =
9+ env:: var ( "DEP_SODIUM_INCLUDE" ) . expect ( "build metadata `DEP_SODIUM_INCLUDE` required" ) ;
810
9- let artifacts = zeromq_src:: Build :: new ( ) . link_static ( true ) . build_debug ( wants_debug) . build ( ) ;
10- artifacts. print_cargo_metadata ( ) ;
11+ let location = zeromq_src:: LibLocation :: new ( lib_dir, include_dir) ;
12+
13+ // Note that by default `libzmq` builds without `libsodium` by instead
14+ // relying on `tweetnacl`. However since this `tweetnacl` [has never been
15+ // audited nor is ready for production](https://github.com/zeromq/libzmq/issues/3006),
16+ // we link against `libsodium` to enable `ZMQ_CURVE`.
17+ zeromq_src:: Build :: new ( )
18+ . with_libsodium ( Some ( location) )
19+ . build ( ) ;
1120}
You can’t perform that action at this time.
0 commit comments