unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
* [bug#28433] [WIP] Rust update
@ 2017-09-12 16:50 Danny Milosavljevic
  2017-10-25 14:19 ` Ricardo Wurmus
  2017-10-30 19:18 ` [bug#28433] [WIP] v2 " Danny Milosavljevic
  0 siblings, 2 replies; 16+ messages in thread
From: Danny Milosavljevic @ 2017-09-12 16:50 UTC (permalink / raw)
  To: 28433

I'm trying to update our Rust.  I've got it to work further than the text "package bootstrap" once, but I can't find how I did it anymore.  See below.

Help?

diff --git a/gnu/packages/rust.scm b/gnu/packages/rust.scm
index 652686e06..a0d4554d6 100644
--- a/gnu/packages/rust.scm
+++ b/gnu/packages/rust.scm
@@ -25,6 +25,7 @@
   #:use-module (gnu packages bootstrap)
   #:use-module (gnu packages cmake)
   #:use-module (gnu packages compression)
+  #:use-module (gnu packages cross-base)
   #:use-module (gnu packages curl)
   #:use-module (gnu packages elf)
   #:use-module (gnu packages flex)
@@ -47,7 +48,7 @@
   #:use-module (srfi srfi-26))
 
 ;; Should be one less than the current released version.
-(define %rust-bootstrap-binaries-version "1.15.0")
+(define %rust-bootstrap-binaries-version "1.17.0")
 
 (define %rust-bootstrap-binaries
   (origin
@@ -58,7 +59,7 @@
           "-i686-unknown-linux-gnu.tar.gz"))
     (sha256
      (base32
-      "0wmkfx8pxmkkw021mrq9s3xhra8f0daqdl6j56pxyn4w39i0rzrw"))))
+      "1svbg96gjkfk40hgyhgkm5mqxlx24943xf1423p3gfhqyvh6rl9r"))))
 
 (define (increment-rust-version rust-version major patch)
   (match (string-split rust-version #\.)
@@ -208,7 +209,7 @@ rustc-bootstrap and cargo-bootstrap packages.")
                     "rustc-" version "-src.tar.gz"))
               (sha256
                (base32
-                "1d78jq7mc34n265by68amr9r4nzbiqrilfbwh7gx56ydn4gb6rpr"))
+                "04b1qd4zy9x0hax0rxzd0gg6nki37kjdvk9bid46j8lykglkdp6j"))
             (modules '((guix build utils)))
             (snippet
              `(begin
@@ -222,16 +223,26 @@ rustc-bootstrap and cargo-bootstrap packages.")
        ("git" ,git)
        ("procps" ,procps) ; For the tests
        ("python-2" ,python-2)
+       ("cargo-bootstrap" ,cargo-bootstrap)
        ("rust-bootstrap" ,rust-bootstrap)
-       ("which" ,which)))
+       ("which" ,which)
+       ("strace" ,strace)
+       ("cross-gcc" ,(cross-gcc "i686-linux-gnu"
+                      #:xbinutils (cross-binutils "i686-linux-gnu")
+                      #:libc (cross-libc "i686-linux-gnu")))
+       ("cross-libc" ,(cross-libc "i686-linux-gnu"))))
     (inputs
      `(("jemalloc" ,jemalloc)
        ("llvm" ,llvm-3.9.1)))
     (arguments
      `(#:phases
        (modify-phases %standard-phases
+         ;; Avoid cargo complaining about mismatched checksums.
+         (delete 'patch-source-shebangs)
+         (delete 'patch-generated-file-shebangs)
+         (delete 'patch-usr-bin-file)
          (add-after 'unpack 'patch-configure
-           (lambda _
+           (lambda* (#:key inputs #:allow-other-keys)
              (substitute* "configure"
                (("/usr/bin/env") (which "env")) ; Detect target CPU correctly.
                (("probe_need CFG_CURL curl") "") ; Avoid curl build dependency.
@@ -247,14 +258,46 @@ rustc-bootstrap and cargo-bootstrap packages.")
              (substitute* "src/tools/compiletest/src/util.rs"
                (("(\"amd64\", \"x86_64\"),") "(\"amd64\", \"x86_64\"),
 (\"nvptx\", \"nvptx\"),")) ; Make LLVM >= 3.8.1 work.
-             (substitute* "mk/main.mk"
-               (("LLVM_OPTIONAL_COMPONENTS=")
-                "LLVM_OPTIONAL_COMPONENTS=nvptx ")) ; Make LLVM >= 3.8.1 work.
+             ;(system* "mv" "src/bootstrap/config.toml.example"
+             ;              "src/bootstrap/config.toml")
+             (mkdir-p "src/bootstrap/.cargo")
+             (call-with-output-file "src/bootstrap/.cargo/config"
+                 (lambda (p)
+                   (format p "
+[source.crates-io]
+registry = 'https://github.com/rust-lang/crates.io-index'
+replace-with = 'vendored-sources'
+
+[source.vendored-sources]
+directory = 'src/vendor'
+
+[target.i686-linux-gnu]
+linker = \"~a/bin/i686-linux-gnu-gcc\"
+
+" (assoc-ref inputs "cross-gcc"))))
+
              #t))
          (add-after 'unpack 'set-env
            (lambda _
+             (define (cross? x)
+               (string-contains x "cross-"))
              (setenv "SHELL" (which "sh"))
              (setenv "CONFIG_SHELL" (which "sh"))
+             (setenv "VERBOSE" "1")
+             (setenv "CROSS_C_INCLUDE_PATH" (getenv "C_INCLUDE_PATH"))
+             (setenv "CROSS_CPLUS_INCLUDE_PATH" (getenv "CPLUS_INCLUDE_PATH"))
+             (setenv "CROSS_LIBRARY_PATH" (getenv "LIBRARY_PATH"))
+             (for-each
+              (lambda (env-name)
+                (let* ((env-value (getenv env-name))
+                       (search-path (search-path-as-string->list env-value))
+                       (new-search-path (filter (lambda (e) (not (cross? e)))
+                                                search-path))
+                       (new-env-value (list->search-path-as-string
+                                       new-search-path ":")))
+                  (setenv env-name new-env-value)))
+              '("C_INCLUDE_PATH" "CPLUS_INCLUDE_PATH" "LIBRARY_PATH"))
+
              #t))
          (add-after 'unpack 'patch-tests
            (lambda* (#:key inputs #:allow-other-keys)
@@ -284,6 +327,7 @@ fn test_process_mask"))
                     (rustc (assoc-ref inputs "rustc-bootstrap"))
                     (llvm (assoc-ref inputs "llvm"))
                     (jemalloc (assoc-ref inputs "jemalloc"))
+                    ;; TODO make bootstrapper use i686 libraries! (-lutil, -ldl, ...).
                     (flags (list
                             (string-append "--prefix=" out)
                             (string-append "--datadir=" out "/share")
@@ -291,16 +335,43 @@ fn test_process_mask"))
                             (string-append "--default-linker=" gcc "/bin/gcc")
                             (string-append "--default-ar=" binutils "/bin/ar")
                             (string-append "--python=" python "/bin/python2")
+                            ; FIXME /gnu/store/6rri0kxb9q1gz6lv1dgdwjh41aa9ijdl-rustc-bootstrap-1.17.0/bin/cargo is wrong.
                             (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"
-                            "--disable-rustbuild" ; rustbuild doesn't work yet.
                             "--disable-manage-submodules")))
+               (mkdir "Xcargo")
+               (call-with-output-file "Xcargo/config"
+                 (lambda (p)
+                   (format p "
+[source.crates-io]
+registry = 'https://github.com/rust-lang/crates.io-index'
+replace-with = 'vendored-sources'
+
+[source.vendored-sources]
+directory = 'src/vendor'
+
+[target.i686-linux-gnu]
+linker = \"~a/bin/i686-linux-gnu-gcc\"
+
+" (assoc-ref inputs "cross-gcc"))))
+               (setenv "CARGO_HOME" (string-append (getcwd) "/Xcargo"))
+               (substitute* "src/bootstrap/bootstrap.py"
+                 (("/etc/NIXOS")
+                  (getcwd))
+                 (("config [+] '/bin/cargo'")
+                  (string-append "'" (assoc-ref inputs "cargo-bootstrap")
+                                 "/bin/cargo'"))
+                 (("cargo[(][)], \"build\"") "cargo(), \"build\", \"--verbose\""))
                ;; Rust uses a custom configure script (no autoconf).
-               (zero? (apply system* "./configure" flags)))))
+               (let ((status (zero? (apply system* (which "sh") "./configure" flags))))
+                (substitute* "Makefile"
+                 (("[$][(]Q[)][$][(]BOOTSTRAP[)] build [$][(]BOOTSTRAP_ARGS[)]")
+                  "$(Q)$(BOOTSTRAP) build $(BOOTSTRAP_ARGS)"))
+                status))))
          (add-after 'install 'wrap-rustc
            (lambda* (#:key inputs outputs #:allow-other-keys)
              (let ((out (assoc-ref outputs "out"))

^ permalink raw reply related	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2017-11-29  8:05 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-09-12 16:50 [bug#28433] [WIP] Rust update Danny Milosavljevic
2017-10-25 14:19 ` Ricardo Wurmus
2017-10-26  8:17   ` Danny Milosavljevic
2017-10-28 10:42     ` Danny Milosavljevic
2017-10-28 11:31       ` Danny Milosavljevic
2017-10-28 11:57         ` Danny Milosavljevic
2017-10-28 18:26           ` Ludovic Courtès
2017-10-30 11:35             ` Danny Milosavljevic
2017-10-30 15:38               ` Ludovic Courtès
2017-10-30 16:14                 ` Danny Milosavljevic
2017-11-28  6:35                   ` ng0
2017-11-28 10:12                     ` Danny Milosavljevic
2017-11-29  8:04                     ` Danny Milosavljevic
2017-10-28 15:36     ` ng0
2017-10-28 18:32       ` Ludovic Courtès
2017-10-30 19:18 ` [bug#28433] [WIP] v2 " Danny Milosavljevic

Code repositories for project(s) associated with this public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).