On Mon, May 08, 2017 at 10:10:31PM +0200, Donovan Watteau wrote:
> Hi,
>
> SDL2 apps on macppc give you harsh whitenoise instead of sound at the
> moment. That's because of a poor endianness check in SDL2, so your
> audio samples are played in little-endian, while we use PowerPC as a
> big-endian arch. Some other bugs might also happen because of this.
>
> Instead of looking for arch defines and miss some of them, let's just
> use <endian.h>, which is way simpler, and accurate. This could also
> be backported to sdl1, which just happens to be luckier, it seems.
>
> I think a minor SHARED_LIBS bump is enough (dependent ports need
> to be recompiled for the change to take effect on macppc), but please
> check.
Thanks, I've committed this but dropped the minor crank. I think
the REVISION change should be enough.
>
> Tested with scummvm and starfighter.
>
> Index: Makefile
> ===================================================================
> RCS file: /cvs/ports/devel/sdl2/Makefile,v
> retrieving revision 1.15
> diff -u -p -r1.15 Makefile
> --- Makefile 10 Nov 2016 10:08:04 -0000 1.15
> +++ Makefile 8 May 2017 20:03:00 -0000
> @@ -1,15 +1,16 @@
> # $OpenBSD: Makefile,v 1.15 2016/11/10 10:08:04 jca Exp $
>
> COMMENT= cross-platform multimedia library
> -BROKEN-hppa= src/atomic/SDL_spinlock.c:101:2: error: #error Please implement
> for your platform.
> +BROKEN-hppa= src/atomic/SDL_spinlock.c:101:2: error: \#error Please
> implement for your platform.
>
> V= 2.0.5
> +REVISION= 0
> DISTNAME= SDL2-${V}
> PKGNAME= sdl2-${V}
> CATEGORIES= devel
> MASTER_SITES= http://www.libsdl.org/release/
>
> -SHARED_LIBS= SDL2 0.3
> +SHARED_LIBS= SDL2 0.4
>
> HOMEPAGE= http://www.libsdl.org/
>
> Index: patches/patch-include_SDL_endian_h
> ===================================================================
> RCS file: patches/patch-include_SDL_endian_h
> diff -N patches/patch-include_SDL_endian_h
> --- /dev/null 1 Jan 1970 00:00:00 -0000
> +++ patches/patch-include_SDL_endian_h 8 May 2017 20:03:00 -0000
> @@ -0,0 +1,19 @@
> +$OpenBSD$
> +
> +<endian.h> is simpler and more reliable.
> +
> +Index: include/SDL_endian.h
> +--- include/SDL_endian.h.orig
> ++++ include/SDL_endian.h
> +@@ -42,7 +42,10 @@
> + #ifdef __linux__
> + #include <endian.h>
> + #define SDL_BYTEORDER __BYTE_ORDER
> +-#else /* __linux__ */
> ++#elif defined(__OpenBSD__)
> ++#include <endian.h>
> ++#define SDL_BYTEORDER BYTE_ORDER
> ++#else
> + #if defined(__hppa__) || \
> + defined(__m68k__) || defined(mc68000) || defined(_M_M68K) || \
> + (defined(__MIPS__) && defined(__MISPEB__)) || \
>