all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Christopher Baines <mail@cbaines.net>
To: 46725@debbugs.gnu.org
Subject: [bug#46725] [PATCH] gnu: guile-lib: Fix cross compilation.
Date: Wed, 24 Feb 2021 08:37:09 +0000	[thread overview]
Message-ID: <20210224083709.9342-1-mail@cbaines.net> (raw)
In-Reply-To: <20210223200755.29532-1-mail@cbaines.net>

These changes were sent upstream as
https://lists.gnu.org/archive/html/guile-devel/2021-02/msg00004.html

Without this change, the .go files are built for the host architecture, rather
than the target. I noticed this when cross building the
guix-build-coordinator (for which guile-lib is an input) to the Hurd.

* gnu/packages/guile-xyz.scm (guile-lib)[arguments]: Add
'patch-for-cross-compilation phase.
[native-inputs]: Add autoconf, automake and gettext.
(guile2.0-lib): Adjust to use alist-replace.
(guile2.2-lib): Adjust to use alist-replace.
---
 gnu/packages/guile-xyz.scm | 37 ++++++++++++++++++++++++++++++++-----
 1 file changed, 32 insertions(+), 5 deletions(-)

diff --git a/gnu/packages/guile-xyz.scm b/gnu/packages/guile-xyz.scm
index ce5aad8ec7..07f81bcc1b 100644
--- a/gnu/packages/guile-xyz.scm
+++ b/gnu/packages/guile-xyz.scm
@@ -116,6 +116,7 @@
   #:use-module (guix build-system gnu)
   #:use-module (guix build-system guile)
   #:use-module (guix utils)
+  #:use-module ((guix build utils) #:select (alist-replace))
   #:use-module (ice-9 match)
   #:use-module ((srfi srfi-1) #:select (alist-delete)))
 
@@ -2194,6 +2195,21 @@ library.")
        '("GUILE_AUTO_COMPILE=0")        ; to prevent guild errors
        #:phases
        (modify-phases %standard-phases
+         (add-after 'unpack 'patch-for-cross-compilation
+           (lambda _
+             (substitute* "configure.ac"
+               (("GUILE_FLAGS")
+                "GUILE_FLAGS
+if test \"$cross_compiling\" != no; then
+   GUILE_TARGET=\"--target=$host_alias\"
+   AC_SUBST([GUILE_TARGET])
+fi
+"))
+             (substitute* "am/guile.mk"
+               (("guild compile") "guild compile $(GUILE_TARGET)"))
+             (delete-file "configure")  ; trigger the bootstrap phase to run
+                                        ; autoreconf
+             #t))
          (add-before 'configure 'patch-module-dir
            (lambda _
              (substitute* "src/Makefile.in"
@@ -2204,7 +2220,10 @@ library.")
 $(libdir)/guile/@GUILE_EFFECTIVE_VERSION@/site-ccache\n"))
              #t)))))
     (native-inputs
-     `(("guile" ,guile-3.0)
+     `(("autoconf" ,autoconf)
+       ("automake" ,automake)
+       ("gettext" ,gettext-minimal)
+       ("guile" ,guile-3.0)
        ("pkg-config" ,pkg-config)))
     (inputs
      `(("guile" ,guile-3.0)))
@@ -2225,15 +2244,23 @@ for Guile\".")
   (package
     (inherit guile-lib)
     (name "guile2.0-lib")
-    (native-inputs `(("pkg-config" ,pkg-config)))
-    (inputs `(("guile" ,guile-2.0)))))
+    (native-inputs
+     (alist-replace "guile" (list guile-2.0)
+                    (package-native-inputs guile-lib)))
+    (inputs
+     (alist-replace "guile" (list guile-2.0)
+                    (package-inputs guile-lib)))))
 
 (define-public guile2.2-lib
   (package
     (inherit guile-lib)
     (name "guile2.2-lib")
-    (native-inputs `(("pkg-config" ,pkg-config)))
-    (inputs `(("guile" ,guile-2.2)))))
+    (native-inputs
+     (alist-replace "guile" (list guile-2.2)
+                    (package-native-inputs guile-lib)))
+    (inputs
+     (alist-replace "guile" (list guile-2.2)
+                    (package-inputs guile-lib)))))
 
 (define-public guile3.0-lib
   (deprecated-package "guile3.0-lib" guile-lib))
-- 
2.30.0





  parent reply	other threads:[~2021-02-24  8:38 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-23 20:07 [bug#46725] [PATCH] gnu: guile-lib: Fix cross compilation Christopher Baines
2021-02-24  7:58 ` Leo Prikler
2021-02-24  8:45   ` Christopher Baines
2021-02-24  8:37 ` Christopher Baines [this message]
2021-03-02 19:20   ` Ludovic Courtès
2021-03-04 13:16     ` Maxim Cournoyer
2021-03-08 14:22       ` Ludovic Courtès
2021-03-08 22:11         ` bug#46725: " Christopher Baines
2021-03-11 21:01           ` [bug#46725] " Maxim Cournoyer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210224083709.9342-1-mail@cbaines.net \
    --to=mail@cbaines.net \
    --cc=46725@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.