package/sdl2: disable altivec built-in function for PowerPC
authorRomain Naour <romain.naour@gmail.com>
Tue, 28 Feb 2017 23:24:52 +0000 (00:24 +0100)
committerThomas Petazzoni <thomas.petazzoni@free-electrons.com>
Wed, 1 Mar 2017 20:54:25 +0000 (21:54 +0100)
As reported in this bug report [1], altivec support in SDL break
arbitrary C++ code.

Issue reported by test-pkg script while testing supertux package:
    error: could not convert 'true' from 'bool' to '__vector(4) __bool int'

[1] https://bugs.debian.org/cgi-bin/bugreport.cgi/?bug=770670

Signed-off-by: Romain Naour <romain.naour@gmail.com>
Cc: Sam Bobroff <sam.bobroff@au1.ibm.com>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
package/sdl2/sdl2.mk

index d2ee50dc1d7ed5f12eef84171e9c93e5a9f34b52..628d9060b4bce601e1439882598c409b5638f3a6 100644 (file)
@@ -23,6 +23,16 @@ SDL2_CONF_OPTS += \
 # We must enable static build to get compilation successful.
 SDL2_CONF_OPTS += --enable-static
 
+# From https://bugs.debian.org/cgi-bin/bugreport.cgi/?bug=770670
+# "The problem lies within SDL_cpuinfo.h.  It includes altivec.h, which by
+# definition provides an unconditional vector, pixel and bool define in
+# standard-c++ mode.  In GNU-c++ mode this names are only defined
+# context-sensitive by cpp.  SDL_cpuinfo.h is included by SDL.h.
+# Including altivec.h makes arbitrary code break."
+ifeq ($(BR2_POWERPC_CPU_HAS_ALTIVEC),y)
+SDL2_CONF_OPTS += --disable-altivec
+endif
+
 ifeq ($(BR2_PACKAGE_HAS_UDEV),y)
 SDL2_DEPENDENCIES += udev
 SDL2_CONF_OPTS += --enable-libudev