diff mbox

[5/7] gnu: Add rustc-bootstrap.

Message ID 20160928151538.11679-5-david@craven.ch
State New
Headers show

Commit Message

David Craven Sept. 28, 2016, 3:15 p.m. UTC
* gnu/packages/rust.scm (rustc-bootstrap, rust-bootstrap-x86_64-1.12.0):
  New variables.
---
 gnu/packages/rust.scm | 99 +++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 99 insertions(+)
 create mode 100644 gnu/packages/rust.scm

Comments

David Craven Sept. 28, 2016, 3:20 p.m. UTC | #1
gcc-toolchain is a function. We could use gcc-toolchain-4.9 if you prefer?
David Craven Sept. 29, 2016, 12:35 p.m. UTC | #2
> gcc-toolchain is a function. We could use gcc-toolchain-4.9 if you prefer?

ah see what you mean now, ignore this comment.
Ludovic Courtès Oct. 4, 2016, 8:57 a.m. UTC | #3
David Craven <david@craven.ch> skribis:

> * gnu/packages/rust.scm (rustc-bootstrap, rust-bootstrap-x86_64-1.12.0):
>   New variables.

I believe this is a followup to my comments at
<https://lists.gnu.org/archive/html/guix-devel/2016-09/msg01993.html>,
right?

> +;;; Copyright © 2016 David Craven <david@craven.ch>

And Eric Le Bihan?  Or is this independent from Eric’s patch?

