git: 2ff55486c633 - main - graphics/libemf: fix build on riscv64
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Fri, 11 Nov 2022 20:50:24 UTC
The branch main has been updated by otis:
URL: https://cgit.FreeBSD.org/ports/commit/?id=2ff55486c6332a41e6ce8ebd9fcee56d467a012e
commit 2ff55486c6332a41e6ce8ebd9fcee56d467a012e
Author: Robert Clausecker <fuz@fuz.su>
AuthorDate: 2022-11-11 20:49:16 +0000
Commit: Juraj Lutter <otis@FreeBSD.org>
CommitDate: 2022-11-11 20:49:16 +0000
graphics/libemf: fix build on riscv64
Add missing RISC-V specific bits to winnt.h to make the build succeed.
These bits are custom written stubs.
PR: 267395
Approved by: maintainer timeout
---
graphics/libemf/Makefile | 2 -
.../libemf/files/patch-include_libEMF_wine_winnt.h | 85 ++++++++++++++++++++++
2 files changed, 85 insertions(+), 2 deletions(-)
diff --git a/graphics/libemf/Makefile b/graphics/libemf/Makefile
index 8548082ed7a5..acc1b9079707 100644
--- a/graphics/libemf/Makefile
+++ b/graphics/libemf/Makefile
@@ -10,8 +10,6 @@ WWW= http://libemf.sourceforge.net/
LICENSE= LGPL21
-BROKEN_riscv64= fails to build: ../include/libEMF/wine/winnt.h:77:3: Unknown CPU architecture
-
OPTIONS_DEFINE= DOCS
USES= cpe libtool
diff --git a/graphics/libemf/files/patch-include_libEMF_wine_winnt.h b/graphics/libemf/files/patch-include_libEMF_wine_winnt.h
new file mode 100644
index 000000000000..66804ae95911
--- /dev/null
+++ b/graphics/libemf/files/patch-include_libEMF_wine_winnt.h
@@ -0,0 +1,85 @@
+--- include/libEMF/wine/winnt.h.orig 2022-10-27 16:15:39 UTC
++++ include/libEMF/wine/winnt.h
+@@ -69,6 +69,10 @@
+ # define WORDS_BIGENDIAN
+ # define BITFIELDS_BIGENDIAN
+ # undef ALLOW_UNALIGNED_ACCESS
++#elif defined(__riscv)
++# undef WORDS_BIGENDIAN
++# undef BITFIELDS_BIGENDIAN
++# define ALLOW_UNALIGNED_ACCESS
+ #elif !defined(RC_INVOKED)
+ # error Unknown CPU architecture!
+ #endif
+@@ -1581,6 +1585,71 @@ typedef struct _CONTEXT {
+ } CONTEXT;
+
+ #endif /* __e2k__ */
++
++#if __riscv_xlen == 64
++/*
++ * FIXME:
++ *
++ * There is not yet an official CONTEXT structure defined for
++ * RV64, so I just made one up.
++ *
++ */
++
++#define CONTEXT_RV64 0x4000000
++#define CONTEXT_CONTROL (CONTEXT_RV64 | 0x00000001)
++#define CONTEXT_INTEGER (CONTEXT_RV64 | 0x00000002)
++#define CONTEXT_FLOATING_POINT (CONTEXT_RV64 | 0x00000004)
++
++#define CONTEXT_FULL (CONTEXT_CONTROL | CONTEXT_INTEGER | CONTEXT_FLOATING_POINT)
++
++#define EXCEPTION_READ_FAULT 0
++#define EXCEPTION_WRITE_FAULT 1
++#define EXCEPTION_EXECUTE_FAULT 8
++
++typedef struct _CONTEXT {
++ ULONG ContextFlags;
++
++ /* This section is specified/returned if the ContextFlags word contains
++ the flag CONTEXT_INTEGER. */
++ ULONGLONG R1;
++ ULONGLONG R2;
++ ULONGLONG R3;
++ ULONGLONG R4;
++ ULONGLONG R5;
++ ULONGLONG R6;
++ ULONGLONG R7;
++ ULONGLONG R8;
++ ULONGLONG R9;
++ ULONGLONG R10;
++ ULONGLONG R12;
++ ULONGLONG R13;
++ ULONGLONG R14;
++ ULONGLONG R15;
++ ULONGLONG R16;
++ ULONGLONG R17;
++ ULONGLONG R18;
++ ULONGLONG R19;
++ ULONGLONG R20;
++ ULONGLONG R21;
++ ULONGLONG R22;
++ ULONGLONG R23;
++ ULONGLONG R24;
++ ULONGLONG R25;
++ ULONGLONG R26;
++ ULONGLONG R27;
++ ULONGLONG R28;
++ ULONGLONG R29;
++ ULONGLONG R30;
++ ULONGLONG R31;
++
++ /* These are selected by CONTEXT_CONTROL */
++ ULONGLONG Pc;
++
++ /* These are selected by CONTEXT_FLOATING_POINT */
++
++} CONTEXT;
++
++#endif /* __riscv */
+
+ #if !defined(CONTEXT_FULL) && !defined(RC_INVOKED)
+ #error You need to define a CONTEXT for your CPU