Add patches to make rpm work.
authorRichard W.M. Jones <rjones@redhat.com>
Wed, 10 Aug 2016 11:11:14 +0000 (12:11 +0100)
committerRichard W.M. Jones <rjones@redhat.com>
Wed, 10 Aug 2016 14:16:37 +0000 (15:16 +0100)
0001-RISCV-64-bit-riscv64-support.patch [moved from 0002-RISCV-64-bit-riscv64-support.patch with 95% similarity]
0002-build-fgetc-returns-int-not-char.patch [new file with mode: 0644]
0003-HACKS-TO-GET-RPM-TO-CROSS-COMPILE.patch [moved from 0001-HACKS-TO-GET-RPM-TO-CROSS-COMPILE.patch with 93% similarity]
Makefile

similarity index 95%
rename from 0002-RISCV-64-bit-riscv64-support.patch
rename to 0001-RISCV-64-bit-riscv64-support.patch
index 26ab199..297843a 100644 (file)
@@ -1,7 +1,7 @@
-From d34904540ecaabbcbfff8e99dc4c831b39f4ea32 Mon Sep 17 00:00:00 2001
+From 2b02641ebbfad717ef02f42c836b9b001a4269c9 Mon Sep 17 00:00:00 2001
 From: "Richard W.M. Jones" <rjones@redhat.com>
 Date: Tue, 9 Aug 2016 18:25:24 +0100
-Subject: [PATCH 2/2] RISCV 64-bit (riscv64) support.
+Subject: [PATCH 1/3] RISCV 64-bit (riscv64) support.
 
 Based on Mark Salter's aarch64 support patch (commit 8e1ca16c58).
 
diff --git a/0002-build-fgetc-returns-int-not-char.patch b/0002-build-fgetc-returns-int-not-char.patch
new file mode 100644 (file)
index 0000000..49887fe
--- /dev/null
@@ -0,0 +1,31 @@
+From 85b9fa7d081f70bbc5ef6266fbdbd7480e7331dc Mon Sep 17 00:00:00 2001
+From: "Richard W.M. Jones" <rjones@redhat.com>
+Date: Wed, 10 Aug 2016 15:01:31 +0100
+Subject: [PATCH 2/3] build: fgetc returns int, not char.
+
+Returning the value into a char is a mistake on all platforms, but is
+particularly bad on RISC-V.  On that platform (like ARM) char is
+unsigned.  Therefore EOF (-1) is returned as 255, and the subsequent
+test 'c == EOF' ('255 == -1') fails causing an infinite loop.
+
+Signed-off-by: Richard W.M. Jones <rjones@redhat.com>
+---
+ build/parseSpec.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/build/parseSpec.c b/build/parseSpec.c
+index 85b0ba3..28f00bc 100644
+--- a/build/parseSpec.c
++++ b/build/parseSpec.c
+@@ -323,7 +323,7 @@ retry:
+     /* Make sure we have something in the read buffer */
+     if (!(ofi->readPtr && *(ofi->readPtr))) {
+-      char c;
++      int c;
+       int i = 0;
+       while((c = fgetc(ofi->fp)) != EOF) {
+-- 
+2.7.4
+
similarity index 93%
rename from 0001-HACKS-TO-GET-RPM-TO-CROSS-COMPILE.patch
rename to 0003-HACKS-TO-GET-RPM-TO-CROSS-COMPILE.patch
index a73b122..8fa7e2a 100644 (file)
@@ -1,7 +1,7 @@
-From d6940aecfc237d215c3c067c16b386885ecd9ca8 Mon Sep 17 00:00:00 2001
+From 006666a5c9132bf0e580357fcbc671254724935a Mon Sep 17 00:00:00 2001
 From: "Richard W.M. Jones" <rjones@redhat.com>
 Date: Tue, 9 Aug 2016 18:21:57 +0100
-Subject: [PATCH 1/2] HACKS TO GET RPM TO CROSS-COMPILE
+Subject: [PATCH 3/3] HACKS TO GET RPM TO CROSS-COMPILE
 
 ---
  configure.ac | 28 ++++++++++++++++------------
index fbbfaca..7399986 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -649,8 +649,10 @@ stage3-chroot/usr/bin/rpm: rpm-$(RPM_SHORT_COMMIT).tar.gz db-$(BDB_VERSION).tar.
        tar -zxf rpm-$(RPM_SHORT_COMMIT).tar.gz
        tar -zxf db-$(BDB_VERSION).tar.gz -C rpm-$(RPM_SHORT_COMMIT)
        cd rpm-$(RPM_SHORT_COMMIT) && ln -s db-$(BDB_VERSION) db
-       cd rpm-$(RPM_SHORT_COMMIT) && patch -p1 < ../0001-HACKS-TO-GET-RPM-TO-CROSS-COMPILE.patch
-       cd rpm-$(RPM_SHORT_COMMIT) && patch -p1 < ../0002-RISCV-64-bit-riscv64-support.patch
+       cd rpm-$(RPM_SHORT_COMMIT) && \
+       patch -p1 < ../0001-RISCV-64-bit-riscv64-support.patch && \
+       patch -p1 < ../0002-build-fgetc-returns-int-not-char.patch && \
+       patch -p1 < ../0003-HACKS-TO-GET-RPM-TO-CROSS-COMPILE.patch
        cd rpm-$(RPM_SHORT_COMMIT) && autoreconf -i
        cd rpm-$(RPM_SHORT_COMMIT) && \
        PATH=$(ROOT)/fixed-gcc:$$PATH \