aboutsummaryrefslogtreecommitdiffstats
path: root/graphics
diff options
context:
space:
mode:
authorzeising <zeising@FreeBSD.org>2013-01-31 00:21:26 +0800
committerzeising <zeising@FreeBSD.org>2013-01-31 00:21:26 +0800
commite9814d23ea37929381fca80150dcd7181abc9454 (patch)
tree892d9ac98ac4f2ee50d774513c615dba3b6da124 /graphics
parentda12f4eb6154fdf372a843374ff69d22f5bf7637 (diff)
downloadfreebsd-ports-gnome-e9814d23ea37929381fca80150dcd7181abc9454.tar.gz
freebsd-ports-gnome-e9814d23ea37929381fca80150dcd7181abc9454.tar.zst
freebsd-ports-gnome-e9814d23ea37929381fca80150dcd7181abc9454.zip
Add patches to fix build with clang by replacing some inline assembly with
optimal code, and removing some unneded casts. Submitted by: dim Approved by: kwm, miwi (mentors, implicit)
Diffstat (limited to 'graphics')
-rw-r--r--graphics/svgalib/Makefile3
-rw-r--r--graphics/svgalib/files/patch-gl::driver.c29
-rw-r--r--graphics/svgalib/files/patch-gl::line.c23
-rw-r--r--graphics/svgalib/files/patch-src::vgapix.c33
4 files changed, 85 insertions, 3 deletions
diff --git a/graphics/svgalib/Makefile b/graphics/svgalib/Makefile
index 9fb5e8528172..2a7a2d50b81e 100644
--- a/graphics/svgalib/Makefile
+++ b/graphics/svgalib/Makefile
@@ -39,9 +39,6 @@ post-patch: .SILENT
${REINPLACE_CMD} -e '30d' ${WRKSRC}/src/vgabg.h
${REINPLACE_CMD} -e 's,^ (unsigned [[:alpha:]]*),,' \
${WRKSRC}/src/apm.c
-# Allow to build on !i386
- ${REINPLACE_CMD} -e '29,36s,def __alpha__, defined(NO_ASSEMBLY),' \
- ${WRKSRC}/src/vgapix.c ${WRKSRC}/gl/driver.c
# 024_vesa_not_print_crap.patch from Debian
${REINPLACE_CMD} -e '/^printf/d' ${WRKSRC}/src/vesa.c
# Clean up after typo fixes in manpages
diff --git a/graphics/svgalib/files/patch-gl::driver.c b/graphics/svgalib/files/patch-gl::driver.c
new file mode 100644
index 000000000000..eefc4a15c406
--- /dev/null
+++ b/graphics/svgalib/files/patch-gl::driver.c
@@ -0,0 +1,29 @@
+--- gl/driver.c.orig 1999-07-18 10:18:44.000000000 +0200
++++ gl/driver.c 2013-01-26 21:34:27.000000000 +0100
+@@ -1,6 +1,7 @@
+ /* driver.c Framebuffer primitives */
+
+
++#include <sys/endian.h>
+ #include <stdio.h>
+ #include <stdlib.h>
+ #include <string.h>
+@@ -33,17 +34,7 @@ static inline int RGB2BGR(int c)
+ /* However bswap is not supported by 386 */
+
+ if (MODEFLAGS & MODEFLAG_24BPP_REVERSED)
+-#ifdef __alpha__
+- c = ((c >> 0) & 0xff) << 16 |
+- ((c >> 8) & 0xff) << 8 |
+- ((c >> 16) & 0xff) << 0;
+-#else
+- asm("rorw $8, %0\n" /* 0RGB -> 0RBG */
+- "rorl $16, %0\n" /* 0RBG -> BG0R */
+- "rorw $8, %0\n" /* BG0R -> BGR0 */
+- "shrl $8, %0\n" /* 0BGR -> 0BGR */
+- : "=q"(c):"0"(c));
+-#endif
++ c = bswap32(c) >> 8;
+ return c;
+ }
+
diff --git a/graphics/svgalib/files/patch-gl::line.c b/graphics/svgalib/files/patch-gl::line.c
new file mode 100644
index 000000000000..5c4e28d87c75
--- /dev/null
+++ b/graphics/svgalib/files/patch-gl::line.c
@@ -0,0 +1,23 @@
+--- gl/line.c.orig 1999-12-05 08:32:54.000000000 +0100
++++ gl/line.c 2013-01-26 21:25:52.000000000 +0100
+@@ -90,13 +90,13 @@ static inline int gl_regioncode (int x,
+
+ #else
+
+-#define INC_IF_NEG(y, result) \
+-{ \
+- __asm__("btl $31,%1\n\t" \
+- "adcl $0,%0" \
+- : "=r" ((int) result) \
+- : "rm" ((int) (y)), "0" ((int) result) \
+- ); \
++#define INC_IF_NEG(y, result) \
++{ \
++ __asm__("btl $31,%1\n\t" \
++ "adcl $0,%0" \
++ : "=r" (result) \
++ : "rm" (y), "0" (result) \
++ ); \
+ }
+
+ static inline int gl_regioncode (int x, int y)
diff --git a/graphics/svgalib/files/patch-src::vgapix.c b/graphics/svgalib/files/patch-src::vgapix.c
new file mode 100644
index 000000000000..cccdddb749d5
--- /dev/null
+++ b/graphics/svgalib/files/patch-src::vgapix.c
@@ -0,0 +1,33 @@
+--- src/vgapix.c.orig 1999-07-27 18:36:19.000000000 +0200
++++ src/vgapix.c 2013-01-26 21:14:42.000000000 +0100
+@@ -8,6 +8,7 @@
+ /* partially copyrighted (C) 1993 by Hartmut Schirmer */
+ /* HH: Added 4bpp support, and use bytesperpixel. */
+
++#include <sys/endian.h>
+ #include <stdio.h>
+ #include "vga.h"
+ #include "libvga.h"
+@@ -22,21 +23,8 @@ static inline void read_write(unsigned l
+
+ static inline int RGB2BGR(int c)
+ {
+-/* a bswap would do the same as the first 3 but in only ONE! cycle. */
+-/* However bswap is not supported by 386 */
+-
+ if (MODEFLAGS & RGB_MISORDERED)
+-#ifdef __alpha__
+- c = ((c >> 0) & 0xff) << 16 |
+- ((c >> 8) & 0xff) << 8 |
+- ((c >> 16) & 0xff) << 0;
+-#else
+- asm("rorw $8, %0\n" /* 0RGB -> 0RBG */
+- "rorl $16, %0\n" /* 0RBG -> BG0R */
+- "rorw $8, %0\n" /* BG0R -> BGR0 */
+- "shrl $8, %0\n" /* 0BGR -> 0BGR */
+- : "=q"(c):"0"(c));
+-#endif
++ c = bswap32(c) >> 8;
+ return c;
+ }
+