GNU bug report logs - #60760
[PATCH core-updates] gnu: bc: Fix cross-compilation.

Previous Next

Package: guix-patches;

Reported by: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>

Date: Thu, 12 Jan 2023 21:43:01 UTC

Severity: normal

Tags: patch

Done: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 60760 in the body.
You can then email your comments to 60760 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to guix-patches <at> gnu.org:
bug#60760; Package guix-patches. (Thu, 12 Jan 2023 21:43:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to Maxim Cournoyer <maxim.cournoyer <at> gmail.com>:
New bug report received and forwarded. Copy sent to guix-patches <at> gnu.org. (Thu, 12 Jan 2023 21:43:01 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
To: guix-patches <at> gnu.org
Cc: Andreas Enge <andreas <at> enge.fr>, Efraim Flashner <efraim <at> flashner.co.il>,
 Maxim Cournoyer <maxim.cournoyer <at> gmail.com>, Eric Bavier <bavier <at> posteo.net>
Subject: [PATCH core-updates] gnu: bc: Fix cross-compilation.
Date: Thu, 12 Jan 2023 16:42:15 -0500
The existing cross-compilation patch no longer worked.  It's been reworked and
submitted to upstream.

* gnu/packages/algebra.scm (bc) [native-inputs]: Add readline.
* gnu/packages/patches/bc-fix-cross-compilation.patch: Refresh patch.

---

 gnu/packages/algebra.scm                      |  2 +-
 .../patches/bc-fix-cross-compilation.patch    | 74 ++++++++++++-------
 2 files changed, 47 insertions(+), 29 deletions(-)

diff --git a/gnu/packages/algebra.scm b/gnu/packages/algebra.scm
index 3ceef8ecd2..89e17cd73f 100644
--- a/gnu/packages/algebra.scm
+++ b/gnu/packages/algebra.scm
@@ -683,7 +683,7 @@ (define-public bc
              (patches (search-patches "bc-fix-cross-compilation.patch"))))
     (build-system gnu-build-system)
     (native-inputs
-     (list automake autoconf ed flex texinfo))
+     (list automake autoconf ed flex readline texinfo))
     (inputs
      (list readline))
     (arguments
diff --git a/gnu/packages/patches/bc-fix-cross-compilation.patch b/gnu/packages/patches/bc-fix-cross-compilation.patch
index 14dfecdbde..04f2c92abf 100644
--- a/gnu/packages/patches/bc-fix-cross-compilation.patch
+++ b/gnu/packages/patches/bc-fix-cross-compilation.patch
@@ -1,15 +1,19 @@
-Patch taken from nix.
-
-commit fdda59736ddc048cf38a2c7103f4f5d9eeaf995e
-Author: Ben Gamari <ben <at> smart-cactus.org>
-Date:   Tue Oct 17 10:51:34 2017 -0400
-
-    Try implementing cross-compilation
+Patch adapted from Nix.
+Upstream-status: Submitted to bug-bc <at> gnu.org.
 
 diff --git a/bc/Makefile.am b/bc/Makefile.am
-index d9d412e..fdef633 100644
+index d9d412e..13f2b1e 100644
 --- a/bc/Makefile.am
 +++ b/bc/Makefile.am
+@@ -8,7 +8,7 @@ EXTRA_DIST = bc.h bcdefs.h const.h fix-libmath_h global.h libmath.b proto.h \
+              sbc.y
+ noinst_HEADERS = libmath.h
+ 
+-DISTCLEANFILES = sbc sbc.c sbc.h libmath.h
++DISTCLEANFILES = fbc sbc sbc.c sbc.h libmath.h
+ 
+ MAINTAINERCLEANFILES = Makefile.in bc.c bc.h scan.c \
+ 	bc.y bcdefs.h const.h execute.c fix-libmath_h \
 @@ -17,6 +17,7 @@ MAINTAINERCLEANFILES = Makefile.in bc.c bc.h scan.c \
  
  AM_CPPFLAGS = -I$(srcdir) -I$(srcdir)/../h
@@ -18,31 +22,36 @@ index d9d412e..fdef633 100644
  LIBL = @LEXLIB@
  LDADD = $(LIBBC) $(LIBL) @READLINELIB@
  
-@@ -29,12 +30,20 @@ $(PROGRAMS): libmath.h $(LIBBC)
+@@ -29,15 +30,22 @@ $(PROGRAMS): libmath.h $(LIBBC)
  scan.o: bc.h
  global.o: libmath.h
-+
-+main_host.c : main.c
-+	cp $< $@
  
 -fbcOBJ = main.o bc.o scan.o execute.o load.o storage.o util.o warranty.o
-+fbcOBJ = $(addsuffix _host,main.o bc.o scan.o execute.o load.o storage.o util.o warranty.o)
-+
-+%.o_host : CC:=$(CC_FOR_BUILD)
-+
-+%.o_host : %.c
-+	$(COMPILE) -c $(CFLAGS) $(INCLUDES) -o $@ $<
++%.o_host: CC := $(CC_FOR_BUILD)
++%.o_host: %.c
++	$(COMPILE) -c -o $@ $<
  
 -libmath.h: libmath.b $(fbcOBJ) $(LIBBC)
-+libmath.h: libmath.b $(fbcOBJ) $(LIBBC_HOST)
- 	echo '{0}' > libmath.h
+-	echo '{0}' > libmath.h
 -	$(MAKE) global.o
 -	$(LINK) -o fbc $(fbcOBJ) global.o $(LIBBC) $(LIBL) $(READLINELIB) $(LIBS)
-+	$(MAKE) global.o_host
-+	$(CC_FOR_BUILD) -o fbc $(fbcOBJ) global.o_host $(LIBBC_HOST) $(LIBL) ${READLINELIB} $(LIBS)
- 	./fbc -c $(srcdir)/libmath.b </dev/null >libmath.h
+-	./fbc -c $(srcdir)/libmath.b </dev/null >libmath.h
++fbcOBJ = $(addsuffix _host,\
++	   main.o bc.o scan.o execute.o load.o storage.o util.o warranty.o)
++
++global_host.c: global.c
++	sed 's/#include "libmath.h"/{0}/' $< > $@
++
++fbc: $(fbcOBJ) global_host.o_host $(LIBBC_HOST) $(LIBS)
++	$(CC_FOR_BUILD) $(LIBL) $(READLINELIB) -o $@ $^
++
++libmath.h: libmath.b fbc $(LIBBC_HOST)
++	./fbc -c $(srcdir)/libmath.b < /dev/null > libmath.h
  	$(srcdir)/fix-libmath_h
- 	rm -f ./fbc ./global.o
+-	rm -f ./fbc ./global.o
+ 
+ sbcOBJ = main.o sbc.o scan.o execute.o global.o load.o storage.o util.o \
+          warranty.o
 diff --git a/configure.ac b/configure.ac
 index fc74573..5cabb73 100644
 --- a/configure.ac
@@ -64,7 +73,7 @@ index fc74573..5cabb73 100644
  
  AM_PROG_LEX
 diff --git a/lib/Makefile.am b/lib/Makefile.am
-index ec4bf59..c670f5b 100644
+index ec4bf59..24c9f42 100644
 --- a/lib/Makefile.am
 +++ b/lib/Makefile.am
 @@ -1,5 +1,5 @@
@@ -74,14 +83,23 @@ index ec4bf59..c670f5b 100644
  
  AM_CPPFLAGS = -I. -I.. -I$(srcdir)/../h
  
-@@ -24,3 +24,11 @@ testmul: testmul.o number.o
+@@ -7,8 +7,6 @@ libbc_a_SOURCES = getopt.c getopt1.c vfprintf.c number.c
+ 
+ DEFS = @DEFS@ $(DEFSADD)
+ 
+-AM_CFLAGS = @CFLAGS@
+-
+ MAINTAINERCLEANFILES = Makefile.in number.c
+ CLEANFILES = testmul specialnumber muldigits.h
+ 
+@@ -24,3 +22,11 @@ testmul: testmul.o number.o
  
  specialnumber: newnumber.o
  	cp newnumber.o number.o
 +
-+%.o_host : CC:=$(CC_FOR_BUILD)
++%.o_host: CC := $(CC_FOR_BUILD)
 +%.o_host : %.c
-+	$(COMPILE) -c $(CFLAGS) $(INCLUDES) -o $@ $<
++	$(COMPILE) -c -o $@ $<
 +
 +libbc_host.a : $(addsuffix _host,$(libbc_a_OBJECTS))
 +	ar cru $@ $+

base-commit: 5e4ec8218142eee8e6e148e787381a5ef891c5b1
prerequisite-patch-id: 37b3abaa163d6eafa0403451a4cdc34e9026a688
prerequisite-patch-id: 776778c03bce9b7ad3ab94a120f42b764c00fcae
prerequisite-patch-id: c45d0aa817c9c4fb9e1ed94cb9effda5ce590c23
prerequisite-patch-id: da44eec28b968e671b2a73432f1a0f9449edfe68
prerequisite-patch-id: ac08f345033c78bf44c856f1f246b52e7e1ab3b2
prerequisite-patch-id: 0f75348f4b5d2c1db3563398018909685c2f169f
prerequisite-patch-id: 31583c7e1b1a1a49ca5084658d267512087fc9a5
prerequisite-patch-id: c9e90155c5f5c753533f6625d338725e71f8c048
prerequisite-patch-id: 185df995edeef5c8448682ac8abc6fbd42f90391
prerequisite-patch-id: 779f92f61bd7ee1d6a84106fa8e86dac4e660ec3
prerequisite-patch-id: 3b4c9f362251c0db6439bb6d63fc6d72564c0197
prerequisite-patch-id: cd60018a3d79ec2ac2c92f8554194a239decf33b
prerequisite-patch-id: 254ad01da5894d525bf859ca1b65f3ac6ca7e446
-- 
2.38.1





bug closed, send any further explanations to 60760 <at> debbugs.gnu.org and Maxim Cournoyer <maxim.cournoyer <at> gmail.com> Request was from Maxim Cournoyer <maxim.cournoyer <at> gmail.com> to control <at> debbugs.gnu.org. (Tue, 07 Feb 2023 20:15:01 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Wed, 08 Mar 2023 12:24:07 GMT) Full text and rfc822 format available.

This bug report was last modified 1 year and 47 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.