ilammy / rust-themis

Using Themis from Rust
https://www.cossacklabs.com/themis/
Apache License 2.0
2 stars 0 forks source link

Build Themis as a part of libthemis-sys #2

Closed ilammy closed 5 years ago

ilammy commented 6 years ago

Usually Rust crates prefer to simply work out-of-the box. Instead of the current approach of expecting a native Themis library to be installed in the system we should be more user-friendly. We should not require the user to do anything more than add a single line to their Cargo.toml and simply run cargo build.

Core Themis is licensened under Apache 2.0. This crate deliberately uses the same license in order to be compatible.

ilammy commented 5 years ago

After some research I have decided to follow the build model of openssl crate which seems to provide reasonable separation of concerns:

themis depends on libthemis-sys and builds its API upon the provided FFI. It does not care how exactly Themis API is made available to it.

libthemis-sys is tasked with locating a suitable installation of Themis and linking against it. If the system does not seem to have Themis available then libthemis-src crate may be used to build it as a static library which can then be linked by libthemis-sys.

This should be enough to implement the following linking strategies: