git: 0c4cab0453d7 - main - multimedia/x265: upgrade from 3.6 to 4.1

From: Robert Clausecker <fuz_at_FreeBSD.org>
Date: Sat, 22 Nov 2025 16:01:51 UTC
The branch main has been updated by fuz:

URL: https://cgit.FreeBSD.org/ports/commit/?id=0c4cab0453d778353fdec3e01f071536f32c3d5a

commit 0c4cab0453d778353fdec3e01f071536f32c3d5a
Author:     Mikhail Teterin <mi@FreeBSD.org>
AuthorDate: 2025-11-13 17:23:47 +0000
Commit:     Robert Clausecker <fuz@FreeBSD.org>
CommitDate: 2025-11-22 16:01:28 +0000

    multimedia/x265: upgrade from 3.6 to 4.1
    
    Unlike with the 4.0, there should be no API compatibility problems.
    
    Changelog: https://x265.readthedocs.io/en/master/releasenotes.html
    
    Reviewed by:    pkubaj
    PR:             290764
---
 multimedia/x265/Makefile                 | 88 ++++++++++++--------------------
 multimedia/x265/distinfo                 |  6 +--
 multimedia/x265/files/patch-arm-assembly |  9 ----
 multimedia/x265/files/patch-warnings     | 23 ++++++---
 multimedia/x265/pkg-plist                |  2 +-
 5 files changed, 53 insertions(+), 75 deletions(-)

diff --git a/multimedia/x265/Makefile b/multimedia/x265/Makefile
index 0f84465e8d1b..be9a85a53b7f 100644
--- a/multimedia/x265/Makefile
+++ b/multimedia/x265/Makefile
@@ -1,6 +1,5 @@
 PORTNAME=	x265
-PORTVERSION=	3.6
-PORTREVISION=	1
+PORTVERSION=	4.1
 CATEGORIES=	multimedia
 MASTER_SITES=	https://bitbucket.org/multicoreware/x265_git/downloads/ \
 		http://ftp.videolan.org/pub/videolan/x265/
@@ -27,7 +26,10 @@ BB_TAG=		Release_${DISTVERSION}
 
 OPTIONS_DEFINE=			VMAF
 OPTIONS_DEFINE_amd64=		SVTHEVC
-OPTIONS_DEFAULT=		HI10P HI12P HI8P OPTIMIZED_FLAGS
+OPTIONS_DEFINE_powerpc=		ALTIVEC
+OPTIONS_DEFINE_powerpc64=	${OPTIONS_DEFINE_powerpc}
+OPTIONS_DEFINE_powerpc64le=	${OPTIONS_DEFINE_powerpc}
+OPTIONS_DEFAULT=		HI10P HI12P HI8P OPTIMIZED_FLAGS ALTIVEC
 
 OPTIONS_MULTI=			PIXELWIDTH
 OPTIONS_MULTI_PIXELWIDTH=	HI10P HI12P HI8P
@@ -40,7 +42,7 @@ HI12P_DESC=		Enable 12-bit pixels (may break on i386)
 HI8P_DESC=		Enable 8-bit pixel-width (you, probably, want this)
 OPTIMIZED_FLAGS_DESC=	Enable O3 optimization
 SVTHEVC_DESC=		HEVC encoding via SVT-HEVC
-VMAF_DESC=		VMAF scores (broken: needs older VMAF)
+VMAF_DESC=		VMAF scores
 VMAF_USES=		localbase:ldflags
 
 DEBUG_CMAKE_ON=		-DCMAKE_ASM_NASM_FLAGS:STRING="-g -O0"
@@ -50,15 +52,11 @@ SVTHEVC_CMAKE_BOOL=	ENABLE_SVT_HEVC
 VMAF_CMAKE_ON=		-DVMAF_INCLUDE_DIR:PATH="${LOCALBASE}/include/libvmaf"
 VMAF_LIB_DEPENDS=	libvmaf.so:multimedia/vmaf
 VMAF_CMAKE_BOOL=	ENABLE_LIBVMAF
+ALTIVEC_CMAKE_BOOL=	ENABLE_ALTIVEC
 
 .include <bsd.port.options.mk>
 
-.if ${ARCH} == powerpc64le
-CMAKE_ARGS+=	-DCPU_POWER8=ON \
-		-DENABLE_ALTIVEC=ON
-.endif
-
-.if !${ARCH:Mpowerpc64*} && !${ARCH:Marmv7}
+.if ${ARCH} == i386 && ${PORT_OPTIONS:MHI8P} || ${ARCH} == amd64
 BUILD_DEPENDS=	nasm:devel/nasm
 .endif
 
@@ -71,6 +69,9 @@ CMAKE_ARGS+=	-DMAIN12:BOOL=true
 
 .if "${DEFAULT_DEPTH}" != "HI8P"
 CMAKE_ARGS+=	-DHIGH_BIT_DEPTH:BOOL=true
