~ruther/guix-local

a43d32577de300113f25577f27a9c002b69757b5 — Ludovic Courtès 3 months ago d118a89
gnu: guile: Add 3.0.11.

This reinstates 2b3782eb6efc95fe752fe3199fa54561ec8dd7fd, which was reverted
in f54a032cec760ff2c3af87e5a45dd305a84dfa48; see
<https://codeberg.org/guix/guix/pulls/4747>.

* gnu/packages/guile.scm (guile-3.0.11): New variable.
(guile-3.0-latest): Add comment.
* gnu/packages/patches/guile-3.0.11-cross-compilation.patch: New file.
* gnu/local.mk (dist_patch_DATA): Add it.

Change-Id: Id8ec934bb504750a5cefb5d417eab84175c47d01
Co-authored-by: Yelninei <yelninei@tutamail.com>
Signed-off-by: Ludovic Courtès <ludo@gnu.org>
Merges: #5360
Signed-off-by: Rutherther <rutherther@ditigal.xyz>
M gnu/local.mk => gnu/local.mk +2 -1
@@ 1,5 1,5 @@
# GNU Guix --- Functional package management for GNU
# Copyright © 2012-2025 Ludovic Courtès <ludo@gnu.org>
# Copyright © 2012-2026 Ludovic Courtès <ludo@gnu.org>
# Copyright © 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020, 2022, 2023, 2024, 2025 Andreas Enge <andreas@enge.fr>
# Copyright © 2016 Mathieu Lirzin <mthl@gnu.org>
# Copyright © 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020, 2021 Mark H Weaver <mhw@netris.org>


@@ 1546,6 1546,7 @@ dist_patch_DATA =						\
  %D%/packages/patches/guile-default-utf8.patch			\
  %D%/packages/patches/guile-2.2-default-utf8.patch		\
  %D%/packages/patches/guile-relocatable.patch			\
  %D%/packages/patches/guile-3.0.11-cross-compilation.patch	\
  %D%/packages/patches/guile-3.0-relocatable.patch		\
  %D%/packages/patches/guile-linux-syscalls.patch		\
  %D%/packages/patches/guile-3.0-linux-syscalls.patch		\

M gnu/packages/guile.scm => gnu/packages/guile.scm +48 -2
@@ 1,5 1,5 @@
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2012-2025 Ludovic Courtès <ludo@gnu.org>
;;; Copyright © 2012-2026 Ludovic Courtès <ludo@gnu.org>
;;; Copyright © 2014 Cyril Roelandt <tipecaml@gmail.com>
;;; Copyright © 2014, 2016, 2018 David Thompson <davet@gnu.org>
;;; Copyright © 2014, 2017, 2018 Mark H Weaver <mhw@netris.org>


@@ 477,7 477,53 @@ without requiring the source code to be rewritten.")
            (variable "GUILE_EXTENSIONS_PATH")
            (files '("lib/guile/3.0/extensions")))))))

(define-public guile-3.0-latest guile-3.0)
(define-public guile-3.0.11
  (package
    (inherit guile-3.0)
    (name "guile")
    (version "3.0.11")
    (source
     (origin
       (inherit (package-source guile-2.2))
       (uri (string-append "mirror://gnu/guile/guile-" version ".tar.xz"))
       (sha256
        (base32 "0q4laxcraxh3r9s62p6nw3g3n6xlqxy16r5kdylpyyk56v97k341"))
       (patches (search-patches "guile-3.0.11-cross-compilation.patch"))
       ;; Replace the snippet because the oom-test still fails on some 32-bit
       ;; architectures.
       (snippet '(for-each delete-file
                           (find-files "prebuilt" "\\.go$")))))
    (arguments
     (substitute-keyword-arguments (package-arguments guile-3.0)
       ((#:phases phases)
        #~(modify-phases #$phases
            #$@(if (target-hurd?)
                   #~((delete 'patch-posix-spawn-usage))
                   #~())
            #$@(if (system-hurd?)
                   #~((replace 'disable-tests
                        (lambda _
                          (substitute* "test-suite/Makefile.in"
                            ;; AF_UNIX/SOCK_STREAM: bind abstract - arguments: bind ENOENT
                            (("tests/00-socket.test")
                             "")
                            ;; thread-sleep!: thread sleeps fractions of a second
                            (("tests/srfi-18.test")
                             "")
                            ;; flaky: server is listening - arguments: connect EINVAL
                            (("tests/web-server.test")
                             ""))
                          ;; failed to remove 't-guild-compile-7215.go.tdL7yC
                          (substitute* "test-suite/standalone/Makefile.in"
                            (("test-guild-compile ")
                             ""))))
                      (delete 'disable-threads.tests))
                   #~())))))))

(define-public guile-3.0-latest
  ;; At the moment 3.0.11 leads to test failures in the 'guix' package so we
  ;; cannot switch just yet: see <https://codeberg.org/guix/guix/pulls/5360>.
  guile-3.0)

;;; The symbol guile-3.0/fixed should be used when guile-3.0 needs fixes
;;; (security or else) and this deprecation could be removed.

A gnu/packages/patches/guile-3.0.11-cross-compilation.patch => gnu/packages/patches/guile-3.0.11-cross-compilation.patch +29 -0
@@ 0,0 1,29 @@
Fix cross-compilation of Guile 3.0.11:

  https://codeberg.org/guile/guile/issues/88

--- a/module/system/base/target.scm
+++ b/module/system/base/target.scm
@@ -45,15 +45,13 @@
 ;;;
 
 ;; Hacky way to get native pointer size without having to load (system
-;; foreign).
-(define-syntax %native-word-size
-  (lambda (stx)
-    (syntax-case stx ()
-      (id (identifier? #'id)
-          (cond
-           ((< most-positive-fixnum (ash 1 32)) 4)
-           ((< most-positive-fixnum (ash 1 64)) 8)
-           (else (error "unexpected!" most-positive-fixnum)))))))
+;; foreign).  Note: Use the value of 'most-positive-fixnum' available at
+;; run time, not a macro-expansion time, to ensure the correct value is
+;; used when cross-compiling.
+(define %native-word-size
+  (cond ((< most-positive-fixnum (ash 1 32)) 4)
+        ((< most-positive-fixnum (ash 1 64)) 8)
+        (else (error "unexpected!" most-positive-fixnum))))
 
 (define %target-type (make-fluid %host-type))
 (define %target-endianness (make-fluid (native-endianness)))