From 7c4a323dc4834be6f8c4c1dc79c80d4700aee001 Mon Sep 17 00:00:00 2001 From: Steven Fackler Date: Mon, 11 Mar 2019 21:12:10 -0700 Subject: [PATCH 1/5] Parameterize rust version in circle --- .circleci/config.yml | 118 +++++++++++++++++++++++-------------------- 1 file changed, 62 insertions(+), 56 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 0397d9a3..91d74cdf 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -17,8 +17,11 @@ jobs: no_run: type: boolean default: false + image: + type: string + default: 1.24.1 docker: - - image: rust:1.24.1 + - image: rust:<< parameters.image >> environment: RUST_BACKTRACE: 1 OPENSSL_DIR: /opt/openssl @@ -50,62 +53,62 @@ jobs: esac rustup target add << parameters.target >> - - restore_cache: - key: openssl-<< parameters.target >>-<< parameters.library >>-<< parameters.version >> - - run: | - if [ -d "$OPENSSL_DIR" ]; then - exit 0 - fi + - unless: + condition: << parameters.vendored >> + steps: + - restore_cache: + key: openssl-<< parameters.target >>-<< parameters.library >>-<< parameters.version >> + - run: | + if [ -d "$OPENSSL_DIR" ]; then + exit 0 + fi - case "<< parameters.library >>" in - "libressl") - URL="https://ftp.openbsd.org/pub/OpenBSD/LibreSSL/libressl-<< parameters.version >>.tar.gz" - ;; - "openssl") - URL="https://openssl.org/source/openssl-<< parameters.version >>.tar.gz" - ;; - "") - exit 0 - ;; - esac + case "<< parameters.library >>" in + "libressl") + URL="https://ftp.openbsd.org/pub/OpenBSD/LibreSSL/libressl-<< parameters.version >>.tar.gz" + ;; + "openssl") + URL="https://openssl.org/source/openssl-<< parameters.version >>.tar.gz" + ;; + esac - case "<< parameters.target >>" in - "x86_64-unknown-linux-gnu") - OS_COMPILER=linux-x86_64 - OS_FLAGS="" - ;; - "i686-unknown-linux-gnu") - OS_COMPILER=linux-elf - OS_FLAGS=-m32 - ;; - "arm-unknown-linux-gnueabihf") - OS_COMPILER=linux-armv4 - OS_FLAGS="" - export AR=arm-linux-gnueabihf-ar - export CC=arm-linux-gnueabihf-gcc - ;; - esac + case "<< parameters.target >>" in + "x86_64-unknown-linux-gnu") + OS_COMPILER=linux-x86_64 + OS_FLAGS="" + ;; + "i686-unknown-linux-gnu") + OS_COMPILER=linux-elf + OS_FLAGS=-m32 + ;; + "arm-unknown-linux-gnueabihf") + OS_COMPILER=linux-armv4 + OS_FLAGS="" + export AR=arm-linux-gnueabihf-ar + export CC=arm-linux-gnueabihf-gcc + ;; + esac - mkdir /tmp/build - cd /tmp/build + mkdir /tmp/build + cd /tmp/build - curl -L $URL | tar --strip-components=1 -xzf - + curl -L $URL | tar --strip-components=1 -xzf - - case "<< parameters.library >>" in - "openssl") - ./Configure --prefix=$OPENSSL_DIR $OS_COMPILER -fPIC -g $OS_FLAGS no-shared - ;; - "libressl") - ./configure --prefix=$OPENSSL_DIR --disable-shared --with-pic - ;; - esac + case "<< parameters.library >>" in + "openssl") + ./Configure --prefix=$OPENSSL_DIR $OS_COMPILER -fPIC -g $OS_FLAGS no-shared + ;; + "libressl") + ./configure --prefix=$OPENSSL_DIR --disable-shared --with-pic + ;; + esac - make - make install_sw - - save_cache: - key: openssl-<< parameters.target >>-<< parameters.library >>-<< parameters.version >> - paths: - - /opt/openssl + make + make install_sw + - save_cache: + key: openssl-<< parameters.target >>-<< parameters.library >>-<< parameters.version >> + paths: + - /opt/openssl - restore_cache: key: registry - run: cargo generate-lockfile @@ -114,7 +117,7 @@ jobs: paths: - /usr/local/cargo/registry/index - restore_cache: - key: deps-1.24.1-<< parameters.target >>-<< parameters.library >>-<< parameters.version >>-{{ checksum "Cargo.lock" }} + key: deps-<< parameters.image >>-<< parameters.target >>-<< parameters.library >>-<< parameters.version >>-{{ checksum "Cargo.lock" }} - run: | cargo run \ --manifest-path=systest/Cargo.toml \ @@ -129,7 +132,7 @@ jobs: --target << parameters.target >> \ <<# parameters.no_run >>--no-run<> - save_cache: - key: deps-1.24.1-<< parameters.target >>-<< parameters.library >>-<< parameters.version >>-{{ checksum "Cargo.lock" }} + key: deps-<< parameters.image >>-<< parameters.target >>-<< parameters.library >>-<< parameters.version >>-{{ checksum "Cargo.lock" }} paths: - /usr/local/cargo/registry/cache - target @@ -147,6 +150,9 @@ jobs: vendored: type: boolean default: false + image: + type: string + default: 1.24.1 macos: xcode: "9.0" environment: @@ -155,11 +161,11 @@ jobs: - checkout - run: sudo mkdir /opt - run: sudo chown -R $USER /usr/local/ /opt - - run: curl https://sh.rustup.rs -sSf | sh -s -- -y --default-toolchain 1.24.1 + - run: curl https://sh.rustup.rs -sSf | sh -s -- -y --default-toolchain << parameters.image >> - run: sudo ln -s ~/.cargo/bin/* /usr/local/bin - run: cargo generate-lockfile - restore_cache: - key: deps-1.24.1-macos-<< parameters.vendored >>-{{ checksum "Cargo.lock" }} + key: deps-<< parameters.image >>-macos-<< parameters.vendored >>-{{ checksum "Cargo.lock" }} - run: | cargo run \ --manifest-path=systest/Cargo.toml \ @@ -170,7 +176,7 @@ jobs: --manifest-path=openssl/Cargo.toml \ <<# parameters.vendored >> --features vendored <> - save_cache: - key: deps-1.24.1-macos-<< parameters.vendored >>-{{ checksum "Cargo.lock" }} + key: deps-<< parameters.image >>-macos-<< parameters.vendored >>-{{ checksum "Cargo.lock" }} paths: - ~/.cargo/registry/cache - target From 914fadcec78628b2abd0c719e482d4d0efa011ca Mon Sep 17 00:00:00 2001 From: Steven Fackler Date: Mon, 11 Mar 2019 21:16:35 -0700 Subject: [PATCH 2/5] Build against modern rust by default Add a single build against 1.24.1 to ensure back compat --- .circleci/config.yml | 26 +++++++++++++++++++------- appveyor.yml | 6 ++++-- 2 files changed, 23 insertions(+), 9 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 91d74cdf..6ec552a9 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -19,7 +19,10 @@ jobs: default: false image: type: string - default: 1.24.1 + default: 1.33.0 + minimal_build: + type: bool + default: false docker: - image: rust:<< parameters.image >> environment: @@ -118,11 +121,14 @@ jobs: - /usr/local/cargo/registry/index - restore_cache: key: deps-<< parameters.image >>-<< parameters.target >>-<< parameters.library >>-<< parameters.version >>-{{ checksum "Cargo.lock" }} - - run: | - cargo run \ - --manifest-path=systest/Cargo.toml \ - <<# parameters.vendored >>--features vendored<> \ - --target << parameters.target >> + - unless: + condition: minimal_build + steps: + - run: | + cargo run \ + --manifest-path=systest/Cargo.toml \ + <<# parameters.vendored >>--features vendored<> \ + --target << parameters.target >> - run: | ulimit -c unlimited export PATH=$OPENSSL_DIR/bin:$PATH @@ -152,7 +158,7 @@ jobs: default: false image: type: string - default: 1.24.1 + default: 1.33.0 macos: xcode: "9.0" environment: @@ -197,6 +203,12 @@ openssl_101: &openssl_101 workflows: test: jobs: + - linux: + name: mimimal-version + target: x86_64-unknown-linux-musl + vendored: true + image: 1.24.1 + minimal_build: true - linux: name: musl-vendored target: x86_64-unknown-linux-musl diff --git a/appveyor.yml b/appveyor.yml index e2bbc77c..2750b03f 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,10 +1,10 @@ environment: SSL_CERT_FILE: "C:\\OpenSSL\\cacert.pem" matrix: - # 1.1.0, 64/32 bit + # 1.1.1, 64 bit - TARGET: x86_64-pc-windows-msvc BITS: 64 - OPENSSL_VERSION: 1_1_0j + OPENSSL_VERSION: 1_1_1b OPENSSL_DIR: C:\OpenSSL # 1.0.2, 64/32 bit @@ -16,6 +16,8 @@ environment: BITS: 32 OPENSSL_VERSION: 1_0_2r OPENSSL_DIR: C:\OpenSSL + + # vcpkg - TARGET: x86_64-pc-windows-msvc VCPKG_DEFAULT_TRIPLET: x64-windows VCPKGRS_DYNAMIC: 1 From 77ff62a4c8493bde877c5ef2024e4c769335722e Mon Sep 17 00:00:00 2001 From: Steven Fackler Date: Mon, 11 Mar 2019 21:18:51 -0700 Subject: [PATCH 3/5] Fix synatx --- .circleci/config.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 6ec552a9..aa13f8bd 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -21,7 +21,7 @@ jobs: type: string default: 1.33.0 minimal_build: - type: bool + type: boolean default: false docker: - image: rust:<< parameters.image >> @@ -122,7 +122,7 @@ jobs: - restore_cache: key: deps-<< parameters.image >>-<< parameters.target >>-<< parameters.library >>-<< parameters.version >>-{{ checksum "Cargo.lock" }} - unless: - condition: minimal_build + condition: << parameters.minimal_build >> steps: - run: | cargo run \ From d922e3f80b82a9947566717544afc77589b6ea5f Mon Sep 17 00:00:00 2001 From: Steven Fackler Date: Mon, 11 Mar 2019 21:34:24 -0700 Subject: [PATCH 4/5] Upgrade ctest --- systest/Cargo.toml | 2 +- systest/build.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/systest/Cargo.toml b/systest/Cargo.toml index 63f80479..bea35574 100644 --- a/systest/Cargo.toml +++ b/systest/Cargo.toml @@ -8,7 +8,7 @@ libc = "0.2" openssl-sys = { path = "../openssl-sys" } [build-dependencies] -ctest = "0.1" +ctest = "0.2" [features] vendored = ['openssl-sys/vendored'] diff --git a/systest/build.rs b/systest/build.rs index 6f3c782b..e8bd221d 100644 --- a/systest/build.rs +++ b/systest/build.rs @@ -67,7 +67,7 @@ fn main() { cfg.header("openssl/cms.h"); } - cfg.type_name(|s, is_struct| { + cfg.type_name(|s, is_struct, _is_union| { // Add some `*` on some callback parameters to get function pointer to // typecheck in C, especially on MSVC. if s == "PasswordCallback" { From 27494508bf276602dadda9e126cdc427ccdda361 Mon Sep 17 00:00:00 2001 From: Steven Fackler Date: Mon, 11 Mar 2019 21:35:21 -0700 Subject: [PATCH 5/5] Fix deprecation warning --- openssl-sys/build/main.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/openssl-sys/build/main.rs b/openssl-sys/build/main.rs index a1f163d7..02b93b90 100644 --- a/openssl-sys/build/main.rs +++ b/openssl-sys/build/main.rs @@ -247,6 +247,7 @@ due to this version mismatch. } // parses a string that looks like "0x100020cfL" +#[allow(deprecated)] // trim_right_matches is now trim_end_matches fn parse_version(version: &str) -> u64 { // cut off the 0x prefix assert!(version.starts_with("0x"));