+.if ${ARCH} == i386
+CMAKE_ARGS+=	-DENABLE_ASSEMBLY:BOOL=false
+.endif
 .endif
 
 CMAKE_OTHER_ARGS=	${CMAKE_ARGS:C/.*-D_END_CUSTOM_OPTIONS=1 +//W}
@@ -83,49 +84,34 @@ CFLAGS:=	${CFLAGS:N-O*} -O0 -g
 CFLAGS:=	${CFLAGS:N-O*} -O3
 .endif
 
-.for b in ${OTHER_DEPTHS:C/HI([0-9]+)P/\1/}
-EXTRA_LINK_FLAGS+=	-L${WRKSRC:H}/${b}bit
-
-.if ${ARCH} == powerpc64le
-
-.if ${b} != 8
-ASSEMBLY=	false
-.else
-ASSEMBLY=	true
+.if ${ARCH} == armv7
+CMAKE_ARGS+=	-DENABLE_NEON:BOOL=true
 .endif
 
-post-patch:
-	${REINPLACE_CMD} -e 's|/usr/local|${LOCALBASE}|' ${WRKSRC}/x265.h
+.if ${ARCH:Mpowerpc*}
+CMAKE_OTHER_ARGS+=	${CMAKE_ARGS:M*ALTIVEC*} -DCPU_POWER8=false
+CMAKE_ARGS+=		-DCPU_POWER8=false
+.endif
 
-pre-build::
-	@${ECHO_MSG} "---> Building the ${b}-bit library ---"
-	${MKDIR} ${WRKSRC:H}/${b}bit
-	${CMAKE_BIN} -S ${WRKSRC} -B ${WRKSRC:H}/${b}bit \
-		${CMAKE_OTHER_ARGS} ${b:C/1./-DHIGH_BIT_DEPTH:BOOL=true/} \
-		-DMAIN${b}:BOOL=true -DENABLE_ALTIVEC=${ASSEMBLY} -DCPU_POWER8=true \
-		-DEXPORT_C_API:BOOL=false -DENABLE_CLI=false
-	${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
-	${ECHO_MSG} "---> Built the ${b}-bit library ---"
+.for b in ${OTHER_DEPTHS:C/HI([0-9]+)P/\1/}
+EXTRA_LINK_FLAGS+=	-L${WRKSRC:H}/$bbit
 
-.else
-.if ((${ARCH} == i386 || ${ARCH} == armv7) && $b != 8) || ${ARCH} == powerpc || ${ARCH} == powerpc64
+.if (${ARCH} == i386 && $b != 8) || ${ARCH:Mpowerpc*}
 ASSEMBLY=	false
 .else
 ASSEMBLY=	true
 .endif
 
 pre-build::
-	@${ECHO_MSG} "---> Building the ${b}-bit library ---"
-	${MKDIR} ${WRKSRC:H}/${b}bit
-	${CMAKE_BIN} -S ${WRKSRC} -B ${WRKSRC:H}/${b}bit \
+	@${ECHO_MSG} "---> Building the $b-bit library ---"
+	${MKDIR} ${WRKSRC:H}/$bbit
+	${CMAKE_BIN} -S ${WRKSRC} -B ${WRKSRC:H}/$bbit \
 		${CMAKE_OTHER_ARGS} ${b:C/1./-DHIGH_BIT_DEPTH:BOOL=true/} \
-		-DMAIN${b}:BOOL=true -DENABLE_ASSEMBLY:BOOL=${ASSEMBLY} -DCPU_POWER8=false -DENABLE_ALTIVEC:BOOL=false \
+		-DMAIN$b:BOOL=true -DENABLE_ASSEMBLY:BOOL=${ASSEMBLY} \
 		-DEXPORT_C_API:BOOL=false -DENABLE_CLI=false
-	${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
-	${ECHO_MSG} "---> Built the ${b}-bit library ---"
-.endif
+	${SETENV} ${MAKE_ENV} ${MAKE_CMD} -C ${WRKSRC:H}/$bbit ${MAKE_ARGS}
+	${LN} -f ${WRKSRC:H}/$bbit/libx265.a ${WRKSRC:H}/$bbit/libx265_$bbit.a
+	@${ECHO_MSG} "---> Built the $b-bit library ---"
 .endfor
 
 .if "${EXTRA_LINK_FLAGS}"
@@ -136,24 +122,18 @@ CMAKE_ARGS+=	${OTHER_DEPTHS:C/HI([0-9]+)P/-DLINKED_\1BIT:BOOL=true/}
 
 CMAKE_ARGS+=	-DENABLE_SHARED:BOOL=true
 
-.if ${ARCH} == i386 && ${DEFAULT_DEPTH} != "HI8P"
-CMAKE_ARGS+=	-DENABLE_ASSEMBLY:BOOL=false
-.else
-.if !${ARCH:Mpowerpc*}
-CMAKE_ARGS+=	-DENABLE_ASSEMBLY:BOOL=true
-.elif ${ARCH} == powerpc64le
-CMAKE_ARGS+=	-DCPU_POWER8=ON \
-		-DENABLE_ALTIVEC=ON
-.elif ${ARCH} == powerpc64
-CMAKE_ARGS+=	-DCPU_POWER8=OFF \
-		-DENABLE_ALTIVEC=OFF
-.endif
-
 do-test:
+.if ${PORT_OPTIONS:MHI8P} || ${ARCH} != i386
 	${WRKDIR}/.build/test/TestBench
+.else
+	@${ECHO_MSG} On ${ARCH} TestBench is only built, when 8bit is enabled
 .endif
 
 CMAKE_ARGS+=	-D_END_CUSTOM_OPTIONS=1
 CMAKE_ARGS+=	-DENABLE_PIC:BOOL=true
 
+.if !defined(DEVELOPER)
+CMAKE_ARGS+=	-Wno-dev
+.endif
+
 .include <bsd.port.mk>
diff --git a/multimedia/x265/distinfo b/multimedia/x265/distinfo
index 7e5f3d943d14..8f4377694bb7 100644
--- a/multimedia/x265/distinfo
+++ b/multimedia/x265/distinfo
@@ -1,3 +1,3 @@
-TIMESTAMP = 1727555881
-SHA256 (x265_3.6.tar.gz) = 663531f341c5389f460d730e62e10a4fcca3428ca2ca109693867bc5fe2e2807
-SIZE (x265_3.6.tar.gz) = 1655889
+TIMESTAMP = 1762019503
+SHA256 (x265_4.1.tar.gz) = a31699c6a89806b74b0151e5e6a7df65de4b49050482fe5ebf8a4379d7af8f29
+SIZE (x265_4.1.tar.gz) = 1725279
diff --git a/multimedia/x265/files/patch-arm-assembly b/multimedia/x265/files/patch-arm-assembly
index e481269c43f0..dd3f71dd12c4 100644
--- a/multimedia/x265/files/patch-arm-assembly
+++ b/multimedia/x265/files/patch-arm-assembly
@@ -1,12 +1,3 @@
---- source/common/arm/blockcopy8.S	2024-09-30 08:38:43.172350000 +0200
-+++ source/common/arm/blockcopy8.S	2024-09-30 09:13:08.635457000 +0200
-@@ -833,5 +833,5 @@
-     vmov.u32        r0, d0[0]
-     uasx            r0, r0, r0
--    mov             r0, r0, lsr 16
-+    lsr             r0, r0, #16
-     rsb             r0, #1024
-     bx              lr
 --- source/common/arm/asm.S	2024-04-04 11:39:50.000000000 +0200
 +++ source/common/arm/asm.S	2024-09-30 19:45:33.295896000 +0200
 @@ -85,4 +85,9 @@
diff --git a/multimedia/x265/files/patch-warnings b/multimedia/x265/files/patch-warnings
index e1a65940be2e..31e3d2416405 100644
--- a/multimedia/x265/files/patch-warnings
+++ b/multimedia/x265/files/patch-warnings
@@ -331,12 +331,19 @@
 +
      // skip -- prefix if provided
      if (name[0] == '-' && name[1] == '-')
---- source/common/cudata.cpp	2024-09-13 09:02:55.000000000 -0400
-+++ source/common/cudata.cpp	2024-09-24 00:04:19.872724000 -0400
-@@ -74,5 +74,5 @@
- inline bool isEqualRowOrCol(int addrA, int addrB)
- {
--    return isEqualCol(addrA, addrB) | isEqualRow(addrA, addrB);
-+    return isEqualCol(addrA, addrB) || isEqualRow(addrA, addrB);
- }
+--- source/encoder/level.cpp	2024-11-22 07:07:34.000000000 -0500
++++ source/encoder/level.cpp	2025-11-01 20:29:50.066886000 -0400
+@@ -61,13 +61,4 @@
+ };
  
+-static inline int _confirm(x265_param* param, bool bflag, const char* message)
+-{
+-    if (!bflag)
+-        return 0;
+-
+-    x265_log(param, X265_LOG_ERROR, "%s\n", message);
+-    return 1;
+-}
+-
+ /* determine minimum decoder level required to decode the described video */
+ void determineLevel(const x265_param &param, VPS& vps)
diff --git a/multimedia/x265/pkg-plist b/multimedia/x265/pkg-plist
index 25e1a71607c4..179d1313492b 100644
--- a/multimedia/x265/pkg-plist
+++ b/multimedia/x265/pkg-plist
@@ -6,5 +6,5 @@ lib/libhdr10plus.a
 lib/libhdr10plus.so
 lib/libx265.a
 lib/libx265.so
-lib/libx265.so.209
+lib/libx265.so.215
 libdata/pkgconfig/x265.pc