[bug#42049,4/4] gnu: crates-io: Use propagated-phases.
diff mbox series

Message ID 20200625212643.26344-1-kuba@kadziolka.net
State New
Headers show
Series
  • build-system/cargo: Propagations across the crate closure.
Related show

Checks

Context Check Description
cbaines/comparison success View comparision
cbaines/git branch success View Git branch
cbaines/applying patch success View Laminar job

Commit Message

Jakub Kądziołka June 25, 2020, 9:26 p.m. UTC
* gnu/packages/crates-io.scm (rust-metadeps-1.1)[arguments]:
  Don't skip build, skip tests instead. Add rust-lazy-static-0.2 as
  development input.
  (rust-clang-sys-0.28)[arguments]: Propagate phase, give it a
  descriptive name.
  [inputs]: Move libclang...
  [propagated-inputs]: ...here.
  (rust-clang-sys-0.26)[arguments]: Use substitute-keyword-arguments
  to avoid duplicating the code of the phase.
  (rust-bindgen-0.52, rust-aom-sys-0.1): Don't duplicate inputs and
  phases of dependencies.
---
 gnu/packages/crates-io.scm | 74 ++++++++++++--------------------------
 1 file changed, 22 insertions(+), 52 deletions(-)

Patch
diff mbox series

diff --git a/gnu/packages/crates-io.scm b/gnu/packages/crates-io.scm
index 5a4b513f1a..8d57f4f8d0 100644
--- a/gnu/packages/crates-io.scm
+++ b/gnu/packages/crates-io.scm
@@ -535,24 +535,11 @@  text or blue underlined text, on ANSI terminals.")
           "0ix3djcf84kk53h6fac73n7jc614745n7kbmikxwi3s73b6vzgsr"))))
     (build-system cargo-build-system)
     (arguments
-     `(;#:skip-build? #t
-       #:cargo-inputs
+     `(#:cargo-inputs
        (("rust-bindgen" ,rust-bindgen-0.51)
-        ("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
-     `(("pkg-config" ,pkg-config)))
+        ("rust-metadeps" ,rust-metadeps-1.1))))
     (inputs
-     `(("libaom" ,libaom)
-       ("libclang" ,clang)
-       ("llvm" ,llvm)))
+     `(("libaom" ,libaom)))
     (home-page "https://github.com/rust-av/aom-rs")
     (synopsis "FFI bindings to aom")
     (description "This package provides FFI bindings to aom.")
@@ -1338,17 +1325,7 @@  that uses Serde for transforming structs into bytes and vice versa!")
        #:cargo-development-inputs
        (("rust-clap" ,rust-clap-2)
         ("rust-diff" ,rust-diff-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
-     `(("libclang" ,clang)))
+        ("rust-shlex" ,rust-shlex-0.1))))
     (home-page "https://rust-lang.github.io/rust-bindgen/")
     (synopsis
      "Automatically generates Rust FFI bindings to C and C++ libraries")
@@ -1391,8 +1368,7 @@  that uses Serde for transforming structs into bytes and vice versa!")
        #:cargo-development-inputs
        (("rust-clap" ,rust-clap-2)
         ("rust-diff" ,rust-diff-0.1)
-        ("rust-shlex" ,rust-shlex-0.1))))
-    (inputs `())))
+        ("rust-shlex" ,rust-shlex-0.1))))))
 
 (define-public rust-bindgen-0.50
   (package
@@ -2968,15 +2944,14 @@  for computer graphics.")
        (("rust-glob" ,rust-glob-0.3)
         ("rust-libc" ,rust-libc-0.2)
         ("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)))))
-    (inputs
+       #:propagated-phases
+       ((add-after 'unpack 'bindgen:set-libclang-path
+          (lambda* (#:key inputs #:allow-other-keys)
+            (let ((clang (assoc-ref inputs "libclang")))
+              (setenv "LIBCLANG_PATH"
+                      (string-append clang "/lib")))
+            #t)))))
+    (propagated-inputs
      `(("libclang" ,clang)))
     (home-page "https://github.com/KyleMayes/clang-sys")
     (synopsis "Rust bindings for libclang")
@@ -2998,18 +2973,11 @@  for computer graphics.")
          (base32
           "1r50dwy5hj5gq07dn0qf8222d07qv0970ymx0j8n9779yayc3w3f"))))
     (arguments
-     `(#:cargo-inputs
-       (("rust-glob" ,rust-glob-0.2)
-        ("rust-libc" ,rust-libc-0.2)
-        ("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)))))))
+      (substitute-keyword-arguments (package-arguments rust-clang-sys-0.28)
+        (#:cargo-inputs
+         `(("rust-glob" ,rust-glob-0.2)
+           ("rust-libc" ,rust-libc-0.2)
+           ("rust-libloading" ,rust-libloading-0.5)))))))
 
 (define-public rust-clang-sys-0.23
   (package
@@ -12712,11 +12680,13 @@  for Rust structs.")
           "1hjla9ypycqw1snd2qf87cckcc0d5z5qvxpcijn5yrrs3f825cbk"))))
     (build-system cargo-build-system)
     (arguments
-     `(#:skip-build? #t
+     `(#:tests? #f ;; Test files aren't shipped to crates.io
        #:cargo-inputs
        (("rust-error-chain" ,rust-error-chain-0.10)
         ("rust-toml" ,rust-toml-0.2)
-        ("rust-pkg-config" ,rust-pkg-config-0.3))))
+        ("rust-pkg-config" ,rust-pkg-config-0.3))
+       #:cargo-development-inputs
+       (("rust-lazy-static" ,rust-lazy-static-0.2))))
     (home-page "https://github.com/joshtriplett/metadeps")
     (synopsis "Run pkg-config from declarative dependencies in Cargo.toml")
     (description "Run pkg-config from declarative dependencies in Cargo.toml.")