Loading .github/workflows/ci.yml +30 −3 Original line number Diff line number Diff line Loading @@ -147,6 +147,9 @@ jobs: - x86_64-unknown-linux-gnu - i686-unknown-linux-gnu - arm-unknown-linux-gnueabihf bindgen: - true - false library: - name: openssl version: vendored Loading @@ -167,14 +170,26 @@ jobs: dl-path: /old/1.0.1 include: - target: x86_64-unknown-linux-gnu bindgen: true library: name: libressl version: 2.5.5 - target: x86_64-unknown-linux-gnu bindgen: true library: name: libressl version: 3.4.2 name: ${{ matrix.target }}-${{ matrix.library.name }}-${{ matrix.library.version }} - target: x86_64-unknown-linux-gnu bindgen: false library: name: libressl version: 2.5.5 - target: x86_64-unknown-linux-gnu bindgen: false library: name: libressl version: 3.4.2 name: ${{ matrix.target }}-${{ matrix.library.name }}-${{ matrix.library.version }}-${{ matrix.bindgen }} runs-on: ubuntu-latest env: OPENSSL_DIR: /opt/openssl Loading Loading @@ -203,6 +218,7 @@ jobs: sudo apt-get update sudo apt-get install -y $packages - run: sudo apt-get remove -y libssl-dev - uses: actions/cache@v2 with: path: /opt/openssl Loading Loading @@ -254,7 +270,9 @@ jobs: make make install_sw if: matrix.library.version != 'vendored' && !steps.openssl-cache.outputs.cache-hit - run: echo "RUST_TEST_THREADS=1" >> $GITHUB_ENV - run: | echo "RUST_TEST_THREADS=1" >> $GITHUB_ENV echo BINDGEN_EXTRA_CLANG_ARGS="--sysroot /usr/arm-linux-gnueabihf" >> $GITHUB_ENV if: matrix.target == 'arm-unknown-linux-gnueabihf' - uses: actions/cache@v1 with: Loading @@ -271,22 +289,31 @@ jobs: - uses: actions/cache@v1 with: path: target key: target-${{ matrix.target }}-${{ matrix.library.name }}-${{ matrix.library.version }}-${{ steps.rust-version.outputs.version }}-${{ hashFiles('Cargo.lock') }} key: target-${{ matrix.target }}-${{ matrix.bindgen }}-${{ matrix.library.name }}-${{ matrix.library.version }}-${{ steps.rust-version.outputs.version }}-${{ hashFiles('Cargo.lock') }} - name: Run systest run: | if [[ "${{ matrix.library.version }}" == "vendored" ]]; then features="--features vendored" fi if [[ "${{ matrix.bindgen }}" == "true" ]]; then features="$features --features bindgen" fi cargo run --manifest-path=systest/Cargo.toml --target ${{ matrix.target }} $features - name: Test openssl run: | if [[ "${{ matrix.library.version }}" == "vendored" ]]; then features="--features vendored" fi if [[ "${{ matrix.bindgen }}" == "true" ]]; then features="$features --features bindgen" fi cargo test --manifest-path=openssl/Cargo.toml --target ${{ matrix.target }} $features - name: Test openssl-errors run: | if [[ "${{ matrix.library.version }}" == "vendored" ]]; then features="--features openssl-sys/vendored" fi if [[ "${{ matrix.bindgen }}" == "true" ]]; then features="$features --features openssl-sys/bindgen" fi cargo test --manifest-path=openssl-errors/Cargo.toml --target ${{ matrix.target }} $features Cargo.toml +3 −0 Original line number Diff line number Diff line Loading @@ -6,3 +6,6 @@ members = [ "openssl-sys", "systest", ] [patch.crates-io] bindgen = { git = "https://github.com/daviddrysdale/rust-bindgen", branch = "allowlist-file" } openssl-sys/Cargo.toml +1 −0 Original line number Diff line number Diff line Loading @@ -20,6 +20,7 @@ vendored = ['openssl-src'] libc = "0.2" [build-dependencies] bindgen = { version = "0.59.2", optional = true } cc = "1.0" openssl-src = { version = "111", optional = true } pkg-config = "0.3.9" Loading openssl-sys/build/find_normal.rs +11 −10 Original line number Diff line number Diff line Loading @@ -209,7 +209,7 @@ fn try_pkg_config() { } }; super::validate_headers(&lib.include_paths); super::postprocess(&lib.include_paths); for include in lib.include_paths.iter() { println!("cargo:include={}", include.display()); Loading @@ -227,17 +227,18 @@ fn try_vcpkg() { // vcpkg will not emit any metadata if it can not find libraries // appropriate for the target triple with the desired linkage. let lib = vcpkg::Config::new() let lib = match vcpkg::Config::new() .emit_includes(true) .find_package("openssl"); if let Err(e) = lib { .find_package("openssl") { Ok(lib) => lib, Err(e) => { println!("note: vcpkg did not find openssl: {}", e); return; } }; let lib = lib.unwrap(); super::validate_headers(&lib.include_paths); super::postprocess(&lib.include_paths); println!("cargo:rustc-link-lib=user32"); println!("cargo:rustc-link-lib=gdi32"); Loading openssl-sys/build/main.rs +14 −2 Original line number Diff line number Diff line #![allow(clippy::inconsistent_digit_grouping, clippy::unusual_byte_groupings)] extern crate autocfg; #[cfg(feature = "bindgen")] extern crate bindgen; extern crate cc; #[cfg(feature = "vendored")] extern crate openssl_src; Loading @@ -12,12 +14,13 @@ use std::collections::HashSet; use std::env; use std::ffi::OsString; use std::path::{Path, PathBuf}; mod cfgs; mod find_normal; #[cfg(feature = "vendored")] mod find_vendored; #[cfg(feature = "bindgen")] mod run_bindgen; #[derive(PartialEq)] enum Version { Loading Loading @@ -83,7 +86,7 @@ fn main() { ); println!("cargo:include={}", include_dir.to_string_lossy()); let version = validate_headers(&[include_dir]); let version = postprocess(&[include_dir]); let libs_env = env("OPENSSL_LIBS"); let libs = match libs_env.as_ref().and_then(|s| s.to_str()) { Loading Loading @@ -135,6 +138,15 @@ fn check_rustc_versions() { } } #[allow(clippy::let_and_return)] fn postprocess(include_dirs: &[PathBuf]) -> Version { let version = validate_headers(include_dirs); #[cfg(feature = "bindgen")] run_bindgen::run(&include_dirs); version } /// Validates the header files found in `include_dir` and then returns the /// version string of OpenSSL. #[allow(clippy::manual_strip)] // we need to support pre-1.45.0 Loading Loading
.github/workflows/ci.yml +30 −3 Original line number Diff line number Diff line Loading @@ -147,6 +147,9 @@ jobs: - x86_64-unknown-linux-gnu - i686-unknown-linux-gnu - arm-unknown-linux-gnueabihf bindgen: - true - false library: - name: openssl version: vendored Loading @@ -167,14 +170,26 @@ jobs: dl-path: /old/1.0.1 include: - target: x86_64-unknown-linux-gnu bindgen: true library: name: libressl version: 2.5.5 - target: x86_64-unknown-linux-gnu bindgen: true library: name: libressl version: 3.4.2 name: ${{ matrix.target }}-${{ matrix.library.name }}-${{ matrix.library.version }} - target: x86_64-unknown-linux-gnu bindgen: false library: name: libressl version: 2.5.5 - target: x86_64-unknown-linux-gnu bindgen: false library: name: libressl version: 3.4.2 name: ${{ matrix.target }}-${{ matrix.library.name }}-${{ matrix.library.version }}-${{ matrix.bindgen }} runs-on: ubuntu-latest env: OPENSSL_DIR: /opt/openssl Loading Loading @@ -203,6 +218,7 @@ jobs: sudo apt-get update sudo apt-get install -y $packages - run: sudo apt-get remove -y libssl-dev - uses: actions/cache@v2 with: path: /opt/openssl Loading Loading @@ -254,7 +270,9 @@ jobs: make make install_sw if: matrix.library.version != 'vendored' && !steps.openssl-cache.outputs.cache-hit - run: echo "RUST_TEST_THREADS=1" >> $GITHUB_ENV - run: | echo "RUST_TEST_THREADS=1" >> $GITHUB_ENV echo BINDGEN_EXTRA_CLANG_ARGS="--sysroot /usr/arm-linux-gnueabihf" >> $GITHUB_ENV if: matrix.target == 'arm-unknown-linux-gnueabihf' - uses: actions/cache@v1 with: Loading @@ -271,22 +289,31 @@ jobs: - uses: actions/cache@v1 with: path: target key: target-${{ matrix.target }}-${{ matrix.library.name }}-${{ matrix.library.version }}-${{ steps.rust-version.outputs.version }}-${{ hashFiles('Cargo.lock') }} key: target-${{ matrix.target }}-${{ matrix.bindgen }}-${{ matrix.library.name }}-${{ matrix.library.version }}-${{ steps.rust-version.outputs.version }}-${{ hashFiles('Cargo.lock') }} - name: Run systest run: | if [[ "${{ matrix.library.version }}" == "vendored" ]]; then features="--features vendored" fi if [[ "${{ matrix.bindgen }}" == "true" ]]; then features="$features --features bindgen" fi cargo run --manifest-path=systest/Cargo.toml --target ${{ matrix.target }} $features - name: Test openssl run: | if [[ "${{ matrix.library.version }}" == "vendored" ]]; then features="--features vendored" fi if [[ "${{ matrix.bindgen }}" == "true" ]]; then features="$features --features bindgen" fi cargo test --manifest-path=openssl/Cargo.toml --target ${{ matrix.target }} $features - name: Test openssl-errors run: | if [[ "${{ matrix.library.version }}" == "vendored" ]]; then features="--features openssl-sys/vendored" fi if [[ "${{ matrix.bindgen }}" == "true" ]]; then features="$features --features openssl-sys/bindgen" fi cargo test --manifest-path=openssl-errors/Cargo.toml --target ${{ matrix.target }} $features
Cargo.toml +3 −0 Original line number Diff line number Diff line Loading @@ -6,3 +6,6 @@ members = [ "openssl-sys", "systest", ] [patch.crates-io] bindgen = { git = "https://github.com/daviddrysdale/rust-bindgen", branch = "allowlist-file" }
openssl-sys/Cargo.toml +1 −0 Original line number Diff line number Diff line Loading @@ -20,6 +20,7 @@ vendored = ['openssl-src'] libc = "0.2" [build-dependencies] bindgen = { version = "0.59.2", optional = true } cc = "1.0" openssl-src = { version = "111", optional = true } pkg-config = "0.3.9" Loading
openssl-sys/build/find_normal.rs +11 −10 Original line number Diff line number Diff line Loading @@ -209,7 +209,7 @@ fn try_pkg_config() { } }; super::validate_headers(&lib.include_paths); super::postprocess(&lib.include_paths); for include in lib.include_paths.iter() { println!("cargo:include={}", include.display()); Loading @@ -227,17 +227,18 @@ fn try_vcpkg() { // vcpkg will not emit any metadata if it can not find libraries // appropriate for the target triple with the desired linkage. let lib = vcpkg::Config::new() let lib = match vcpkg::Config::new() .emit_includes(true) .find_package("openssl"); if let Err(e) = lib { .find_package("openssl") { Ok(lib) => lib, Err(e) => { println!("note: vcpkg did not find openssl: {}", e); return; } }; let lib = lib.unwrap(); super::validate_headers(&lib.include_paths); super::postprocess(&lib.include_paths); println!("cargo:rustc-link-lib=user32"); println!("cargo:rustc-link-lib=gdi32"); Loading
openssl-sys/build/main.rs +14 −2 Original line number Diff line number Diff line #![allow(clippy::inconsistent_digit_grouping, clippy::unusual_byte_groupings)] extern crate autocfg; #[cfg(feature = "bindgen")] extern crate bindgen; extern crate cc; #[cfg(feature = "vendored")] extern crate openssl_src; Loading @@ -12,12 +14,13 @@ use std::collections::HashSet; use std::env; use std::ffi::OsString; use std::path::{Path, PathBuf}; mod cfgs; mod find_normal; #[cfg(feature = "vendored")] mod find_vendored; #[cfg(feature = "bindgen")] mod run_bindgen; #[derive(PartialEq)] enum Version { Loading Loading @@ -83,7 +86,7 @@ fn main() { ); println!("cargo:include={}", include_dir.to_string_lossy()); let version = validate_headers(&[include_dir]); let version = postprocess(&[include_dir]); let libs_env = env("OPENSSL_LIBS"); let libs = match libs_env.as_ref().and_then(|s| s.to_str()) { Loading Loading @@ -135,6 +138,15 @@ fn check_rustc_versions() { } } #[allow(clippy::let_and_return)] fn postprocess(include_dirs: &[PathBuf]) -> Version { let version = validate_headers(include_dirs); #[cfg(feature = "bindgen")] run_bindgen::run(&include_dirs); version } /// Validates the header files found in `include_dir` and then returns the /// version string of OpenSSL. #[allow(clippy::manual_strip)] // we need to support pre-1.45.0 Loading