Skip to content

Commit

Permalink
Merge branch 'release-v0.9.0' into release
Browse files Browse the repository at this point in the history
  • Loading branch information
sfackler committed Nov 6, 2016
2 parents 37c4753 + 72ac2a0 commit a0b56c4
Show file tree
Hide file tree
Showing 62 changed files with 9,069 additions and 5,767 deletions.
104 changes: 81 additions & 23 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,28 +1,86 @@
language: rust
sudo: false
addons:
apt:
packages:
- gcc-arm-linux-gnueabihf
rust:
- nightly
- 1.9.0
os:
- osx
- linux
sudo: required
rust: stable
dist: trusty

env:
matrix:
- TEST_FEATURES=false
- TEST_FEATURES=true
global:
- TARGET=x86_64-unknown-linux-gnu
- BUILD_OPENSSL_VERSION=1.0.1u
matrix:
# include:
# - os: linux
# env: TARGET=arm-unknown-linux-gnueabihf TEST_FEATURES=true
# rust: 1.7.0
exclude:
- os: osx
env: TEST_FEATURES=true
include:
# ARM-bit version compat
- env: >
TARGET=arm-unknown-linux-gnueabihf
BUILD_OPENSSL_VERSION=1.0.2h
CARGO_TARGET_ARM_UNKNOWN_LINUX_GNUEABIHF_LINKER=arm-linux-gnueabihf-gcc
QEMU_LD_PREFIX=/usr/arm-linux-gnueabihf
RUST_TEST_THREADS=1
addons:
apt:
packages:
- gcc-arm-linux-gnueabihf
- qemu-user-static
- libc6-dev-armhf-cross
- binfmt-support
- env: >
TARGET=arm-unknown-linux-gnueabihf
BUILD_OPENSSL_VERSION=1.1.0b
CARGO_TARGET_ARM_UNKNOWN_LINUX_GNUEABIHF_LINKER=arm-linux-gnueabihf-gcc
QEMU_LD_PREFIX=/usr/arm-linux-gnueabihf
RUST_TEST_THREADS=1
addons:
apt:
packages:
- gcc-arm-linux-gnueabihf
- qemu-user-static
- libc6-dev-armhf-cross
- binfmt-support
# Minimum version supported
- rust: 1.9.0

# beta/nightly channels
- rust: beta
- rust: nightly

# 64-bit version compat
- env: BUILD_OPENSSL_VERSION=1.0.2h
- env: BUILD_OPENSSL_VERSION=1.1.0b

# 32-bit version compat
- env: TARGET=i686-unknown-linux-gnu BUILD_OPENSSL_VERSION=1.0.1u
addons:
apt:
packages:
- gcc-multilib
- env: TARGET=i686-unknown-linux-gnu BUILD_OPENSSL_VERSION=1.0.2h
addons:
apt:
packages:
- gcc-multilib
- env: TARGET=i686-unknown-linux-gnu BUILD_OPENSSL_VERSION=1.1.0b
addons:
apt:
packages:
- gcc-multilib

# osx 32/64
- os: osx
env: TARGET=x86_64-apple-darwin
- os: osx
env: TARGET=i686-apple-darwin
install: brew uninstall openssl && brew install openssl --universal


before_install:
- ./openssl/test/build.sh
- ./openssl/test/build.sh
- curl https://static.rust-lang.org/rustup.sh |
sh -s -- --add-target=$TARGET --disable-sudo -y --prefix=`rustc --print sysroot`
script:
- ./openssl/test/run.sh
- ./openssl/test/run.sh

cache:
cargo: true
directories:
- $HOME/openssl
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
[workspace]
members = ["openssl", "openssl-sys"]
members = ["openssl", "openssl-sys", "systest"]
116 changes: 62 additions & 54 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,26 @@

