devel/sdl20: fix build on powerpc*

Fix ALTIVEC detection on FreeBSD.
This commit is contained in:
Piotr Kubaj 2020-07-10 15:02:31 +00:00
parent 388b188225
commit f8ac971618
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=541862
2 changed files with 25 additions and 0 deletions

View file

@ -14,6 +14,7 @@ LICENSE_FILE= ${WRKSRC}/COPYING.txt
GNU_CONFIGURE= yes
USES= gmake iconv libtool localbase:ldflags pathfix pkgconfig
USE_CSTD= c99
USE_LDCONFIG= yes
CONFIGURE_ARGS+= --disable-arts \

View file

@ -0,0 +1,24 @@
--- src/cpuinfo/SDL_cpuinfo.c.orig 2020-03-11 01:36:18 UTC
+++ src/cpuinfo/SDL_cpuinfo.c
@@ -49,7 +49,7 @@
#endif
#if defined(__MACOSX__) && (defined(__ppc__) || defined(__ppc64__))
#include <sys/sysctl.h> /* For AltiVec check */
-#elif defined(__OpenBSD__) && defined(__powerpc__)
+#elif (defined(__OpenBSD__) || defined(__FreeBSD__)) && defined(__powerpc__)
#include <sys/param.h>
#include <sys/sysctl.h> /* For AltiVec check */
#include <machine/cpu.h>
@@ -314,9 +314,11 @@ CPU_haveAltiVec(void)
{
volatile int altivec = 0;
#ifndef SDL_CPUINFO_DISABLED
-#if (defined(__MACOSX__) && (defined(__ppc__) || defined(__ppc64__))) || (defined(__OpenBSD__) && defined(__powerpc__))
+#if (defined(__MACOSX__) && (defined(__ppc__) || defined(__ppc64__))) || (defined(__OpenBSD__) && defined(__powerpc__)) || (defined(__FreeBSD__) && defined(__powerpc__))
#ifdef __OpenBSD__
int selectors[2] = { CTL_MACHDEP, CPU_ALTIVEC };
+#elif __FreeBSD__
+ int selectors[2] = { CTL_HW, PPC_FEATURE_HAS_ALTIVEC };
#else
int selectors[2] = { CTL_HW, HW_VECTORUNIT };
#endif