> +(define rust-bootstrap-x86_64-1.12.0

Add a comment saying that this is a pre-built binary.

> +  (origin
> +    (method url-fetch)
> +    (uri (string-append
> +          "https://static.rust-lang.org/dist/"
> +          "rust-beta-x86_64-unknown-linux-gnu.tar.gz"))

This URL is unversioned, so the contents might change over time no?

> +               ;; Rust requires a gcc toolchain for linking. It
> +               ;; looks for a compiler named cc in it's path. This
> +               ;; can probably be configured during the build.

s/This can…/Thus, add a ‘cc’ symlink next to it./

> +    (home-page "https://www.rust-lang.org")
> +    (synopsis "Rustc bootstrap")

“Rust bootstrapping compiler”?

> +    (description "This package prepares the rustc binary for bootstrapping
> +the rustc package.")

“This package provides a pre-built @command{rustc} compiler, which can
in turn be used to build the final Rust compiler.”

Thanks,
Ludo’.
Ludovic Courtès Oct. 4, 2016, 8:59 a.m. UTC | #4
David Craven <david@craven.ch> skribis:

> +(define-public rustc-bootstrap
> +  (package
> +    (name "rustc-bootstrap")
> +    (version "1.12.0")
> +    (source rust-bootstrap-x86_64-1.12.0)

Also, add (supported-platforms '("x86_64-linux")).

Ludo’.
ng0 Oct. 4, 2016, 9:11 a.m. UTC | #5
Ludovic Courtès <ludo@gnu.org> writes:

> David Craven <david@craven.ch> skribis:
>
>> * gnu/packages/rust.scm (rustc-bootstrap, rust-bootstrap-x86_64-1.12.0):
>>   New variables.
>
> I believe this is a followup to my comments at
> <https://lists.gnu.org/archive/html/guix-devel/2016-09/msg01993.html>,
> right?
>
>> +;;; Copyright © 2016 David Craven <david@craven.ch>
>
> And Eric Le Bihan?  Or is this independent from Eric’s patch?
>
>> +(define rust-bootstrap-x86_64-1.12.0
>
> Add a comment saying that this is a pre-built binary.
>
>> +  (origin
>> +    (method url-fetch)
>> +    (uri (string-append
>> +          "https://static.rust-lang.org/dist/"
>> +          "rust-beta-x86_64-unknown-linux-gnu.tar.gz"))
>
> This URL is unversioned, so the contents might change over time no?

I don't know what rust-beta-* is, but the rust package I created did not
use unversioned files. There are versioned files, but afaik not in
beta. For bootstrap I had this (though it could be that this is already
Jelle's work based on my work):

(define (archive-name version platform checksum)
  (string-append "rust-stage0-" version "-" platform "-" checksum ".tar.bz2"))

(define rust-stage0-bootstrap-x86_64-archive
  (archive-name "2016-02-17-4d3eebf" "linux-x86_64" "d29b7607d13d64078b6324aec82926fb493f59ba"))

(define rust-stage0-bootstrap-x86_64
  (origin
    (method url-fetch)
    (uri
     (string-append "https://static.rust-lang.org/stage0-snapshots/" rust-stage0-bootstrap-x86_64-archive))
    (sha256 
     (base32
      "0gk87rknijyirlhw3h34bjxzq98j0v0icp3l8flrxn5pgil8pswd"))))

(define rust-stage0-bootstrap-i386-archive
  (archive-name "2016-02-17-4d3eebf" "linux-i386" "5f194aa7628c0703f0fd48adc4ec7f3cc64b98c7"))

(define rust-stage0-bootstrap-i386
  (origin
    (method url-fetch)
    (uri
     (string-append "https://static.rust-lang.org/stage0-snapshots/" rust-stage0-bootstrap-i386-archive))
    (sha256
     (base32
      "16fd2hmli86g1q3fyicdhh2l4aqryzxcij7sk1pljig8dr2m8hg5"))))


>> +               ;; Rust requires a gcc toolchain for linking. It
>> +               ;; looks for a compiler named cc in it's path. This
>> +               ;; can probably be configured during the build.
>
> s/This can…/Thus, add a ‘cc’ symlink next to it./
>
>> +    (home-page "https://www.rust-lang.org")
>> +    (synopsis "Rustc bootstrap")
>
> “Rust bootstrapping compiler”?
>
>> +    (description "This package prepares the rustc binary for bootstrapping
>> +the rustc package.")
>
> “This package provides a pre-built @command{rustc} compiler, which can
> in turn be used to build the final Rust compiler.”
>
> Thanks,
> Ludo’.
>
>

--
Ludovic Courtès Oct. 4, 2016, 1:09 p.m. UTC | #6
ng0 <ngillmann@runbox.com> skribis:

> I don't know what rust-beta-* is, but the rust package I created did not
> use unversioned files.

Cool!  (Did you submit your own Rust package?)

> There are versioned files, but afaik not in beta. For bootstrap I had
> this (though it could be that this is already Jelle's work based on my
> work):
>
> (define (archive-name version platform checksum)
>   (string-append "rust-stage0-" version "-" platform "-" checksum ".tar.bz2"))
>
> (define rust-stage0-bootstrap-x86_64-archive
>   (archive-name "2016-02-17-4d3eebf" "linux-x86_64" "d29b7607d13d64078b6324aec82926fb493f59ba"))
>
> (define rust-stage0-bootstrap-x86_64
>   (origin
>     (method url-fetch)
>     (uri
>      (string-append "https://static.rust-lang.org/stage0-snapshots/" rust-stage0-bootstrap-x86_64-archive))
>     (sha256 
>      (base32
>       "0gk87rknijyirlhw3h34bjxzq98j0v0icp3l8flrxn5pgil8pswd"))))
>
> (define rust-stage0-bootstrap-i386-archive
>   (archive-name "2016-02-17-4d3eebf" "linux-i386" "5f194aa7628c0703f0fd48adc4ec7f3cc64b98c7"))
>
> (define rust-stage0-bootstrap-i386
>   (origin
>     (method url-fetch)
>     (uri
>      (string-append "https://static.rust-lang.org/stage0-snapshots/" rust-stage0-bootstrap-i386-archive))
>     (sha256
>      (base32
>       "16fd2hmli86g1q3fyicdhh2l4aqryzxcij7sk1pljig8dr2m8hg5"))))

That looks good.

I was also going to suggest adding support for i386, which could have
happened later, but I’m glad you’re providing guidance here!

Ludo’.
ng0 Oct. 4, 2016, 1:55 p.m. UTC | #7
Ludovic Courtès <ludo@gnu.org> writes:

> ng0 <ngillmann@runbox.com> skribis:
>
>> I don't know what rust-beta-* is, but the rust package I created did not
>> use unversioned files.
>
> Cool!  (Did you submit your own Rust package?)

Yes, search the guix-devel archives for the first rust patches in
beginning of 2016, I went as far as I could at that point and that's how
probably everyone else started off based on that work.

>> There are versioned files, but afaik not in beta. For bootstrap I had
>> this (though it could be that this is already Jelle's work based on my
>> work):
>>
>> (define (archive-name version platform checksum)
>>   (string-append "rust-stage0-" version "-" platform "-" checksum ".tar.bz2"))
>>
>> (define rust-stage0-bootstrap-x86_64-archive
>>   (archive-name "2016-02-17-4d3eebf" "linux-x86_64" "d29b7607d13d64078b6324aec82926fb493f59ba"))
>>
>> (define rust-stage0-bootstrap-x86_64
>>   (origin
>>     (method url-fetch)
>>     (uri
>>      (string-append "https://static.rust-lang.org/stage0-snapshots/" rust-stage0-bootstrap-x86_64-archive))
>>     (sha256 
>>      (base32
>>       "0gk87rknijyirlhw3h34bjxzq98j0v0icp3l8flrxn5pgil8pswd"))))
>>
>> (define rust-stage0-bootstrap-i386-archive
>>   (archive-name "2016-02-17-4d3eebf" "linux-i386" "5f194aa7628c0703f0fd48adc4ec7f3cc64b98c7"))
>>
>> (define rust-stage0-bootstrap-i386
>>   (origin
>>     (method url-fetch)
>>     (uri
>>      (string-append "https://static.rust-lang.org/stage0-snapshots/" rust-stage0-bootstrap-i386-archive))
>>     (sha256
>>      (base32
>>       "16fd2hmli86g1q3fyicdhh2l4aqryzxcij7sk1pljig8dr2m8hg5"))))
>
> That looks good.
>
> I was also going to suggest adding support for i386, which could have
> happened later, but I’m glad you’re providing guidance here!
>
> Ludo’.
>

Do you want me to submit the entire file for context? It's just what
jelle ended up with, I no longer have this online in public searchable
format.
Okay turns out my old repo (moving to gnunet.org slowly) is still
existing and public accessible.
https://gitlab.com/secushare/guixpkgs/blob/master/n0is/packages/rust.scm
David Craven Oct. 4, 2016, 1:59 p.m. UTC | #8
I think Eric said he created the rustc package independently of
yours... Just saying...
ng0 Oct. 4, 2016, 2:11 p.m. UTC | #9
David Craven <david@craven.ch> writes:

> I think Eric said he created the rustc package independently of
> yours... Just saying...
>

Sorry. My attempt to be short in communication leads to generalization.
Well it would be good if we had an overview of who's working on what so
that work on same packages can be avoided or aided for those who finish
and leave them for others to pick up. I really don't feel like reading
every single email of those circa 1000 / month to figure out details of
packages when I don't need them.
A bad temporary option while we lack something web based could be a
simple .org file in the repository.

I was working on opencolorio and only announced this on irc very
briefly, some days ago I gave my work to Leo as I happened to see that
Leo was working on it as well.

That being said, I do not try to claim anything here, I'm just proving
this as additional input so that we can fix up rust.
--
diff mbox

Patch

diff --git a/gnu/packages/rust.scm b/gnu/packages/rust.scm
new file mode 100644
index 0000000..2726348
--- /dev/null
+++ b/gnu/packages/rust.scm
@@ -0,0 +1,99 @@ 
+;;; GNU Guix --- Functional package management for GNU
+;;; Copyright © 2016 David Craven <david@craven.ch>
+;;;
+;;; This file is part of GNU Guix.
+;;;
+;;; GNU Guix is free software; you can redistribute it and/or modify it
+;;; under the terms of the GNU General Public License as published by
+;;; the Free Software Foundation; either version 3 of the License, or (at
+;;; your option) any later version.
+;;;
+;;; GNU Guix is distributed in the hope that it will be useful, but
+;;; WITHOUT ANY WARRANTY; without even the implied warranty of
+;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;;; GNU General Public License for more details.
+;;;
+;;; You should have received a copy of the GNU General Public License
+;;; along with GNU Guix.  If not, see <http://www.gnu.org/licenses/>.
+
+(define-module (gnu packages rust)
+  #: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 gnu)
+  #:use-module (guix download)
+  #:use-module (guix packages)
+  #:use-module ((guix licenses) #:prefix license:))
+
+(define rust-bootstrap-x86_64-1.12.0
+  (origin
+    (method url-fetch)
+    (uri (string-append
+          "https://static.rust-lang.org/dist/"
+          "rust-beta-x86_64-unknown-linux-gnu.tar.gz"))
+    (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")))
+               ;; Rust requires a gcc toolchain for linking. It
+               ;; looks for a compiler named cc in it's path. This
+               ;; can probably be configured during the build.
+               (symlink (string-append toolchain "/bin/gcc")
+                        (string-append out "/bin/cc"))))))))
+    (home-page "https://www.rust-lang.org")
+    (synopsis "Rustc bootstrap")
+    (description "This package prepares the rustc binary for bootstrapping
+the rustc package.")
+    (license license:asl2.0)))