Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 16 Nov 2021 14:49:48 GMT
From:      Piotr Kubaj <pkubaj@FreeBSD.org>
To:        ports-committers@FreeBSD.org, dev-commits-ports-all@FreeBSD.org, dev-commits-ports-main@FreeBSD.org
Subject:   git: cc29ad659847 - main - multimedia/x265: add option to use altivec on powerpc64
Message-ID:  <202111161449.1AGEnm06084664@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by pkubaj:

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

commit cc29ad6598478ba1125b88114d88838f86a6b8be
Author:     Piotr Kubaj <pkubaj@FreeBSD.org>
AuthorDate: 2021-11-16 14:44:19 +0000
Commit:     Piotr Kubaj <pkubaj@FreeBSD.org>
CommitDate: 2021-11-16 14:44:19 +0000

    multimedia/x265: add option to use altivec on powerpc64
    
    PR:     259564
    Approved by: mi@ALDAN.algebra.com (maintainer timeout)
---
 multimedia/x265/Makefile                          | 42 +++++++++++++++++++++--
 multimedia/x265/files/patch-source_CMakeLists.txt | 20 ++++++++---
 2 files changed, 55 insertions(+), 7 deletions(-)

diff --git a/multimedia/x265/Makefile b/multimedia/x265/Makefile
index d2a0b8dd52b0..712a954ff091 100644
--- a/multimedia/x265/Makefile
+++ b/multimedia/x265/Makefile
@@ -23,6 +23,7 @@ OPTIONS_DEFAULT=	OPTIMIZED_FLAGS HI8P HI10P HI12P
 OPTIONS_DEFINE_aarch64=	ASM
 OPTIONS_DEFINE_amd64=	ASM SVTHEVC
 OPTIONS_DEFINE_i386=	ASM
+OPTIONS_DEFINE_powerpc64=	ASM
 OPTIONS_DEFAULT_amd64=	ASM
 
 OPTIONS_MULTI=		PixelWidth
@@ -62,11 +63,14 @@ WRKSRC=		${WRKDIR}/source
 .if ${ARCH} == aarch64 && ${PORT_OPTIONS:MASM}
 BUILD_DEPENDS=	as:devel/binutils
 USE_GCC=	yes
-ASM_PREVENTS=	HI10P HI12P
-ASM_PREVENTS_MSG=	Currently HI10P and HI12P doesn't build with assembly
 .endif
 
-.if ${ARCH} != aarch64 && ${PORT_OPTIONS:MASM}
+.if ${ARCH} == powerpc64 && ${PORT_OPTIONS:MASM}
+CMAKE_ARGS+=	-DCPU_POWER8=ON \
+		-DENABLE_ALTIVEC=ON
+.endif
+
+.if ${ARCH} != aarch64 && ${ARCH} != powerpc64 && ${PORT_OPTIONS:MASM}
 BUILD_DEPENDS=	nasm:devel/nasm
 .endif
 
@@ -90,6 +94,32 @@ CFLAGS:=	${CFLAGS:N-O*} -O0 -g
 .for b in ${OTHER_DEPTHS:C/HI([0-9]+)P/\1/}
 EXTRA_LINK_FLAGS+=-L${WRKSRC:H}/$bbit
 
+.if ${ARCH} == powerpc64
+
+.if $b != 8 || ! ${PORT_OPTIONS:MASM}
+ASSEMBLY=false
+.else
+ASSEMBLY=true
+.endif
+
+.if ${PORT_OPTIONS:MASM}
+POWER8=	true
+.else
+POWER8=	false
+.endif
+
+pre-build::
+	@${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_ALTIVEC=${ASSEMBLY} -DCPU_POWER8=${POWER8} \
+		-DEXPORT_C_API:BOOL=false -DENABLE_CLI=false
+	${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 ---"
+
+.else
 .if ${ARCH} == i386 && $b != 8 || ! ${PORT_OPTIONS:MASM}
 ASSEMBLY=false
 .else
@@ -106,6 +136,7 @@ pre-build::
 	${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 ---"
+.endif
 .endfor
 
 .if "${EXTRA_LINK_FLAGS}"
@@ -119,7 +150,12 @@ CMAKE_ARGS+=	-DENABLE_SHARED:BOOL=true
 .if ${ARCH} == i386 && ${DEFAULT_DEPTH} != "HI8P" || ! ${PORT_OPTIONS:MASM}
 CMAKE_ARGS+=	-DENABLE_ASSEMBLY:BOOL=false
 .else
+.if ${ARCH} != powerpc64
 CMAKE_ARGS+=	-DENABLE_ASSEMBLY:BOOL=true
+.else
+CMAKE_ARGS+=	-DCPU_POWER8=ON \
+		-DENABLE_ALTIVEC=ON
+.endif
 
 do-test:
 	${WRKDIR}/.build/test/TestBench
diff --git a/multimedia/x265/files/patch-source_CMakeLists.txt b/multimedia/x265/files/patch-source_CMakeLists.txt
index 8758bc33e723..19fa130e3b0e 100644
--- a/multimedia/x265/files/patch-source_CMakeLists.txt
+++ b/multimedia/x265/files/patch-source_CMakeLists.txt
@@ -1,11 +1,23 @@
---- source/CMakeLists.txt.orig	2020-06-06 08:18:40 UTC
+--- source/CMakeLists.txt.orig	2021-10-31 01:46:10 UTC
 +++ source/CMakeLists.txt
-@@ -122,3 +122,4 @@
+@@ -43,7 +43,7 @@ set(X86_ALIASES x86 i386 i686 x86_64 amd64)
+ set(ARM_ALIASES armv6l armv7l aarch64)
+ list(FIND X86_ALIASES "${SYSPROC}" X86MATCH)
+ list(FIND ARM_ALIASES "${SYSPROC}" ARMMATCH)
+-set(POWER_ALIASES ppc64 ppc64le)
++set(POWER_ALIASES powerpc64 powerpc64le ppc64 ppc64le)
+ list(FIND POWER_ALIASES "${SYSPROC}" POWERMATCH)
+ if("${SYSPROC}" STREQUAL "" OR X86MATCH GREATER "-1")
+     set(X86 1)
+@@ -121,6 +121,7 @@ if(UNIX)
+     option(ENABLE_LIBVMAF "Enable VMAF" OFF)
      if(ENABLE_LIBVMAF)
          add_definitions(-DENABLE_LIBVMAF)
 +        include_directories(${VMAF_INCLUDE_DIR})
      endif()
-@@ -592,12 +592,6 @@ if(ENABLE_HDR10_PLUS)
+ endif(UNIX)
+ 
+@@ -592,12 +593,6 @@ if(ENABLE_HDR10_PLUS)
          ARCHIVE DESTINATION ${LIB_INSTALL_DIR})
  endif()
  
@@ -18,7 +30,7 @@
  install(FILES x265.h "${PROJECT_BINARY_DIR}/x265_config.h" DESTINATION include)
  if((WIN32 AND ENABLE_CLI) OR (WIN32 AND ENABLE_SHARED))
      if(MSVC_IDE)
-@@ -649,7 +643,10 @@ if(ENABLE_SHARED)
+@@ -649,7 +644,10 @@ if(ENABLE_SHARED)
      if(EXTRA_LIB)
          target_link_libraries(x265-shared ${EXTRA_LIB})
      endif()



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202111161449.1AGEnm06084664>