[PATCH 0/2] Split off rust@1.19.0.

  • Done
  • quality assurance status badge
Details
2 participants
  • Danny Milosavljevic
  • Nils Gillmann
Owner
unassigned
Submitted by
Danny Milosavljevic
Severity
normal
D
D
Danny Milosavljevic wrote on 2 Apr 2018 19:17
(address . guix-patches@gnu.org)(name . Danny Milosavljevic)(address . dannym@scratchpost.org)
20180402171721.12331-1-dannym@scratchpost.org
Prepare for mrustc bootstrap.

Danny Milosavljevic (2):
gnu: Add rust@1.19.0.
gnu: Factorize rust-bootstrapped-package.

gnu/packages/rust.scm | 155 +++++++++++++++++++++++++++++---------------------
1 file changed, 90 insertions(+), 65 deletions(-)
D
D
Danny Milosavljevic wrote on 2 Apr 2018 19:24
[PATCH 1/2] gnu: Add rust@1.19.0.
(address . 31026@debbugs.gnu.org)(name . Danny Milosavljevic)(address . dannym@scratchpost.org)
20180402172409.13230-1-dannym@scratchpost.org
* gnu/packages/rust.scm (rust-1.23)[build-system, native-inputs, inputs,
native-search-paths, synopsis, description, home-page, license]: Move to...
(rust-1.19): ... here. New variable.
(rust-1.23)[arguments]<#:phases>[set-env, patch-tests, patch-cargo-checksums]:
Move to...
(rust-1.19): ... here.
(rust-1.19)[arguments]<#:phases>[configure, check, install]: Replace by no-op.
---
gnu/packages/rust.scm | 126 ++++++++++++++++++++++++++++----------------------
1 file changed, 72 insertions(+), 54 deletions(-)

Toggle diff (160 lines)
diff --git a/gnu/packages/rust.scm b/gnu/packages/rust.scm
index 70140579b..8ec748fa6 100644
--- a/gnu/packages/rust.scm
+++ b/gnu/packages/rust.scm
@@ -150,30 +150,12 @@ in turn be used to build the final Rust.")
(modules '((guix build utils)))
(snippet '(begin (delete-file-recursively "src/llvm") #t))))
-(define-public rust-1.23
+(define-public rust-1.19
(package
(name "rust")
- (version "1.23.0")
- (source (rust-source version "14fb8vhjzsxlbi6yrn1r6fl5dlbdd1m92dn5zj5gmzfwf4w9ar3l"))
- (build-system gnu-build-system)
- (native-inputs
- `(("bison" ,bison) ; For the tests
- ("cmake" ,cmake)
- ("flex" ,flex) ; For the tests
- ("gdb" ,gdb) ; For the tests
- ("git" ,git)
- ("procps" ,procps) ; For the tests
- ("python-2" ,python-2)
- ("rustc-bootstrap" ,rust-bootstrap)
- ("cargo-bootstrap" ,rust-bootstrap "cargo")
- ("pkg-config" ,pkg-config) ; For "cargo"
- ("which" ,which)))
- (inputs
- `(("jemalloc" ,jemalloc-4.5.0)
- ("llvm" ,llvm-3.9.1)
- ("openssl" ,openssl)
- ("libcurl" ,curl))) ; For "cargo"
- (outputs '("out" "doc" "cargo"))
+ (version "1.19.0")
+ (source (rust-source version "0l8c14qsf42rmkqy92ahij4vf356dbyspxcips1aswpvad81y8qm"))
+ (outputs '("out" "cargo"))
(arguments
`(#:imported-modules ,%cargo-build-system-modules ;for `generate-checksums'
#:phases
@@ -204,15 +186,6 @@ in turn be used to build the final Rust.")
;; <https://lists.gnu.org/archive/html/guix-devel/2017-06/msg00193.html>
(delete-file-recursively "src/test/run-make/linker-output-non-utf8")
#t)))
- (add-after 'patch-tests 'fix-mtime-bug
- (lambda* _
- (substitute* "src/build_helper/lib.rs"
- ;; Bug in Rust code.
- ;; Current implementation assume that if dst not exist then it's mtime
- ;; is 0, but in same time "src" have 0 mtime in guix build!
- (("let threshold = mtime\\(dst\\);")
- "if !dst.exists() {\nreturn false\n}\n let threshold = mtime(dst);"))
- #t))
(add-after 'patch-source-shebangs 'patch-cargo-checksums
(lambda* _
(substitute* "src/Cargo.lock"
@@ -230,20 +203,73 @@ in turn be used to build the final Rust.")
(find-files "src/vendor" ".cargo-checksum.json"))
#t))
(replace 'configure
- (lambda* (#:key inputs outputs #:allow-other-keys)
- (let* ((out (assoc-ref outputs "out"))
- (doc (assoc-ref outputs "doc"))
- (gcc (assoc-ref inputs "gcc"))
- (gdb (assoc-ref inputs "gdb"))
- (binutils (assoc-ref inputs "binutils"))
- (python (assoc-ref inputs "python-2"))
- (rustc (assoc-ref inputs "rustc-bootstrap"))
- (cargo (assoc-ref inputs "cargo-bootstrap"))
- (llvm (assoc-ref inputs "llvm"))
- (jemalloc (assoc-ref inputs "jemalloc")))
- (call-with-output-file "config.toml"
- (lambda (port)
- (display (string-append "
+ (const #t))
+ (replace 'check
+ (const #t))
+ (replace 'install
+ (const #t)))))
+ (build-system gnu-build-system)
+ (native-inputs
+ `(("bison" ,bison) ; For the tests
+ ("cmake" ,cmake)
+ ("flex" ,flex) ; For the tests
+ ("gdb" ,gdb) ; For the tests
+ ("git" ,git)
+ ("procps" ,procps) ; For the tests
+ ("python-2" ,python-2)
+ ("rustc-bootstrap" ,rust-bootstrap)
+ ("cargo-bootstrap" ,rust-bootstrap "cargo")
+ ("pkg-config" ,pkg-config) ; For "cargo"
+ ("which" ,which)))
+ (inputs
+ `(("jemalloc" ,jemalloc-4.5.0)
+ ("llvm" ,llvm-3.9.1)
+ ("openssl" ,openssl)
+ ("libcurl" ,curl))) ; For "cargo"
+ ;; rustc invokes gcc, so we need to set its search paths accordingly.
+ (native-search-paths (package-native-search-paths gcc))
+ (synopsis "Compiler for the Rust progamming language")
+ (description "Rust is a systems programming language that provides memory
+safety and thread safety guarantees.")
+ (home-page "https://www.rust-lang.org")
+ ;; Dual licensed.
+ (license (list license:asl2.0 license:expat))))
+
+(define-public rust-1.23
+ (package
+ (inherit rust-1.19)
+ (name "rust")
+ (version "1.23.0")
+ (source (rust-source version "14fb8vhjzsxlbi6yrn1r6fl5dlbdd1m92dn5zj5gmzfwf4w9ar3l"))
+ (outputs '("out" "doc" "cargo"))
+ (arguments
+ (substitute-keyword-arguments (package-arguments rust-1.19)
+ ((#:phases phases)
+ `(modify-phases ,phases
+ (add-after 'patch-tests 'fix-mtime-bug
+ (lambda* _
+ (substitute* "src/build_helper/lib.rs"
+ ;; Bug in Rust code.
+ ;; Current implementation assume that if dst not exist then it's mtime
+ ;; is 0, but in same time "src" have 0 mtime in guix build!
+ (("let threshold = mtime\\(dst\\);")
+ "if !dst.exists() {\nreturn false\n}\n let threshold = mtime(dst);"))
+ #t))
+ (replace 'configure
+ (lambda* (#:key inputs outputs #:allow-other-keys)
+ (let* ((out (assoc-ref outputs "out"))
+ (doc (assoc-ref outputs "doc"))
+ (gcc (assoc-ref inputs "gcc"))
+ (gdb (assoc-ref inputs "gdb"))
+ (binutils (assoc-ref inputs "binutils"))
+ (python (assoc-ref inputs "python-2"))
+ (rustc (assoc-ref inputs "rustc-bootstrap"))
+ (cargo (assoc-ref inputs "cargo-bootstrap"))
+ (llvm (assoc-ref inputs "llvm"))
+ (jemalloc (assoc-ref inputs "jemalloc")))
+ (call-with-output-file "config.toml"
+ (lambda (port)
+ (display (string-append "
[llvm]
[build]
cargo = \"" cargo "/bin/cargo" "\"
@@ -308,15 +334,7 @@ jemalloc = \"" jemalloc "/lib/libjemalloc_pic.a" "\"
(wrap-program (string-append out "/bin/rustc")
`("PATH" ":" prefix (,(string-append ld-wrapper "/bin")))
`("LIBRARY_PATH" ":" suffix (,(string-append libc "/lib"))))
- #t))))))
- ;; rustc invokes gcc, so we need to set its search paths accordingly.
- (native-search-paths (package-native-search-paths gcc))
- (synopsis "Compiler for the Rust progamming language")
- (description "Rust is a systems programming language that provides memory
-safety and thread safety guarantees.")
- (home-page "https://www.rust-lang.org")
- ;; Dual licensed.
- (license (list license:asl2.0 license:expat))))
+ #t)))))))))
(define-public rust
(let ((base-rust rust-1.23))
D
D
Danny Milosavljevic wrote on 2 Apr 2018 19:24
[PATCH 2/2] gnu: Factorize rust-bootstrapped-package.
(address . 31026@debbugs.gnu.org)(name . Danny Milosavljevic)(address . dannym@scratchpost.org)
20180402172409.13230-2-dannym@scratchpost.org
* gnu/packages/rust.scm (rust-bootstrapped-package): New procedure.
(rust): Use rust-bootstrapped-package.
---
gnu/packages/rust.scm | 29 ++++++++++++++++++-----------
1 file changed, 18 insertions(+), 11 deletions(-)

Toggle diff (48 lines)
diff --git a/gnu/packages/rust.scm b/gnu/packages/rust.scm
index 8ec748fa6..eaa8c4852 100644
--- a/gnu/packages/rust.scm
+++ b/gnu/packages/rust.scm
@@ -235,6 +235,18 @@ safety and thread safety guarantees.")
;; Dual licensed.
(license (list license:asl2.0 license:expat))))
+(define (rust-bootstrapped-package base-rust version checksum)
+ "Bootstrap rust VERSION with source checksum CHECKSUM using BASE-RUST."
+ (package
+ (inherit base-rust)
+ (version version)
+ (source
+ (rust-source version checksum))
+ (native-inputs
+ (alist-replace "cargo-bootstrap" (list base-rust "cargo")
+ (alist-replace "rustc-bootstrap" (list base-rust)
+ (package-native-inputs base-rust))))))
+
(define-public rust-1.23
(package
(inherit rust-1.19)
@@ -337,18 +349,13 @@ jemalloc = \"" jemalloc "/lib/libjemalloc_pic.a" "\"
#t)))))))))
(define-public rust
- (let ((base-rust rust-1.23))
+ (let ((base-rust
+ (rust-bootstrapped-package rust-1.23 "1.24.1"
+ "1vv10x2h9kq7fxh2v01damdq8pvlp5acyh1kzcda9sfjx12kv99y")))
(package
(inherit base-rust)
- (version "1.24.1")
- (source
- (rust-source version
- "1vv10x2h9kq7fxh2v01damdq8pvlp5acyh1kzcda9sfjx12kv99y"))
- (native-inputs
- (alist-replace "cargo-bootstrap" (list base-rust "cargo")
- (alist-replace "rustc-bootstrap" (list base-rust)
- (package-native-inputs base-rust))))
(arguments
(substitute-keyword-arguments (package-arguments base-rust)
- ((#:phases phases) `(modify-phases ,phases
- (delete 'fix-mtime-bug))))))))
+ ((#:phases phases)
+ `(modify-phases ,phases
+ (delete 'fix-mtime-bug))))))))
N
N
Nils Gillmann wrote on 2 Apr 2018 20:19
Re: [bug#31026] [PATCH 0/2] Split off rust@1.19.0.
(name . Danny Milosavljevic)(address . dannym@scratchpost.org)(address . 31026@debbugs.gnu.org)
20180402181921.qsmwady62buv5hkj@abyayala
Danny Milosavljevic transcribed 260 bytes:
Toggle quote (2 lines)
> Prepare for mrustc bootstrap.

Woo, good news. Did I miss an email or does this still require some review?
I can reserve some time for building this tonight and review tomorrow at some
point.

Toggle quote (10 lines)
> Danny Milosavljevic (2):
> gnu: Add rust@1.19.0.
> gnu: Factorize rust-bootstrapped-package.
>
> gnu/packages/rust.scm | 155 +++++++++++++++++++++++++++++---------------------
> 1 file changed, 90 insertions(+), 65 deletions(-)
>
>
>
>
D
D
Danny Milosavljevic wrote on 2 Apr 2018 21:20
(name . Nils Gillmann)(address . ng0@n0.is)(address . 31026@debbugs.gnu.org)
20180402212053.41f46ab5@scratchpost.org
On Mon, 2 Apr 2018 18:19:21 +0000
Nils Gillmann <ng0@n0.is> wrote:

Toggle quote (5 lines)
> Danny Milosavljevic transcribed 260 bytes:
> > Prepare for mrustc bootstrap.
>
> Woo, good news. Did I miss an email

I've been trying to use mrustc to bootstrap rust on and off for quite
some time now. The upstream authors have been busy too and it's far enough
that I have a working rust-1.19.0 compiler compiled by mrustc in /gnu/store :)

The libstd still had some rough edges - and one test takes about 30 h of
building - so it will still take some time until this is done.

I thought in the meantime I'd clean up and split up the patches.

These here are some of the patches that can be applied without switching to mrustc
yet (that is, they just refactor stuff).

Toggle quote (2 lines)
>or does this still require some review?

Right now, mrustc officially *supports* x86_64 targets only.

aarch64 is under review upstream (support is there but unfinished).

We will only be able to use mrustc to bootstrap if it supports more architectures.

We will see when that comes to pass.

mrustc is written in a way that it can compile rust@1.19.0 so that's why this
exact version is in this patchset. I hope in the future mrustc can compile
newer versions of Rust.

Toggle quote (3 lines)
> I can reserve some time for building this tonight and review tomorrow at some
> point.

Nice!

I've attached my current gnu/packages/rust.scm here - which includes some things
not ready to merge yet. But it should (famous last words) bootstrap rust 1.24
starting from mrustc in multiple steps.
Attachment: rust.scm
-----BEGIN PGP SIGNATURE-----

iQEzBAEBCAAdFiEEds7GsXJ0tGXALbPZ5xo1VCwwuqUFAlrCgpUACgkQ5xo1VCww
uqWo8wgAjcX3F/uquCShpKv0cybY0m1M4WnGJa0gOiN4wZOBWaAHpibLeXGlMLRE
Cb8br54OZP7VjdQXwORG5pl9mKTO8g93yFzkquWBYYU2fMKOeePOhJ17e490mY7W
Gjt0aT3gCV46cSeDLhZDhlZ1G93NVGN/mz2ETti9qWpb0QXLkvwAkTFygdMrO/Om
Y5ia0CQDuzuZpPjy7nZVPESIVsjDwGgCxRuzU8YaeOdQrURFL1onZ1x760sGse7B
9l3PAV54X22VNzg7xC1ibDdy05DRdHTjfZbXityHNASYoH2wpd0TViZdn6aOCzLY
r2niHt7UtBA3p/Ll5QPxYrm5UnHhSA==
=661N
-----END PGP SIGNATURE-----


N
N
Nils Gillmann wrote on 3 Apr 2018 13:10
(name . Danny Milosavljevic)(address . dannym@scratchpost.org)
20180403111033.pwyx23wdh4fdytgk@abyayala
Attachment: file
D
D
Danny Milosavljevic wrote on 15 Apr 2018 09:58
(no subject)
(address . control@debbugs.gnu.org)
20180415095837.64f66960@scratchpost.org
close 31026
close 31070
-----BEGIN PGP SIGNATURE-----

iQEzBAEBCAAdFiEEds7GsXJ0tGXALbPZ5xo1VCwwuqUFAlrTBi0ACgkQ5xo1VCww
uqUFIQf6Auv6j404VQzmvpLTMe/dxZzSmUoppixM1UmcwjVkL2xXFv5a5cBeQ4DC
26PiaflxJtLQ6yeyXFcjwwfsLW8g4NpKavJDzyLce04Mqnt0BSCLeAvmVpO/lqiV
p/sg6ZSQWR1K2MNbIiHgmcBadxtlGI46FQSuNp4DxFGFnhYdXZlklg9l3+6/ltpq
iMz9gQjsEVtidJRfI4O0GONLrdvhPKqKckC7jY4zZMoRwy5LdFJLtkH6ULo1JnKU
8fqJKytx3NrX0pSxb3DwKkq+f4qcY757kafrn/n7i4ioxhCDcWMOGm+Q6OLa8PQx
s4+GnGtBgk9JvR6ex/UDT8a+970+WQ==
=SuTz
-----END PGP SIGNATURE-----


?
Your comment

This issue is archived.

To comment on this conversation send an email to 31026@debbugs.gnu.org

To respond to this issue using the mumi CLI, first switch to it
mumi current 31026
Then, you may apply the latest patchset in this issue (with sign off)
mumi am -- -s
Or, compose a reply to this issue
mumi compose
Or, send patches to this issue
mumi send-email *.patch