This commit is relatively major refactoring of the `openssl-sys` crate as well
as the `openssl` crate itself. The end goal here was to support OpenSSL 1.1.0,
and lots of other various tweaks happened along the way. The major new features
are:
* OpenSSL 1.1.0 is supported
* OpenSSL 0.9.8 is no longer supported (aka all OSX users by default)
* All FFI bindings are verified with the `ctest` crate (same way as the `libc`
crate)
* CI matrixes are vastly expanded to include 32/64 of all platforms, more
OpenSSL version coverage, as well as ARM coverage on Linux
* The `c_helpers` module is completely removed along with the `gcc` dependency.
* The `openssl-sys` build script was completely rewritten
* Now uses `OPENSSL_DIR` to find the installation, not include/lib env vars.
* Better error messages for mismatched versions.
* Better error messages for failing to find OpenSSL on a platform (more can be
done here)
* Probing of OpenSSL build-time configuration to inform the API of the `*-sys`
crate.
* Many Cargo features have been removed as they're now enabled by default.
As this is a breaking change to both the `openssl` and `openssl-sys` crates this
will necessitate a major version bump of both. There's still a few more API
questions remaining but let's hash that out on a PR!
Closes #452
|
||
|---|---|---|
| openssl | ||
| openssl-sys | ||
| systest | ||
| .gitignore | ||
| .travis.yml | ||
| Cargo.toml | ||
| README.md | ||
| THIRD_PARTY | ||
| appveyor.yml | ||
| build_docs.sh | ||
README.md
rust-openssl
Building
rust-openssl depends on the OpenSSL runtime libraries version 1.0.1 or above. Currently the libraries need to be present in the build environment before this crate is compiled, and some instructions of how to do this are in the sections below.
Linux
On Linux, you can typically install OpenSSL via your package manager. The headers are sometimes provided in a separate package than the runtime libraries
- look for something like
openssl-develorlibssl-dev.
# On Ubuntu
sudo apt-get install libssl-dev
# On Arch Linux
sudo pacman -S openssl
# On Fedora
sudo dnf install openssl-devel
If installation via a package manager is not possible, or if you're cross compiling to a separate target, you'll typically need to compile OpenSSL from source. That can normally be done with:
curl -O https://www.openssl.org/source/openssl-1.1.0b.tar.gz
tar xf openssl-1.1.0b.tar.gz
cd openssl-1.1.0b
export CC=...
./Configure --prefix=... linux-x86_64 -fPIC
make -j$(nproc)
make install
OSX
Although OpenSSL 0.9.8 is preinstalled on OSX this library is being phased out of OSX and this crate also does not support this version of OpenSSL. To use this crate on OSX you'll need to install OpenSSL via some alternate means, typically homebrew:
brew install openssl
Windows MSVC
On MSVC it's unfortunately not always a trivial process acquiring OpenSSL. Perhaps the easiest way to do this right now is to download precompiled binaries and install them on your system. Currently it's recommended to install the 1.1.0b light installation if you're choosing this route.
Once a precompiled binary is installed you can configure this crate to find the installation via an environment variable:
set OPENSSL_DIR=C:\OpenSSL-Win64
After that, you're just a cargo build away!
Windows GNU (MinGW)
The easiest way to acquire OpenSSL when working with MinGW is to ensure you're using MSYS2 and to then execute:
# 32-bit
pacman -S mingw-w64-i686-openssl
# 64-bit
pacman -S mingw-w64-x86_64-openssl
And after that, a cargo build should be all you need!
Manual configuration
rust-openssl's build script will by default attempt to locate OpenSSL via pkg-config or other system-specific mechanisms. This will not work in some situations however, for example cross compiling or when using a copy of OpenSSL other than the normal system install.
The build script can be configured via environment variables:
OPENSSL_DIR- If specified, a directory that will be used to find OpenSSL installation. It's expected that under this directory theincludefolder has header files and alibfolder has the runtime libraries.OPENSSL_STATIC- If specified, OpenSSL libraries will be statically rather than dynamically linked.
If OPENSSL_DIR is specified, then the build script will skip the pkg-config
step.