diff options
author | Efraim Flashner <efraim@flashner.co.il> | 2024-01-12 12:57:30 +0200 |
---|---|---|
committer | Efraim Flashner <efraim@flashner.co.il> | 2024-02-20 13:57:41 +0200 |
commit | d3f4df4be93ce5c28f7b40a3a91aeb6a86284e80 (patch) | |
tree | 8706a242fe9ffea6458486203a6f3f17721638c1 /gnu/packages/rust.scm | |
parent | f3b13d4e0e19ffa7bc9ef4de6df2059479e99156 (diff) |
gnu: rust: Use more system libraries.
* gnu/packages/rust.scm (rust)[source]: Adjust inherited source to also
unbundle curl, libffi, nghttp2 and zlib.
[inputs]: Add libffi, nghttp2:lib, zlib.
Change-Id: I97932b9afda507a4c655027df494a70cf8c11509
Diffstat (limited to 'gnu/packages/rust.scm')
-rw-r--r-- | gnu/packages/rust.scm | 36 |
1 files changed, 35 insertions, 1 deletions
diff --git a/gnu/packages/rust.scm b/gnu/packages/rust.scm index b873437458..25e843dba6 100644 --- a/gnu/packages/rust.scm +++ b/gnu/packages/rust.scm @@ -46,6 +46,7 @@ #:use-module (gnu packages flex) #:use-module (gnu packages gcc) #:use-module (gnu packages gdb) + #:use-module (gnu packages libffi) #:use-module (gnu packages linux) #:use-module (gnu packages llvm) #:use-module (gnu packages mingw) @@ -53,6 +54,7 @@ #:use-module (gnu packages python) #:use-module (gnu packages ssh) #:use-module (gnu packages tls) + #:use-module (gnu packages web) #:use-module (gnu packages) #:use-module (guix build-system cargo) #:use-module (guix build-system gnu) @@ -833,6 +835,38 @@ safety and thread safety guarantees.") (inherit base-rust) (properties (alist-delete 'hidden? (package-properties base-rust))) (outputs (cons* "rust-src" "tools" (package-outputs base-rust))) + (source + (origin + (inherit (package-source base-rust)) + (snippet + '(begin + (for-each delete-file-recursively + '("src/llvm-project" + "vendor/openssl-src/openssl" + "vendor/tikv-jemalloc-sys/jemalloc" + ;; These are referenced by the cargo output + ;; so we unbundle them. + "vendor/curl-sys/curl" + "vendor/curl-sys-0.4.63+curl-8.1.2/curl" + "vendor/libffi-sys/libffi" + "vendor/libnghttp2-sys/nghttp2" + "vendor/libz-sys/src/zlib")) + ;; Use the packaged nghttp2 + (delete-file "vendor/libnghttp2-sys/build.rs") + (with-output-to-file "vendor/libnghttp2-sys/build.rs" + (lambda _ + (format #t "fn main() {~@ + println!(\"cargo:rustc-link-lib=nghttp2\");~@ + }~%"))) + ;; Remove vendored dynamically linked libraries. + ;; find . -not -type d -executable -exec file {} \+ | grep ELF + ;; Also remove the bundled (mostly Windows) libraries. + (for-each delete-file + (find-files "vendor" "\\.(a|dll|exe|lib)$")) + ;; Adjust vendored dependency to explicitly use rustix with libc backend. + (substitute* "vendor/tempfile/Cargo.toml" + (("features = \\[\"fs\"" all) + (string-append all ", \"use-libc\""))))))) (arguments (substitute-keyword-arguments (strip-keyword-arguments '(#:tests?) @@ -1054,7 +1088,7 @@ exec -a \"$0\" \"~a\" \"$@\"" (chmod (string-append bin "/rust-analyzer") #o755)))))))) (inputs (modify-inputs (package-inputs base-rust) - (prepend curl))) + (prepend curl libffi `(,nghttp2 "lib") zlib))) ;; Add test inputs. (native-inputs (cons* `("gdb" ,gdb/pinned) `("procps" ,procps) |