On Wed, Sep 21, 2022 at 10:13:44PM -0400, George Koehler wrote: > graphics/webp-pixbuf-loader failed in the ongoing powerpc bulk, but > this looks easy to fix. OpenBSD doesn't have <byteswap.h>, so use > <endian.h> (on big-endian platforms like powerpc and sparc64). With > this patch, "make package" works and "make test" passes on powerpc.
This uses the compiler builtin __BYTE_ORDER__ instead of endian.h BYTE_ORDER. Both could be avoided by using htole32() instead. Then the two ifdefs could be removed as well. > > ok to commit? > > ../webp-pixbuf-loader-0.0.6/io-webp.c:16:10: fatal error: 'byteswap.h' > file not found > #include <byteswap.h> > ^~~~~~~~~~~~ > 1 error generated. > > Index: Makefile > =================================================================== > RCS file: /cvs/ports/graphics/webp-pixbuf-loader/Makefile,v > retrieving revision 1.1.1.1 > diff -u -p -r1.1.1.1 Makefile > --- Makefile 12 Aug 2022 11:42:55 -0000 1.1.1.1 > +++ Makefile 22 Sep 2022 01:57:35 -0000 > @@ -3,6 +3,7 @@ COMMENT= WebP GDK Pixbuf Loader library > GH_ACCOUNT= aruiz > GH_PROJECT= webp-pixbuf-loader > GH_TAGNAME= 0.0.6 > +REVISION= 0 > > CATEGORIES= graphics > > Index: patches/patch-io-webp_c > =================================================================== > RCS file: patches/patch-io-webp_c > diff -N patches/patch-io-webp_c > --- /dev/null 1 Jan 1970 00:00:00 -0000 > +++ patches/patch-io-webp_c 22 Sep 2022 01:57:35 -0000 > @@ -0,0 +1,23 @@ > +Use <endian.h> on BE_ARCHS; OpenBSD doesn't have <byteswap.h>. > + > +Index: io-webp.c > +--- io-webp.c.orig > ++++ io-webp.c > +@@ -13,7 +13,7 @@ > + #include "io-webp.h" > + > + #if __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__ > +-#include <byteswap.h> > ++#include <endian.h> > + #endif > + > + #define IMAGE_READ_BUFFER_SIZE 65535 > +@@ -279,7 +279,7 @@ gdk_pixbuf__webp_anim_load_increment (gpointer co > + uint32_t anim_size = *(uint32_t *) (buf + 4); /* gives file > size not counting the first 8 bytes. */ > + > + #if __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__ > +- anim_size = bswap_32(anim_size); > ++ anim_size = swap32(anim_size); > + #endif > + > + uint32_t file_size = anim_size + 8; > >