Re: [PATCH 10/12] gnu: Add rustc-bootstrap.

2016-09-26 Thread Ludovic Courtès
David Craven  skribis:

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

[...]

> +(define-public rustc-bootstrap
> +  (package
> +(name "rustc-bootstrap")
> +(version "1.12.0")
> +(source rust-bootstrap-x86_64-1.12.0)

Could you add a comment above that summarizes the bootstrapping story
that Eric Le Bihan and others discussed about here, and/or give a link
to that discussion?

> +(inputs
> + `(("gcc-lib" ,gcc "lib")
> +   ("gcc-toolchain-6" ,gcc-toolchain-6)

I think we can omit “-6” and use the current default.  However could you
add a comment as to why we depend on gcc-toolchain and provide that “cc”
symlink?  I’m sure Eric L.B. explained it before, but I forgot.

> +   (platform ,(system->rust-platform (%current-system)))

I don’t see ‘system->rust-platform’ defined here.  I think it’d be best
in the importer or in the build system.

> +(description "Rustc bootstrap.")

Could you expound a bit?

Thanks for picking it up!

Ludo’.



[PATCH 10/12] gnu: Add rustc-bootstrap.

2016-09-22 Thread David Craven
* gnu/packages/rust.scm (rustc-bootstrap): New variable.
---
 gnu/packages/rust.scm | 67 ++-
 1 file changed, 66 insertions(+), 1 deletion(-)

diff --git a/gnu/packages/rust.scm b/gnu/packages/rust.scm
index 1831aa7..4030d18 100644
--- a/gnu/packages/rust.scm
+++ b/gnu/packages/rust.scm
@@ -17,7 +17,16 @@
 ;;; along with GNU Guix.  If not, see .
 
 (define-module (gnu packages rust)
-  #:use-module (guix download))
+  #:use-module (gnu packages base)
+  #:use-module (gnu packages bootstrap)
+  #:use-module (gnu packages commencement)
+  #:use-module (gnu packages compression)
+  #:use-module (gnu packages elf)
+  #:use-module (gnu packages gcc)
+  #:use-module (guix build-system trivial)
+  #:use-module (guix download)
+  #:use-module (guix packages)
+  #:use-module ((guix licenses) #:prefix license:))
 
 (define rust-bootstrap-x86_64-1.12.0
   (origin
@@ -28,3 +37,59 @@
 (sha256
  (base32
   "1is1k93zarvxx0h7b57ga8vr9gj34b36l9la6zkph41x33gfgpvl"
+
+(define-public rustc-bootstrap
+  (package
+(name "rustc-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)
+   ("zlib" ,zlib)))
+(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"))
+   (gcc-lib (assoc-ref inputs "gcc-lib"))
+   (toolchain (assoc-ref inputs "gcc-toolchain-6"))
+   (zlib (assoc-ref inputs "zlib"))
+   (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)
+(string-append "--components=rustc,"
+   "rust-std-" platform))
+   (for-each
+(lambda (file)
+  (system* "patchelf"
+   "--set-rpath"
+   (string-append out "/lib:" zlib "/lib:"
+  gcc-lib "/lib:" toolchain "/lib")
+   file))
+(cons* (string-append out "/bin/rustc")
+   (string-append out "/bin/rustdoc")
+   (find-files out "\\.so$")))
+   (for-each
+(lambda (file)
+  (system* "patchelf"
+   "--set-interpreter" ld-so
+   file))
+(list (string-append out "/bin/rustc")
+  (string-append out "/bin/rustdoc")))
+   (symlink (string-append toolchain "/bin/gcc")
+(string-append out "/bin/cc"
+(home-page "https://www.rust-lang.org;)
+(synopsis "Rustc bootstrap")
+(description "Rustc bootstrap.")
+(license license:asl2.0)))
-- 
2.9.0