Source: a56
Version: 1.3+dfsg-15
Tags: patch upstream
User: [email protected]
Usertags: ftcbfs

a56 fails to cross build from source as it fails stripping keybld. They
keybld tool is in a strange position as it is both run during build and
installed into the package. The upstream Makefile partially recognizes
this and compiles it using $(HOSTCC). Unfortunately, that results in it
being the wrong architecture for packaging. There is no right here as
the installed one must be host and the run one must be build. What we
actually need here is building them twice. I am attaching a patch to the
Makefile that implements this need. When HOSTCC equals CC, there is no
need to build them twice, so my patch ensures that the native case
remains as before. Please consider forwarding the patch upstream.

Helmut
--- a56-1.3+dfsg.orig/Makefile
+++ a56-1.3+dfsg/Makefile
@@ -63,6 +63,13 @@
 #DEFINES = -DYYDEBUG -DLDEBUG $(CCDEFS)
 
 CFLAGS += $(DEBUG) $(DEFINES) $(CPPFLAGS) $(LDFLAGS)
+HOSTCFLAGS += $(DEBUG) $(DEFINES) $(HOSTCPPFLAGS) $(HOSTLDFLAGS)
+
+ifeq ($(CC),$(HOSTCC))
+HOST_KEYBLD = keybld
+else
+HOST_KEYBLD = host_keybld
+endif
 
 all:	keybld a56 toomf a56-tobin bin2h
 
@@ -71,20 +78,30 @@
 	@$(POSTPROCESS) a56
 
 keybld:	keybld.o ksubs.o
-	$(HOSTCC) $(CFLAGS) -o keybld keybld.o ksubs.o
+	$(CC) $(CFLAGS) -o keybld keybld.o ksubs.o
 	@$(POSTPROCESS) keybld
 
+host_keybld: host_keybld.o host_ksubs.o
+	$(HOSTCC) $(HOSTCFLAGS) -o host_keybld host_keybld.o host_ksubs.o
+	@$(POSTPROCESS) host_keybld
+
 keybld.o:	keybld.c
-	$(HOSTCC) $(CFLAGS) -c keybld.c
+	$(CC) $(CFLAGS) -c keybld.c
+
+host_keybld.o: keybld.c
+	$(HOSTCC) $(HOSTCFLAGS) -c keybld.c -o host_keybld.o
 
 ksubs.o:	subs.c
-	$(HOSTCC) $(CFLAGS) -c subs.c
+	$(CC) $(CFLAGS) -c subs.c
 	$(MV) subs.o ksubs.o
 
+host_ksubs.o: subs.c
+	$(HOSTCC) $(HOSTCFLAGS) -c subs.c -o host_ksubs.o
+
 lex.o:	lex.c a56.h gram.h
 
-kparse.c:	a56.key keybld
-	./keybld < a56.key > kparse.c
+kparse.c:	a56.key $(HOST_KEYBLD)
+	./$(HOST_KEYBLD) < a56.key > kparse.c
 
 gram.c gram.h:	a56.y
 	@echo "[expect 2 shift/reduce conflicts here]"
@@ -112,7 +129,7 @@
 
 main.o:	a56.h gram.h
 
-clean:	; rm -f a56 toomf y.output *.o *.out tmp *.bak a56.tar.gz keybld
+clean:	; rm -f a56 toomf y.output *.o *.out tmp *.bak a56.tar.gz keybld host_keybld
 
 spotless:	clean
 	rm -f gram.c lexyy.c gram.h toktab.c kparse.c

Reply via email to