[![Build Status](https://travis-ci.org/sfackler/rust-openssl.svg?branch=master)](https://travis-ci.org/sfackler/rust-openssl)

[Documentation](https://sfackler.github.io/rust-openssl/doc/v0.8.3/openssl).
[Documentation](https://sfackler.github.io/rust-openssl/doc/v0.9.0/openssl).

## Warning

This README does not correspond to rust-openssl 0.7.x. See
[here](https://github.com/sfackler/rust-openssl/blob/b8fb29db5c246175a096260eacca38180cd77dd0/README.md)
for that README.

## Building

rust-openssl depends on both the OpenSSL runtime libraries and headers.
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 install OpenSSL via your package manager. The headers are
sometimes provided in a separate package than the runtime libraries - look for
something like `openssl-devel` or `libssl-dev`.
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-devel` or `libssl-dev`.

```bash
# On Ubuntu
Expand All @@ -23,79 +32,78 @@ sudo pacman -S openssl
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

OpenSSL 0.9.8 is preinstalled on OSX. Some features are only available when
linking against OpenSSL 1.0.0 or greater; see below on how to point
rust-openssl to a separate installation. OSX releases starting at 10.11, "El
Capitan", no longer include OpenSSL headers which will prevent the `openssl`
crate from compiling.
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:

For OSX 10.11 you can use brew to install OpenSSL and then set the environment variables
as described below.
```bash
brew install openssl
export OPENSSL_INCLUDE_DIR=`brew --prefix openssl`/include
export OPENSSL_LIB_DIR=`brew --prefix openssl`/lib
```

May be necessary clean the repository with `cargo clean` before build again.

### Windows
### Windows MSVC

On Windows, consider building with [mingw-w64](http://mingw-w64.org/).
Build script will try to find mingw in `PATH` environment variable to provide
Cargo with location where openssl libs from mingw-w64 package may be found.
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.

mingw-w64 can be easily installed by using [MSYS2](http://msys2.github.io/). Install MSYS2 according to the instructions, and then, from an MSYS2 Shell, install mingw-w64:
[precompiled binaries]: http://slproweb.com/products/Win32OpenSSL.html

32-bit:
```bash
pacman -S mingw-w64-i686-gcc
```
Once a precompiled binary is installed you can configure this crate to find the
installation via an environment variable:

64-bit
```bash
pacman -S mingw-w64-x86_64-gcc
```
set OPENSSL_DIR=C:\OpenSSL-Win64
```

and then install the mingw-w64 toolchain.
After that, you're just a `cargo build` away!

32-bit:
```bash
pacman -S mingw-w64-i686-toolchain
```
### Windows GNU (MinGW)

64-bit:
```bash
pacman -S mingw-w64-x86_64-toolchain
```
The easiest way to acquire OpenSSL when working with MinGW is to ensure you're
using [MSYS2](http://msys2.github.io) and to then execute:

Alternatively, install OpenSSL from [here][1]. Cargo will not be able to find OpenSSL if it's
installed to the default location. You can either copy the `include/openssl`
directory, `libssl32.dll`, and `libeay32.dll` to locations that Cargo can find
or pass the location to Cargo via environment variables:
```
# 32-bit
pacman -S mingw-w64-i686-openssl
```bash
env OPENSSL_LIB_DIR=C:/OpenSSL-Win64 OPENSSL_INCLUDE_DIR=C:/OpenSSL-Win64/include cargo build
# 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. This will not work in some situations, for example, on systems that
don't have pkg-config, when cross compiling, or when using a copy of OpenSSL
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_LIB_DIR` - If specified, a directory that will be used to find
OpenSSL runtime libraries.
* `OPENSSL_INCLUDE_DIR` - If specified, a directory that will be used to find
OpenSSL headers.
* `OPENSSL_STATIC` - If specified, OpenSSL libraries will be statically rather
than dynamically linked.

If either `OPENSSL_LIB_DIR` or `OPENSSL_INCLUDE_DIR` are specified, then the
build script will skip the pkg-config step.
* `OPENSSL_DIR` - If specified, a directory that will be used to find
OpenSSL installation. It's expected that under this directory the `include`
folder has header files and a `lib` folder has the runtime libraries.
* `OPENSSL_STATIC` - If specified, OpenSSL libraries will be statically rather
than dynamically linked.

[1]: http://slproweb.com/products/Win32OpenSSL.html
If `OPENSSL_DIR` is specified, then the build script will skip the pkg-config
step.
50 changes: 35 additions & 15 deletions appveyor.yml
Original file line number Diff line number Diff line change
@@ -1,25 +1,45 @@
environment:
OPENSSL_INCLUDE_DIR: C:\OpenSSL\include
OPENSSL_LIB_DIR: C:\OpenSSL\lib
OPENSSL_LIBS: ssleay32:libeay32
SSL_CERT_FILE: "C:\\OpenSSL\\cacert.pem"
matrix:
- TARGET: i686-pc-windows-gnu
BITS: 32
- TARGET: x86_64-pc-windows-msvc
BITS: 64
# 1.1.0, 64/32 bit
- TARGET: i686-pc-windows-gnu
BITS: 32
MSYS2: 1
OPENSSL_VERSION: 1_1_0b
- TARGET: x86_64-pc-windows-msvc
BITS: 64
OPENSSL_VERSION: 1_1_0b
OPENSSL_DIR: C:\OpenSSL

# 1.0.2, 64/32 bit
- TARGET: x86_64-pc-windows-gnu
BITS: 64
MSYS2: 1
OPENSSL_VERSION: 1_0_2j
- TARGET: i686-pc-windows-msvc
BITS: 32
OPENSSL_VERSION: 1_0_2j
OPENSSL_DIR: C:\OpenSSL
install:
- ps: Start-FileDownload "http://slproweb.com/download/Win${env:BITS}OpenSSL-1_0_2h.exe"
- Win%BITS%OpenSSL-1_0_2h.exe /SILENT /VERYSILENT /SP- /DIR="C:\OpenSSL"
- ps: Start-FileDownload "https://static.rust-lang.org/dist/rust-1.9.0-${env:TARGET}.exe"
- rust-1.9.0-%TARGET%.exe /VERYSILENT /NORESTART /DIR="C:\Program Files (x86)\Rust"
- SET PATH=%PATH%;C:\Program Files (x86)\Rust\bin
- SET PATH=%PATH%;C:\MinGW\bin
# install OpenSSL
- ps: Start-FileDownload "http://slproweb.com/download/Win${env:BITS}OpenSSL-${env:OPENSSL_VERSION}.exe"
- Win%BITS%OpenSSL-%OPENSSL_VERSION%.exe /SILENT /VERYSILENT /SP- /DIR="C:\OpenSSL"
- ps: Start-FileDownload "https://curl.haxx.se/ca/cacert.pem" -FileName "C:\OpenSSL\cacert.pem"

# Install Rust
- curl -sSf -o rustup-init.exe https://win.rustup.rs/
- rustup-init.exe -y --default-host %TARGET%
- set PATH=%PATH%;C:\Users\appveyor\.cargo\bin
- if defined MSYS2 set PATH=C:\msys64\mingw%BITS%\bin;%PATH%
- rustc -V
- cargo -V

build: false

# Don't run doctests due to rust-lang/cargo#1592
test_script:
- cargo test --lib --manifest-path openssl/Cargo.toml
- cargo run --manifest-path systest/Cargo.toml --target %TARGET%
- cargo test --manifest-path openssl/Cargo.toml --target %TARGET%

cache:
- target
- C:\Users\appveyor\.cargo\registry
30 changes: 2 additions & 28 deletions openssl-sys/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,47 +1,21 @@
[package]
name = "openssl-sys"
version = "0.7.17"
version = "0.9.0"
authors = ["Alex Crichton <alex@alexcrichton.com>",
"Steven Fackler <sfackler@gmail.com>"]
license = "MIT"
description = "FFI bindings to OpenSSL"
repository = "https://github.com/sfackler/rust-openssl"
documentation = "https://sfackler.github.io/rust-openssl/doc/v0.7.17/openssl_sys"
documentation = "https://sfackler.github.io/rust-openssl/doc/v0.9.0/openssl_sys"
links = "openssl"
build = "build.rs"

[features]
tlsv1_2 = []
tlsv1_1 = []
dtlsv1 = []
dtlsv1_2 = []
sslv2 = []
sslv3 = []
aes_xts = []
aes_ctr = []
npn = []
alpn = []
rfc5114 = []
pkcs5_pbkdf2_hmac = []
ecdh_auto = []
hmac_clone = []

[dependencies]
libc = "0.2"

[build-dependencies]
pkg-config = "0.3"

[target.le32-unknown-nacl.dependencies]
libressl-pnacl-sys = "2.1.0"
[target.x86_64-unknown-nacl.dependencies]
libressl-pnacl-sys = "2.1.0"
[target.i686-unknown-nacl.dependencies]
libressl-pnacl-sys = "2.1.0"
[target.arm-unknown-nacl.dependencies]
libressl-pnacl-sys = "2.1.0"

# Only here to make sure we link to these in a static build on Windows
[target.'cfg(windows)'.dependencies]
user32-sys = "0.2"
gdi32-sys = "0.2"
Loading

0 comments on commit a0b56c4

Please sign in to comment.