From: Richard W.M. Jones Date: Wed, 10 Aug 2016 11:11:14 +0000 (+0100) Subject: Add patches to make rpm work. X-Git-Url: http://git.annexia.org/?a=commitdiff_plain;h=54c2a1a95a177dbf15d3d65d8e5f9cf53a3c8d71;p=fedora-riscv.git Add patches to make rpm work. --- diff --git a/0002-RISCV-64-bit-riscv64-support.patch b/0001-RISCV-64-bit-riscv64-support.patch 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 --- a/0002-RISCV-64-bit-riscv64-support.patch +++ b/0001-RISCV-64-bit-riscv64-support.patch @@ -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" 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 index 0000000..49887fe --- /dev/null +++ b/0002-build-fgetc-returns-int-not-char.patch @@ -0,0 +1,31 @@ +From 85b9fa7d081f70bbc5ef6266fbdbd7480e7331dc Mon Sep 17 00:00:00 2001 +From: "Richard W.M. Jones" +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 +--- + 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 + diff --git a/0001-HACKS-TO-GET-RPM-TO-CROSS-COMPILE.patch b/0003-HACKS-TO-GET-RPM-TO-CROSS-COMPILE.patch 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 --- a/0001-HACKS-TO-GET-RPM-TO-CROSS-COMPILE.patch +++ b/0003-HACKS-TO-GET-RPM-TO-CROSS-COMPILE.patch @@ -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" 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 ++++++++++++++++------------ diff --git a/Makefile b/Makefile index fbbfaca..7399986 100644 --- 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 \