gnu: guile-lib: Fix cross compilation.

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.
This commit is contained in:
Christopher Baines 2021-02-23 20:02:14 +00:00
parent 7a43651738
commit a0b24d5f8c
No known key found for this signature in database
GPG key ID: 5E28A33B0B84F577

View file

@ -116,6 +116,7 @@ (define-module (gnu packages guile-xyz)
#:use-module (guix build-system gnu) #:use-module (guix build-system gnu)
#:use-module (guix build-system guile) #:use-module (guix build-system guile)
#:use-module (guix utils) #:use-module (guix utils)
#:use-module ((guix build utils) #:select (alist-replace))
#:use-module (ice-9 match) #:use-module (ice-9 match)
#:use-module ((srfi srfi-1) #:select (alist-delete))) #:use-module ((srfi srfi-1) #:select (alist-delete)))
@ -2191,6 +2192,21 @@ (define-public guile-lib
'("GUILE_AUTO_COMPILE=0") ; to prevent guild errors '("GUILE_AUTO_COMPILE=0") ; to prevent guild errors
#:phases #:phases
(modify-phases %standard-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 (add-before 'configure 'patch-module-dir
(lambda _ (lambda _
(substitute* "src/Makefile.in" (substitute* "src/Makefile.in"
@ -2201,7 +2217,10 @@ (define-public guile-lib
$(libdir)/guile/@GUILE_EFFECTIVE_VERSION@/site-ccache\n")) $(libdir)/guile/@GUILE_EFFECTIVE_VERSION@/site-ccache\n"))
#t))))) #t)))))
(native-inputs (native-inputs
`(("guile" ,guile-3.0) `(("autoconf" ,autoconf)
("automake" ,automake)
("gettext" ,gettext-minimal)
("guile" ,guile-3.0)
("pkg-config" ,pkg-config))) ("pkg-config" ,pkg-config)))
(inputs (inputs
`(("guile" ,guile-3.0))) `(("guile" ,guile-3.0)))
@ -2222,15 +2241,23 @@ (define-public guile2.0-lib
(package (package
(inherit guile-lib) (inherit guile-lib)
(name "guile2.0-lib") (name "guile2.0-lib")
(native-inputs `(("pkg-config" ,pkg-config))) (native-inputs
(inputs `(("guile" ,guile-2.0))))) (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 (define-public guile2.2-lib
(package (package
(inherit guile-lib) (inherit guile-lib)
(name "guile2.2-lib") (name "guile2.2-lib")
(native-inputs `(("pkg-config" ,pkg-config))) (native-inputs
(inputs `(("guile" ,guile-2.2))))) (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 (define-public guile3.0-lib
(deprecated-package "guile3.0-lib" guile-lib)) (deprecated-package "guile3.0-lib" guile-lib))