diff mbox series

[bug#38063,2/2] bootstrap: Add m2-planet-boot0.

Message ID 20191104224243.19953-2-janneke@gnu.org
State Accepted
Headers show
Series gnu: Add m2-planet-boot0. | expand

Commit Message

Janneke Nieuwenhuizen Nov. 4, 2019, 10:42 p.m. UTC
* gnu/packages/commencement.scm (m2-planet-boot0): New variable.
---
 gnu/packages/commencement.scm | 103 +++++++++++++++++++++++++++++++++-
 1 file changed, 102 insertions(+), 1 deletion(-)

Comments

Ludovic Courtès Nov. 13, 2019, 10:26 p.m. UTC | #1
Hi,

Jan Nieuwenhuizen <janneke@gnu.org> skribis:

> * gnu/packages/commencement.scm (m2-planet-boot0): New variable.

Since this is currently unused, should we postpone and review it as part
of a bigger change that will actually use it?  What do you prefer?

> +(define-public m2-planet-boot0
> +  ;; The soon-to-be initial bootstrap package: no binary inputs except for a
> +  ;; ~500 byte binary seed: `x86/hex0-seed'.
> +  (let* ((version "1.4.0")
> +         (revision "0")
> +         (commit "1fc2aeab483208bd2ba117b21df3894c182470ec")
> +         (seed-version "Release_1.1")
> +         (mescc-tools-version "Release_0.6.1")
> +         (mes-m2-commit "f025a24b19e8447fb96ba1746bdad494ae63a514")
> +         (mes-m2-version (string-append "0.19-" (string-take mes-m2-commit 7))))

This is a bit intimidating.  ;-)  It would be great if we could refer to
releases only, and perhaps we don’t need to have all these in this
‘define’?

> +                (method url-fetch)
> +                (uri (string-append
> +                      "https://github.com/oriansj/m2-planet"
> +                      "/archive/" commit ".tar.gz"))

Unless I’m mistaken, /archive tarballs are automatically generated and
should thus be avoided.

However, using ‘git-fetch’ here is not quite feasible because it could
lead to bootstrapping problems (“soft” bootstrapping problems, because
these are fixed-output derivations, but still.)

Thanks!

Ludo’.
Janneke Nieuwenhuizen Nov. 14, 2019, 5:56 a.m. UTC | #2
Ludovic Courtès writes:

Hello Ludo',

> Jan Nieuwenhuizen <janneke@gnu.org> skribis:
>> * gnu/packages/commencement.scm (m2-planet-boot0): New variable.
>
> Since this is currently unused, should we postpone and review it as part
> of a bigger change that will actually use it?  What do you prefer?

Yes, I think that's wise.  I was so excited that I wanted to share this
recipe.  The releases that we need for a proper packaging will take some
serious time and effort.

>> +(define-public m2-planet-boot0
>> +  ;; The soon-to-be initial bootstrap package: no binary inputs except for a
>> +  ;; ~500 byte binary seed: `x86/hex0-seed'.
>> +  (let* ((version "1.4.0")
>> +         (revision "0")
>> +         (commit "1fc2aeab483208bd2ba117b21df3894c182470ec")
>> +         (seed-version "Release_1.1")
>> +         (mescc-tools-version "Release_0.6.1")
>> +         (mes-m2-commit "f025a24b19e8447fb96ba1746bdad494ae63a514")
>> +         (mes-m2-version (string-append "0.19-" (string-take mes-m2-commit 7))))
>
> This is a bit intimidating.  ;-)  It would be great if we could refer to
> releases only, and perhaps we don’t need to have all these in this
> ‘define’?

Sure!  I am hoping to drop mes-m2 here and use tarballs; even if we have
to hand-craft them and host them ourselves.

>> +                (method url-fetch)
>> +                (uri (string-append
>> +                      "https://github.com/oriansj/m2-planet"
>> +                      "/archive/" commit ".tar.gz"))
>
> Unless I’m mistaken, /archive tarballs are automatically generated and
> should thus be avoided.
>
> However, using ‘git-fetch’ here is not quite feasible because it could
> lead to bootstrapping problems (“soft” bootstrapping problems, because
> these are fixed-output derivations, but still.)

Yes...

I will close this issue after giving the plain m2-planet a proper
description.

Thanks for looking a it ;-)
Greetings,
janneke
diff mbox series

Patch

diff --git a/gnu/packages/commencement.scm b/gnu/packages/commencement.scm
index 54746151ce..31722b4cf3 100644
--- a/gnu/packages/commencement.scm
+++ b/gnu/packages/commencement.scm
@@ -5,7 +5,7 @@ 
 ;;; Copyright © 2014, 2015, 2017 Mark H Weaver <mhw@netris.org>
 ;;; Copyright © 2017, 2018, 2019 Efraim Flashner <efraim@flashner.co.il>
 ;;; Copyright © 2018 Tobias Geerinckx-Rice <me@tobias.gr>
-;;; Copyright © 2018 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
+;;; Copyright © 2018, 2019 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
 ;;; Copyright © 2019 Marius Bakke <mbakke@fastmail.com>
 ;;;
 ;;; This file is part of GNU Guix.
@@ -84,6 +84,107 @@ 
 ;;;
 ;;; Code:
 
+(define-public m2-planet-boot0
+  ;; The soon-to-be initial bootstrap package: no binary inputs except for a
+  ;; ~500 byte binary seed: `x86/hex0-seed'.
+  (let* ((version "1.4.0")
+         (revision "0")
+         (commit "1fc2aeab483208bd2ba117b21df3894c182470ec")
+         (seed-version "Release_1.1")
+         (mescc-tools-version "Release_0.6.1")
+         (mes-m2-commit "f025a24b19e8447fb96ba1746bdad494ae63a514")
+         (mes-m2-version (string-append "0.19-" (string-take mes-m2-commit 7))))
+    (package
+      (inherit m2-planet)
+      (name "m2-planet-boot0")
+      (version (string-append version "-" revision "." (string-take commit 7)))
+      (source (origin
+                (method url-fetch)
+                (uri (string-append
+                      "https://github.com/oriansj/m2-planet"
+                      "/archive/" commit ".tar.gz"))
+                (file-name (string-append "mescc-tools-seed-" version ".tar.gz"))
+                (sha256
+                 (base32
+                  "09dfbhrkfq754lkk9qqsa95rgfp5crdwy8l4db97qwfclr0y914z"))))
+      (inputs `(("mescc-tools-seed"
+                 ,(bootstrap-origin
+                   (origin
+                     (method url-fetch)
+                     (uri (string-append
+                           "https://github.com/oriansj/mescc-tools-seed"
+                           "/archive/" seed-version ".tar.gz"))
+                     (file-name (string-append "mescc-tools-seed-" seed-version
+                                               ".tar.gz"))
+                     (sha256
+                      (base32
+                       "1ymkaanx3b9x8y3n4x0kpqxyjcql3gpv37hp1cbzvhwh89yqy6m4")))))
+                ("mescc-tools-source"
+                 ,(bootstrap-origin
+                   (origin
+                     (method url-fetch)
+                     (uri (string-append
+                           "https://github.com/oriansj/mescc-tools"
+                           "/archive/" mescc-tools-version ".tar.gz"))
+                     (file-name (string-append "mescc-tools-"
+                                               mescc-tools-version
+                                               ".tar.gz"))
+                     (sha256
+                      (base32
+                       "06jpvq6xfjzn2al6b4rdwd3zv3h4cvilc4n9gqcnjr9cr6wjpw2n")))))
+                ("mes-m2-source"
+                 ,(bootstrap-origin
+                   (origin
+                     (method url-fetch)
+                     (uri (string-append
+                           "https://github.com/oriansj/mes-m2"
+                           "/archive/" mes-m2-commit ".tar.gz"))
+                     (file-name (string-append "mes-m2-"
+                                               mes-m2-version
+                                               ".tar.gz"))
+                     (sha256
+                      (base32
+                       "092ydx21cms8rkgx5dfndxi4hrw9jqw9r266h4rsvycpv2lw6kp1")))))))
+      (native-inputs
+       `(("coreutils" , %bootstrap-coreutils&co)
+         ("guile" , %bootstrap-guile)))
+      (supported-systems '("i686-linux" "x86_64-linux"))
+      (build-system trivial-build-system)
+      (arguments
+       `(#:guile ,%bootstrap-guile
+         #:modules ((guix build utils))
+         #:builder (begin
+                     (use-modules (guix build utils))
+                     (let* ((mescc-tools-seed (assoc-ref %build-inputs "mescc-tools-seed"))
+                            (mescc-tools-source (assoc-ref %build-inputs "mescc-tools-source"))
+                            (mes-m2-source (assoc-ref %build-inputs "mes-m2-source"))
+                            (source (assoc-ref %build-inputs "source"))
+                            (dir (string-append "mescc-tools-seed-" ,seed-version))
+                            (coreutils (assoc-ref %build-inputs "coreutils"))
+                            (guile     (assoc-ref %build-inputs "guile"))
+                            (out       (assoc-ref %outputs "out"))
+                            (bindir    (string-append out "/bin")))
+                       (setenv "PATH" (string-append coreutils "/bin"))
+                       (invoke "tar" "--strip-components=1" "-xvf" mescc-tools-seed)
+                       (invoke "tar" "--strip-components=1" "-C" "mescc-tools" "-xvf" mescc-tools-source)
+                       (invoke "tar" "--strip-components=1" "-C" "M2-Planet" "-xvf" source)
+                       (invoke "tar" "--strip-components=1" "-C" "mes-m2" "-xvf" mes-m2-source)
+                       (mkdir-p bindir)
+                       (with-directory-excursion "x86"
+                         (invoke "../kaem-optional-seed" "--verbose" "--strict"))
+                       (with-directory-excursion "bin"
+                         (copy-file "mes-m2" "mes")
+                         (install-file "hex2" bindir)
+                         (install-file "M1" bindir)
+                         (install-file "blood-elf" bindir)
+                         (install-file "kaem" bindir)
+                         (install-file "get_machine" bindir)
+                         (install-file "get_machine" bindir)
+                         (install-file "M2-Planet" bindir)
+                         (install-file "mes" bindir)
+                         (install-file "mes-m2" bindir))
+                       #t)))))))
+
 (define mes-boot
   (package
     (inherit mes)