build-system/cargo: Set openssl environment variable when available.

* guix/build/cargo-build-system.scm (configure): When openssl is
available set the OPENSSL_DIR variable to discover its location.
* gnu/packages/crates-io.scm (rust-curl-sys-0.4, rust-libgit2-sys-0.10,
rust-libpijul-0.12, rust-libssh2-sys-0.2, rust-native-tls-0.2,
rust-openssl-sys-0.9, rust-openssl-0.7, rust-trust-dns-rustls-0.6),
* gnu/packages/rust-apps.scm (tokei, exa)[arguments]: Remove redundant
setenv for openssl.
This commit is contained in:
Efraim Flashner 2020-11-22 18:09:39 +02:00
parent 93b14be52e
commit 3dbf3a7f51
No known key found for this signature in database
GPG key ID: 41AAE7DCCA3D8351
3 changed files with 30 additions and 84 deletions

View file

@ -5914,14 +5914,7 @@ (define-public rust-curl-sys-0.4
("rust-winapi" ,rust-winapi-0.3)
("rust-cc" ,rust-cc-1)
("rust-pkg-config" ,rust-pkg-config-0.3)
("rust-vcpkg" ,rust-vcpkg-0.2))
#:phases
(modify-phases %standard-phases
(add-after 'unpack 'find-openssl
(lambda* (#:key inputs #:allow-other-keys)
(let ((openssl (assoc-ref inputs "openssl")))
(setenv "OPENSSL_DIR" openssl))
#t)))))
("rust-vcpkg" ,rust-vcpkg-0.2))))
(native-inputs
`(("pkg-config" ,pkg-config)))
(inputs
@ -10362,10 +10355,11 @@ (define-public rust-git2-0.11
("rust-thread-id" ,rust-thread-id-3)
("rust-time" ,rust-time-0.1))))
(native-inputs
`(("pkg-config" ,pkg-config)))
(inputs
`(("libgit2" ,libgit2)
("libssh2" ,libssh2)
("openssl" ,openssl)
("pkg-config" ,pkg-config)
("zlib" ,zlib)))
(home-page "https://github.com/rust-lang/git2-rs")
(synopsis "Rust bindings to libgit2")
@ -13602,18 +13596,12 @@ (define-public rust-libgit2-sys-0.10
("rust-openssl-sys" ,rust-openssl-sys-0.9)
;; Build dependencies:
("rust-cc" ,rust-cc-1)
("rust-pkg-config" ,rust-pkg-config-0.3))
#:phases
(modify-phases %standard-phases
(add-after 'configure 'dont-vendor-sources
(lambda* (#:key inputs #:allow-other-keys)
(let ((openssl (assoc-ref inputs "openssl")))
(setenv "OPENSSL_DIR" openssl))
#t)))))
("rust-pkg-config" ,rust-pkg-config-0.3))))
(native-inputs
`(("pkg-config" ,pkg-config)))
(inputs
`(("libgit2" ,libgit2)
("openssl" ,openssl)
("pkg-config" ,pkg-config)
("zlib" ,zlib)))
(home-page "https://github.com/rust-lang/git2-rs")
(synopsis "Native bindings to the libgit2 library")
@ -13896,7 +13884,6 @@ (define-public rust-libpijul-0.12
(modify-phases %standard-phases
(add-after 'unpack 'set-missing-env-vars
(lambda* (#:key inputs #:allow-other-keys)
(setenv "OPENSSL_DIR" (assoc-ref inputs "openssl"))
(setenv "LIBCLANG_PATH"
(string-append (assoc-ref inputs "clang") "/lib"))
#t)))))
@ -14139,18 +14126,12 @@ (define-public rust-libssh2-sys-0.2
;; Build dependencies:
("rust-cc" ,rust-cc-1)
("rust-pkg-config" ,rust-pkg-config-0.3)
("rust-vcpkg" ,rust-vcpkg-0.2))
#:phases
(modify-phases %standard-phases
(add-after 'configure 'dont-vendor-sources
(lambda* (#:key inputs #:allow-other-keys)
(let ((openssl (assoc-ref inputs "openssl")))
(setenv "OPENSSL_DIR" openssl))
#t)))))
("rust-vcpkg" ,rust-vcpkg-0.2))))
(native-inputs
`(("pkg-config" ,pkg-config)))
(inputs
`(("libssh2" ,libssh2)
("openssl" ,openssl)
("pkg-config" ,pkg-config)
("zlib" ,zlib)))
(home-page "https://github.com/alexcrichton/ssh2-rs")
(synopsis "Native bindings to the libssh2 library")
@ -16040,17 +16021,11 @@ (define-public rust-native-tls-0.2
("rust-security-framework-sys" ,rust-security-framework-sys-0.3)
("rust-tempfile" ,rust-tempfile-3))
#:cargo-development-inputs
(("rust-hex" ,rust-hex-0.3))
#:phases
(modify-phases %standard-phases
(add-after 'unpack 'find-openssl
(lambda* (#:key inputs #:allow-other-keys)
(let ((openssl (assoc-ref inputs "openssl")))
(setenv "OPENSSL_DIR" openssl))
#t)))))
(("rust-hex" ,rust-hex-0.3))))
(native-inputs
`(("openssl" ,openssl)
("pkg-config" ,pkg-config)))
`(("pkg-config" ,pkg-config)))
(inputs
`(("openssl" ,openssl)))
(home-page "https://github.com/sfackler/rust-native-tls")
(synopsis
"Wrapper over a platform's native TLS implementation")
@ -17633,7 +17608,7 @@ (define-public rust-openssl-0.7
(substitute* "Cargo.toml"
((", path =.*}") "}"))
#t)))))
(native-inputs
(inputs
`(("openssl" ,openssl-1.0))))) ; for openssl-sys-extras
(define-public rust-openssl-probe-0.1
@ -17677,17 +17652,11 @@ (define-public rust-openssl-sys-0.9
("rust-autocfg" ,rust-autocfg-1.0)
("rust-cc" ,rust-cc-1)
("rust-pkg-config" ,rust-pkg-config-0.3)
("rust-vcpkg" ,rust-vcpkg-0.2))
#:phases
(modify-phases %standard-phases
(add-after 'unpack 'find-openssl
(lambda* (#:key inputs #:allow-other-keys)
(let ((openssl (assoc-ref inputs "openssl")))
(setenv "OPENSSL_DIR" openssl))
#t)))))
("rust-vcpkg" ,rust-vcpkg-0.2))))
(native-inputs
`(("openssl" ,openssl)
("pkg-config" ,pkg-config)))
`(("pkg-config" ,pkg-config)))
(inputs
`(("openssl" ,openssl)))
(home-page "https://github.com/sfackler/rust-openssl")
(synopsis "FFI bindings to OpenSSL")
(description
@ -17721,14 +17690,7 @@ (define-public rust-openssl-sys-0.7
(("rust-gdi32-sys" ,rust-gdi32-sys-0.2)
("rust-libc" ,rust-libc-0.2)
("rust-user32-sys" ,rust-user32-sys-0.2)
("rust-pkg-config" ,rust-pkg-config-0.3))
#:phases
(modify-phases %standard-phases
(add-after 'unpack 'find-openssl
(lambda* (#:key inputs #:allow-other-keys)
(let ((openssl (assoc-ref inputs "openssl")))
(setenv "OPENSSL_DIR" openssl))
#t)))))))
("rust-pkg-config" ,rust-pkg-config-0.3))))))
(define-public rust-openssl-sys-extras-0.7
(package
@ -17756,7 +17718,7 @@ (define-public rust-openssl-sys-extras-0.7
(substitute* "Cargo.toml"
((", path =.*}") "}"))
#t)))))
(native-inputs
(inputs
`(("openssl" ,openssl-1.0))) ; openssl-1.0 specifically
(home-page "https://github.com/sfackler/rust-openssl")
(synopsis
@ -25752,7 +25714,7 @@ (define-public rust-sha1-0.2
(substitute* "Cargo.toml"
((", path =.*}") "}"))
#t)))))
(native-inputs
(inputs
`(("openssl" ,openssl-1.0))))) ; for openssl-sys-extras
(define-public rust-sha1-asm-0.4
@ -31008,8 +30970,9 @@ (define-public rust-trust-dns-rustls-0.6
(base32
"0vbh2y7w2s5gcw33fn4hb5f927kgjm6603vw63slg9riikmsiq43"))))
(native-inputs
`(("openssl" ,openssl)
("pkg-config" ,pkg-config)))
`(("pkg-config" ,pkg-config)))
(inputs
`(("openssl" ,openssl)))
(arguments
`(#:cargo-test-flags
'("--release" "--" "--skip=tests::test_tls_client_stream_ipv4")
@ -31023,14 +30986,7 @@ (define-public rust-trust-dns-rustls-0.6
("rust-webpki" ,rust-webpki-0.19))
#:cargo-development-inputs
(("rust-openssl" ,rust-openssl-0.10)
("rust-tokio" ,rust-tokio-0.1))
#:phases
(modify-phases %standard-phases
(add-after 'unpack 'find-openssl
(lambda* (#:key inputs #:allow-other-keys)
(let ((openssl (assoc-ref inputs "openssl")))
(setenv "OPENSSL_DIR" openssl))
#t)))))))
("rust-tokio" ,rust-tokio-0.1))))))
(define-public rust-try-from-0.3
(package

View file

@ -73,13 +73,7 @@ (define-public exa
("rust-zoneinfo-compiled" ,rust-zoneinfo-compiled-0.4))
#:cargo-development-inputs
(("rust-datetime" ,rust-datetime-0.4))
#:phases
(modify-phases %standard-phases
(add-after 'configure 'dont-vendor-sources
(lambda* (#:key inputs #:allow-other-keys)
(let ((openssl (assoc-ref inputs "openssl")))
(setenv "OPENSSL_DIR" openssl))
#t))
;; Ignoring failing tests.
;; Reported in https://github.com/ogham/exa/issues/318
(add-before 'check 'disable-failing-tests
@ -393,18 +387,12 @@ (define-public tokei
("rust-lazy-static" ,rust-lazy-static-1)
("rust-regex" ,rust-regex-1)
("rust-serde-json" ,rust-serde-json-1)
("rust-tempfile" ,rust-tempfile-3))
#:phases
(modify-phases %standard-phases
(add-after 'configure 'unvendor-libraries-from-crates
(lambda* (#:key inputs #:allow-other-keys)
(let ((openssl (assoc-ref inputs "openssl")))
(setenv "OPENSSL_DIR" openssl))
#t)))))
("rust-tempfile" ,rust-tempfile-3))))
(native-inputs
`(("pkg-config" ,pkg-config)))
(inputs
`(("libgit2" ,libgit2)
("openssl" ,openssl)
("pkg-config" ,pkg-config)
("zlib" ,zlib)))
(home-page "https://tokei.rs")
(synopsis "Count code, quickly")

View file

@ -122,6 +122,8 @@ (define* (configure #:key inputs
(setenv "CC" (string-append (assoc-ref inputs "gcc") "/bin/gcc"))
(setenv "LIBGIT2_SYS_USE_PKG_CONFIG" "1")
(setenv "LIBSSH2_SYS_USE_PKG_CONFIG" "1")
(when (assoc-ref inputs "openssl")
(setenv "OPENSSL_DIR" (assoc-ref inputs "openssl")))
;; We don't use the Cargo.lock file to determine the package versions we use
;; during building, and in any case if one is not present it is created