Commit a0b56c43 authored by Steven Fackler's avatar Steven Fackler
Browse files

Merge branch 'release-v0.9.0' into release

parents 37c47538 72ac2a01
Loading
Loading
Loading
Loading
+81 −23
Original line number Diff line number Diff line
language: rust
sudo: false
sudo: required
rust: stable
dist: trusty

env:
  global:
    - TARGET=x86_64-unknown-linux-gnu
    - BUILD_OPENSSL_VERSION=1.0.1u
matrix:
  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
rust:
- nightly
- 1.9.0
os:
- osx
- linux
env:
  matrix:
  - TEST_FEATURES=false
  - TEST_FEATURES=true
matrix:
    #  include:
    #  - os: linux
    #    env: TARGET=arm-unknown-linux-gnueabihf TEST_FEATURES=true
    #    rust: 1.7.0
  exclude:
            - 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: TEST_FEATURES=true
      env: TARGET=i686-apple-darwin
      install: brew uninstall openssl && brew install openssl --universal


before_install:
  - ./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

cache:
  cargo: true
  directories:
    - $HOME/openssl
+1 −1
Original line number Diff line number Diff line
[workspace]
members = ["openssl", "openssl-sys"]
members = ["openssl", "openssl-sys", "systest"]
+62 −54
Original line number Diff line number Diff line
@@ -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
@@ -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 MSVC

### Windows
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.

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.
[precompiled binaries]: http://slproweb.com/products/Win32OpenSSL.html

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:
Once a precompiled binary is installed you can configure this crate to find the
installation via an environment variable:

32-bit:
```bash
pacman -S mingw-w64-i686-gcc
```

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_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.

If either `OPENSSL_LIB_DIR` or `OPENSSL_INCLUDE_DIR` are specified, then the
build script will skip the pkg-config step.

[1]: http://slproweb.com/products/Win32OpenSSL.html
If `OPENSSL_DIR` is specified, then the build script will skip the pkg-config
step.
+35 −15
Original line number Diff line number Diff line
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:
    # 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
+2 −28
Original line number Diff line number Diff line
[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