unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
blob 834001bd8311b01c877a82d912631d58afd91ca9 5484 bytes (raw)
name: gnu/packages/patches/racket-backport-8.10-rktboot.patch 	 # note: path name is non-authoritative(*)

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
 
From 5446e36e0685ec5c7b4f812dec5bf7959db4f906 Mon Sep 17 00:00:00 2001
From: Efraim Flashner <efraim@flashner.co.il>
Date: Thu, 20 Jul 2023 15:56:21 +0300
Subject: [PATCH 1/2] rktboot: Add support for riscv64.

(cherry picked from commit f80c5d001d5235556ae9cde617b1e3a1322d0505)
---
 racket/src/rktboot/machine-def.rkt | 1 +
 1 file changed, 1 insertion(+)

diff --git a/racket/src/rktboot/machine-def.rkt b/racket/src/rktboot/machine-def.rkt
index 8ff0688652..59ebfc88d8 100644
--- a/racket/src/rktboot/machine-def.rkt
+++ b/racket/src/rktboot/machine-def.rkt
@@ -25,6 +25,7 @@
                                      [(regexp-match? #rx"^t?arm32" target-machine) "arm32"]
                                      [(regexp-match? #rx"^t?arm64" target-machine) "arm64"]
                                      [(regexp-match? #rx"^t?ppc32" target-machine) "ppc32"]
+                                     [(regexp-match? #rx"^t?rv64" target-machine) "rv64"]
                                      [(regexp-match? #rx"^t?pb" target-machine) "pb"]
                                      [else (error "machine.def: cannot infer architecture")]))]
                [s (regexp-replace* #rx"[$][(]Mend[)]" s

base-commit: b10ecfb8311fca2d42636eea2ca12aff0b76b208
-- 
2.41.0


From 6261c3582c386e770d654ca6a36f112834f35aef Mon Sep 17 00:00:00 2001
From: Philip McGrath <philip@philipmcgrath.com>
Date: Sun, 16 Jul 2023 15:47:14 -0400
Subject: [PATCH 2/2] rktboot: improve machene type inference

Related to https://issues.guix.gnu.org/62231
Related to https://github.com/racket/racket/issues/3948

(cherry picked from commit 005488491cee89e7db38109de4c9dcf2d8d5aef0)
---
 racket/src/rktboot/config.rkt | 73 +++++++++++++++++++++++++++++------
 1 file changed, 61 insertions(+), 12 deletions(-)

diff --git a/racket/src/rktboot/config.rkt b/racket/src/rktboot/config.rkt
index 7a969017ed..2b411e002c 100644
--- a/racket/src/rktboot/config.rkt
+++ b/racket/src/rktboot/config.rkt
@@ -15,20 +15,69 @@
                                (path->complete-path scheme-dir))))))
 (hash-set! ht 'make-boot-scheme-dir scheme-dir)
 
+(define (infer-target-machine)
+  ;; Compute a native or pbarch machine string for the current platform.
+  ;; Some caveats:
+  ;;  1. A pbarch Racket will always infer a pbarch machine,
+  ;;     even if a native machine exists. Hopefully this is an
+  ;;     unlikely scenario: if you're running Racket CS, you've
+  ;;     bootstrapped Chez somehow, so you could use `re.boot`.
+  ;;  2. A `tpb` or `pb` Racket on a 32-bit platform would still return
+  ;;     64 from `(system-type 'word)`, but, in addition to the above,
+  ;;     it is not currently possible or desired to build Racket as
+  ;;     `tpb` or `pb` (as opposed to pbarch variants):
+  ;;     see <https://github.com/racket/racket/issues/4692>.
+  ;;  3. On a hypothetical platform where Chez supported both the
+  ;;     architecture and the OS, but not the combination of the two,
+  ;;     (e.g. riscv64 Windows) this code would currently return a
+  ;;     non-existent native machine (e.g. trv64nt) instead of a
+  ;;     working pbarch machine. Presumably this could be fixed if
+  ;;     such a platform came into existence.
+  (define s (path->string (system-library-subpath #f)))
+  (define arch+os
+    (cond
+      [(regexp-match #rx"^([^\\]+)\\\\([^\\]+)$" s)
+       => (λ (m)
+            (reverse (cdr m)))]
+      [(regexp-match #rx"^([^-]+)-(.+)$" s)
+       => cdr]
+      [else
+       (error 'infer-target-machine "unknown format for system library subpath"
+              "produced" (system-library-subpath #f))]))
+  (define arch
+    (case (car arch+os)
+      [("x86_64" "amd64") "a6"] ; https://github.com/racket/racket/issues/4691
+      [("i386") "i3"]
+      [("aarch64") "arm64"]
+      [("arm") "arm32"]
+      [("ppc") "ppc32"]
+      [("riscv64") "rv64"]
+      [("unknown") #f] ; pb machine types
+      [else #f]))
+  (define os
+    (case (cadr arch+os)
+      [("macosx" "darwin" "ios") "osx"]
+      [("win32" "cygwin") "nt"]
+      [("linux" "android") "le"]
+      [("gnu-hurd") "gnu"]
+      [("freebsd") "fb"]
+      [("openbsd") "ob"]
+      [("netbsd") "nb"]
+      [("solaris") "s2"] ; NOT "sunos4" (I think)
+      [("qnx") "qnx"]
+      [("unknown") #f] ; pb machine types
+      [else #f]))
+  (if (and arch os)
+      (string-append "t" arch os)
+      (format "tpb~a~a"
+              (system-type 'word)
+              (if (system-big-endian?)
+                  "b"
+                  "l"))))
+
 (define target-machine (or (hash-ref ht 'make-boot-targate-machine #f)
                            (getenv "MACH")
-                           (case (system-type)
-                             [(macosx) (if (eqv? 64 (system-type 'word))
-                                           "ta6osx"
-                                           "ti3osx")]
-                             [(windows) (if (eqv? 64 (system-type 'word))
-                                           "ta6nt"
-                                           "ti3nt")]
-                             [else
-                              (case (path->string (system-library-subpath #f))
-                                [("x86_64-linux") "ta6le"]
-                                [("i386-linux") "ti3le"]
-                                [else #f])])))
+                           (infer-target-machine)))
 (hash-set! ht 'make-boot-targate-machine target-machine)
 
 (define optimize-level-init 3)
-- 
2.41.0


debug log:

solving 834001bd83 ...
found 834001bd83 in https://git.savannah.gnu.org/cgit/guix.git

(*) Git path names are given by the tree(s) the blob belongs to.
    Blobs themselves have no identifier aside from the hash of its contents.^

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).