[packages/x265] fix compiler flags on arm
atler
atler at pld-linux.org
Wed Jun 30 11:40:53 CEST 2021
commit ee433883b7e5f4807542a2bbe6f1a26a8b014157
Author: Jan Palus <atler at pld-linux.org>
Date: Wed Jun 30 10:46:23 2021 +0200
fix compiler flags on arm
x265-arm_flags.patch | 55 ++++++++++++++++++++++++++++++++++++++++++++++++++++
x265.spec | 14 ++++++++++++-
2 files changed, 68 insertions(+), 1 deletion(-)
---
diff --git a/x265.spec b/x265.spec
index 236b7cb..9ef9579 100644
--- a/x265.spec
+++ b/x265.spec
@@ -22,11 +22,12 @@ Source0: https://bitbucket.org/multicoreware/x265_git/downloads/%{name}_%{versio
# Source0-md5: deb5df5cb2ec17bdbae6ac6bbc3b1eef
Patch0: %{name}-opt.patch
Patch1: %{name}-x32.patch
+Patch2: %{name}-arm_flags.patch
URL: https://www.x265.org/
BuildRequires: cmake >= 2.8.11
BuildRequires: libstdc++-devel >= 6:4.8
BuildRequires: numactl-devel >= 2
-BuildRequires: rpmbuild(macros) >= 1.605
+BuildRequires: rpmbuild(macros) >= 2.007
%{?with_asm:BuildRequires: nasm >= 2.13.0}
%{?with_vmaf:BuildRequires: vmaf-devel}
Requires: libx265 = %{version}-%{release}
@@ -83,10 +84,21 @@ Statyczna biblioteka x265.
%setup -q -n %{name}_%{version}
%patch0 -p1
%patch1 -p1
+%ifarch %{arm} aarch64
+%patch2 -p1
+%endif
%build
install -d source/build
cd source/build
+%ifarch %{arm} aarch64
+export CFLAGS="%{rpmcflags} -fPIC"
+export CXXFLAGS="%{rpmcxxflags} -fPIC"
+%ifarch %{arm_with_neon}
+export CFLAGS="$CFLAGS -DHAVE_NEON"
+export CXXFLAGS="$CXXFLAGS -DHAVE_NEON"
+%endif
+%endif
%cmake .. \
-DENABLE_ASSEMBLY=%{!?with_asm:OFF}%{?with_asm:ON} \
-DENABLE_HDR10_PLUS=ON \
diff --git a/x265-arm_flags.patch b/x265-arm_flags.patch
new file mode 100644
index 0000000..67c48b6
--- /dev/null
+++ b/x265-arm_flags.patch
@@ -0,0 +1,55 @@
+diff -ur x265_3.5.orig/source/CMakeLists.txt x265_3.5/source/CMakeLists.txt
+--- x265_3.5.orig/source/CMakeLists.txt 2021-06-30 10:18:05.027691945 +0200
++++ x265_3.5/source/CMakeLists.txt 2021-06-30 10:22:34.076437753 +0200
+@@ -235,28 +235,7 @@
+ endif()
+ endif()
+ endif()
+- if(ARM AND CROSS_COMPILE_ARM)
+- if(ARM64)
+- set(ARM_ARGS -fPIC)
+- else()
+- set(ARM_ARGS -march=armv6 -mfloat-abi=soft -mfpu=vfp -marm -fPIC)
+- endif()
+- message(STATUS "cross compile arm")
+- elseif(ARM)
+- if(ARM64)
+- set(ARM_ARGS -fPIC)
+- add_definitions(-DHAVE_NEON)
+- else()
+- find_package(Neon)
+- if(CPU_HAS_NEON)
+- set(ARM_ARGS -mcpu=native -mfloat-abi=hard -mfpu=neon -marm -fPIC)
+- add_definitions(-DHAVE_NEON)
+- else()
+- set(ARM_ARGS -mcpu=native -mfloat-abi=hard -mfpu=vfp -marm)
+- endif()
+- endif()
+- endif()
+- add_definitions(${ARM_ARGS})
++ string(REPLACE " " ";" ARM_ARGS ${CMAKE_CXX_FLAGS})
+ if(FPROFILE_GENERATE)
+ if(INTEL_CXX)
+ add_definitions(-prof-gen -prof-dir="${CMAKE_CURRENT_BINARY_DIR}")
+diff -ur x265_3.5.orig/source/dynamicHDR10/CMakeLists.txt x265_3.5/source/dynamicHDR10/CMakeLists.txt
+--- x265_3.5.orig/source/dynamicHDR10/CMakeLists.txt 2021-03-16 13:53:00.000000000 +0100
++++ x265_3.5/source/dynamicHDR10/CMakeLists.txt 2021-06-30 10:23:02.973020022 +0200
+@@ -42,18 +42,6 @@
+ endif()
+ endif()
+ endif()
+- if(ARM AND CROSS_COMPILE_ARM)
+- set(ARM_ARGS -march=armv6 -mfloat-abi=soft -mfpu=vfp -marm -fPIC)
+- elseif(ARM)
+- find_package(Neon)
+- if(CPU_HAS_NEON)
+- set(ARM_ARGS -mcpu=native -mfloat-abi=hard -mfpu=neon -marm -fPIC)
+- add_definitions(-DHAVE_NEON)
+- else()
+- set(ARM_ARGS -mcpu=native -mfloat-abi=hard -mfpu=vfp -marm)
+- endif()
+- endif()
+- add_definitions(${ARM_ARGS})
+ if(FPROFILE_GENERATE)
+ if(INTEL_CXX)
+ add_definitions(-prof-gen -prof-dir="${CMAKE_CURRENT_BINARY_DIR}")
================================================================
---- gitweb:
http://git.pld-linux.org/gitweb.cgi/packages/x265.git/commitdiff/62922eb360754a9b158aa9c050dd16c9ecbff7a1
More information about the pld-cvs-commit
mailing list