GNU bug report logs - #53833
[PATCH] gnu: Add qbe.

Previous Next

Package: guix-patches;

Reported by: jgart <jgart <at> dismail.de>

Date: Mon, 7 Feb 2022 01:21:01 UTC

Severity: normal

Tags: patch

Merged with 55150, 55151, 55605

Done: Liliana Marie Prikler <liliana.prikler <at> gmail.com>

Bug is archived. No further changes may be made.

Full log


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

From: "(unmatched-parenthesis" <paren <at> disroot.org>
To: 53833 <at> debbugs.gnu.org
Cc: "\(unmatched-parenthesis" <paren <at> disroot.org>
Subject: [PATCH] gnu: patches: Add qbe-makefile-add-target.patch.
Date: Sat,  7 May 2022 18:11:04 +0100
* gnu/packages/patches/qbe-makefile-add-target.patch: New variable.

Signed-off-by: (unmatched-parenthesis <paren <at> disroot.org>
---
 .../patches/qbe-makefile-add-target.patch     | 56 +++++++++++++++++++
 1 file changed, 56 insertions(+)
 create mode 100644 gnu/packages/patches/qbe-makefile-add-target.patch

diff --git a/gnu/packages/patches/qbe-makefile-add-target.patch b/gnu/packages/patches/qbe-makefile-add-target.patch
new file mode 100644
index 0000000000..e87559c3fa
--- /dev/null
+++ b/gnu/packages/patches/qbe-makefile-add-target.patch
@@ -0,0 +1,56 @@
+This patch modifies the QBE makefile to add a TARGET variable that allows us to support
+cross-compiling it. We modify the case...esac in the config.h target to use this variable
+instead of TARGET.
+--- a/Makefile
++++ b/Makefile
+@@ -17,6 +17,8 @@ OBJ      = $(SRC:%.c=$(OBJDIR)/%.o) $(AMD64OBJ) $(ARM64OBJ) $(RV64OBJ)
+ 
+ CFLAGS += -Wall -Wextra -std=c99 -g -pedantic
+ 
++TARGET = unknown
++
+ $(OBJDIR)/$(BIN): $(OBJ) $(OBJDIR)/timestamp
+ 	@test -z "$(V)" || echo "ld $@"
+ 	$(V)$(CC) $(LDFLAGS) $(OBJ) -o $@
+@@ -39,26 +41,21 @@ $(RV64OBJ): rv64/all.h
+ $(OBJDIR)/main.o: config.h
+ 
+ config.h:
+-	@case `uname` in                               \
+-	*Darwin*)                                      \
+-		echo "#define Defasm Gasmacho";        \
+-		echo "#define Deftgt T_amd64_sysv";    \
+-		;;                                     \
+-	*)                                             \
+-		echo "#define Defasm Gaself";          \
+-		case `uname -m` in                     \
+-		*aarch64*)                             \
+-			echo "#define Deftgt T_arm64"; \
+-			;;                             \
+-		*riscv64*)                             \
+-			echo "#define Deftgt T_rv64";  \
+-			;;                             \
+-		*)                                     \
+-			echo "#define Deftgt T_amd64_sysv";\
+-			;;                             \
+-		esac                                   \
+-		;;                                     \
+-	esac > $@
++	@echo "#define Defasm Gaself" >> $@
++	@case $(TARGET) in \
++	*x86_64*) \
++		echo "#define Deftgt T_amd64_sysv"; \
++		;; \
++	*aarch64*) \
++		echo "#define Deftgt T_arm64"; \
++		;; \
++	*riscv64*) \
++		echo "#define Deftgt T_rv64"; \
++		;; \
++	*) \
++		echo "#error target not set to x86_64, aarch64, or riscv64 in makefile"; \
++		;; \
++	esac >> $@
+ 
+ install: $(OBJDIR)/$(BIN)
+ 	mkdir -p "$(DESTDIR)/$(PREFIX)/bin/"
-- 
2.36.0





This bug report was last modified 3 years and 49 days ago.

Previous Next


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