From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33294) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1droOv-00023c-Fn for guix-patches@gnu.org; Tue, 12 Sep 2017 12:51:07 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1droOs-0007Hy-2f for guix-patches@gnu.org; Tue, 12 Sep 2017 12:51:05 -0400 Received: from debbugs.gnu.org ([208.118.235.43]:55753) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1droOr-0007Hp-Tc for guix-patches@gnu.org; Tue, 12 Sep 2017 12:51:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1droOr-0005Rz-MR for guix-patches@gnu.org; Tue, 12 Sep 2017 12:51:01 -0400 Subject: [bug#28433] [WIP] Rust update Resent-Message-ID: Received: from eggs.gnu.org ([2001:4830:134:3::10]:33016) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1droOQ-0001Xn-Ix for guix-patches@gnu.org; Tue, 12 Sep 2017 12:50:36 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1droON-00075c-7O for guix-patches@gnu.org; Tue, 12 Sep 2017 12:50:34 -0400 Received: from dd1012.kasserver.com ([85.13.128.8]:51140) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1droOM-00074p-TM for guix-patches@gnu.org; Tue, 12 Sep 2017 12:50:31 -0400 Received: from localhost (77.118.195.213.wireless.dyn.drei.com [77.118.195.213]) by dd1012.kasserver.com (Postfix) with ESMTPSA id 602641CA00D7 for ; Tue, 12 Sep 2017 18:50:27 +0200 (CEST) Date: Tue, 12 Sep 2017 18:50:23 +0200 From: Danny Milosavljevic Message-ID: <20170912185023.7de883ff@scratchpost.org> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+kyle=kyleam.com@gnu.org Sender: "Guix-patches" To: 28433@debbugs.gnu.org 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"))