all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: David Craven <david@craven.ch>
To: guix-devel@gnu.org
Subject: [PATCH 08/12] gnu: Add rustc.
Date: Sun, 11 Dec 2016 18:25:33 +0100	[thread overview]
Message-ID: <20161211172537.23315-9-david@craven.ch> (raw)
In-Reply-To: <20161211172537.23315-1-david@craven.ch>

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

Co-authored-by: Eric Le Bihan <eric.le.bihan.dev@free.fr>
---
 gnu/packages/rust.scm | 81 +++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 81 insertions(+)

diff --git a/gnu/packages/rust.scm b/gnu/packages/rust.scm
index 34f87c689..8bbb5d116 100644
--- a/gnu/packages/rust.scm
+++ b/gnu/packages/rust.scm
@@ -23,6 +23,10 @@
   #:use-module (gnu packages compression)
   #:use-module (gnu packages elf)
   #:use-module (gnu packages gcc)
+  #:use-module (gnu packages jemalloc)
+  #:use-module (gnu packages llvm)
+  #:use-module (gnu packages python)
+  #:use-module (gnu packages version-control)
   #:use-module (guix build-system gnu)
   #:use-module (guix build-system trivial)
   #:use-module (guix download)
@@ -188,3 +192,80 @@ to be deprecated.")
     (synopsis "Rust bootstrap")
     (description "Meta package for rustc and cargo bootstrap packages.")
     (license license:asl2.0)))
+
+(define-public rustc
+  (package
+    (name "rustc")
+    (version (rustc-version %rust-bootstrap-binaries-version))
+    (source (origin
+              (method url-fetch)
+              (uri (string-append
+                    "https://static.rust-lang.org/dist/"
+                    "rustc-" version "-src.tar.gz"))
+              (sha256
+               (base32
+                "112h7qgbn8c7s5880vplpgy5n58sc8css32dq7z5wylpr9slgf7c"))))
+    (build-system gnu-build-system)
+    (native-inputs
+     `(("cmake" ,cmake)
+       ("git" ,git)
+       ("python-2" ,python-2)
+       ("rustc-bootstrap" ,rustc-bootstrap)
+       ("which" ,which)))
+    (inputs
+     `(("jemalloc" ,jemalloc)
+       ("llvm" ,llvm)))
+    (arguments
+     ;; FIXME: Test failure with llvm 3.8; Update llvm.
+     ;; https://github.com/rust-lang/rust/issues/36835
+     `(#:tests? #f
+       #:phases
+       (modify-phases %standard-phases
+         (add-after 'unpack 'patch-configure
+           (lambda _
+             ;; Detect target CPU correctly.
+             (substitute* "configure"
+               (("/usr/bin/env") (which "env")))
+             ;; Avoid curl as a build dependency.
+             (substitute* "configure"
+               (("probe_need CFG_CURL curl") ""))))
+         (add-after 'unpack 'set-env
+           (lambda _
+             (setenv "RUSTC_BOOTSTRAP" "1")
+             (setenv "VERBOSE" "1")
+             (setenv "SHELL" (which "sh"))
+             (setenv "CONFIG_SHELL" (which "sh"))))
+         (add-after 'unpack 'patch-lockfile-test
+           (lambda _
+             (substitute* "src/tools/tidy/src/main.rs"
+               (("^.*cargo.*::check.*$") ""))))
+         (replace 'configure
+           (lambda* (#:key inputs outputs #:allow-other-keys)
+             (let* ((out (assoc-ref outputs "out"))
+                    (gcc (assoc-ref inputs "gcc"))
+                    (python (assoc-ref inputs "python-2"))
+                    (rustc (assoc-ref inputs "rustc-bootstrap"))
+                    (llvm (assoc-ref inputs "llvm"))
+                    (jemalloc (assoc-ref inputs "jemalloc"))
+                    (flags (list
+                            (string-append "--prefix=" out)
+                            (string-append "--datadir=" out "/share")
+                            (string-append "--infodir=" out "/share/info")
+                            (string-append "--default-linker=" gcc "/bin/gcc")
+                            (string-append "--default-ar=" gcc "/bin/ar")
+                            (string-append "--python=" python "/bin/python2")
+                            (string-append "--local-rust-root=" rustc)
+                            (string-append "--llvm-root=" llvm)
+                            (string-append "--jemalloc-root=" jemalloc "/lib")
+                            "--release-channel=stable"
+                            "--enable-rpath"
+                            "--enable-local-rust"
+                            ;;"--enable-rustbuild"
+                            "--disable-manage-submodules")))
+               ;; Rust uses a custom configure script (no autoconf).
+               (zero? (apply system* "./configure" flags))))))))
+    (synopsis "Compiler for the Rust progamming language")
+    (description "Rust is a systems programming language that runs blazingly
+fast, prevents segfaults, and guarantees thread safety.")
+    (home-page "https://www.rust-lang.org")
+    (license (list license:asl2.0 license:expat))))
-- 
2.11.0

  parent reply	other threads:[~2016-12-11 17:26 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-12-11 17:25 [PATCH 00/12] Rust build system v2 David Craven
2016-12-11 17:25 ` [PATCH 01/12] upstream: Use a the first url from urls when find2 returns #f David Craven
2016-12-13 17:25   ` Ludovic Courtès
2016-12-13 20:07     ` David Craven
2016-12-13 22:22       ` Ludovic Courtès
2016-12-11 17:25 ` [PATCH 02/12] build-system: Add cargo build system David Craven
2016-12-13 17:26   ` Ludovic Courtès
2016-12-30 11:08   ` Danny Milosavljevic
2017-01-01 14:42     ` David Craven
2016-12-11 17:25 ` [PATCH 03/12] import: utils: Add some utilities David Craven
2016-12-13 17:29   ` Ludovic Courtès
2016-12-13 18:09     ` David Craven
2016-12-11 17:25 ` [PATCH 04/12] import: Add importer for rust crates David Craven
2016-12-13 17:30   ` Ludovic Courtès
2016-12-11 17:25 ` [PATCH 05/12] import: Add updater " David Craven
2016-12-13 17:30   ` Ludovic Courtès
2016-12-11 17:25 ` [PATCH 06/12] gnu: llvm: Enable install utils David Craven
2016-12-13 22:50   ` Ludovic Courtès
2016-12-11 17:25 ` [PATCH 07/12] gnu: Add rust bootstrap binaries David Craven
2016-12-13 22:44   ` Ludovic Courtès
2016-12-11 17:25 ` David Craven [this message]
2016-12-13 22:47   ` [PATCH 08/12] gnu: Add rustc Ludovic Courtès
2016-12-11 17:25 ` [PATCH 09/12] gnu: Add rust-libc David Craven
2016-12-13 22:48   ` Ludovic Courtès
2016-12-11 17:25 ` [PATCH 10/12] RECURSIVE IMPORTER wip David Craven
2016-12-13 22:49   ` Ludovic Courtès
2016-12-11 17:25 ` [PATCH 11/12] gnu: Add rust-rand David Craven
2016-12-13 22:50   ` Ludovic Courtès
2017-01-03  0:52   ` Danny Milosavljevic
2016-12-11 17:25 ` [PATCH 12/12] gnu: Add cargo David Craven
2016-12-13 22:51   ` Ludovic Courtès

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20161211172537.23315-9-david@craven.ch \
    --to=david@craven.ch \
    --cc=guix-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.