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

* guix/build/cargo-build-system.scm (configure): When clang is available
in the build environment set the LIBCLANG_PATH variable.
* gnu/packages/crates-graphics.scm (rust-aom-sys-0.1,
uust-dav1d-sys-0.3),
* gnu/packages/crates-io.scm (rust-bindgen-0.55, rust-bindgen-0.54,
rust-bindgen-0.53, rust-bindgen-0.52, rust-cexpr-0.4, rust-cexpr-0.3,
rust-cexpr-0.2, rust-clang-sys-1, rust-clang-sys-0.29,
rust-clang-sys-0.26, rust-clang-sys-0.22, rust-clang-sys-0.11,
rust-libpijul-0.12, rust-nettle-7, rust-nettle-sys-2,
rust-sequoia-openpgp-0.9)[arguments]: Remove phases which set an
environment variable to find clang.
[inputs]: Rename instances of libclang with clang.
This commit is contained in:
Efraim Flashner 2020-11-22 18:56:56 +02:00
parent 3dbf3a7f51
commit 73dbcc4b5f
No known key found for this signature in database
GPG key ID: 41AAE7DCCA3D8351
3 changed files with 27 additions and 162 deletions

View file

@ -183,20 +183,12 @@ (define-public rust-aom-sys-0.1
(arguments (arguments
`(#:cargo-inputs `(#:cargo-inputs
(("rust-bindgen" ,rust-bindgen-0.53) (("rust-bindgen" ,rust-bindgen-0.53)
("rust-metadeps" ,rust-metadeps-1.1)) ("rust-metadeps" ,rust-metadeps-1.1))))
#:phases
(modify-phases %standard-phases
(add-after 'unpack 'set-environmental-variable
(lambda* (#:key inputs #:allow-other-keys)
(let ((clang (assoc-ref inputs "libclang")))
(setenv "LIBCLANG_PATH"
(string-append clang "/lib")))
#t)))))
(native-inputs (native-inputs
`(("pkg-config" ,pkg-config))) `(("pkg-config" ,pkg-config)))
(inputs (inputs
`(("libaom" ,libaom) `(("libaom" ,libaom)
("libclang" ,clang) ("clang" ,clang)
("llvm" ,llvm))) ("llvm" ,llvm)))
(home-page "https://github.com/rust-av/aom-rs") (home-page "https://github.com/rust-av/aom-rs")
(synopsis "FFI bindings to aom") (synopsis "FFI bindings to aom")
@ -402,19 +394,12 @@ (define-public rust-dav1d-sys-0.3
(arguments (arguments
`(#:cargo-inputs `(#:cargo-inputs
(("rust-bindgen" ,rust-bindgen-0.54) (("rust-bindgen" ,rust-bindgen-0.54)
("rust-metadeps" ,rust-metadeps-1.1)) ("rust-metadeps" ,rust-metadeps-1.1))))
#:phases (native-inputs
(modify-phases %standard-phases `(("pkg-config" ,pkg-config)))
(add-after 'unpack 'set-environmental-variable
(lambda* (#:key inputs #:allow-other-keys)
(let ((clang (assoc-ref inputs "libclang")))
(setenv "LIBCLANG_PATH"
(string-append clang "/lib")))
#t)))))
(inputs (inputs
`(("dav1d" ,dav1d) `(("dav1d" ,dav1d)
("pkg-config" ,pkg-config) ("clang" ,clang)
("libclang" ,clang)
("llvm" ,llvm))) ("llvm" ,llvm)))
(home-page "https://github.com/rust-av/dav1d-rs") (home-page "https://github.com/rust-av/dav1d-rs")
(synopsis "FFI bindings to dav1d") (synopsis "FFI bindings to dav1d")

View file

@ -1749,11 +1749,6 @@ (define-public rust-bindgen-0.55
(add-after 'unpack 'enable-unstable-features (add-after 'unpack 'enable-unstable-features
(lambda _ (lambda _
(setenv "RUSTC_BOOTSTRAP" "1") (setenv "RUSTC_BOOTSTRAP" "1")
#t))
(add-before 'configure 'configure-clang
(lambda* (#:key inputs #:allow-other-keys)
(setenv "LIBCLANG_PATH" (string-append (assoc-ref inputs "clang")
"/lib"))
#t))))) #t)))))
(home-page "https://rust-lang.github.io/rust-bindgen/") (home-page "https://rust-lang.github.io/rust-bindgen/")
(synopsis "Generate Rust FFI bindings to C and C++ libraries.") (synopsis "Generate Rust FFI bindings to C and C++ libraries.")
@ -1798,17 +1793,9 @@ (define-public rust-bindgen-0.54
#:cargo-development-inputs #:cargo-development-inputs
(("rust-clap" ,rust-clap-2) (("rust-clap" ,rust-clap-2)
("rust-diff" ,rust-diff-0.1) ("rust-diff" ,rust-diff-0.1)
("rust-shlex" ,rust-shlex-0.1)) ("rust-shlex" ,rust-shlex-0.1))))
#:phases
(modify-phases %standard-phases
(add-after 'unpack 'set-environmental-variable
(lambda* (#:key inputs #:allow-other-keys)
(let ((clang (assoc-ref inputs "libclang")))
(setenv "LIBCLANG_PATH"
(string-append clang "/lib")))
#t)))))
(inputs (inputs
`(("libclang" ,clang))))) `(("clang" ,clang)))))
(define-public rust-bindgen-0.53 (define-public rust-bindgen-0.53
(package (package
@ -1845,15 +1832,7 @@ (define-public rust-bindgen-0.53
#:cargo-development-inputs #:cargo-development-inputs
(("rust-clap" ,rust-clap-2) (("rust-clap" ,rust-clap-2)
("rust-diff" ,rust-diff-0.1) ("rust-diff" ,rust-diff-0.1)
("rust-shlex" ,rust-shlex-0.1)) ("rust-shlex" ,rust-shlex-0.1))))))
#:phases
(modify-phases %standard-phases
(add-after 'unpack 'set-environmental-variable
(lambda* (#:key inputs #:allow-other-keys)
(let ((clang (assoc-ref inputs "libclang")))
(setenv "LIBCLANG_PATH"
(string-append clang "/lib")))
#t)))))))
(define-public rust-bindgen-0.52 (define-public rust-bindgen-0.52
(package (package
@ -1891,15 +1870,7 @@ (define-public rust-bindgen-0.52
#:cargo-development-inputs #:cargo-development-inputs
(("rust-clap" ,rust-clap-2) (("rust-clap" ,rust-clap-2)
("rust-diff" ,rust-diff-0.1) ("rust-diff" ,rust-diff-0.1)
("rust-shlex" ,rust-shlex-0.1)) ("rust-shlex" ,rust-shlex-0.1))))))
#:phases
(modify-phases %standard-phases
(add-after 'unpack 'set-environmental-variable
(lambda* (#:key inputs #:allow-other-keys)
(let ((clang (assoc-ref inputs "libclang")))
(setenv "LIBCLANG_PATH"
(string-append clang "/lib")))
#t)))))))
(define-public rust-bindgen-0.51 (define-public rust-bindgen-0.51
(package (package
@ -3530,17 +3501,9 @@ (define-public rust-cexpr-0.4
`(#:cargo-inputs `(#:cargo-inputs
(("rust-nom" ,rust-nom-5)) (("rust-nom" ,rust-nom-5))
#:cargo-development-inputs #:cargo-development-inputs
(("rust-clang-sys" ,rust-clang-sys-0.28)) (("rust-clang-sys" ,rust-clang-sys-0.28))))
#:phases
(modify-phases %standard-phases
(add-after 'unpack 'set-environmental-variable
(lambda* (#:key inputs #:allow-other-keys)
(let ((clang (assoc-ref inputs "libclang")))
(setenv "LIBCLANG_PATH"
(string-append clang "/lib")))
#t)))))
(inputs (inputs
`(("libclang" ,clang))) `(("clang" ,clang)))
(home-page "https://github.com/jethrogb/rust-cexpr") (home-page "https://github.com/jethrogb/rust-cexpr")
(synopsis "C expression parser and evaluator") (synopsis "C expression parser and evaluator")
(description (description
@ -3565,15 +3528,7 @@ (define-public rust-cexpr-0.3
`(#:cargo-inputs `(#:cargo-inputs
(("rust-nom" ,rust-nom-4.2)) (("rust-nom" ,rust-nom-4.2))
#:cargo-development-inputs #:cargo-development-inputs
(("rust-clang-sys" ,rust-clang-sys-0.28)) (("rust-clang-sys" ,rust-clang-sys-0.28))))))
#:phases
(modify-phases %standard-phases
(add-after 'unpack 'set-environmental-variable
(lambda* (#:key inputs #:allow-other-keys)
(let ((clang (assoc-ref inputs "libclang")))
(setenv "LIBCLANG_PATH"
(string-append clang "/lib")))
#t)))))))
(define-public rust-cexpr-0.2 (define-public rust-cexpr-0.2
(package (package
@ -3594,15 +3549,7 @@ (define-public rust-cexpr-0.2
`(#:cargo-inputs `(#:cargo-inputs
(("rust-nom" ,rust-nom-3)) (("rust-nom" ,rust-nom-3))
#:cargo-development-inputs #:cargo-development-inputs
(("rust-clang-sys" ,rust-clang-sys-0.11)) (("rust-clang-sys" ,rust-clang-sys-0.11))))))
#:phases
(modify-phases %standard-phases
(add-after 'unpack 'set-environmental-variable
(lambda* (#:key inputs #:allow-other-keys)
(let ((clang (assoc-ref inputs "libclang")))
(setenv "LIBCLANG_PATH"
(string-append clang "/lib")))
#t)))))))
(define-public rust-cfg-if-0.1 (define-public rust-cfg-if-0.1
(package (package
@ -3705,20 +3652,12 @@ (define-public rust-clang-sys-1
"0695kfrqx7n091fzm6msbqg2q2kyhka64q08lm63f3l9d964i8cx")))) "0695kfrqx7n091fzm6msbqg2q2kyhka64q08lm63f3l9d964i8cx"))))
(build-system cargo-build-system) (build-system cargo-build-system)
(inputs (inputs
`(("libclang" ,clang))) `(("clang" ,clang)))
(arguments (arguments
`(#:cargo-inputs `(#:cargo-inputs
(("rust-glob" ,rust-glob-0.3) (("rust-glob" ,rust-glob-0.3)
("rust-libc" ,rust-libc-0.2) ("rust-libc" ,rust-libc-0.2)
("rust-libloading" ,rust-libloading-0.6)) ("rust-libloading" ,rust-libloading-0.6))))
#:phases
(modify-phases %standard-phases
(add-before 'configure 'configure-clang
(lambda* (#:key inputs #:allow-other-keys)
(setenv "LIBCLANG_PATH"
(string-append (assoc-ref inputs "libclang")
"/lib"))
#t)))))
(home-page "https://github.com/KyleMayes/clang-sys") (home-page "https://github.com/KyleMayes/clang-sys")
(synopsis "Rust bindings for libclang") (synopsis "Rust bindings for libclang")
(description "This package provides Rust bindings for libclang.") (description "This package provides Rust bindings for libclang.")
@ -3742,15 +3681,7 @@ (define-public rust-clang-sys-0.29
`(#:cargo-inputs `(#:cargo-inputs
(("rust-glob" ,rust-glob-0.3) (("rust-glob" ,rust-glob-0.3)
("rust-libc" ,rust-libc-0.2) ("rust-libc" ,rust-libc-0.2)
("rust-libloading" ,rust-libloading-0.5)) ("rust-libloading" ,rust-libloading-0.5))))))
#:phases
(modify-phases %standard-phases
(add-after 'unpack 'set-environmental-variable
(lambda* (#:key inputs #:allow-other-keys)
(let ((clang (assoc-ref inputs "libclang")))
(setenv "LIBCLANG_PATH"
(string-append clang "/lib")))
#t)))))))
(define-public rust-clang-sys-0.28 (define-public rust-clang-sys-0.28
(package (package
@ -3783,15 +3714,7 @@ (define-public rust-clang-sys-0.26
`(#:cargo-inputs `(#:cargo-inputs
(("rust-glob" ,rust-glob-0.2) (("rust-glob" ,rust-glob-0.2)
("rust-libc" ,rust-libc-0.2) ("rust-libc" ,rust-libc-0.2)
("rust-libloading" ,rust-libloading-0.5)) ("rust-libloading" ,rust-libloading-0.5))))))
#:phases
(modify-phases %standard-phases
(add-after 'unpack 'set-environmental-variable
(lambda* (#:key inputs #:allow-other-keys)
(let ((clang (assoc-ref inputs "libclang")))
(setenv "LIBCLANG_PATH"
(string-append clang "/lib")))
#t)))))))
(define-public rust-clang-sys-0.23 (define-public rust-clang-sys-0.23
(package (package
@ -3828,15 +3751,7 @@ (define-public rust-clang-sys-0.22
(("rust-clippy" ,rust-clippy-0.0) (("rust-clippy" ,rust-clippy-0.0)
("rust-glob" ,rust-glob-0.2) ("rust-glob" ,rust-glob-0.2)
("rust-libc" ,rust-libc-0.2) ("rust-libc" ,rust-libc-0.2)
("rust-libloading" ,rust-libloading-0.5)) ("rust-libloading" ,rust-libloading-0.5))))))
#:phases
(modify-phases %standard-phases
(add-after 'unpack 'set-environmental-variable
(lambda* (#:key inputs #:allow-other-keys)
(let ((clang (assoc-ref inputs "libclang")))
(setenv "LIBCLANG_PATH"
(string-append clang "/lib")))
#t)))))))
(define-public rust-clang-sys-0.11 (define-public rust-clang-sys-0.11
(package (package
@ -3860,15 +3775,7 @@ (define-public rust-clang-sys-0.11
("rust-glob" ,rust-glob-0.2) ("rust-glob" ,rust-glob-0.2)
("rust-lazy-static" ,rust-lazy-static-0.2) ("rust-lazy-static" ,rust-lazy-static-0.2)
("rust-libc" ,rust-libc-0.2) ("rust-libc" ,rust-libc-0.2)
("rust-libloading" ,rust-libloading-0.3)) ("rust-libloading" ,rust-libloading-0.3))))))
#:phases
(modify-phases %standard-phases
(add-after 'unpack 'set-environmental-variable
(lambda* (#:key inputs #:allow-other-keys)
(let ((clang (assoc-ref inputs "libclang")))
(setenv "LIBCLANG_PATH"
(string-append clang "/lib")))
#t)))))))
(define-public rust-clap-2 (define-public rust-clap-2
(package (package
@ -13879,14 +13786,7 @@ (define-public rust-libpijul-0.12
("rust-serde-derive" ,rust-serde-derive-1) ("rust-serde-derive" ,rust-serde-derive-1)
("rust-serde-json" ,rust-serde-json-1) ("rust-serde-json" ,rust-serde-json-1)
("rust-tempdir" ,rust-tempdir-0.3) ("rust-tempdir" ,rust-tempdir-0.3)
("rust-toml" ,rust-toml-0.4)) ("rust-toml" ,rust-toml-0.4))))
#:phases
(modify-phases %standard-phases
(add-after 'unpack 'set-missing-env-vars
(lambda* (#:key inputs #:allow-other-keys)
(setenv "LIBCLANG_PATH"
(string-append (assoc-ref inputs "clang") "/lib"))
#t)))))
(native-inputs (native-inputs
`(("pkg-config" ,pkg-config))) `(("pkg-config" ,pkg-config)))
(inputs (inputs
@ -16108,15 +16008,7 @@ (define-public rust-nettle-7
("rust-thiserror" ,rust-thiserror-1)) ("rust-thiserror" ,rust-thiserror-1))
#:cargo-development-inputs #:cargo-development-inputs
(("rust-bindgen" ,rust-bindgen-0.51) (("rust-bindgen" ,rust-bindgen-0.51)
("rust-pkg-config" ,rust-pkg-config-0.3)) ("rust-pkg-config" ,rust-pkg-config-0.3))))
#:phases
(modify-phases %standard-phases
(add-after 'unpack 'set-missing-env-vars
(lambda* (#:key inputs #:allow-other-keys)
;; FIXME: why do we need to set this?
(setenv "LIBCLANG_PATH"
(string-append (assoc-ref inputs "clang") "/lib"))
#t)))))
(home-page "https://gitlab.com/sequoia-pgp/nettle-rs") (home-page "https://gitlab.com/sequoia-pgp/nettle-rs")
(synopsis "Rust bindings for the Nettle cryptographic library") (synopsis "Rust bindings for the Nettle cryptographic library")
(description "This package provides Rust bindings for the Nettle (description "This package provides Rust bindings for the Nettle
@ -16158,15 +16050,7 @@ (define-public rust-nettle-sys-2
(arguments (arguments
`(#:cargo-inputs `(#:cargo-inputs
(("rust-bindgen" ,rust-bindgen-0.51) (("rust-bindgen" ,rust-bindgen-0.51)
("rust-pkg-config" ,rust-pkg-config-0.3)) ("rust-pkg-config" ,rust-pkg-config-0.3))))
#:phases
(modify-phases %standard-phases
(add-after 'unpack 'set-environmental-variable
(lambda* (#:key inputs #:allow-other-keys)
(let ((clang (assoc-ref inputs "clang")))
(setenv "LIBCLANG_PATH"
(string-append clang "/lib")))
#t)))))
(home-page "https://gitlab.com/sequoia-pgp/nettle-sys") (home-page "https://gitlab.com/sequoia-pgp/nettle-sys")
(synopsis "Low-level Rust bindings for the Nettle cryptographic library") (synopsis "Low-level Rust bindings for the Nettle cryptographic library")
(description "This package provides low-level Rust bindings for the Nettle (description "This package provides low-level Rust bindings for the Nettle
@ -24774,14 +24658,7 @@ (define-public rust-sequoia-openpgp-0.9
("rust-sequoia-rfc2822" ,rust-sequoia-rfc2822-0.9) ("rust-sequoia-rfc2822" ,rust-sequoia-rfc2822-0.9)
("rust-time" ,rust-time-0.1)) ("rust-time" ,rust-time-0.1))
#:cargo-development-inputs #:cargo-development-inputs
(("rust-rpassword" ,rust-rpassword-3)) (("rust-rpassword" ,rust-rpassword-3))))
#:phases
(modify-phases %standard-phases
(add-after 'unpack 'set-missing-env-vars
(lambda* (#:key inputs #:allow-other-keys)
(setenv "LIBCLANG_PATH"
(string-append (assoc-ref inputs "clang") "/lib"))
#t)))))
(native-inputs (native-inputs
`(("pkg-config" ,pkg-config))) `(("pkg-config" ,pkg-config)))
(inputs (inputs

View file

@ -124,6 +124,9 @@ (define* (configure #:key inputs
(setenv "LIBSSH2_SYS_USE_PKG_CONFIG" "1") (setenv "LIBSSH2_SYS_USE_PKG_CONFIG" "1")
(when (assoc-ref inputs "openssl") (when (assoc-ref inputs "openssl")
(setenv "OPENSSL_DIR" (assoc-ref inputs "openssl"))) (setenv "OPENSSL_DIR" (assoc-ref inputs "openssl")))
(when (assoc-ref inputs "clang")
(setenv "LIBCLANG_PATH"
(string-append (assoc-ref inputs "clang") "/lib")))
;; We don't use the Cargo.lock file to determine the package versions we use ;; 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 ;; during building, and in any case if one is not present it is created