[PATCH] Build system fixes

Jonas Hahnfeld via "Developers list for Guile, the GNU extensibility library" <[email protected]>
Newsgroups gmane.lisp.guile.devel,gmane.lisp.guile.bugs
Message-ID <[email protected]>
Dear Guile maintainers,

please find attached two patches for changes that we have been carrying
downstream in LilyPond so far: one fix to make a sed invocation fully
portable, and a fix for cross-compilation in out-of-tree-builds.

Regards
Jonas
0001-build-Make-sed-invocation-fully-portable.patch (text/x-patch, 1.8 KB)
From 428d1b17c5f664d3cb8da4cd5687bd47bdd87877 Mon Sep 17 00:00:00 2001
From: Jonas Hahnfeld <[email protected]>
Date: Thu, 22 Feb 2024 21:57:41 +0100
Subject: [PATCH 1/2] build: Make sed invocation fully portable

Commit 08041d216f attempted to make the "invocation compatible with
BSD sed", but moving '-i' first does not solve the problem because
it still requires to pass an argument. Instead just redirect the
instantiated output into a temporary file and install that.

* libguile/Makefile.am: Remove '-i' from INSTANTIATE.
---
 libguile/Makefile.am | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/libguile/Makefile.am b/libguile/Makefile.am
index 249e44a49..2641e7f69 100644
--- a/libguile/Makefile.am
+++ b/libguile/Makefile.am
@@ -492,9 +492,9 @@ install-exec-hook:
 
 ## Instantiate a template.
 INSTANTIATE =									\
-  $(SED) -i -e 's,[@]pkgdatadir[@],$(pkgdatadir),g'				\
-            -e 's,[@]pkglibdir[@],$(pkglibdir),g'				\
-            -e 's,[@]GUILE_EFFECTIVE_VERSION[@],$(GUILE_EFFECTIVE_VERSION),g'
+  $(SED) -e 's,[@]pkgdatadir[@],$(pkgdatadir),g'				\
+         -e 's,[@]pkglibdir[@],$(pkglibdir),g'					\
+         -e 's,[@]GUILE_EFFECTIVE_VERSION[@],$(GUILE_EFFECTIVE_VERSION),g'
 
 install-data-hook: libguile-@[email protected]
 	@$(MKDIR_P) $(DESTDIR)$(libdir)
@@ -518,9 +518,9 @@ install-data-hook: libguile-@[email protected]
 	cd $$here;						\
 	echo " $(INSTALL_DATA) $<				\
 $(DESTDIR)$(libdir)/$$libname-gdb.scm";				\
-	$(INSTALL_DATA) "$<"					\
-	    "$(DESTDIR)$(libdir)/$$libname-gdb.scm";		\
-	$(INSTANTIATE) "$(DESTDIR)$(libdir)/$$libname-gdb.scm"
+	$(INSTANTIATE) "$<" > $$libname-gdb.scm;		\
+	$(INSTALL_DATA) $$libname-gdb.scm			\
+	    "$(DESTDIR)$(libdir)/$$libname-gdb.scm";
 
 # Remove the GDB support file and the Info 'dir' file that
 # 'install-info' 5.x installs.
-- 
2.43.2
0002-build-Fix-cross-compilation-in-out-of-tree-builds.patch (text/x-patch, 1.5 KB)
From ad01912391b449fcf547ac52ed468f9b572cb0ad Mon Sep 17 00:00:00 2001
From: Jonas Hahnfeld <[email protected]>
Date: Thu, 22 Feb 2024 22:10:06 +0100
Subject: [PATCH 2/2] build: Fix cross-compilation in out-of-tree-builds

gen-scmconfig.h is generated in libguile, not $(top_builddir).

* libguile/Makefile.am: Add '-I.' when compiling gen-scmconfig.o.
---
 libguile/Makefile.am | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/libguile/Makefile.am b/libguile/Makefile.am
index 2641e7f69..f5d43cc01 100644
--- a/libguile/Makefile.am
+++ b/libguile/Makefile.am
@@ -62,14 +62,15 @@ gen_scmconfig_SOURCES = gen-scmconfig.c
 ## Override default rule; this should be compiled for BUILD host.  Note
 ## that we don't add $(AM_CPPFLAGS) here, as we need to run this
 ## program, but $(top_srcdir)/lib has a gnulib configured for the
-## target.  Instead we manually add $(top_builddir), in order to pick up
-## the generated config.h and gen-scmconfig.h.  Nothing else from Guile
-## is included by this code generator.
+## target.  Instead we manually add $(top_builddir) and the current
+## directory, in order to pick up the generated config.h and
+## gen-scmconfig.h.  Nothing else from Guile is included by this code
+## generator.
 gen-scmconfig.$(OBJEXT): gen-scmconfig.c
 	$(AM_V_GEN) \
 	if [ "$(cross_compiling)" = "yes" ]; then \
 		$(CC_FOR_BUILD) $(DEFS) $(DEFAULT_INCLUDES) -I$(top_builddir) \
-		   -c -o $@ $<; \
+		   -I. -c -o $@ $<; \
 	else \
 		$(COMPILE) -c -o $@ $<; \
 	fi
-- 
2.43.2
signature.asc (application/pgp-signature, 488 B)
-----BEGIN PGP SIGNATURE-----

iQEzBAABCAAdFiEEXw/5YGpL6H9VOgO2kcnDPSxhrNsFAmXXuRwACgkQkcnDPSxh
rNs7TwgAgYV3KPf2TboO2dWhWnd0GKg8emXDK4IbxcxbwBwjrKj2LlgPksVBxzZz
0wXECTmup3m3ljIE5uYJ6S9tNMgRLpjrn0C6J0zqjquEkxhGIRkTQvdMy0ODkX7v
sAx3hbzQI+ueXglLJH+vBuVeIcSIG3NvHGoCQ2dWeRE3Tik03ib6qHXIg8RLCJzw
H01nqzYDLrpllwO/SdaJb+l+e5HPLLl6uo7O1+WZuNZodxwDZmAIRtXrBtZH6ViY
u+k4wTRu3tWOCQJPtHl6hIaRuMbhaGGwJNekIuUyl88Ex/l41sgIG/9SLt/Lsw9A
CI910D7v/tdIp2VvuM7mO4WjfaHrPQ==
=KIfP
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.