gnu: bc: Fix cross-compilation.
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. Series-postfix: core-updates Series-to: 60760@debbugs.gnu.orgmaster
parent
70b7d19ecf
commit
f8c1dba3d3
|
@ -685,7 +685,7 @@ binary.")
|
||||||
(patches (search-patches "bc-fix-cross-compilation.patch"))))
|
(patches (search-patches "bc-fix-cross-compilation.patch"))))
|
||||||
(build-system gnu-build-system)
|
(build-system gnu-build-system)
|
||||||
(native-inputs
|
(native-inputs
|
||||||
(list automake autoconf ed flex texinfo))
|
(list automake autoconf ed flex readline texinfo))
|
||||||
(inputs
|
(inputs
|
||||||
(list readline))
|
(list readline))
|
||||||
(arguments
|
(arguments
|
||||||
|
|
|
@ -1,15 +1,19 @@
|
||||||
Patch taken from nix.
|
Patch adapted from Nix.
|
||||||
|
Upstream-status: Submitted to bug-bc@gnu.org.
|
||||||
commit fdda59736ddc048cf38a2c7103f4f5d9eeaf995e
|
|
||||||
Author: Ben Gamari <ben@smart-cactus.org>
|
|
||||||
Date: Tue Oct 17 10:51:34 2017 -0400
|
|
||||||
|
|
||||||
Try implementing cross-compilation
|
|
||||||
|
|
||||||
diff --git a/bc/Makefile.am b/bc/Makefile.am
|
diff --git a/bc/Makefile.am b/bc/Makefile.am
|
||||||
index d9d412e..fdef633 100644
|
index d9d412e..13f2b1e 100644
|
||||||
--- a/bc/Makefile.am
|
--- a/bc/Makefile.am
|
||||||
+++ b/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 \
|
@@ -17,6 +17,7 @@ MAINTAINERCLEANFILES = Makefile.in bc.c bc.h scan.c \
|
||||||
|
|
||||||
AM_CPPFLAGS = -I$(srcdir) -I$(srcdir)/../h
|
AM_CPPFLAGS = -I$(srcdir) -I$(srcdir)/../h
|
||||||
|
@ -18,31 +22,36 @@ index d9d412e..fdef633 100644
|
||||||
LIBL = @LEXLIB@
|
LIBL = @LEXLIB@
|
||||||
LDADD = $(LIBBC) $(LIBL) @READLINELIB@
|
LDADD = $(LIBBC) $(LIBL) @READLINELIB@
|
||||||
|
|
||||||
@@ -29,12 +30,20 @@ $(PROGRAMS): libmath.h $(LIBBC)
|
@@ -29,15 +30,22 @@ $(PROGRAMS): libmath.h $(LIBBC)
|
||||||
scan.o: bc.h
|
scan.o: bc.h
|
||||||
global.o: libmath.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 = 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
|
||||||
+%.o_host : CC:=$(CC_FOR_BUILD)
|
+ $(COMPILE) -c -o $@ $<
|
||||||
+
|
|
||||||
+%.o_host : %.c
|
|
||||||
+ $(COMPILE) -c $(CFLAGS) $(INCLUDES) -o $@ $<
|
|
||||||
|
|
||||||
-libmath.h: libmath.b $(fbcOBJ) $(LIBBC)
|
-libmath.h: libmath.b $(fbcOBJ) $(LIBBC)
|
||||||
+libmath.h: libmath.b $(fbcOBJ) $(LIBBC_HOST)
|
- echo '{0}' > libmath.h
|
||||||
echo '{0}' > libmath.h
|
|
||||||
- $(MAKE) global.o
|
- $(MAKE) global.o
|
||||||
- $(LINK) -o fbc $(fbcOBJ) global.o $(LIBBC) $(LIBL) $(READLINELIB) $(LIBS)
|
- $(LINK) -o fbc $(fbcOBJ) global.o $(LIBBC) $(LIBL) $(READLINELIB) $(LIBS)
|
||||||
+ $(MAKE) global.o_host
|
- ./fbc -c $(srcdir)/libmath.b </dev/null >libmath.h
|
||||||
+ $(CC_FOR_BUILD) -o fbc $(fbcOBJ) global.o_host $(LIBBC_HOST) $(LIBL) ${READLINELIB} $(LIBS)
|
+fbcOBJ = $(addsuffix _host,\
|
||||||
./fbc -c $(srcdir)/libmath.b </dev/null >libmath.h
|
+ 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
|
$(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
|
diff --git a/configure.ac b/configure.ac
|
||||||
index fc74573..5cabb73 100644
|
index fc74573..5cabb73 100644
|
||||||
--- a/configure.ac
|
--- a/configure.ac
|
||||||
|
@ -64,7 +73,7 @@ index fc74573..5cabb73 100644
|
||||||
|
|
||||||
AM_PROG_LEX
|
AM_PROG_LEX
|
||||||
diff --git a/lib/Makefile.am b/lib/Makefile.am
|
diff --git a/lib/Makefile.am b/lib/Makefile.am
|
||||||
index ec4bf59..c670f5b 100644
|
index ec4bf59..24c9f42 100644
|
||||||
--- a/lib/Makefile.am
|
--- a/lib/Makefile.am
|
||||||
+++ b/lib/Makefile.am
|
+++ b/lib/Makefile.am
|
||||||
@@ -1,5 +1,5 @@
|
@@ -1,5 +1,5 @@
|
||||||
|
@ -74,14 +83,23 @@ index ec4bf59..c670f5b 100644
|
||||||
|
|
||||||
AM_CPPFLAGS = -I. -I.. -I$(srcdir)/../h
|
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
|
specialnumber: newnumber.o
|
||||||
cp newnumber.o number.o
|
cp newnumber.o number.o
|
||||||
+
|
+
|
||||||
+%.o_host : CC:=$(CC_FOR_BUILD)
|
+%.o_host: CC := $(CC_FOR_BUILD)
|
||||||
+%.o_host : %.c
|
+%.o_host : %.c
|
||||||
+ $(COMPILE) -c $(CFLAGS) $(INCLUDES) -o $@ $<
|
+ $(COMPILE) -c -o $@ $<
|
||||||
+
|
+
|
||||||
+libbc_host.a : $(addsuffix _host,$(libbc_a_OBJECTS))
|
+libbc_host.a : $(addsuffix _host,$(libbc_a_OBJECTS))
|
||||||
+ ar cru $@ $+
|
+ ar cru $@ $+
|
||||||
|
|
Reference in New Issue