[PATCH] gnu: guile-lib: Fix cross compilation.

OpenSubmitted by Christopher Baines.
Details
2 participants
  • Leo Prikler
  • Christopher Baines
Owner
unassigned
Severity
normal
C
C
Christopher Baines wrote 3 days ago
(address . guix-patches@gnu.org)
20210223200755.29532-1-mail@cbaines.net
These changes were sent upstream ashttps://lists.gnu.org/archive/html/guile-devel/2021-02/msg00004.html
Without this change, the .go files are built for the host architecture, ratherthan the target. I noticed this when cross building theguix-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.--- gnu/packages/guile-xyz.scm | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-)
Toggle diff (39 lines)diff --git a/gnu/packages/guile-xyz.scm b/gnu/packages/guile-xyz.scmindex ce5aad8ec7..e9dfc6cc8d 100644--- a/gnu/packages/guile-xyz.scm+++ b/gnu/packages/guile-xyz.scm@@ -2194,6 +2194,20 @@ 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)"))+ (invoke "autoreconf" "-vif")+ #t)) (add-before 'configure 'patch-module-dir (lambda _ (substitute* "src/Makefile.in"@@ -2204,7 +2218,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)))-- 2.30.0
L
L
Leo Prikler wrote 3 days ago
d3ce8a30601c3601a08d6a10b17628ef368d9f75.camel@student.tugraz.at
Hello,
Am Dienstag, den 23.02.2021, 20:07 +0000 schrieb Christopher Baines:
Toggle quote (36 lines)> 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.> ---> gnu/packages/guile-xyz.scm | 19 ++++++++++++++++++-> 1 file changed, 18 insertions(+), 1 deletion(-)> > diff --git a/gnu/packages/guile-xyz.scm b/gnu/packages/guile-xyz.scm> index ce5aad8ec7..e9dfc6cc8d 100644> --- a/gnu/packages/guile-xyz.scm> +++ b/gnu/packages/guile-xyz.scm> @@ -2194,6 +2194,20 @@ 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)"))> + (invoke "autoreconf" "-vif")
Invoking autoreconf seems a bit overkill for a "patch-<something>"phase. Wouldn't it be regenerated in bootstrap if you (delete-file"configure")?
Toggle quote (16 lines)> + #t))> (add-before 'configure 'patch-module-dir> (lambda _> (substitute* "src/Makefile.in"> @@ -2204,7 +2218,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)))
Otherwise LGTM, but I haven't checked cross-compiling. From yourmessage I'll assume you did.
Regards,Leo
C
C
Christopher Baines wrote 3 days ago
[PATCH] gnu: guile-lib: Fix cross compilation.
(address . 46725@debbugs.gnu.org)
20210224083709.9342-1-mail@cbaines.net
These changes were sent upstream ashttps://lists.gnu.org/archive/html/guile-devel/2021-02/msg00004.html
Without this change, the .go files are built for the host architecture, ratherthan the target. I noticed this when cross building theguix-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(-)
Toggle diff (76 lines)diff --git a/gnu/packages/guile-xyz.scm b/gnu/packages/guile-xyz.scmindex 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
C
C
Christopher Baines wrote 3 days ago
(name . Leo Prikler)(address . leo.prikler@student.tugraz.at)(address . 46725@debbugs.gnu.org)
87czwplupv.fsf@cbaines.net
Leo Prikler <leo.prikler@student.tugraz.at> writes:
Toggle quote (42 lines)> Am Dienstag, den 23.02.2021, 20:07 +0000 schrieb Christopher Baines:>> 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.>> --->> gnu/packages/guile-xyz.scm | 19 ++++++++++++++++++->> 1 file changed, 18 insertions(+), 1 deletion(-)>> >> diff --git a/gnu/packages/guile-xyz.scm b/gnu/packages/guile-xyz.scm>> index ce5aad8ec7..e9dfc6cc8d 100644>> --- a/gnu/packages/guile-xyz.scm>> +++ b/gnu/packages/guile-xyz.scm>> @@ -2194,6 +2194,20 @@ 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)"))>> + (invoke "autoreconf" "-vif")>> Invoking autoreconf seems a bit overkill for a "patch-<something>"> phase. Wouldn't it be regenerated in bootstrap if you (delete-file> "configure")?
Yeah, this works as well. I've changed this phase to delete theconfigure file instead.
Toggle quote (20 lines)>> + #t))>> (add-before 'configure 'patch-module-dir>> (lambda _>> (substitute* "src/Makefile.in">> @@ -2204,7 +2218,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)))>> Otherwise LGTM, but I haven't checked cross-compiling. From your> message I'll assume you did.
Turns out I broke guile2.0-lib and guile2.2-lib, so I've sent anotherpatch which fixes that.
-----BEGIN PGP SIGNATURE-----
iQKlBAEBCgCPFiEEPonu50WOcg2XVOCyXiijOwuE9XcFAmA2EjxfFIAAAAAALgAoaXNzdWVyLWZwckBub3RhdGlvbnMub3BlbnBncC5maWZ0aGhvcnNlbWFuLm5ldDNFODlFRUU3NDU4RTcyMEQ5NzU0RTBCMjVFMjhBMzNCMEI4NEY1NzcRHG1haWxAY2JhaW5lcy5uZXQACgkQXiijOwuE9Xd9kw//W39lz1VavsgfbgwDJjo+kvCVJaRoQFIcLAUwb9qo0WeBymz4dii67jCk6Xmm+6TjbBVQzv6p8oace5us6dcLlB0RFG6AgV+ud26KFh5OpOggDGlksH4jPDFpHSVli/km/oolHss4MX2YhTPHD9yy8C3sS+NK6/9eKHFvZBktVFSQzucgbhYJxrEhkf7cDXVi+R97GwyKG8HBbUGrOuyg+TzjEd3Rxm4SFxvHABBWMwoi5yk8zJHnmgifcJKpK7+4ePW7LJREGOyKXWHq2qnZi7p4ekPvoobG079kafkxhd9zjpiELWf66GGFpDfsJab5LiiSmotdekWyQV5+bUI0UQ91SJQqVurId4Xru4RbDenUoIFP95oH+zEU389wmvNOXkC84psINFXk+KIB81WxnY4CJ0IXrps/kdtuQD563Z5KEWPzJEWdp3OxBHphf5n1zzoSLpkl9SLXBJV+x64Dbb9uzQZU8hPOTuNlQQ0o450a3IGu+SFgb4jf5g0c+JgYIOa8UHi/vb1NkR8bOHg2LyKUY584RuCZxZQFMMVwX9JgjV133O3oLJ/+bIOhf2kIHRUWpPLq0TbURa7lBeGgWuXRvscuVwkazZJMkEZOKtWcbnveqVS28N/WtfDp52H55EoxqyXHTBrBiaE7TwqaKcB6F5quTtc9OTj+Mbjaxlw==0ICu-----END PGP SIGNATURE-----
?