freebsd-ports/multimedia/libx264/files/patch-common_cpu.c
Kubilay Kocak 23384aba46 multimedia/{lib}x264: Fix build on ARMv6
- Fix build for missing symbols on ARMv6 [1]
- Backport upstream 9463ec00 to fix default AS on ARM [2]
- Remove unecessary WRKSRC override (x264)
- Whitespace alignment

[2] http://git.videolan.org/?p=x264.git;a=patch;h=9463ec

PR:		196033 [1]
Submitted by:	Mikael Urandar <mikael.urankar at gmail com> [1]
Tested by:	sbruno
2014-12-31 06:20:13 +00:00

29 lines
880 B
C

--- common/cpu.c.orig 2014-08-27 20:45:08 UTC
+++ common/cpu.c
@@ -313,7 +313,7 @@ uint32_t x264_cpu_detect( void )
#elif ARCH_PPC
-#if SYS_MACOSX || SYS_OPENBSD
+#if SYS_MACOSX || SYS_OPENBSD || SYS_FREEBSD
#include <sys/sysctl.h>
uint32_t x264_cpu_detect( void )
{
@@ -321,12 +321,16 @@ uint32_t x264_cpu_detect( void )
uint32_t cpu = 0;
#if SYS_OPENBSD
int selectors[2] = { CTL_MACHDEP, CPU_ALTIVEC };
-#else
+#elif SYS_MACOSX
int selectors[2] = { CTL_HW, HW_VECTORUNIT };
#endif
int has_altivec = 0;
size_t length = sizeof( has_altivec );
+#if SYS_MACOSX || SYS_OPENBSD
int error = sysctl( selectors, 2, &has_altivec, &length, NULL, 0 );
+#else
+ int error = sysctlbyname("hw.altivec", &has_altivec, &length, NULL, 0 );
+#endif
if( error == 0 && has_altivec != 0 )
cpu |= X264_CPU_ALTIVEC;