diff mbox

[11/12] gnu: Add cargo-bootstrap.

Message ID 20160922131903.1606-11-david@craven.ch
State New
Headers show

Commit Message

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

Comments

Ludovic Courtès Sept. 26, 2016, 10:28 a.m. UTC | #1
David Craven <david@craven.ch> skribis:

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

So I gather that Cargo cannot be built at all with a build tool other
than Cargo, right?

> +(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)))

s/-6//

> +    (description "Cargo bootstrap.")

Please expound.  :-)

Otherwise LGTM, thanks!

Ludo’.
diff mbox

Patch

diff --git a/gnu/packages/rust.scm b/gnu/packages/rust.scm
index 4030d18..33c1d5c 100644
--- a/gnu/packages/rust.scm
+++ b/gnu/packages/rust.scm
@@ -93,3 +93,43 @@ 
     (synopsis "Rustc bootstrap")
     (description "Rustc bootstrap.")
     (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 "Cargo bootstrap.")
+    (license license:asl2.0)))