diff mbox

[6/7] gnu: Add cargo-bootstrap.

Message ID 20160928151538.11679-6-david@craven.ch
State New
Headers show

Commit Message

David Craven Sept. 28, 2016, 3:15 p.m. UTC
* gnu/packages/rust.scm (cargo-bootstrap): New variable.
---
 gnu/packages/rust.scm | 43 +++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 43 insertions(+)

Comments

Ludovic Courtès Oct. 4, 2016, 9:11 a.m. UTC | #1
David Craven <david@craven.ch> skribis:

> * gnu/packages/rust.scm (cargo-bootstrap): New variable.

Please add (supported-platforms '("x86_64-linux")).

> +    (synopsis "Cargo bootstrap")
> +    (description "This package prepares the cargo binary for bootstrapping

@command{cargo}

> +the cargo package and it's dependencies.  When rustc is build using the new
       ^                   ^                      ^            ^
the @code{cargo} package and its dependencies.  When @command{rustc} is built

What about being more explicit here:

  This package provides a pre-built binary of the Cargo build tool,
  which in turn is used to build the Rust compiler and the final Cargo
  package.

?

> +rustbuild build system it also requires cargo.  The gnu build system is going

requires Cargo.

> +to be deprecated.")

The last sentence is hard to understand in the context of the
description of this package.  Probably best to remove it or to write it
as a comment with a longer explanation.

Otherwise LGTM, thanks!

Ludo’.
diff mbox

Patch

diff --git a/gnu/packages/rust.scm b/gnu/packages/rust.scm
index 2726348..5b369fc 100644
--- a/gnu/packages/rust.scm
+++ b/gnu/packages/rust.scm
@@ -97,3 +97,46 @@ 
     (description "This package prepares the rustc binary for bootstrapping
 the rustc package.")
     (license license:asl2.0)))
+
+(define-public cargo-bootstrap
+  (package
+    (name "cargo-bootstrap")
+    (version "1.12.0")
+    (source rust-bootstrap-x86_64-1.12.0)
+    (build-system gnu-build-system)
+    (native-inputs
+     `(("patchelf" ,patchelf)))
+    (inputs
+     `(("gcc-lib" ,gcc "lib")
+       ("gcc-toolchain-6" ,gcc-toolchain-6)))
+    (arguments
+     `(#:tests? #f
+       #:strip-binaries? #f
+       #:phases
+       (modify-phases %standard-phases
+         (delete 'configure)
+         (delete 'build)
+         (replace 'install
+           (lambda* (#:key inputs outputs #:allow-other-keys)
+             (let ((out (assoc-ref outputs "out"))
+                   (platform ,(system->rust-platform (%current-system)))
+                   (ld-so (string-append (assoc-ref inputs "libc")
+                                         ,(glibc-dynamic-linker))))
+               (system* "bash" "install.sh"
+                        (string-append "--prefix=" out)
+                        "--components=cargo")
+               (zero? (system* "patchelf"
+                               "--set-interpreter" ld-so
+                               "--set-rpath"
+                               (string-append
+                                out "/lib:"
+                                (assoc-ref inputs "gcc-lib") "/lib:"
+                                (assoc-ref inputs "gcc-toolchain-6") "/lib")
+                      (string-append out "/bin/cargo")))))))))
+    (home-page "https://www.rust-lang.org")
+    (synopsis "Cargo bootstrap")
+    (description "This package prepares the cargo binary for bootstrapping
+the cargo package and it's dependencies.  When rustc is build using the new
+rustbuild build system it also requires cargo.  The gnu build system is going
+to be deprecated.")
+    (license license:asl2.0)))