From 07d27c9c2d8dc5ebc3e80aaff3d4302155ef480d Mon Sep 17 00:00:00 2001 From: Niclas Zeising Date: Wed, 30 Jan 2013 16:21:26 +0000 Subject: [PATCH] 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) --- graphics/svgalib/Makefile | 3 -- graphics/svgalib/files/patch-gl::driver.c | 29 +++++++++++++++++++ graphics/svgalib/files/patch-gl::line.c | 23 +++++++++++++++ graphics/svgalib/files/patch-src::vgapix.c | 33 ++++++++++++++++++++++ 4 files changed, 85 insertions(+), 3 deletions(-) create mode 100644 graphics/svgalib/files/patch-gl::driver.c create mode 100644 graphics/svgalib/files/patch-gl::line.c create mode 100644 graphics/svgalib/files/patch-src::vgapix.c 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 + #include + #include + #include +@@ -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 + #include + #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; + } +