multimedia/x265: fix build on powerpc, fix runtime on older powerpc64 CPUs

1. Assembly on powerpc seems to be not supported:
ld: error: undefined reference due to --no-allow-shlib-undefined: x265::setupAssemblyPrimitives(x265::EncoderPrimitives&, int)
2. Do not optimize for POWER8, since our baseline is G5.
This commit is contained in:
Piotr Kubaj 2024-12-31 12:31:02 +01:00
parent 40b80af5fe
commit e9e6dbc8c4

View file

@ -1,5 +1,6 @@
PORTNAME= x265 PORTNAME= x265
PORTVERSION= 3.6 PORTVERSION= 3.6
PORTREVISION= 1
CATEGORIES= multimedia CATEGORIES= multimedia
MASTER_SITES= https://bitbucket.org/multicoreware/x265_git/downloads/ \ MASTER_SITES= https://bitbucket.org/multicoreware/x265_git/downloads/ \
http://ftp.videolan.org/pub/videolan/x265/ http://ftp.videolan.org/pub/videolan/x265/
@ -52,7 +53,7 @@ VMAF_CMAKE_BOOL= ENABLE_LIBVMAF
.include <bsd.port.options.mk> .include <bsd.port.options.mk>
.if ${ARCH:Mpowerpc64*} .if ${ARCH} == powerpc64le
CMAKE_ARGS+= -DCPU_POWER8=ON \ CMAKE_ARGS+= -DCPU_POWER8=ON \
-DENABLE_ALTIVEC=ON -DENABLE_ALTIVEC=ON
.endif .endif
@ -85,7 +86,7 @@ CFLAGS:= ${CFLAGS:N-O*} -O3
.for b in ${OTHER_DEPTHS:C/HI([0-9]+)P/\1/} .for b in ${OTHER_DEPTHS:C/HI([0-9]+)P/\1/}
EXTRA_LINK_FLAGS+= -L${WRKSRC:H}/${b}bit EXTRA_LINK_FLAGS+= -L${WRKSRC:H}/${b}bit
.if ${ARCH:Mpowerpc64*} .if ${ARCH} == powerpc64le
.if ${b} != 8 .if ${b} != 8
ASSEMBLY= false ASSEMBLY= false
@ -108,7 +109,7 @@ pre-build::
${ECHO_MSG} "---> Built the ${b}-bit library ---" ${ECHO_MSG} "---> Built the ${b}-bit library ---"
.else .else
.if (${ARCH} == i386 || ${ARCH} == armv7) && $b != 8 .if ((${ARCH} == i386 || ${ARCH} == armv7) && $b != 8) || ${ARCH} == powerpc || ${ARCH} == powerpc64
ASSEMBLY= false ASSEMBLY= false
.else .else
ASSEMBLY= true ASSEMBLY= true
@ -119,7 +120,7 @@ pre-build::
${MKDIR} ${WRKSRC:H}/${b}bit ${MKDIR} ${WRKSRC:H}/${b}bit
${CMAKE_BIN} -S ${WRKSRC} -B ${WRKSRC:H}/${b}bit \ ${CMAKE_BIN} -S ${WRKSRC} -B ${WRKSRC:H}/${b}bit \
${CMAKE_OTHER_ARGS} ${b:C/1./-DHIGH_BIT_DEPTH:BOOL=true/} \ ${CMAKE_OTHER_ARGS} ${b:C/1./-DHIGH_BIT_DEPTH:BOOL=true/} \
-DMAIN${b}:BOOL=true -DENABLE_ASSEMBLY:BOOL=${ASSEMBLY} \ -DMAIN${b}:BOOL=true -DENABLE_ASSEMBLY:BOOL=${ASSEMBLY} -DCPU_POWER8=false -DENABLE_ALTIVEC:BOOL=false \
-DEXPORT_C_API:BOOL=false -DENABLE_CLI=false -DEXPORT_C_API:BOOL=false -DENABLE_CLI=false
${SETENV} ${MAKE_ENV} ${MAKE_CMD} -C ${WRKSRC:H}/${b}bit ${MAKE_ARGS} ${SETENV} ${MAKE_ENV} ${MAKE_CMD} -C ${WRKSRC:H}/${b}bit ${MAKE_ARGS}
${LN} -f ${WRKSRC:H}/${b}bit/libx265.a ${WRKSRC:H}/${b}bit/libx265_${b}bit.a ${LN} -f ${WRKSRC:H}/${b}bit/libx265.a ${WRKSRC:H}/${b}bit/libx265_${b}bit.a
@ -138,11 +139,14 @@ CMAKE_ARGS+= -DENABLE_SHARED:BOOL=true
.if ${ARCH} == i386 && ${DEFAULT_DEPTH} != "HI8P" .if ${ARCH} == i386 && ${DEFAULT_DEPTH} != "HI8P"
CMAKE_ARGS+= -DENABLE_ASSEMBLY:BOOL=false CMAKE_ARGS+= -DENABLE_ASSEMBLY:BOOL=false
.else .else
.if !${ARCH:Mpowerpc64*} .if !${ARCH:Mpowerpc*}
CMAKE_ARGS+= -DENABLE_ASSEMBLY:BOOL=true CMAKE_ARGS+= -DENABLE_ASSEMBLY:BOOL=true
.else .elif ${ARCH} == powerpc64le
CMAKE_ARGS+= -DCPU_POWER8=ON \ CMAKE_ARGS+= -DCPU_POWER8=ON \
-DENABLE_ALTIVEC=ON -DENABLE_ALTIVEC=ON
.elif ${ARCH} == powerpc64
CMAKE_ARGS+= -DCPU_POWER8=OFF \
-DENABLE_ALTIVEC=OFF
.endif .endif
do-test: do-test: