guix-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


From: David Craven
Subject: [PATCH 10/12] gnu: Add rustc-bootstrap.
Date: Thu, 22 Sep 2016 15:19:01 +0200

* 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 <http://www.gnu.org/licenses/>.
 
 (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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]